改支付状态 如果是已支付改退款中 如果是未支付改为取消

This commit is contained in:
Hawking 2023-04-20 21:50:41 +08:00
parent e2dfdd057e
commit 0a82851e2c
2 changed files with 8 additions and 8 deletions

View File

@ -315,7 +315,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
if (BigDecimal.ZERO.compareTo(detailMoney) > -1) {
logger.info("子订单[{}]不需要退款 payMoney={}元", orderDetail.getId(), detailMoney);
// 更新子财务单金额和状态
financialDetail.setPayStatus(PayStatus.REFUND.getCode());
financialDetail.setPayStatus(paid ? PayStatus.REFUND.getCode() : PayStatus.CANCEL.getCode());
financialDetail.setPayMoney(detailMoney);
financialDetailService.updateFinancialDetail(financialDetail);
@ -325,9 +325,9 @@ public class OrderDetailServiceImpl implements OrderDetailService {
return;
}
// 更新子财务单金额和状态
// 更新子财务单金额和状态 如果是已支付改退款中 如果是未支付改为取消
financialDetail.setPayMoney(detailMoney);
financialDetail.setPayStatus(PayStatus.REFUNDING.getCode());
financialDetail.setPayStatus(paid ? PayStatus.REVERSING.getCode() : PayStatus.CANCEL.getCode());
financialDetailService.updateFinancialDetail(financialDetail);
// 更新主财务单金额

View File

@ -376,12 +376,12 @@ public class OrderMasterServiceImpl implements OrderMasterService {
boolean paid = PayStatus.PAID.getCode().equals(financialMaster.getPayStatus()) ||
PayStatus.PAYED_ADD.getCode().equals(financialMaster.getPayStatus());
// 主订单的支付状态
updatePayStatus(orderMasterId, PayStatus.REFUND.getCode());
// 支付状态 如果是已支付改退款中 如果是未支付改为取消
updatePayStatus(orderMasterId, paid ? PayStatus.REVERSING.getCode() : PayStatus.CANCEL.getCode());
// 改子订单的支付状态
OrderDetail odUpdate = new OrderDetail();
odUpdate.setOrderMasterId(orderMasterId);
odUpdate.setPayStatus(PayStatus.REFUND.getCode());
odUpdate.setPayStatus(paid ? PayStatus.REVERSING.getCode() : PayStatus.CANCEL.getCode());
orderDetailService.updateByOrderMasterId(odUpdate);
// 主订单金额=订单原价+加价
@ -395,12 +395,12 @@ public class OrderMasterServiceImpl implements OrderMasterService {
}
// 修改主财务单状态
financialMasterService.updatePayStatus(financialMaster.getId(), PayStatus.REVERSING.getCode());
financialMasterService.updatePayStatus(financialMaster.getId(), paid ? PayStatus.REVERSING.getCode() : PayStatus.CANCEL.getCode());
// 修改子财务单状态
List<FinancialDetail> fdList = financialDetailService.selectByFinancialMasterId(financialMaster.getId());
for (FinancialDetail fd : fdList) {
if (PayStatus.PAID.getCode().equals(fd.getPayStatus())) {
financialDetailService.updatePayStatus(fd.getId(), PayStatus.REFUND.getCode());
financialDetailService.updatePayStatus(fd.getId(), paid ? PayStatus.REVERSING.getCode() : PayStatus.CANCEL.getCode());
}
}