From 60da6176964cb65963bd15e8a00772cc33efbf1a Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Fri, 07 Oct 2022 16:04:32 +0800 Subject: [PATCH] 修改退款时无法退款到储值卡的bug --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceHelper.java | 18 ++++++++++++++---- zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java | 2 +- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 4 +++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java index 43a1b81..eb061f6 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/MoneyCardUseServiceImpl.java @@ -202,7 +202,7 @@ moneyCardPayOrder(moneyCardOperationDto); } else if (MoneyCardUseFlow.USE_TYPE_ORDRE_CANCEL.equals(moneyCardOperationDto.getType())) { //回退储值卡余额 - GroupValidateStatusCheckUtil.check(moneyCardOperationDto,MoneyCardUseGroup.moneyCardUseOrderChange.class); + GroupValidateStatusCheckUtil.check(moneyCardOperationDto,MoneyCardUseGroup.moneyCardUseTk.class); returnMoneyCard(moneyCardOperationDto); } else if (MoneyCardUseFlow.USE_TYPE_CZ.equals(moneyCardOperationDto.getType())) { //回退储值卡余额 diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceHelper.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceHelper.java index 8dc52a9..bc75ac4 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceHelper.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceHelper.java @@ -263,12 +263,19 @@ /** * 储值卡退款 * @param order + * @param isWholeOrder 是否整个订单退款 */ - public void returnMoneyCardPay(SysOrder order) { + public void returnMoneyCardPay(SysOrder order, boolean isWholeOrder) { SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); List<MoneyCardOperationDto> moneyCardOperationDtos = Lists.newArrayList(); - List<SysOrderFlow> flows = sysOrderFlowDao.selectByOrderId(order.getId()); + List<SysOrderFlow> flows = null; + if (isWholeOrder) { + flows = sysOrderFlowDao.selectByOrderId(order.getId()); + } else { + flows = order.getFlows(); + } + // 非现金收款退回扣卡余额 for (SysOrderFlow flow : flows) { if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { @@ -280,11 +287,14 @@ dto.setCarUseId(flow.getCardId()); dto.setType(MoneyCardUseFlow.USE_TYPE_ORDRE_CANCEL); if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { - dto.setGiftMoney(flow.getAmount().doubleValue()); + dto.setGiftMoney(flow.getAmount().abs().doubleValue()); } else { - dto.setRealMoney(flow.getAmount().doubleValue()); + dto.setRealMoney(flow.getAmount().abs().doubleValue()); } dto.setUpdateUser(user.getSuId()); + + // 用于通过校验 + dto.setOrderItemId(-1L); moneyCardOperationDtos.add(dto); } else { throw new GlobleException("无效的储值卡支付方式"); diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java index 2a4ea95..3a6bbe4 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java @@ -177,7 +177,7 @@ } //储值卡退款 - sysOrderServiceHelper.returnMoneyCardPay(order); + sysOrderServiceHelper.returnMoneyCardPay(order, true); //套餐项目取消 List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(order.getId()); @@ -573,6 +573,8 @@ sysOrderServiceHelper.addOrderFlow(sysOrder, false); //退款退套餐退项目 refundProjUse(sysOrder); + + sysOrderServiceHelper.returnMoneyCardPay(sysOrder, false); //删除积分 SysOrder oldOrder = sysOrderDao.selectById(sysOrder.getOldOrderId()); scoreVipDetailService.removeByBusinessId(oldOrder.getVipId(), oldOrder.getId()); -- Gitblit v1.9.1