支付成功回调时更新OrderMaster的支付状态
This commit is contained in:
parent
062164f90d
commit
bc64e4a10c
|
|
@ -9,6 +9,7 @@ import com.ghy.common.adapay.model.PaymentDTO;
|
||||||
import com.ghy.common.enums.PayStatus;
|
import com.ghy.common.enums.PayStatus;
|
||||||
import com.ghy.order.domain.OrderAddSubtract;
|
import com.ghy.order.domain.OrderAddSubtract;
|
||||||
import com.ghy.order.service.IOrderAddSubtractService;
|
import com.ghy.order.service.IOrderAddSubtractService;
|
||||||
|
import com.ghy.order.service.OrderMasterService;
|
||||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||||
import com.ghy.payment.domain.FinancialDetail;
|
import com.ghy.payment.domain.FinancialDetail;
|
||||||
import com.ghy.payment.domain.FinancialMaster;
|
import com.ghy.payment.domain.FinancialMaster;
|
||||||
|
|
@ -36,6 +37,8 @@ import java.util.concurrent.CompletableFuture;
|
||||||
@Service("payCallbackService")
|
@Service("payCallbackService")
|
||||||
public class PayCallbackService implements CallBackService {
|
public class PayCallbackService implements CallBackService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OrderMasterService orderMasterService;
|
||||||
@Resource
|
@Resource
|
||||||
FinancialMasterService financialMasterService;
|
FinancialMasterService financialMasterService;
|
||||||
@Resource
|
@Resource
|
||||||
|
|
@ -87,7 +90,9 @@ public class PayCallbackService implements CallBackService {
|
||||||
for (PaymentRelation relation : paymentRelations) {
|
for (PaymentRelation relation : paymentRelations) {
|
||||||
Long relationId = relation.getRelationId();
|
Long relationId = relation.getRelationId();
|
||||||
if (PaymentRelation.FINANCIAL_MASTER.equals(relation.getRelationIdType())) {
|
if (PaymentRelation.FINANCIAL_MASTER.equals(relation.getRelationIdType())) {
|
||||||
|
FinancialMaster financialMaster = financialMasterService.selectById(relationId);
|
||||||
|
// 更新主订单的支付信息
|
||||||
|
orderMasterService.updatePayStatus(financialMaster.getOrderMasterId(), PayStatus.PAID.getCode());
|
||||||
// 更新主财务单的支付信息
|
// 更新主财务单的支付信息
|
||||||
financialMasterService.updatePay(relationId, paymentId, PayStatus.PAID.getCode());
|
financialMasterService.updatePay(relationId, paymentId, PayStatus.PAID.getCode());
|
||||||
log.info("主财务单[{}]支付成功", relationId);
|
log.info("主财务单[{}]支付成功", relationId);
|
||||||
|
|
@ -111,6 +116,8 @@ public class PayCallbackService implements CallBackService {
|
||||||
financialMaster2Update.setPayMoney(financialMaster.getPayMoney().add(fc.getChangeMoney()));
|
financialMaster2Update.setPayMoney(financialMaster.getPayMoney().add(fc.getChangeMoney()));
|
||||||
financialMaster2Update.setPayStatus(PayStatus.PAID.getCode());
|
financialMaster2Update.setPayStatus(PayStatus.PAID.getCode());
|
||||||
financialMasterService.updateFinancialMaster(financialMaster2Update);
|
financialMasterService.updateFinancialMaster(financialMaster2Update);
|
||||||
|
// 更新主订单的支付信息
|
||||||
|
orderMasterService.updatePayStatus(financialMaster.getOrderMasterId(), PayStatus.PAID.getCode());
|
||||||
log.info("FinancialChange[{}]支付成功", relationId);
|
log.info("FinancialChange[{}]支付成功", relationId);
|
||||||
|
|
||||||
} else if (PaymentRelation.ORDER_ADD.equals(relation.getRelationIdType())) {
|
} else if (PaymentRelation.ORDER_ADD.equals(relation.getRelationIdType())) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue