debug:退款
This commit is contained in:
parent
7fa4290e7f
commit
898bd5b4e6
|
@ -1090,7 +1090,8 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
TransactionBillVO order = bo.getOrder();
|
||||
DeviceVO device = bo.getDevice();
|
||||
ServiceUtil.assertion(order == null, "订单不存在");
|
||||
ServiceUtil.assertion(!TransactionBillStatus.SUCCESS_DEPOSIT.getStatus().equals(order.getStatus()), "当前订单状态不允许结束");
|
||||
// ServiceUtil.assertion(!TransactionBillStatus.SUCCESS_DEPOSIT.getStatus().equals(order.getStatus()), "当前订单状态不允许结束");
|
||||
ServiceUtil.assertion(order.getIsFinished() != null && order.getIsFinished(), "当前订单已结束,无法操作");
|
||||
ServiceUtil.assertion(device == null, "设备不存在");
|
||||
|
||||
LocalDateTime endTime = LocalDateTime.now(); // 结束使用的时间
|
||||
|
@ -1111,6 +1112,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
TransactionBillQuery query = new TransactionBillQuery();
|
||||
query.setStatus(TransactionBillStatus.SUCCESS_DEPOSIT.getStatus());
|
||||
query.setBillId(order.getBillId());
|
||||
query.setIsFinished(false);
|
||||
int update = this.updateByQuery(data, query);
|
||||
ServiceUtil.assertion(update != 1, "修改订单状态失败,请刷新后重试");
|
||||
|
||||
|
@ -1181,7 +1183,6 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
TransactionBillVO order = bo.getOrder();
|
||||
DeviceVO device = bo.getDevice();
|
||||
ServiceUtil.assertion(order == null, "订单不存在");
|
||||
ServiceUtil.assertion(!TransactionBillStatus.SUCCESS.getStatus().equals(order.getStatus()), "当前订单状态不允许结束");
|
||||
ServiceUtil.assertion(!SuitFeeMode.SMART.getMode().equals(order.getSuitFeeMode()), "当前订单非智能收费订单,无法提前结束");
|
||||
ServiceUtil.assertion(order.getIsFinished() != null && order.getIsFinished(), "当前订单已结束,无法操作");
|
||||
ServiceUtil.assertion(device == null, "设备不存在");
|
||||
|
@ -1215,13 +1216,15 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
// 计算需要退款的金额,若金额 > 0.01 则申请退款
|
||||
BigDecimal refundAmount = this.calcRefundAmount(order, endTime, totalEle);
|
||||
if (BigDecimal.valueOf(0.01).compareTo(refundAmount) < 0) {
|
||||
// 申请退款
|
||||
BillRefundDTO refundDto = new BillRefundDTO();
|
||||
refundDto.setBillId(order.getBillId());
|
||||
refundDto.setRefundAmount(refundAmount);
|
||||
refundDto.setRefundReason(String.format("充值订单%s智能退款%s元", order.getBillNo(), refundAmount));
|
||||
int refund = this.refund(refundDto);
|
||||
ServiceUtil.assertion(refund != 1, "申请退款失败");
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
// 申请退款
|
||||
BillRefundDTO refundDto = new BillRefundDTO();
|
||||
refundDto.setBillId(order.getBillId());
|
||||
refundDto.setRefundAmount(refundAmount);
|
||||
refundDto.setRefundReason(String.format("充值订单%s智能退款%s元", order.getBillNo(), refundAmount));
|
||||
int refund = this.refund(refundDto);
|
||||
ServiceUtil.assertion(refund != 1, "申请退款失败");
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// 清零设备
|
||||
|
@ -1303,7 +1306,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
DeviceVO device = bo.getDevice();
|
||||
ServiceUtil.assertion(order == null, "订单不存在");
|
||||
ServiceUtil.assertion(order.getIsFinished() != null && order.getIsFinished(), "当前订单已结束,无法操作");
|
||||
ServiceUtil.assertion(!TransactionBillStatus.SUCCESS.getStatus().equals(order.getStatus()), "当前订单状态不允许结束");
|
||||
// ServiceUtil.assertion(!TransactionBillStatus.SUCCESS.getStatus().equals(order.getStatus()), "当前订单状态不允许结束");
|
||||
ServiceUtil.assertion(device == null, "设备不存在");
|
||||
|
||||
LocalDateTime endTime = LocalDateTime.now(); // 结束使用的时间
|
||||
|
@ -1745,8 +1748,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
TransactionBillVO bill = this.selectSmTransactionBillByBillId(dto.getBillId());
|
||||
ServiceUtil.assertion(bill == null, "待退款的订单不存在");
|
||||
ServiceUtil.assertion(dto.getRefundAmount().compareTo(bill.getMoney()) > 0, "退款金额不允许大于订单金额");
|
||||
ServiceUtil.assertion(bill.getIsFinished() == null || !bill.getIsFinished(), "当前订单还未结束使用,无法退款");
|
||||
ServiceUtil.assertion(!TransactionBillStatus.SUCCESS.getStatus().equals(bill.getStatus()), "当前订单未支付成功,不允许退款");
|
||||
ServiceUtil.assertion(!TransactionBillStatus.SUCCESS.getStatus().equals(bill.getStatus()), "当前订单状态不允许退款");
|
||||
|
||||
// 拼接分成列表
|
||||
transactionAssembler.assembleBonusList(bill);
|
||||
|
@ -1760,7 +1762,6 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
TransactionBillQuery billQuery = new TransactionBillQuery();
|
||||
billQuery.setBillId(dto.getBillId());
|
||||
billQuery.setStatus(TransactionBillStatus.SUCCESS.getStatus());
|
||||
billQuery.setIsFinished(true);
|
||||
int updateBill = this.updateByQuery(data, billQuery);
|
||||
ServiceUtil.assertion(updateBill != 1, "退款时修改订单状态失败,订单状态已发生改变,请刷新后重试");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user