|  | @@ -3,12 +3,14 @@ package cn.newfeifan.mall.module.trade.controller.app.order;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.common.pojo.CommonResult;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.common.pojo.PageResult;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.security.core.annotations.PreAuthenticated;
 | 
	
		
			
				|  |  | +import cn.newfeifan.mall.module.distri.service.usertopupconsumptionpointsorder.UserTopUpConsumptionPointsOrderService;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderRespVO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.controller.app.order.vo.AppPayOrderSubmitZeroPurchaseReqVO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.convert.order.PayOrderConvert;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.dal.mysql.order.PayOrderMapper;
 | 
	
		
			
				|  |  | +import cn.newfeifan.mall.module.pay.enums.DictTypeConstants;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.enums.order.PayOrderStatusEnum;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.service.fuyouorder.FuYouPayOrderService;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.pay.service.order.PayOrderService;
 | 
	
	
		
			
				|  | @@ -74,14 +76,16 @@ public class AppTradeOrderController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private FuYouPayOrderService fuYouPayOrderService;
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private UserTopUpConsumptionPointsOrderService userTopUpConsumptionPointsOrderService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @GetMapping("/getPayOrderByStatus2")
 | 
	
		
			
				|  |  |      @Operation(summary = "获得支付订单2")
 | 
	
		
			
				|  |  |      @Parameter(name = "id", description = "支付订单编号", required = true, example = "1024")
 | 
	
		
			
				|  |  |      public CommonResult<PayOrderRespVO> getPayOrderByStatus2(@RequestParam("id") Long id) {
 | 
	
		
			
				|  |  | -        log.info("getPayOrderByStatus2:=========id:{}",id);
 | 
	
		
			
				|  |  | +        log.info("getPayOrderByStatus2:=========id:{}", id);
 | 
	
		
			
				|  |  |          PayOrderDO oldPayOrderDO = payOrderMapper.selectById(id);
 | 
	
		
			
				|  |  | -        log.info("getPayOrderByStatus2:oldPayOrderDO===========:{}",oldPayOrderDO);
 | 
	
		
			
				|  |  | +        log.info("getPayOrderByStatus2:oldPayOrderDO===========:{}", oldPayOrderDO);
 | 
	
		
			
				|  |  |          PayOrderDO newPayOrderDO = payOrderService.getOrderByStatus(oldPayOrderDO);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return getPayOrderRespVOCommonResult(id, newPayOrderDO, oldPayOrderDO);
 | 
	
	
		
			
				|  | @@ -91,11 +95,11 @@ public class AppTradeOrderController {
 | 
	
		
			
				|  |  |      @Operation(summary = "查询富友支付订单状态")
 | 
	
		
			
				|  |  |      @Parameter(name = "payOrderNo", description = "支付订单编号", required = true, example = "16103-202407151500201")
 | 
	
		
			
				|  |  |      public CommonResult<PayOrderRespVO> getFuYouPayOrderByStatus(@RequestParam("payOrderNo") String payOrderNo) {
 | 
	
		
			
				|  |  | -        log.info("getPayOrderByStatus2:=========id:{}",payOrderNo);
 | 
	
		
			
				|  |  | +        log.info("getPayOrderByStatus2:=========id:{}", payOrderNo);
 | 
	
		
			
				|  |  |          PayOrderDO oldPayOrderDO = payOrderMapper.selectByPayOrderNo(payOrderNo);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 若查无此订单
 | 
	
		
			
				|  |  | -        if(oldPayOrderDO == null){
 | 
	
		
			
				|  |  | +        if (oldPayOrderDO == null) {
 | 
	
		
			
				|  |  |              throw exception(PAY_ORDER_NOT_FOUND);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -109,24 +113,28 @@ public class AppTradeOrderController {
 | 
	
		
			
				|  |  |          CommonResult<PayOrderRespVO> success = success(PayOrderConvert.INSTANCE.convert(newPayOrderDO));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //如果在上一行代码,把支付订单状态从“待支付”,改为“已支付”,则证明订单支付成功,则改trade_order表状态为待发货,并且分配积分
 | 
	
		
			
				|  |  | -        if(oldPayOrderDO.getStatus().equals(PayOrderStatusEnum.WAITING.getStatus())
 | 
	
		
			
				|  |  | +        if (oldPayOrderDO.getStatus().equals(PayOrderStatusEnum.WAITING.getStatus())
 | 
	
		
			
				|  |  |                  &&
 | 
	
		
			
				|  |  |                  newPayOrderDO.getStatus().equals(PayOrderStatusEnum.SUCCESS.getStatus())
 | 
	
		
			
				|  |  | -        )
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            //只有支付订单id参数payOrderId是有用的。
 | 
	
		
			
				|  |  | -            List list = tradeOrderUpdateService.updateOrderPaid(id);
 | 
	
		
			
				|  |  | -            Object jfObj = list.get(0);
 | 
	
		
			
				|  |  | -            Object sjObj = list.get(1);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            Long jf = (Long)jfObj;//待确权积分
 | 
	
		
			
				|  |  | -            Double sj = (Double)sjObj;//待确权身价
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            success.getData().setJf(jf);
 | 
	
		
			
				|  |  | -            success.getData().setSj(sj);
 | 
	
		
			
				|  |  | +        ) {
 | 
	
		
			
				|  |  | +            // 判断是否是商品订单
 | 
	
		
			
				|  |  | +            if (newPayOrderDO.getNo().contains(DictTypeConstants.TUP_UP_NO) || (newPayOrderDO.getPayOrderNo() != null && newPayOrderDO.getPayOrderNo().contains(DictTypeConstants.TUP_UP_NO))) {
 | 
	
		
			
				|  |  | +                userTopUpConsumptionPointsOrderService.topUpConsumptionPoints(newPayOrderDO);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                //只有支付订单id参数payOrderId是有用的。
 | 
	
		
			
				|  |  | +                List list = tradeOrderUpdateService.updateOrderPaid(id);
 | 
	
		
			
				|  |  | +                Object jfObj = list.get(0);
 | 
	
		
			
				|  |  | +                Object sjObj = list.get(1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                Long jf = (Long) jfObj;//待确权积分
 | 
	
		
			
				|  |  | +                Double sj = (Double) sjObj;//待确权身价
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                success.getData().setJf(jf);
 | 
	
		
			
				|  |  | +                success.getData().setSj(sj);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        log.info("getPayOrderByStatus2:success===========:{}",success);
 | 
	
		
			
				|  |  | +        log.info("getPayOrderByStatus2:success===========:{}", success);
 | 
	
		
			
				|  |  |          return success;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -134,6 +142,7 @@ public class AppTradeOrderController {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * add by Ben
 | 
	
		
			
				|  |  |       * 待支付订单,点支付时的新增方法
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param tradeOrderId 订单id
 | 
	
		
			
				|  |  |       * @return 支付订单
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -188,10 +197,11 @@ public class AppTradeOrderController {
 | 
	
		
			
				|  |  |          DeliveryExpressDO express = order.getLogisticsId() != null && order.getLogisticsId() > 0 ?
 | 
	
		
			
				|  |  |                  deliveryExpressService.getDeliveryExpress(order.getLogisticsId()) : null;
 | 
	
		
			
				|  |  |          // 最终组合
 | 
	
		
			
				|  |  | -        CommonResult<AppTradeOrderDetailRespVO> rs=
 | 
	
		
			
				|  |  | +        CommonResult<AppTradeOrderDetailRespVO> rs =
 | 
	
		
			
				|  |  |                  success(TradeOrderConvert.INSTANCE.convert02(order, orderItems, tradeOrderProperties, express));
 | 
	
		
			
				|  |  |          for (AppTradeOrderItemRespVO item : rs.getData().getItems()) {
 | 
	
		
			
				|  |  | -            if(item.getAfterSaleId() != null) item.setRefundStatus(afterSaleService.getAfterSale(item.getAfterSaleId()).getStatus());
 | 
	
		
			
				|  |  | +            if (item.getAfterSaleId() != null)
 | 
	
		
			
				|  |  | +                item.setRefundStatus(afterSaleService.getAfterSale(item.getAfterSaleId()).getStatus());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //设置订单支付的积分
 |