|
@@ -3,6 +3,8 @@ package com.yami.shop.service.impl;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -10,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.yami.shop.bean.dto.OrderRefundDto;
|
|
|
+import com.yami.shop.bean.dto.hb.HBBaseReq;
|
|
|
import com.yami.shop.bean.enums.*;
|
|
|
import com.yami.shop.bean.event.OrderRefundSuccessEvent;
|
|
|
import com.yami.shop.bean.event.ReceiptOrderEvent;
|
|
@@ -29,7 +32,9 @@ import com.yami.shop.dao.OrderRefundMapper;
|
|
|
import com.yami.shop.dao.OrderSettlementMapper;
|
|
|
import com.yami.shop.dao.ShopWalletMapper;
|
|
|
import com.yami.shop.service.*;
|
|
|
+import com.yami.shop.utils.HBSignUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
@@ -42,6 +47,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.*;
|
|
|
|
|
|
+import static com.yami.shop.common.util.HttpUtil.post;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, OrderRefund> implements OrderRefundService {
|
|
@@ -67,7 +75,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
|
|
|
private final ApplicationContext applicationContext;
|
|
|
private final PayManagerService payManagerService;
|
|
|
private final Snowflake snowflake;
|
|
|
-
|
|
|
+ private final HBSignUtil hbSignUtil;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -930,4 +938,35 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
|
|
|
newOrderRefund.setUpdateTime(new Date());
|
|
|
this.applyRefund(newOrderRefund);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //*************************** 售后接口 ***************************
|
|
|
+ @Override
|
|
|
+ public String createRefundOrder(String channelOrderId,String afterSaleOrder) {
|
|
|
+ HBBaseReq<Object> build = HBBaseReq.create();
|
|
|
+ build.setAppId(hbSignUtil.getAppId());
|
|
|
+
|
|
|
+ // 3. 构建外层请求体
|
|
|
+ JSONObject requestBody = new JSONObject();
|
|
|
+ requestBody.put("channelOrderId", channelOrderId);
|
|
|
+ requestBody.put("afterSaleOrder", afterSaleOrder);
|
|
|
+ // 4. 将整个JSON对象序列化为字符串并设置
|
|
|
+ build.setBody(JSON.toJSONString(requestBody));
|
|
|
+
|
|
|
+ build.setSign(hbSignUtil.signMd5(build));
|
|
|
+ log.info("post 订单推送单号参数:{}", JSON.toJSONString(build));
|
|
|
+ String post = post(hbSignUtil.getHBHost() + "/api/order/asyncSave", build);
|
|
|
+ log.info("post 订单推送结果:{}", post);
|
|
|
+ return post;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String details(JSONObject hBRequest) {
|
|
|
+// try {
|
|
|
+// JSONObject bodyStr = hBRequest.getObject("body");
|
|
|
+// log.info("退款订单信息,body:{}", bodyStr);
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|