use of com.paascloud.provider.model.domain.PtcPayInfo in project paascloud-master by paascloud.
the class PtcAlipayServiceImpl method aliPayCallback.
@Override
public Wrapper aliPayCallback(Map<String, String> params) {
log.info("支付宝回调. - aliPayCallback. params={}", params);
String orderNo = params.get("out_trade_no");
String tradeNo = params.get("trade_no");
String tradeStatus = params.get("trade_status");
OrderDto order = omcOrderService.queryOrderDtoByOrderNo(orderNo);
if (order == null) {
throw new OmcBizException(ErrorCodeEnum.OMC10031010);
}
if (order.getStatus() >= OmcApiConstant.OrderStatusEnum.PAID.getCode()) {
throw new OmcBizException(ErrorCodeEnum.OMC10031011);
}
if (PtcApiConstant.AlipayCallback.TRADE_STATUS_TRADE_SUCCESS.equals(tradeStatus)) {
order.setPaymentTime(DateUtil.parseDate(params.get("gmt_payment")));
order.setStatus(OmcApiConstant.OrderStatusEnum.PAID.getCode());
ModelMapper modelMapper = new ModelMapper();
OmcOrder omcOrder = modelMapper.map(order, OmcOrder.class);
omcOrderService.update(omcOrder);
}
PtcPayInfo payInfo = new PtcPayInfo();
payInfo.setUserId(order.getUserId());
payInfo.setOrderNo(order.getOrderNo());
payInfo.setPayPlatform(PtcApiConstant.PayPlatformEnum.ALIPAY.getCode());
payInfo.setPlatformNumber(tradeNo);
payInfo.setPlatformStatus(tradeStatus);
payInfo.setUpdateTime(new Date());
payInfo.setCreatedTime(new Date());
payInfo.setCreator(order.getCreator());
payInfo.setCreatorId(order.getUserId());
payInfo.setLastOperator(order.getLastOperator());
payInfo.setLastOperatorId(order.getLastOperatorId());
payInfo.setId(UniqueIdGenerator.generateId());
ptcPayInfoMapper.insertSelective(payInfo);
return WrapMapper.ok();
}
Aggregations