同步解决更新订单异常的问题;

This commit is contained in:
terrfly 2024-04-30 13:43:36 +08:00
parent 8fe04ed808
commit b0ce8876df
2 changed files with 29 additions and 12 deletions

View File

@ -26,7 +26,10 @@ import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.model.DBApplicationConfig;
import com.jeequan.jeepay.core.utils.*;
import com.jeequan.jeepay.core.utils.AmountUtil;
import com.jeequan.jeepay.core.utils.SeqKit;
import com.jeequan.jeepay.core.utils.SpringBeansUtil;
import com.jeequan.jeepay.core.utils.StringKit;
import com.jeequan.jeepay.pay.channel.IPaymentService;
import com.jeequan.jeepay.pay.ctrl.ApiController;
import com.jeequan.jeepay.pay.exception.ChannelException;
@ -372,18 +375,8 @@ public abstract class AbstractPayOrderController extends ApiController {
payOrder.setChannelUser(channelRetMsg.getChannelUserId());
}
payOrderProcessService.updateIngAndSuccessOrFailByCreatebyOrder(payOrder, channelRetMsg);
boolean isSuccess = payOrderService.updateInit2Ing(payOrder.getPayOrderId(), payOrder);
if(!isSuccess){
throw new BizException("更新订单异常!");
}
isSuccess = payOrderService.updateIng2SuccessOrFail(payOrder.getPayOrderId(), payOrder.getState(),
channelRetMsg.getChannelOrderId(), channelRetMsg.getChannelUserId(), channelRetMsg.getChannelErrCode(), channelRetMsg.getChannelErrMsg());
if(!isSuccess){
throw new BizException("更新订单异常!");
}
}

View File

@ -20,10 +20,13 @@ import com.jeequan.jeepay.components.mq.model.PayOrderDivisionMQ;
import com.jeequan.jeepay.components.mq.vender.IMQSender;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.service.impl.PayOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/***
* 订单处理通用逻辑
@ -88,4 +91,25 @@ public class PayOrderProcessService {
}
/***
*
* 支付中 -- 支付成功或者失败
* **/
@Transactional
public void updateIngAndSuccessOrFailByCreatebyOrder(PayOrder payOrder, ChannelRetMsg channelRetMsg){
boolean isSuccess = payOrderService.updateInit2Ing(payOrder.getPayOrderId(), payOrder);
if(!isSuccess){
log.error("updateInit2Ing更新异常 payOrderId={}", payOrder.getPayOrderId());
throw new BizException("更新订单异常!");
}
isSuccess = payOrderService.updateIng2SuccessOrFail(payOrder.getPayOrderId(), payOrder.getState(),
channelRetMsg.getChannelOrderId(), channelRetMsg.getChannelUserId(), channelRetMsg.getChannelErrCode(), channelRetMsg.getChannelErrMsg());
if(!isSuccess){
log.error("updateIng2SuccessOrFail更新异常 payOrderId={}", payOrder.getPayOrderId());
throw new BizException("更新订单异常!");
}
}
}