diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/BillRefundDTO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/BillRefundDTO.java index 678fee69..db48ba8c 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/BillRefundDTO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/BillRefundDTO.java @@ -36,4 +36,7 @@ public class BillRefundDTO { @ApiModelProperty("退款操作人ID") private Long userId; + + @ApiModelProperty("校验是否完成") + private Boolean checkFinish; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 3a45fe86..5fabde98 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -1240,6 +1240,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After refundDto.setBillId(order.getBillId()); refundDto.setRefundAmount(refundAmount); refundDto.setRefundReason(String.format("充值订单%s智能退款%s元", order.getBillNo(), refundAmount)); + refundDto.setCheckFinish(false); int refund = this.refund(refundDto); ServiceUtil.assertion(refund != 1, "申请退款失败"); }, 10, TimeUnit.SECONDS); @@ -1770,7 +1771,10 @@ public class TransactionBillServiceImpl implements TransactionBillService, After ServiceUtil.assertion(bill == null, "待退款的订单不存在"); ServiceUtil.assertion(dto.getRefundAmount().compareTo(bill.getMoney()) > 0, "退款金额不允许大于订单金额"); ServiceUtil.assertion(!TransactionBillStatus.SUCCESS.getStatus().equals(bill.getStatus()), "当前订单状态不允许退款"); - ServiceUtil.assertion(bill.getIsFinished() == null || !bill.getIsFinished(), "当前订单未完成,不允许退款"); + + if (dto.getCheckFinish() != null && dto.getCheckFinish()) { + ServiceUtil.assertion(bill.getIsFinished() == null || !bill.getIsFinished(), "当前订单未完成,不允许退款"); + } // 拼接分成列表 transactionAssembler.assembleBonusList(bill); @@ -1784,7 +1788,9 @@ public class TransactionBillServiceImpl implements TransactionBillService, After TransactionBillQuery billQuery = new TransactionBillQuery(); billQuery.setBillId(dto.getBillId()); billQuery.setStatus(TransactionBillStatus.SUCCESS.getStatus()); - billQuery.setIsFinished(true); + if (dto.getCheckFinish() != null && dto.getCheckFinish()) { + billQuery.setIsFinished(true); + } int updateBill = this.updateByQuery(data, billQuery); ServiceUtil.assertion(updateBill != 1, "退款时修改订单状态失败,订单状态已发生改变,请刷新后重试"); diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java index 58b3cb43..3151a2de 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java @@ -281,6 +281,7 @@ public class AppTransactionBillController extends BaseController dto.setUserType(loginUser.getLoginType().getType()); dto.setUserId(getUserId()); dto.setRefundReason(String.format("充值订单退款:%s", bill.getBillNo())); + dto.setCheckFinish(true); return toAjax(transactionBillService.refund(dto)); } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java index 856e5cbd..e9479119 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java @@ -155,6 +155,7 @@ public class SmTransactionBillController extends BaseController dto.setUserType(loginUser.getLoginType().getType()); dto.setUserId(getUserId()); dto.setRefundReason(String.format("充值订单退款:%s", bill.getBillNo())); + dto.setCheckFinish(true); return toAjax(transactionBillService.refund(dto)); }