From 2a48cfa63f46c274d4da8e4562f142a27545a43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 13:21:50 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E6=97=A0=E5=8F=B0=E6=A1=8C=E4=B8=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=B0=B1=E9=A4=90=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashierservice/service/OrderService.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java index f9e1b49..33cd4e0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java @@ -159,7 +159,12 @@ public class OrderService { */ public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId) { String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); - return getShopEatTypeInfoDTO(shopId, eatModel, tableId); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId, true); + } + + public ShopEatTypeInfoDTO getEatModelUnCheck(Object shopId, String tableId) { + String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId, false); } /** @@ -171,7 +176,7 @@ public class OrderService { */ public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId, String useType) { String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); - return getShopEatTypeInfoDTO(shopId, eatModel, tableId); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId, true); } /** @@ -182,14 +187,14 @@ public class OrderService { * @param tableId 台桌id * @return just餐类型信息 */ - private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) { + private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId, boolean isCheckModel) { TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper() .eq(TbShopInfo::getId, shopId)); if (shopInfo == null) { throw new MsgException("店铺信息不存在"); } - if (!shopInfo.getEatModel().contains(eatModel)) { + if (!shopInfo.getEatModel().contains(eatModel) && isCheckModel) { throw new MsgException("当前店铺未开启此就餐模式"); } boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel); @@ -273,8 +278,13 @@ public class OrderService { if (number == null) { return Result.fail(CodeEnum.PARAM); } - ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, tableId); + ShopEatTypeInfoDTO shopEatTypeInfoDTO; + if (StrUtil.isBlank(tableId)) { + shopEatTypeInfoDTO = getEatModelUnCheck(shopId, tableId); + }else { + shopEatTypeInfoDTO = checkEatModel(shopId, tableId); + } // 台桌点单 boolean isSeatCart = productId != null && TableConstant.CashierCart.ID.equals(productId.toString()); @@ -889,8 +899,12 @@ public class OrderService { if (shopInfo == null) { throw new MsgException("店铺信息不存在"); } - - ShopEatTypeInfoDTO eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId()); + ShopEatTypeInfoDTO eatTypeInfoDTO; + if (StrUtil.isBlank(orderVo.getTableId())) { + eatTypeInfoDTO = getEatModelUnCheck(orderVo.getShopId(), orderVo.getTableId()); + }else { + eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId()); + } if (ShopInfoEatModelEnum.DINE_IN.getValue().equals(eatTypeInfoDTO.getUseType()) && StrUtil.isBlank(eatTypeInfoDTO.getUseType())) { throw new MsgException("店内就餐必须选择桌码"); From a9903124d5aca196dbbd24b355e08d00cadad77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 13:21:50 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E6=97=A0=E5=8F=B0=E6=A1=8C=E4=B8=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=B0=B1=E9=A4=90=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashierservice/service/OrderService.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java index f9e1b49..33cd4e0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java @@ -159,7 +159,12 @@ public class OrderService { */ public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId) { String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); - return getShopEatTypeInfoDTO(shopId, eatModel, tableId); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId, true); + } + + public ShopEatTypeInfoDTO getEatModelUnCheck(Object shopId, String tableId) { + String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId, false); } /** @@ -171,7 +176,7 @@ public class OrderService { */ public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId, String useType) { String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); - return getShopEatTypeInfoDTO(shopId, eatModel, tableId); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId, true); } /** @@ -182,14 +187,14 @@ public class OrderService { * @param tableId 台桌id * @return just餐类型信息 */ - private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) { + private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId, boolean isCheckModel) { TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper() .eq(TbShopInfo::getId, shopId)); if (shopInfo == null) { throw new MsgException("店铺信息不存在"); } - if (!shopInfo.getEatModel().contains(eatModel)) { + if (!shopInfo.getEatModel().contains(eatModel) && isCheckModel) { throw new MsgException("当前店铺未开启此就餐模式"); } boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel); @@ -273,8 +278,13 @@ public class OrderService { if (number == null) { return Result.fail(CodeEnum.PARAM); } - ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, tableId); + ShopEatTypeInfoDTO shopEatTypeInfoDTO; + if (StrUtil.isBlank(tableId)) { + shopEatTypeInfoDTO = getEatModelUnCheck(shopId, tableId); + }else { + shopEatTypeInfoDTO = checkEatModel(shopId, tableId); + } // 台桌点单 boolean isSeatCart = productId != null && TableConstant.CashierCart.ID.equals(productId.toString()); @@ -889,8 +899,12 @@ public class OrderService { if (shopInfo == null) { throw new MsgException("店铺信息不存在"); } - - ShopEatTypeInfoDTO eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId()); + ShopEatTypeInfoDTO eatTypeInfoDTO; + if (StrUtil.isBlank(orderVo.getTableId())) { + eatTypeInfoDTO = getEatModelUnCheck(orderVo.getShopId(), orderVo.getTableId()); + }else { + eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getTableId()); + } if (ShopInfoEatModelEnum.DINE_IN.getValue().equals(eatTypeInfoDTO.getUseType()) && StrUtil.isBlank(eatTypeInfoDTO.getUseType())) { throw new MsgException("店内就餐必须选择桌码"); From ad776d7ff47fc73bcf61cdd94d7759db76a2cc35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 13:26:51 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=8D=E6=9F=A5=E8=AF=A2=E4=BC=98=E6=83=A0=E5=88=B8=E5=95=86?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper/TbProductMapper.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/mapper/TbProductMapper.xml b/src/main/resources/mapper/TbProductMapper.xml index be823f4..35f80a5 100644 --- a/src/main/resources/mapper/TbProductMapper.xml +++ b/src/main/resources/mapper/TbProductMapper.xml @@ -486,6 +486,7 @@ and a.name like CONCAT('%',#{commdityName},'%') + and type != 'coupon' and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort` @@ -512,6 +513,8 @@ and a.name like CONCAT('%',#{commdityName},'%') + and type != 'coupon' + and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort` @@ -524,6 +527,8 @@ and a.name like CONCAT('%',#{commdityName},'%') + and type != 'coupon' + and b.is_grounding=0 GROUP BY a.id ORDER BY a.`sort` From 6e7fcd6404a3c5c212e453d81cfb61b9c7208787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 13:32:12 +0800 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20=E6=97=A0=E5=8F=B0=E6=A1=8C=E4=B8=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=B0=B1=E9=A4=90=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/OrderService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java index 33cd4e0..4c9e9e9 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/OrderService.java @@ -643,8 +643,12 @@ public class OrderService { if (StringUtils.isEmpty(shopId)) { return Result.fail(CodeEnum.SHOPINFONOEXIST); } - - ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(shopId), tableId); + ShopEatTypeInfoDTO shopEatTypeInfoDTO; + if (StrUtil.isBlank(tableId)) { + shopEatTypeInfoDTO = getEatModelUnCheck(Integer.valueOf(shopId), tableId); + }else { + shopEatTypeInfoDTO = checkEatModel(Integer.valueOf(shopId), tableId); + } String day = DateUtils.getDay(); String finalMasterId1 = masterId; From f42ab0d8b969f9fe85490b235895162b1c6cf32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 14:24:38 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=E9=80=80=E6=AC=BE=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E4=B8=BAnull=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chaozhanggui/system/cashierservice/service/PayService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 489a943..5921213 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -1297,7 +1297,7 @@ public class PayService { throw new MsgException("退款金额必须大于0"); } - oldOrderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO)); + oldOrderInfo.setCouponInfoList(couponInfoDTO == null ? null : JSONObject.toJSONString(couponInfoDTO)); // 保存剩余未退款的订单详情 if (!remainOrderDetailList.isEmpty()) { From f243d83de8df7cb11579eba3d3bbd6d6823185e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 14:25:58 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=E9=80=80=E6=AC=BE=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E4=B8=BAnull=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/PayService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 5921213..76becb5 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -1500,8 +1500,10 @@ public class PayService { if (count == 0) { returnCoupon(orderInfo, true); // 返还积分 - memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(), - "用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId())); + if (orderInfo.getMemberId() != null) { + memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(), + "用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId())); + } } } mPOrderInfoMapper.updateById(orderInfo); From 2c69dcc4d3dd093fa3d20f0949b65886b4831ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 14:28:23 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20=E9=80=80=E6=AC=BE=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chaozhanggui/system/cashierservice/service/PayService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 76becb5..fa6c720 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -1500,7 +1500,7 @@ public class PayService { if (count == 0) { returnCoupon(orderInfo, true); // 返还积分 - if (orderInfo.getMemberId() != null) { + if (orderInfo.getMemberId() != null && orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) { memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(), "用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId())); } From c815a7b061c9d9ce871e658e0a8015ab09ad3cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 14:42:18 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E4=BC=9A=E5=91=98=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/controller/OrderController.java | 1 - .../system/cashierservice/controller/PayController.java | 2 +- .../chaozhanggui/system/cashierservice/service/PayService.java | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/OrderController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/OrderController.java index 436b46c..d04755b 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/OrderController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/OrderController.java @@ -139,7 +139,6 @@ public class OrderController { JSONObject jsonObject = TokenUtil.parseParamFromToken(token); String userId = jsonObject.getString("accountId"); orderVo.setMerchantId(Integer.valueOf(userId)); - orderVo.setUserId(jsonObject.getString("staffId")); return orderService.createOrder(orderVo, clientType, token, null); } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java index 87c7fa0..99416e8 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java @@ -238,7 +238,7 @@ public class PayController { } @RequestMapping("returnOrder") - @LimitSubmit(key = "returnOrder:%s", limit = 10) +// @LimitSubmit(key = "returnOrder:%s", limit = 10) public Result returnOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName, @RequestHeader("clientType") String clientType, diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index fa6c720..4b1eed4 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -941,6 +941,7 @@ public class PayService { orderInfo.setStatus("closed"); orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo())); orderInfo.setMemberId(vipUserId.toString()); + orderInfo.setUserId(shopUser.getUserId()); tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo); //更新购物车状态 mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, orderInfo.getId()); @@ -1399,7 +1400,7 @@ public class PayService { } - @Transactional + @Transactional(rollbackFor = Exception.class) public Object returnOrder(ReturnOrderDTO returnOrderDTO) { TbOrderInfo orderInfo = mPOrderInfoMapper.selectOne(new LambdaQueryWrapper() .eq(TbOrderInfo::getId, returnOrderDTO.getOrderId()) From b88509133c7a5773160c8ce8d0793ae1450ec62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Tue, 17 Dec 2024 14:42:18 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20=E9=80=80=E6=AC=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/controller/PayController.java | 2 +- .../system/cashierservice/service/PayService.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java index 99416e8..87c7fa0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java @@ -238,7 +238,7 @@ public class PayController { } @RequestMapping("returnOrder") -// @LimitSubmit(key = "returnOrder:%s", limit = 10) + @LimitSubmit(key = "returnOrder:%s", limit = 10) public Result returnOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName, @RequestHeader("clientType") String clientType, diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 4b1eed4..a6ec140 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -1253,7 +1253,7 @@ public class PayService { hasNormalReturn = true; saleAmount = saleAmount.add(orderDetail.getPrice()); if (remainNum.compareTo(BigDecimal.ZERO) <= 0) { - returnAmount = orderDetail.getPriceAmount(); + returnAmount = returnAmount.add(orderDetail.getPriceAmount()); packAMount = orderDetail.getPackAmount(); } else { currentDetailAMount = orderDetail.getPriceAmount() @@ -1326,6 +1326,9 @@ public class PayService { returnOrder.setPayAmount(returnAmount); mPOrderInfoMapper.insert(returnOrder); + for (TbOrderDetail orderDetail : detailList) { + orderDetail.setOrderId(returnOrder.getId()); + } updateStockAndRecord(detailList); mpOrderDetailService.updateBatchById(detailList);