From 44cdda9f3c59c43cc322f598ce3c8ea366ad0b8d Mon Sep 17 00:00:00 2001 From: liux <963924687@qq.com> Date: Thu, 3 Apr 2025 16:56:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E9=A1=B5=E9=9D=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/InitializationActivity.java | 2 +- .../canteen/activity/OperationActivity.java | 65 +++++- .../activity/order/MachineSaleActivity.java | 14 +- .../order/entity/OrderDetailAndroidVO.java | 39 +++- .../order/entity/OrderListAndroidVO.java | 6 +- .../com/bonus/canteen/db/AppDatabase.java | 2 +- .../bonus/canteen/db/dao/base/OrderDao.java | 2 +- .../db/entity/base/OrderDetailsInfo.java | 113 ++++----- .../canteen/db/entity/base/OrderInfo.java | 220 ++++++++++-------- .../java/com/bonus/canteen/utils/Utils.java | 34 +++ 10 files changed, 315 insertions(+), 182 deletions(-) diff --git a/app/src/main/java/com/bonus/canteen/activity/InitializationActivity.java b/app/src/main/java/com/bonus/canteen/activity/InitializationActivity.java index aefba55..6ddee49 100644 --- a/app/src/main/java/com/bonus/canteen/activity/InitializationActivity.java +++ b/app/src/main/java/com/bonus/canteen/activity/InitializationActivity.java @@ -246,7 +246,7 @@ public class InitializationActivity extends BaseActivity0){ + JSONObject jsonObject = JSONObject.parseObject(jsonArray.getString(0)); + orderInfo.setStallId(jsonObject.getString("stallId")); + orderInfo.setStallName(jsonObject.getString("canteenName")); + orderInfo.setPermissionCode(deviceBaseInfo.getCanteenId()+"_"+jsonObject.getString("stallId")); + + orderInfo.setOrderTime(jsonObject.getString("orderTime")); + orderInfo.setPayTime(jsonObject.getString("orderTime")); + + } OrderListEntity orderList ; if(orderListEntities !=null && orderListEntities.size()>0){ orderList = orderListEntities.get(0); + orderInfo.setMealtimeType(orderList.getMealtimeType()+""); + orderInfo.setMealtimeName(orderList.getMealtimeName()+""); + orderInfo.setMachineSn("2AD2428001118585"); + orderInfo.setMealCode("015"); + //获取提交订单详细信息 List orderDetailsInfoList = orderList.getOrderDetailList(); - - + int money = orderEntity.getAmount(); + for(OrderDetailListEntity detailListEntity:orderDetailsInfoList){ + int detailType = detailListEntity.getDetailType(); + String goodsDishesId = detailListEntity.getGoodsDishesId()+""; + String goodsDishesName = detailListEntity.getGoodsDishesName(); + String menuDetailId = detailListEntity.getMenuDetailId()+""; + int quantity = detailListEntity.getQuantity(); + int salePrice = detailListEntity.getSalePrice(); + int salesMode = detailListEntity.getSalesMode(); + int weightUnit = detailListEntity.getWeightUnit(); + int thisMoney = Utils.multiply(salePrice,quantity); + OrderDetailsInfo ord = new OrderDetailsInfo(); + ord.setDetailId(UUIDUtil.uuid().replace("-","")); + ord.setOrderId(orderId); + ord.setDetailType(detailType); + ord.setGoodsDishesId(goodsDishesId); + ord.setGoodsDishesName(goodsDishesName); + ord.setMenuDetailId(menuDetailId); + ord.setSalePrice(salePrice); + ord.setSalesMode(salesMode); + ord.setQuantity(quantity); + ord.setWeightUnit(weightUnit); + ord.setTotalAmount(thisMoney); + ord.setCalcTotalAmount(thisMoney); + ord.setRealAmount(thisMoney); + ord.setRefundAmount(thisMoney); + AppDatabase.getDatabase(OperationActivity.this).orderDetailsDao().insert(ord); + } + orderInfo.setPackingAmount(money); + orderInfo.setRealAmount(money); + orderInfo.setNeedPayAmount(money); + orderInfo.setRefundAmount(money); + orderInfo.setPayType(orderEntity.getPayType()); + orderInfo.setPayState(3); + orderInfo.setOrderType(11); + orderInfo.setOrderState(2); + orderInfo.setOrderStateMix(1); + orderInfo.setDishesState(4); + orderInfo.setIsPush(0); + orderInfo.setStrJson(mealStr); + AppDatabase.getDatabase(OperationActivity.this).orderDao().insert(orderInfo); } } }); diff --git a/app/src/main/java/com/bonus/canteen/activity/order/MachineSaleActivity.java b/app/src/main/java/com/bonus/canteen/activity/order/MachineSaleActivity.java index ff0aa6a..767905d 100644 --- a/app/src/main/java/com/bonus/canteen/activity/order/MachineSaleActivity.java +++ b/app/src/main/java/com/bonus/canteen/activity/order/MachineSaleActivity.java @@ -157,12 +157,16 @@ public class MachineSaleActivity extends BaseActivity>() {}.getType(); list = gson.fromJson(strRecords, new TypeToken>(){}.getType()); Log.e("list===333",list.toString()+""); runOnUiThread(new Runnable() { diff --git a/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderDetailAndroidVO.java b/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderDetailAndroidVO.java index 31a8e5a..c8648e0 100644 --- a/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderDetailAndroidVO.java +++ b/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderDetailAndroidVO.java @@ -4,8 +4,8 @@ import cn.hutool.core.bean.BeanUtil; import java.math.BigDecimal; public class OrderDetailAndroidVO implements OrderDetailWithImage { - private Long detailId; - private Long orderId; + private String detailId; + private String orderId; private Integer detailType; private Long goodsDishesId; private String goodsDishesName; @@ -36,11 +36,11 @@ public class OrderDetailAndroidVO implements OrderDetailWithImage { return (OrderDetailAndroidVO)BeanUtil.copyProperties(orderDetail, OrderDetailAndroidVO.class, new String[0]); } - public Long getDetailId() { + public String getDetailId() { return this.detailId; } - public Long getOrderId() { + public String getOrderId() { return this.orderId; } @@ -120,11 +120,11 @@ public class OrderDetailAndroidVO implements OrderDetailWithImage { return this.makingComplete; } - public void setDetailId(final Long detailId) { + public void setDetailId(final String detailId) { this.detailId = detailId; } - public void setOrderId(final Long orderId) { + public void setOrderId(final String orderId) { this.orderId = orderId; } @@ -209,8 +209,31 @@ public class OrderDetailAndroidVO implements OrderDetailWithImage { } + @Override public String toString() { - Long var10000 = this.getDetailId(); - return "OrderDetailAndroidVO(detailId=" + var10000 + ", orderId=" + this.getOrderId() + ", detailType=" + this.getDetailType() + ", goodsDishesId=" + this.getGoodsDishesId() + ", goodsDishesName=" + this.getGoodsDishesName() + ", goodsDishesImgUrl=" + this.getGoodsDishesImgUrl() + ", menuDetailId=" + this.getMenuDetailId() + ", salePrice=" + String.valueOf(this.getSalePrice()) + ", prefPrice=" + String.valueOf(this.getPrefPrice()) + ", price=" + String.valueOf(this.getPrice()) + ", weightUnit=" + this.getWeightUnit() + ", quantity=" + this.getQuantity() + ", unitName=" + this.getUnitName() + ", totalAmount=" + String.valueOf(this.getTotalAmount()) + ", calcTotalAmount=" + String.valueOf(this.getCalcTotalAmount()) + ", realAmount=" + String.valueOf(this.getRealAmount()) + ", refundAmount=" + String.valueOf(this.getRefundAmount()) + ", salesMode=" + this.getSalesMode() + ", tasteName=" + this.getTasteName() + ", detailState=" + this.getDetailState() + ", goodsRefundNum=" + this.getGoodsRefundNum() + ", makingComplete=" + this.getMakingComplete() + ")"; + return "OrderDetailAndroidVO{" + + "detailId='" + detailId + '\'' + + ", orderId=" + orderId + + ", detailType=" + detailType + + ", goodsDishesId=" + goodsDishesId + + ", goodsDishesName='" + goodsDishesName + '\'' + + ", goodsDishesImgUrl='" + goodsDishesImgUrl + '\'' + + ", menuDetailId=" + menuDetailId + + ", salePrice=" + salePrice + + ", prefPrice=" + prefPrice + + ", price=" + price + + ", weightUnit=" + weightUnit + + ", quantity=" + quantity + + ", unitName='" + unitName + '\'' + + ", totalAmount=" + totalAmount + + ", calcTotalAmount=" + calcTotalAmount + + ", realAmount=" + realAmount + + ", refundAmount=" + refundAmount + + ", salesMode=" + salesMode + + ", tasteName='" + tasteName + '\'' + + ", detailState=" + detailState + + ", goodsRefundNum=" + goodsRefundNum + + ", makingComplete=" + makingComplete + + '}'; } } diff --git a/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderListAndroidVO.java b/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderListAndroidVO.java index 56a9b30..aa27f05 100644 --- a/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderListAndroidVO.java +++ b/app/src/main/java/com/bonus/canteen/adapter/order/entity/OrderListAndroidVO.java @@ -5,7 +5,7 @@ import java.math.BigDecimal; import java.util.List; public class OrderListAndroidVO { - private Long orderId; + private String orderId; private String macOrderId; private Integer sourceType; private String plateSerialNum; @@ -52,11 +52,11 @@ public class OrderListAndroidVO { private Integer payChannel; private List orderDetailList; - public Long getOrderId() { + public String getOrderId() { return orderId; } - public void setOrderId(Long orderId) { + public void setOrderId(String orderId) { this.orderId = orderId; } diff --git a/app/src/main/java/com/bonus/canteen/db/AppDatabase.java b/app/src/main/java/com/bonus/canteen/db/AppDatabase.java index ca6a7b0..e0fd6ea 100644 --- a/app/src/main/java/com/bonus/canteen/db/AppDatabase.java +++ b/app/src/main/java/com/bonus/canteen/db/AppDatabase.java @@ -31,7 +31,7 @@ import androidx.room.RoomDatabase; import androidx.room.TypeConverters; @Database(entities = {CustInfo.class, SecretKeyInfo.class, MealTimeInfo.class, DeviceBaseInfo.class, CookBookInfo.class, CookMeetDetailInfo.class, - CookMeetTimesInfo.class, CookMeetMealInfo.class, CustPhotoFulInfo.class, OrderInfo.class, OrderDetailsInfo.class}, version = 2) + CookMeetTimesInfo.class, CookMeetMealInfo.class, CustPhotoFulInfo.class, OrderInfo.class, OrderDetailsInfo.class}, version = 1) @TypeConverters(ListConverter.class) public abstract class AppDatabase extends RoomDatabase { diff --git a/app/src/main/java/com/bonus/canteen/db/dao/base/OrderDao.java b/app/src/main/java/com/bonus/canteen/db/dao/base/OrderDao.java index 47b98cc..a9c8356 100644 --- a/app/src/main/java/com/bonus/canteen/db/dao/base/OrderDao.java +++ b/app/src/main/java/com/bonus/canteen/db/dao/base/OrderDao.java @@ -13,7 +13,7 @@ import androidx.room.Update; @Dao public interface OrderDao { - @Query("select * from order_info") + @Query("select * from order_info where isPush = 0") List getOrderInfoList(); @Query("select * from order_info where orderId =:orderId") diff --git a/app/src/main/java/com/bonus/canteen/db/entity/base/OrderDetailsInfo.java b/app/src/main/java/com/bonus/canteen/db/entity/base/OrderDetailsInfo.java index d20e588..017e317 100644 --- a/app/src/main/java/com/bonus/canteen/db/entity/base/OrderDetailsInfo.java +++ b/app/src/main/java/com/bonus/canteen/db/entity/base/OrderDetailsInfo.java @@ -17,7 +17,7 @@ public class OrderDetailsInfo { private String orderId; @ColumnInfo - private String detailType;//类别:1 菜品 2 套餐 3 商品 4 按键 5 补扣 6 报餐 + private int detailType;//类别:1 菜品 2 套餐 3 商品 4 按键 5 补扣 6 报餐 @ColumnInfo private String goodsDishesId;//菜品id @@ -32,49 +32,49 @@ public class OrderDetailsInfo { private String menuDetailId;//菜品详情id @ColumnInfo - private String salePrice;//ifOnline + private int salePrice;//ifOnline @ColumnInfo - private String prefPrice;//优惠价 + private int prefPrice;//优惠价 @ColumnInfo - private String price;//菜品基础单价(分 + private int price;//菜品基础单价(分 @ColumnInfo - private String weightUnit;//每份重量 g + private int weightUnit;//每份重量 g @ColumnInfo - private String quantity;//数量/重量 + private int quantity;//数量/重量 @ColumnInfo private String unitName;//单位 @ColumnInfo - private String totalAmount;//餐券制作总金额 + private int totalAmount;//餐券制作总金额 @ColumnInfo - private String calcTotalAmount;//菜品实际应付款金额合计 单位为分 + private int calcTotalAmount;//菜品实际应付款金额合计 单位为分 @ColumnInfo - private String realAmount;//实付金额 + private int realAmount;//实付金额 @ColumnInfo - private String refundAmount ="0"; //退款金额 + private int refundAmount =0; //退款金额 @ColumnInfo - private String salesMode; //销售方式 1 按份 2 称重 + private int salesMode; //销售方式 1 按份 2 称重 @ColumnInfo private String tasteName; //口味名称 多个值用,分隔 @ColumnInfo - private String detailState;//订单详情状态 1 正常 2 已退菜 3 部分退菜 + private int detailState;//订单详情状态 1 正常 2 已退菜 3 部分退菜 @ColumnInfo - private String goodsRefundNum;//商品已退数量 + private int goodsRefundNum;//商品已退数量 @ColumnInfo - private String makingComplete; + private int makingComplete; @NotNull public String getDetailId() { @@ -93,11 +93,11 @@ public class OrderDetailsInfo { this.orderId = orderId; } - public String getDetailType() { + public int getDetailType() { return detailType; } - public void setDetailType(String detailType) { + public void setDetailType(int detailType) { this.detailType = detailType; } @@ -133,43 +133,43 @@ public class OrderDetailsInfo { this.menuDetailId = menuDetailId; } - public String getSalePrice() { + public int getSalePrice() { return salePrice; } - public void setSalePrice(String salePrice) { + public void setSalePrice(int salePrice) { this.salePrice = salePrice; } - public String getPrefPrice() { + public int getPrefPrice() { return prefPrice; } - public void setPrefPrice(String prefPrice) { + public void setPrefPrice(int prefPrice) { this.prefPrice = prefPrice; } - public String getPrice() { + public int getPrice() { return price; } - public void setPrice(String price) { + public void setPrice(int price) { this.price = price; } - public String getWeightUnit() { + public int getWeightUnit() { return weightUnit; } - public void setWeightUnit(String weightUnit) { + public void setWeightUnit(int weightUnit) { this.weightUnit = weightUnit; } - public String getQuantity() { + public int getQuantity() { return quantity; } - public void setQuantity(String quantity) { + public void setQuantity(int quantity) { this.quantity = quantity; } @@ -181,43 +181,43 @@ public class OrderDetailsInfo { this.unitName = unitName; } - public String getTotalAmount() { + public int getTotalAmount() { return totalAmount; } - public void setTotalAmount(String totalAmount) { + public void setTotalAmount(int totalAmount) { this.totalAmount = totalAmount; } - public String getCalcTotalAmount() { + public int getCalcTotalAmount() { return calcTotalAmount; } - public void setCalcTotalAmount(String calcTotalAmount) { + public void setCalcTotalAmount(int calcTotalAmount) { this.calcTotalAmount = calcTotalAmount; } - public String getRealAmount() { + public int getRealAmount() { return realAmount; } - public void setRealAmount(String realAmount) { + public void setRealAmount(int realAmount) { this.realAmount = realAmount; } - public String getRefundAmount() { + public int getRefundAmount() { return refundAmount; } - public void setRefundAmount(String refundAmount) { + public void setRefundAmount(int refundAmount) { this.refundAmount = refundAmount; } - public String getSalesMode() { + public int getSalesMode() { return salesMode; } - public void setSalesMode(String salesMode) { + public void setSalesMode(int salesMode) { this.salesMode = salesMode; } @@ -229,55 +229,56 @@ public class OrderDetailsInfo { this.tasteName = tasteName; } - public String getDetailState() { + public int getDetailState() { return detailState; } - public void setDetailState(String detailState) { + public void setDetailState(int detailState) { this.detailState = detailState; } - public String getGoodsRefundNum() { + public int getGoodsRefundNum() { return goodsRefundNum; } - public void setGoodsRefundNum(String goodsRefundNum) { + public void setGoodsRefundNum(int goodsRefundNum) { this.goodsRefundNum = goodsRefundNum; } - public String getMakingComplete() { + public int getMakingComplete() { return makingComplete; } - public void setMakingComplete(String makingComplete) { + public void setMakingComplete(int makingComplete) { this.makingComplete = makingComplete; } + @Override public String toString() { return "OrderDetailsInfo{" + "detailId='" + detailId + '\'' + ", orderId='" + orderId + '\'' + - ", detailType='" + detailType + '\'' + + ", detailType=" + detailType + ", goodsDishesId='" + goodsDishesId + '\'' + ", goodsDishesName='" + goodsDishesName + '\'' + ", goodsDishesImgUrl='" + goodsDishesImgUrl + '\'' + ", menuDetailId='" + menuDetailId + '\'' + - ", salePrice='" + salePrice + '\'' + - ", prefPrice='" + prefPrice + '\'' + - ", price='" + price + '\'' + - ", weightUnit='" + weightUnit + '\'' + - ", quantity='" + quantity + '\'' + + ", salePrice=" + salePrice + + ", prefPrice=" + prefPrice + + ", price=" + price + + ", weightUnit=" + weightUnit + + ", quantity=" + quantity + ", unitName='" + unitName + '\'' + - ", totalAmount='" + totalAmount + '\'' + - ", calcTotalAmount='" + calcTotalAmount + '\'' + - ", realAmount='" + realAmount + '\'' + - ", refundAmount='" + refundAmount + '\'' + - ", salesMode='" + salesMode + '\'' + + ", totalAmount=" + totalAmount + + ", calcTotalAmount=" + calcTotalAmount + + ", realAmount=" + realAmount + + ", refundAmount=" + refundAmount + + ", salesMode=" + salesMode + ", tasteName='" + tasteName + '\'' + - ", detailState='" + detailState + '\'' + - ", goodsRefundNum='" + goodsRefundNum + '\'' + - ", makingComplete='" + makingComplete + '\'' + + ", detailState=" + detailState + + ", goodsRefundNum=" + goodsRefundNum + + ", makingComplete=" + makingComplete + '}'; } } diff --git a/app/src/main/java/com/bonus/canteen/db/entity/base/OrderInfo.java b/app/src/main/java/com/bonus/canteen/db/entity/base/OrderInfo.java index 51c3388..8c6d52a 100644 --- a/app/src/main/java/com/bonus/canteen/db/entity/base/OrderInfo.java +++ b/app/src/main/java/com/bonus/canteen/db/entity/base/OrderInfo.java @@ -17,7 +17,7 @@ public class OrderInfo { @ColumnInfo private String macOrderId;//macId @ColumnInfo - private String sourceType;//来源 + private int sourceType;//来源 @ColumnInfo private String plateSerialNum;//餐盘物理卡号 @ColumnInfo @@ -51,35 +51,35 @@ public class OrderInfo { @ColumnInfo private String mealCode;//流水号前缀 @ColumnInfo - private String payableAmount;//应付金额 分 + private int payableAmount;//应付金额 分 @ColumnInfo - private String discountsAmount = "0";//优惠金额 + private int discountsAmount = 0;//优惠金额 @ColumnInfo - private String couponAmount = "0";//餐券金额 + private int couponAmount = 0;//餐券金额 @ColumnInfo - private String deliveryAmount = "0";//配送费 + private int deliveryAmount = 0;//配送费 @ColumnInfo - private String packingAmount = "0";//包装费 分 + private int packingAmount = 0;//包装费 分 @ColumnInfo - private String realAmount;//订单实付总金额 + private int realAmount;//订单实付总金额 @ColumnInfo - private String needPayAmount;//实际应付款金额 单位为分 + private int needPayAmount;//实际应付款金额 单位为分 @ColumnInfo - private String refundAmount = "0"; + private int refundAmount = 0; @ColumnInfo private String orderTime;//下单时间 @ColumnInfo private String payTime;//支付时间 @ColumnInfo - private String payType;//支付方式 + private int payType;//支付方式 @ColumnInfo - private String payState;//支付状态 + private int payState;//支付状态 @ColumnInfo - private String deductionType;//扣款类型 1 下单扣款 2 核销扣款 + private int deductionType = 1;//扣款类型 1 下单扣款 2 核销扣款 @ColumnInfo - private String orderType;//订单类型 + private int orderType;//订单类型 @ColumnInfo - private String orderState;//订单状态 + private int orderState;//订单状态 //(1, "已支付"), //(9, "已取消"), @@ -91,7 +91,7 @@ public class OrderInfo { //(25, "部分退单"), //(26, "支付中"); @ColumnInfo - private String orderStateMix; + private int orderStateMix; //(1, "待制作"), //(2, "制作中"), @@ -100,11 +100,11 @@ public class OrderInfo { //(3, "待领取"), //(4, "已领取"); @ColumnInfo - private String dishesState; + private int dishesState; @ColumnInfo - private String orderRefundState;//"订单退款状态 1 未申请 2 已退单 3 部分退单" + private int orderRefundState;//"订单退款状态 1 未申请 2 已退单 3 部分退单" @ColumnInfo - private String commentState;//评价状态 1 已评价 2 未评价 + private int commentState;//评价状态 1 已评价 2 未评价 @ColumnInfo private String checkState;//"审核状态 1 待审核 2 审核通过 3 审核失败 @ColumnInfo @@ -112,24 +112,28 @@ public class OrderInfo { @ColumnInfo private String remark; @ColumnInfo - private String goodsCount;//菜品总数量 + private int goodsCount;//菜品总数量 @ColumnInfo - private String ifOnline; //是否在线 + private int ifOnline; //是否在线 @ColumnInfo - private String payChannel = "1";//默认乐牛系统账户 详情PayChannelEnum + private int payChannel = 1;//默认乐牛系统账户 详情PayChannelEnum @ColumnInfo - private String isPush; + private int isPush = 0; + + @ColumnInfo + private String strJson; @Ignore private List orderDetailList; + @Override public String toString() { return "OrderInfo{" + "orderId='" + orderId + '\'' + ", macOrderId='" + macOrderId + '\'' + - ", sourceType='" + sourceType + '\'' + + ", sourceType=" + sourceType + ", plateSerialNum='" + plateSerialNum + '\'' + ", plateNum='" + plateNum + '\'' + ", custId='" + custId + '\'' + @@ -146,57 +150,43 @@ public class OrderInfo { ", mealtimeName='" + mealtimeName + '\'' + ", machineSn='" + machineSn + '\'' + ", mealCode='" + mealCode + '\'' + - ", payableAmount='" + payableAmount + '\'' + - ", discountsAmount='" + discountsAmount + '\'' + - ", couponAmount='" + couponAmount + '\'' + - ", deliveryAmount='" + deliveryAmount + '\'' + - ", packingAmount='" + packingAmount + '\'' + - ", realAmount='" + realAmount + '\'' + - ", needPayAmount='" + needPayAmount + '\'' + - ", refundAmount='" + refundAmount + '\'' + + ", payableAmount=" + payableAmount + + ", discountsAmount=" + discountsAmount + + ", couponAmount=" + couponAmount + + ", deliveryAmount=" + deliveryAmount + + ", packingAmount=" + packingAmount + + ", realAmount=" + realAmount + + ", needPayAmount=" + needPayAmount + + ", refundAmount=" + refundAmount + ", orderTime='" + orderTime + '\'' + ", payTime='" + payTime + '\'' + - ", payType='" + payType + '\'' + - ", payState='" + payState + '\'' + - ", deductionType='" + deductionType + '\'' + - ", orderType='" + orderType + '\'' + - ", orderState='" + orderState + '\'' + - ", orderStateMix='" + orderStateMix + '\'' + - ", dishesState='" + dishesState + '\'' + - ", orderRefundState='" + orderRefundState + '\'' + - ", commentState='" + commentState + '\'' + + ", payType=" + payType + + ", payState=" + payState + + ", deductionType=" + deductionType + + ", orderType=" + orderType + + ", orderState=" + orderState + + ", orderStateMix=" + orderStateMix + + ", dishesState=" + dishesState + + ", orderRefundState=" + orderRefundState + + ", commentState=" + commentState + ", checkState='" + checkState + '\'' + ", imgUrl='" + imgUrl + '\'' + ", remark='" + remark + '\'' + - ", goodsCount='" + goodsCount + '\'' + - ", ifOnline='" + ifOnline + '\'' + - ", payChannel='" + payChannel + '\'' + - ", isPush='" + isPush + '\'' + + ", goodsCount=" + goodsCount + + ", ifOnline=" + ifOnline + + ", payChannel=" + payChannel + + ", isPush=" + isPush + + ", strJson='" + strJson + '\'' + ", orderDetailList=" + orderDetailList + '}'; } - public String getIsPush() { - return isPush; - } - - public void setIsPush(String isPush) { - this.isPush = isPush; - } - - public List getOrderDetailList() { - return orderDetailList; - } - - public void setOrderDetailList(List orderDetailList) { - this.orderDetailList = orderDetailList; - } - + @NotNull public String getOrderId() { return orderId; } - public void setOrderId(String orderId) { + public void setOrderId(@NotNull String orderId) { this.orderId = orderId; } @@ -208,11 +198,11 @@ public class OrderInfo { this.macOrderId = macOrderId; } - public String getSourceType() { + public int getSourceType() { return sourceType; } - public void setSourceType(String sourceType) { + public void setSourceType(int sourceType) { this.sourceType = sourceType; } @@ -344,67 +334,67 @@ public class OrderInfo { this.mealCode = mealCode; } - public String getPayableAmount() { + public int getPayableAmount() { return payableAmount; } - public void setPayableAmount(String payableAmount) { + public void setPayableAmount(int payableAmount) { this.payableAmount = payableAmount; } - public String getDiscountsAmount() { + public int getDiscountsAmount() { return discountsAmount; } - public void setDiscountsAmount(String discountsAmount) { + public void setDiscountsAmount(int discountsAmount) { this.discountsAmount = discountsAmount; } - public String getCouponAmount() { + public int getCouponAmount() { return couponAmount; } - public void setCouponAmount(String couponAmount) { + public void setCouponAmount(int couponAmount) { this.couponAmount = couponAmount; } - public String getDeliveryAmount() { + public int getDeliveryAmount() { return deliveryAmount; } - public void setDeliveryAmount(String deliveryAmount) { + public void setDeliveryAmount(int deliveryAmount) { this.deliveryAmount = deliveryAmount; } - public String getPackingAmount() { + public int getPackingAmount() { return packingAmount; } - public void setPackingAmount(String packingAmount) { + public void setPackingAmount(int packingAmount) { this.packingAmount = packingAmount; } - public String getRealAmount() { + public int getRealAmount() { return realAmount; } - public void setRealAmount(String realAmount) { + public void setRealAmount(int realAmount) { this.realAmount = realAmount; } - public String getNeedPayAmount() { + public int getNeedPayAmount() { return needPayAmount; } - public void setNeedPayAmount(String needPayAmount) { + public void setNeedPayAmount(int needPayAmount) { this.needPayAmount = needPayAmount; } - public String getRefundAmount() { + public int getRefundAmount() { return refundAmount; } - public void setRefundAmount(String refundAmount) { + public void setRefundAmount(int refundAmount) { this.refundAmount = refundAmount; } @@ -424,75 +414,75 @@ public class OrderInfo { this.payTime = payTime; } - public String getPayType() { + public int getPayType() { return payType; } - public void setPayType(String payType) { + public void setPayType(int payType) { this.payType = payType; } - public String getPayState() { + public int getPayState() { return payState; } - public void setPayState(String payState) { + public void setPayState(int payState) { this.payState = payState; } - public String getDeductionType() { + public int getDeductionType() { return deductionType; } - public void setDeductionType(String deductionType) { + public void setDeductionType(int deductionType) { this.deductionType = deductionType; } - public String getOrderType() { + public int getOrderType() { return orderType; } - public void setOrderType(String orderType) { + public void setOrderType(int orderType) { this.orderType = orderType; } - public String getOrderState() { + public int getOrderState() { return orderState; } - public void setOrderState(String orderState) { + public void setOrderState(int orderState) { this.orderState = orderState; } - public String getOrderStateMix() { + public int getOrderStateMix() { return orderStateMix; } - public void setOrderStateMix(String orderStateMix) { + public void setOrderStateMix(int orderStateMix) { this.orderStateMix = orderStateMix; } - public String getDishesState() { + public int getDishesState() { return dishesState; } - public void setDishesState(String dishesState) { + public void setDishesState(int dishesState) { this.dishesState = dishesState; } - public String getOrderRefundState() { + public int getOrderRefundState() { return orderRefundState; } - public void setOrderRefundState(String orderRefundState) { + public void setOrderRefundState(int orderRefundState) { this.orderRefundState = orderRefundState; } - public String getCommentState() { + public int getCommentState() { return commentState; } - public void setCommentState(String commentState) { + public void setCommentState(int commentState) { this.commentState = commentState; } @@ -520,27 +510,51 @@ public class OrderInfo { this.remark = remark; } - public String getGoodsCount() { + public int getGoodsCount() { return goodsCount; } - public void setGoodsCount(String goodsCount) { + public void setGoodsCount(int goodsCount) { this.goodsCount = goodsCount; } - public String getIfOnline() { + public int getIfOnline() { return ifOnline; } - public void setIfOnline(String ifOnline) { + public void setIfOnline(int ifOnline) { this.ifOnline = ifOnline; } - public String getPayChannel() { + public int getPayChannel() { return payChannel; } - public void setPayChannel(String payChannel) { + public void setPayChannel(int payChannel) { this.payChannel = payChannel; } + + public int getIsPush() { + return isPush; + } + + public void setIsPush(int isPush) { + this.isPush = isPush; + } + + public List getOrderDetailList() { + return orderDetailList; + } + + public void setOrderDetailList(List orderDetailList) { + this.orderDetailList = orderDetailList; + } + + public String getStrJson() { + return strJson; + } + + public void setStrJson(String strJson) { + this.strJson = strJson; + } } diff --git a/app/src/main/java/com/bonus/canteen/utils/Utils.java b/app/src/main/java/com/bonus/canteen/utils/Utils.java index 2cb91c3..bfca1e0 100644 --- a/app/src/main/java/com/bonus/canteen/utils/Utils.java +++ b/app/src/main/java/com/bonus/canteen/utils/Utils.java @@ -24,6 +24,7 @@ import com.bonus.canteen.adapter.menu.utils.StringHelper; import com.xuexiang.xui.utils.ColorUtils; import java.math.BigDecimal; +import java.math.RoundingMode; /** * 工具类 @@ -60,4 +61,37 @@ public final class Utils { return result.toString(); } + + + //加 + public static int add(int a, int b) { + BigDecimal num1 = new BigDecimal(a); + BigDecimal num2 = new BigDecimal(b); + return num1.add(num2).intValue(); + } + + //减 + public static int subtract(int a, int b) { + BigDecimal num1 = new BigDecimal(a); + BigDecimal num2 = new BigDecimal(b); + return num1.subtract(num2).intValue(); + } + + //乘 + public static int multiply(int a, int b) { + BigDecimal num1 = new BigDecimal(a); + BigDecimal num2 = new BigDecimal(b); + return num1.multiply(num2).intValue(); + } + + //除 + public static BigDecimal divide(int a, int b, int scale) { + if (b == 0) { + throw new ArithmeticException("Division by zero"); + } + BigDecimal num1 = new BigDecimal(a); + BigDecimal num2 = new BigDecimal(b); + return num1.divide(num2, scale, RoundingMode.HALF_UP); + } + }