|  | @@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.OrderStatusEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.TradeStatusEnum;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.props.PaymentProperties;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.UserOrderService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.res.OrderPayRes;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
	
		
			
				|  | @@ -15,10 +15,8 @@ import com.yonge.cooleshow.common.service.IdGeneratorService;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.base.result.BaseResult;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.payment.base.enums.OpenEnum;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.payment.base.enums.PayChannelEnum;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.payment.base.model.ClosePayment;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.payment.base.model.DeviceInfo;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.payment.base.model.DivMember;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.payment.base.model.Payment;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.payment.base.model.*;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.payment.core.props.PaymentProperties;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.payment.core.service.PaymentClient;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.utils.string.StringUtil;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -71,11 +69,12 @@ public class UserOrderPaymentServiceImpl extends ServiceImpl<UserOrderPaymentDao
 | 
	
		
			
				|  |  |       * @updateTime 2022/5/11 18:47
 | 
	
		
			
				|  |  |       * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    private UserOrderPayment insertOrderPayment(Payment payment, OrderPayReq payReq) {
 | 
	
		
			
				|  |  | +    private UserOrderPayment insertOrderPayment(Payment payment) {
 | 
	
		
			
				|  |  |          UserOrderPayment orderPayment = new UserOrderPayment();
 | 
	
		
			
				|  |  | -        orderPayment.setOrderNo(payReq.getOrderNo());
 | 
	
		
			
				|  |  | +        orderPayment.setOpenType(payment.getOpenType());
 | 
	
		
			
				|  |  | +        orderPayment.setPayChannel(payment.getPayChannel());
 | 
	
		
			
				|  |  | +        orderPayment.setOrderNo(payment.getOrderNo());
 | 
	
		
			
				|  |  |          orderPayment.setPaymentNo(payment.getPaymentNo());
 | 
	
		
			
				|  |  | -        orderPayment.setPayChannel(payReq.getPayChannel());
 | 
	
		
			
				|  |  |          orderPayment.setTransNo(payment.getId());
 | 
	
		
			
				|  |  |          orderPayment.setPayAmt(
 | 
	
		
			
				|  |  |                  new BigDecimal(payment.getPayAmt()).setScale(2, RoundingMode.HALF_UP)
 | 
	
	
		
			
				|  | @@ -84,7 +83,7 @@ public class UserOrderPaymentServiceImpl extends ServiceImpl<UserOrderPaymentDao
 | 
	
		
			
				|  |  |          orderPayment.setStatus(TradeStatusEnum.pending);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //查询订单下支付中的付款单,取消支付
 | 
	
		
			
				|  |  | -        closePayment(payReq.getOrderNo(), "用户发起了新的付款请求");
 | 
	
		
			
				|  |  | +        closePayment(payment.getOrderNo(), "用户发起了新的付款请求");
 | 
	
		
			
				|  |  |          //保存新的付款单
 | 
	
		
			
				|  |  |          save(orderPayment);
 | 
	
		
			
				|  |  |          return orderPayment;
 | 
	
	
		
			
				|  | @@ -160,10 +159,17 @@ public class UserOrderPaymentServiceImpl extends ServiceImpl<UserOrderPaymentDao
 | 
	
		
			
				|  |  |          OpenEnum openType = OpenEnum.valueOf(paymentProperties.getOpenType());
 | 
	
		
			
				|  |  |          Payment payment = new Payment(openType, payReq.getPayChannel());
 | 
	
		
			
				|  |  |          payment.setPaymentNo(paymentNo.toString());
 | 
	
		
			
				|  |  | +        payment.setOrderNo(payReq.getOrderNo());
 | 
	
		
			
				|  |  |          payment.setOrderTitle(detail.getOrderName());
 | 
	
		
			
				|  |  |          payment.setOrderDesc(detail.getOrderDesc());
 | 
	
		
			
				|  |  | -        payment.setPayAmt(detail.getActualPrice().setScale(2, RoundingMode.HALF_UP).toString());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        //封装订单详情
 | 
	
		
			
				|  |  | +        List<OrderDetil> orderDetils = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (UserOrderDetailVo orderDetailVo : detail.getOrderDetailList()) {
 | 
	
		
			
				|  |  | +            orderDetils.add(new OrderDetil(orderDetailVo.getId().toString(), orderDetailVo.getGoodName(), 1, orderDetailVo.getActualPrice().toString()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        payment.setOrderDetils(orderDetils);
 | 
	
		
			
				|  |  | +        payment.setPayAmt(detail.getActualPrice().setScale(2, RoundingMode.HALF_UP).toString());
 | 
	
		
			
				|  |  |          payment.setDescription(payReq.getReason());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (OpenEnum.ADAPAY.equals(openType)) {
 | 
	
	
		
			
				|  | @@ -196,7 +202,7 @@ public class UserOrderPaymentServiceImpl extends ServiceImpl<UserOrderPaymentDao
 | 
	
		
			
				|  |  |              orderPayRes.setPayChannel(payReq.getPayChannel());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //入订单付款表
 | 
	
		
			
				|  |  | -            insertOrderPayment(paymentResBaseResult.getData(), payReq);
 | 
	
		
			
				|  |  | +            insertOrderPayment(paymentResBaseResult.getData());
 | 
	
		
			
				|  |  |              //修改订单状态
 | 
	
		
			
				|  |  |              userOrderService.updateStatusByOrderNo(payReq.getOrderNo(), OrderStatusEnum.PAYING.getCode());
 | 
	
		
			
				|  |  |              return HttpResponseResult.succeed(orderPayRes);
 |