|  | @@ -327,26 +327,9 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 | 
	
		
			
				|  |  |                  UmsMember member = memberService.getById(cancelOrder.getMemberId());
 | 
	
		
			
				|  |  |                  memberService.updateIntegration(cancelOrder.getMemberId(), member.getIntegration() + cancelOrder.getUseIntegration());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            UserOrderPayment orderPayment = userOrderPaymentService.getByTranNo(cancelOrder.getOrderSn());
 | 
	
		
			
				|  |  | -            if (null != orderPayment) {
 | 
	
		
			
				|  |  | -                // 发起关单
 | 
	
		
			
				|  |  | -                OrderCloseReq orderCloseReq = new OrderCloseReq();
 | 
	
		
			
				|  |  | -                orderCloseReq.setPaymentId(orderPayment.getTransNo());
 | 
	
		
			
				|  |  | -                orderCloseReq.setReason(message);
 | 
	
		
			
				|  |  | -                OrderCloseRes closeRes = adapayPaymentService.orderClose(orderCloseReq);
 | 
	
		
			
				|  |  | -                if (closeRes.isStatus()) {
 | 
	
		
			
				|  |  | -                    orderPayment.setCloseStatus(PayStatusEnum.pending.getCode());
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    orderPayment.setCloseStatus(PayStatusEnum.failed.getCode());
 | 
	
		
			
				|  |  | -                    orderPayment.setCloseFailMsg(closeRes.getFailMsg());
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +            // 发起关单
 | 
	
		
			
				|  |  | +            userOrderPaymentService.closePayment(cancelOrder.getOrderSn(),message);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                //更新付款单
 | 
	
		
			
				|  |  | -                orderPayment.setStatus(PayStatusEnum.failed.getCode());
 | 
	
		
			
				|  |  | -                orderPayment.setPayFailMsg(message);
 | 
	
		
			
				|  |  | -                orderPayment.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | -                userOrderPaymentService.saveOrUpdate(orderPayment);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -479,16 +462,20 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 | 
	
		
			
				|  |  |              orderPayRes.setMessage("订单已付款或已关闭");
 | 
	
		
			
				|  |  |              return orderPayRes;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        payReq.setOrderPrice(detail.getPayAmount());
 | 
	
		
			
				|  |  |          UserOrderPayment userOrderPayment = userOrderPaymentService
 | 
	
		
			
				|  |  |                  .getByOrderNo(detail.getOrderSn(), payReq.getPayChannel(), PayStatusEnum.pending);
 | 
	
		
			
				|  |  | -        payReq.orderStatus(detail.getStatus());
 | 
	
		
			
				|  |  | -        payReq.setOrderNo(detail.getOrderSn());
 | 
	
		
			
				|  |  | -        payReq.setOrderPrice(detail.getPayAmount());
 | 
	
		
			
				|  |  | -        payReq.setGoodTitle("");
 | 
	
		
			
				|  |  | -        payReq.setGoodDesc("");
 | 
	
		
			
				|  |  | -        if (userOrderPayment != null) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (userOrderPayment == null) {
 | 
	
		
			
				|  |  | +            // 支付订单号
 | 
	
		
			
				|  |  | +            payReq.setOrderNo(generateOrderSn(detail));
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            // 拉起原有的支付
 | 
	
		
			
				|  |  |              payReq.setPayInfo(userOrderPayment.getPayInfo());
 | 
	
		
			
				|  |  | +            return adapayPaymentService.orderContinue(payReq);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        payReq.setGoodTitle("酷乐秀商城订单编号-" + detail.getOrderSn());
 | 
	
		
			
				|  |  | +        payReq.setGoodDesc("酷乐秀商城订单编号-" + detail.getOrderSn());
 | 
	
		
			
				|  |  |          // 支付中的返回拉起信息
 | 
	
		
			
				|  |  |          orderPayRes = adapayPaymentService.orderPay(payReq);
 | 
	
		
			
				|  |  |          if (!orderPayRes.isStatus()) {
 | 
	
	
		
			
				|  | @@ -500,12 +487,6 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 | 
	
		
			
				|  |  |              cancelOrder(detail.getId(),"订单金额和实际支付金额不符");
 | 
	
		
			
				|  |  |              throw new BizException("订单金额和实际支付金额不符");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // 订单状态和付款状态都是付款中,直接返回付款拉起信息
 | 
	
		
			
				|  |  | -        if (OrderStatusEnum.PAYING.getCode().equals(payReq.getOrderStatus().getCode())
 | 
	
		
			
				|  |  | -                && PayStatusEnum.pending.getCode().equals(orderPayRes.getPayStatus().getCode())) {
 | 
	
		
			
				|  |  | -            return orderPayRes;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          OmsOrder omsOrder = new OmsOrder();
 | 
	
		
			
				|  |  |          omsOrder.setId(detail.getId());
 | 
	
	
		
			
				|  | @@ -513,10 +494,9 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 | 
	
		
			
				|  |  |              omsOrder.setStatus(0);
 | 
	
		
			
				|  |  |              orderMapper.updateByPrimaryKeySelective(omsOrder);
 | 
	
		
			
				|  |  |              // 保存订单支付表
 | 
	
		
			
				|  |  | -            if (userOrderPayment == null) {
 | 
	
		
			
				|  |  | -                userOrderPayment = new UserOrderPayment();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            userOrderPayment.setOrderNo(orderPayRes.getOrderNo());
 | 
	
		
			
				|  |  | +            userOrderPayment = new UserOrderPayment();
 | 
	
		
			
				|  |  | +            userOrderPayment.setOrderNo(detail.getOrderSn());
 | 
	
		
			
				|  |  | +            userOrderPayment.setAdapayNo(orderPayRes.getOrderNo());
 | 
	
		
			
				|  |  |              userOrderPayment.setPayChannel(orderPayRes.getPayChannel());
 | 
	
		
			
				|  |  |              userOrderPayment.setTransNo(orderPayRes.getTransNo());
 | 
	
		
			
				|  |  |              userOrderPayment.setPayAmt(new BigDecimal(orderPayRes.getPay_amt()));
 | 
	
	
		
			
				|  | @@ -635,9 +615,9 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      void payingOrderHandle(OmsOrder userOrder) {
 | 
	
		
			
				|  |  |          //判断汇付订单状态
 | 
	
		
			
				|  |  | -        UserOrderPayment orderPayment = userOrderPaymentService.getByTranNo(userOrder.getOrderSn());
 | 
	
		
			
				|  |  | +        UserOrderPayment orderPayment = userOrderPaymentService.getByOrderNoAndStatusPaying(userOrder.getOrderSn());
 | 
	
		
			
				|  |  |          if (null == orderPayment) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            cancelOrder(userOrder.getId(), "支付超时");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              Map<String, Object> resMap = paymentSdk.queryPayment(orderPayment.getTransNo());
 | 
	
	
		
			
				|  | @@ -659,14 +639,13 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 订单完成
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  | -     * @author liweifan
 | 
	
		
			
				|  |  |       * @param: detail
 | 
	
		
			
				|  |  |       * @updateTime 2022/4/13 17:17
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      void orderSuccess(OmsOrder detail, JSONObject hfRes) {
 | 
	
		
			
				|  |  |          //更新订单
 | 
	
		
			
				|  |  | -        UserOrderPayment orderPayment = userOrderPaymentService.getByTranNo(detail.getOrderSn());
 | 
	
		
			
				|  |  | +        UserOrderPayment orderPayment = userOrderPaymentService.getByOrderNoAndStatusPaying(detail.getOrderSn());
 | 
	
		
			
				|  |  |          if (orderPayment.getPayChannel().equals("alipay")) {
 | 
	
		
			
				|  |  |              paySuccess(detail.getId(),1);
 | 
	
		
			
				|  |  |          } else if (orderPayment.getPayChannel().equals("wx_lite")) {
 |