|  | @@ -16,6 +16,7 @@ import cn.newfeifan.mall.module.distri.enums.CaclEnum;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.distri.service.dailybill.DailyBillService;
 |  |  import cn.newfeifan.mall.module.distri.service.dailybill.DailyBillService;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.distri.service.integral.IntegralService;
 |  |  import cn.newfeifan.mall.module.distri.service.integral.IntegralService;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.distri.service.ptdailybill.PtDailyBillService;
 |  |  import cn.newfeifan.mall.module.distri.service.ptdailybill.PtDailyBillService;
 | 
											
												
													
														|  | 
 |  | +import cn.newfeifan.mall.module.member.service.user.MemberUserService;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
 |  |  import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
 |  |  import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
 |  |  import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
 | 
											
										
											
												
													
														|  | @@ -48,6 +49,8 @@ import cn.newfeifan.mall.module.trade.framework.order.config.TradeOrderPropertie
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.trade.service.delivery.DeliveryExpressService;
 |  |  import cn.newfeifan.mall.module.trade.service.delivery.DeliveryExpressService;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
 |  |  import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
 |  |  import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
 | 
											
												
													
														|  | 
 |  | +import cn.newfeifan.mall.module.trade.utils.push.JPushUtils;
 | 
											
												
													
														|  | 
 |  | +import cn.newfeifan.mall.module.trade.utils.push.pojo.RequestBody;
 | 
											
												
													
														|  |  import cn.newfeifan.mall.module.trade.utils.wechat.WcChatMessageUtils;
 |  |  import cn.newfeifan.mall.module.trade.utils.wechat.WcChatMessageUtils;
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 |  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
											
												
													
														|  |  import com.google.common.collect.Maps;
 |  |  import com.google.common.collect.Maps;
 | 
											
										
											
												
													
														|  | @@ -107,6 +110,10 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Resource
 |  |      @Resource
 | 
											
												
													
														|  |      private WcChatMessageUtils wcChatMessageUtils;
 |  |      private WcChatMessageUtils wcChatMessageUtils;
 | 
											
												
													
														|  | 
 |  | +    @Resource
 | 
											
												
													
														|  | 
 |  | +    private JPushUtils jPushUtils;
 | 
											
												
													
														|  | 
 |  | +    @Resource
 | 
											
												
													
														|  | 
 |  | +    private MemberUserService memberUserService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Resource
 |  |      @Resource
 | 
											
												
													
														|  |      private DailyBillService dailyBillService;
 |  |      private DailyBillService dailyBillService;
 | 
											
										
											
												
													
														|  | @@ -243,7 +250,10 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          // TODO 发送售后消息
 |  |          // TODO 发送售后消息
 | 
											
												
													
														|  |          if (afterSale.getWay().equals(AfterSaleWayEnum.RETURN_AND_REFUND.getWay())) {
 |  |          if (afterSale.getWay().equals(AfterSaleWayEnum.RETURN_AND_REFUND.getWay())) {
 | 
											
												
													
														|  | 
 |  | +            // 发送微信消息
 | 
											
												
													
														|  |              sentWcChatMessage(afterSale, AfterSaleStatusEnum.SELLER_AGREE.getContent());
 |  |              sentWcChatMessage(afterSale, AfterSaleStatusEnum.SELLER_AGREE.getContent());
 | 
											
												
													
														|  | 
 |  | +            // 发送极光推送
 | 
											
												
													
														|  | 
 |  | +            sentJPush(afterSale, AfterSaleStatusEnum.SELLER_AGREE.getContent());
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -266,6 +276,9 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 | 
											
												
													
														|  |          // 发送给微信用户售后消息
 |  |          // 发送给微信用户售后消息
 | 
											
												
													
														|  |          sentWcChatMessage(afterSale, AfterSaleStatusEnum.SELLER_DISAGREE.getContent());
 |  |          sentWcChatMessage(afterSale, AfterSaleStatusEnum.SELLER_DISAGREE.getContent());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        // 发送极光推送
 | 
											
												
													
														|  | 
 |  | +        sentJPush(afterSale, AfterSaleStatusEnum.SELLER_DISAGREE.getContent());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          // 更新交易订单项的售后状态为【未申请】
 |  |          // 更新交易订单项的售后状态为【未申请】
 | 
											
												
													
														|  |          tradeOrderUpdateService.updateOrderItemWhenAfterSaleCancel(afterSale.getOrderItemId());
 |  |          tradeOrderUpdateService.updateOrderItemWhenAfterSaleCancel(afterSale.getOrderItemId());
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -367,6 +380,9 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 | 
											
												
													
														|  |          // TODO 发送售后消息
 |  |          // TODO 发送售后消息
 | 
											
												
													
														|  |          sentWcChatMessage(afterSale, AfterSaleStatusEnum.SELLER_REFUSE.getContent());
 |  |          sentWcChatMessage(afterSale, AfterSaleStatusEnum.SELLER_REFUSE.getContent());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        // 发送极光推送
 | 
											
												
													
														|  | 
 |  | +        sentJPush(afterSale, AfterSaleStatusEnum.SELLER_REFUSE.getContent());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          // 更新交易订单项的售后状态为【未申请】
 |  |          // 更新交易订单项的售后状态为【未申请】
 | 
											
												
													
														|  |          tradeOrderUpdateService.updateOrderItemWhenAfterSaleCancel(afterSale.getOrderItemId());
 |  |          tradeOrderUpdateService.updateOrderItemWhenAfterSaleCancel(afterSale.getOrderItemId());
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -514,6 +530,9 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 | 
											
												
													
														|  |          // 发送给微信用户售后消息
 |  |          // 发送给微信用户售后消息
 | 
											
												
													
														|  |          sentWcChatMessage(afterSale, AfterSaleStatusEnum.COMPLETE.getContent());
 |  |          sentWcChatMessage(afterSale, AfterSaleStatusEnum.COMPLETE.getContent());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        // 发送极光推送
 | 
											
												
													
														|  | 
 |  | +        sentJPush(afterSale, AfterSaleStatusEnum.COMPLETE.getContent());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          // 更新交易订单项的售后状态为【已完成】
 |  |          // 更新交易订单项的售后状态为【已完成】
 | 
											
												
													
														|  |          tradeOrderUpdateService.updateOrderItemWhenAfterSaleSuccess(afterSale.getOrderItemId(), afterSale.getRefundPrice());
 |  |          tradeOrderUpdateService.updateOrderItemWhenAfterSaleSuccess(afterSale.getOrderItemId(), afterSale.getRefundPrice());
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -540,6 +559,33 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 | 
											
												
													
														|  |                  params, null, afterSale.getUserId(), afterSale.getId());
 |  |                  params, null, afterSale.getUserId(), afterSale.getId());
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 发送极光推送消息
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  | 
 |  | +     * @param afterSale   售后订单
 | 
											
												
													
														|  | 
 |  | +     * @param afterStatus 是否同意退款
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private void sentJPush(AfterSaleDO afterSale, String afterStatus) {
 | 
											
												
													
														|  | 
 |  | +        String title = WcChatMessageTemplateIdEnum.AFTER_SALE_CHECK2.getName();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        String alert = "售后订单号: " + afterSale.getNo();
 | 
											
												
													
														|  | 
 |  | +        alert += "\n商品名称: " + afterSale.getSpuName();
 | 
											
												
													
														|  | 
 |  | +        DecimalFormat df = new DecimalFormat("0.00");
 | 
											
												
													
														|  | 
 |  | +        String formattedPrice = df.format((double) afterSale.getRefundPrice() / 100);
 | 
											
												
													
														|  | 
 |  | +        alert += "\n金额: ¥ " + formattedPrice;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        alert += "\n售后状态: " + afterStatus;
 | 
											
												
													
														|  | 
 |  | +        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
											
												
													
														|  | 
 |  | +        alert += "\n时间: " + LocalDateTime.now().format(formatter);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        List<String> userRsgIds = memberUserService.getUserRsgIds(null, afterSale.getUserId());
 | 
											
												
													
														|  | 
 |  | +        if (userRsgIds != null) {
 | 
											
												
													
														|  | 
 |  | +            String url = jPushUtils.getUrl(title, afterSale.getUserId(), afterSale.getId());
 | 
											
												
													
														|  | 
 |  | +            RequestBody requestBody = jPushUtils.getRequestBody(userRsgIds, alert, title, url);
 | 
											
												
													
														|  | 
 |  | +            jPushUtils.jPush(requestBody, afterSale.getUserId(), null, afterSale.getId());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      private void createPayRefund(String userIp, AfterSaleDO afterSale) {
 |  |      private void createPayRefund(String userIp, AfterSaleDO afterSale) {
 | 
											
												
													
														|  |  //        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
 |  |  //        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
 | 
											
												
													
														|  |  
 |  |  
 |