补充上一commit
This commit is contained in:
parent
6e6bd07f23
commit
42d8d3fad7
|
|
@ -149,32 +149,32 @@ public class AfterServiceRecordServiceImpl implements IAfterServiceRecordService
|
|||
Assert.notNull(orderMaster, "找不到对应的订单");
|
||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(orderDetail.getOrderMasterId());
|
||||
Assert.notNull(financialMaster, "找不到订单");
|
||||
// if(PayTypeEnum.ALIPAY_QR.getCode().equals(orderMaster.getPayType()) && ! PayStatus.PAID.getCode().equals(financialMaster.getPayStatus())){
|
||||
// financialMaster.setPayMoney(financialMaster.getPayMoney().subtract(refundMoney));
|
||||
// financialMasterService.updateFinancialMaster(financialMaster);
|
||||
// financialDetailService.updateFinancialDetail(financialDetail);
|
||||
// param.setOriginalRefund(BigDecimal.ZERO);
|
||||
// } else {
|
||||
// Assert.hasText(financialMaster.getPaymentId(), "找不到订单的支付记录,请联系管理员");
|
||||
// JSONObject response = null;
|
||||
// try {
|
||||
// response = adapayService.payReverse(orderMaster.getDeptId(), financialMaster.getPaymentId(), String.valueOf(refundMoney));
|
||||
// if (AdapayStatusEnum.pending.code.equals(response.getString("status"))) {
|
||||
// financialMaster.setPayMoney(financialMaster.getPayMoney().subtract(refundMoney));
|
||||
// financialMasterService.updateFinancialMaster(financialMaster);
|
||||
// financialDetailService.updateFinancialDetail(financialDetail);
|
||||
// param.setOriginalRefund(refundMoney);
|
||||
// } else if (AdapayStatusEnum.failed.code.equals(response.getString("status"))) {
|
||||
// if("reverse_amt_over".equals(response.getString("error_code"))){
|
||||
// throw new BaseException("退款金额大于最后一次支付,请撤销改金额再发起");
|
||||
// }else {
|
||||
// throw new BaseException("发起退款异常");
|
||||
// }
|
||||
// }
|
||||
// } catch (BaseAdaPayException e) {
|
||||
// throw new BaseException(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
if(PayTypeEnum.ALIPAY_QR.getCode().equals(orderMaster.getPayType()) && ! PayStatus.PAID.getCode().equals(financialMaster.getPayStatus())){
|
||||
financialMaster.setPayMoney(financialMaster.getPayMoney().subtract(refundMoney));
|
||||
financialMasterService.updateFinancialMaster(financialMaster);
|
||||
financialDetailService.updateFinancialDetail(financialDetail);
|
||||
param.setOriginalRefund(BigDecimal.ZERO);
|
||||
} else {
|
||||
Assert.hasText(financialMaster.getPaymentId(), "找不到订单的支付记录,请联系管理员");
|
||||
JSONObject response = null;
|
||||
try {
|
||||
response = adapayService.payReverse(orderMaster.getDeptId(), financialMaster.getPaymentId(), String.valueOf(refundMoney));
|
||||
if (AdapayStatusEnum.pending.code.equals(response.getString("status"))) {
|
||||
financialMaster.setPayMoney(financialMaster.getPayMoney().subtract(refundMoney));
|
||||
financialMasterService.updateFinancialMaster(financialMaster);
|
||||
financialDetailService.updateFinancialDetail(financialDetail);
|
||||
param.setOriginalRefund(refundMoney);
|
||||
} else if (AdapayStatusEnum.failed.code.equals(response.getString("status"))) {
|
||||
if("reverse_amt_over".equals(response.getString("error_code"))){
|
||||
throw new BaseException("退款金额大于最后一次支付,请撤销改金额再发起");
|
||||
}else {
|
||||
throw new BaseException("发起退款异常");
|
||||
}
|
||||
}
|
||||
} catch (BaseAdaPayException e) {
|
||||
throw new BaseException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 判断子单payMoney是否已经是0了,是的话就修改子单状态为已取消;主单状态会随之更改,不用做处理。
|
||||
if (financialDetail.getPayMoney().compareTo(BigDecimal.ZERO) == 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue