Ver Fonte

Merge branch 'feature/退款积分回退1201'

qng há 3 anos atrás
pai
commit
eb79c93ba0

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/HaiKongResendMsgDao.java

@@ -0,0 +1,12 @@
+package com.kmall.admin.dao;
+
+import com.kmall.admin.entity.HaiKongResendMsgEntity;
+
+public interface HaiKongResendMsgDao {
+
+    /**
+     * 保存重发信息
+     * @param haiKongResendMsgEntity
+     */
+    public void saveResendMsg(HaiKongResendMsgEntity haiKongResendMsgEntity);
+}

+ 3 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/MallVmcSendLogDao.java

@@ -1,11 +1,13 @@
 package com.kmall.admin.dao;
 
+import com.kmall.admin.entity.MallVmcSendlogEntity;
+
 public interface MallVmcSendLogDao {
 
     /**
      * 新增免税mall请求日志
      * @param mallVmcSendlogEntity
      */
-    public void saveVmcSend(com.kmall.admin.entity.MallVmcSendlogEntity mallVmcSendlogEntity);
+    public void saveVmcSend(MallVmcSendlogEntity mallVmcSendlogEntity);
 
 }

+ 55 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/HaiKongResendMsgEntity.java

@@ -0,0 +1,55 @@
+package com.kmall.admin.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 接口重发实体类
+ */
+@Data
+public class HaiKongResendMsgEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    private Integer id;
+    /**
+     * 会员唯一标识
+     */
+    private String openId;
+    /**
+     * 订单编号
+     */
+    private String orderSn;
+    /**
+     * 接口类型
+     */
+    private String interfaceType;
+    /**
+     * 请求信息
+     */
+    private String requestMsg;
+    /**
+     * 响应信息
+     */
+    private String responseMsg;
+    /**
+     * 重发次数
+     */
+    private Integer resendNum;
+    /**
+     * 重发时间
+     */
+    private Date resendTime;
+    /**
+     * 最后重发时间
+     */
+    private Date lastResendTime;
+    /**
+     * 是否重发:1重发;2不重发
+     */
+    private Integer isValid;
+}

+ 33 - 11
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -33,10 +33,7 @@ import com.kmall.admin.entity.vip.Mall2MemberPointsEntity;
 import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
 import com.kmall.admin.fromcomm.dao.SysConfigDao;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
-import com.kmall.admin.haikong.constant.Constants;
-import com.kmall.admin.haikong.constant.HaiKongMemberOrderResendStatusEnum;
-import com.kmall.admin.haikong.constant.HaiKongMemberScoreChangeEventEnum;
-import com.kmall.admin.haikong.constant.VmcconnectUrlEnum;
+import com.kmall.admin.haikong.constant.*;
 import com.kmall.admin.haikong.dto.*;
 import com.kmall.admin.haikong.utils.ListUtils;
 import com.kmall.admin.haikong.vo.CalculateOrderDiscountPriceResponseVO;
@@ -216,10 +213,6 @@ public class OrderServiceImpl implements OrderService {
 
     @Autowired
     private AddressInfoService addressInfoService;
-
-//    @Autowired
-//    private CustomsClearanceTimeliness customsClearanceTimeliness;
-
     @Autowired
     private HaiKongMemberTemplate haiKongMemberTemplate;
 
@@ -272,6 +265,12 @@ public class OrderServiceImpl implements OrderService {
     @Autowired
     private HaiKongMemberScoreChangeRecordService haiKongMemberScoreChangeRecordService;
 
+    /**
+     * 接口重发信息
+     */
+    @Autowired
+    private HaiKongResendMsgDao haiKongResendMsgDao;
+
     @Override
     public OrderEntity queryObject(Long id) {
         return orderDao.queryObject(id);
@@ -3341,7 +3340,6 @@ public class OrderServiceImpl implements OrderService {
             if (sellVolume.compareTo(Constant.ZERO) < 0) {
                 sellVolume = Constant.ZERO;
             }
-
             GoodsEntity goodsEntity = goodsDao.queryObject(orderGoodsEntity.getGoodsId());
             if (goodsEntity != null) {
                 //还原商户商品总库存
@@ -3354,9 +3352,33 @@ public class OrderServiceImpl implements OrderService {
         }
         //调用免税mall接口
         vmcShopMall(order);
-        //调用会员系统积分回退接口
+        //调用会员系统积分全量回退接口
+        vipIntegralGoBack(order);
+
+    }
+
+    /**
+     * 调用会员系统积分全量回退接口
+     * @param order
+     * @throws Exception
+     */
+    private void vipIntegralGoBack(OrderEntity order) throws Exception{
         IntegralGoBackEntity changeRecordEntity = haiKongMemberScoreChangeRecordService.queryIntegralGoBack(order.getOrderSn());
-        haiKongMemberTemplate.rollbackMemberScore(JSON.toJSONString(changeRecordEntity));
+        String responseMsg =  haiKongMemberTemplate.rollbackMemberScore(JSON.toJSONString(changeRecordEntity));
+        Map<String,Object> res = JSON.parseObject(responseMsg,Map.class);
+        if("true".equals(res.get("success"))){
+            LOGGER.info("=======> [vipIntegralGoBack-----调用会员系统积分全量回退接口数据]"+responseMsg);
+        }else{
+            LOGGER.error("=======> [vipIntegralGoBack-----调用会员系统积分全量回退接口异常数据]"+responseMsg);
+            HaiKongResendMsgEntity haiKongResendMsgEntity = new HaiKongResendMsgEntity();
+            haiKongResendMsgEntity.setOpenId(changeRecordEntity.getOpen_id());
+            haiKongResendMsgEntity.setOrderSn(order.getOrderSn());
+            haiKongResendMsgEntity.setInterfaceType(HaiKongMemberSystemUrlEnum.ROLLBACK_MEMBER_SCORE.getUrl());
+            haiKongResendMsgEntity.setRequestMsg(JSON.toJSONString(changeRecordEntity));
+            haiKongResendMsgEntity.setResponseMsg(responseMsg);
+            haiKongResendMsgEntity.setIsValid(1);
+            haiKongResendMsgDao.saveResendMsg(haiKongResendMsgEntity);
+        }
     }
 
     /**

+ 32 - 0
kmall-admin/src/main/resources/mybatis/mapper/HaiKongResendMsgDao.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.admin.dao.HaiKongResendMsgDao">
+
+	<insert id="saveResendMsg" parameterType="com.kmall.admin.entity.HaiKongResendMsgEntity" >
+		insert into haikong_resend_msg
+		(
+			open_id,
+			order_sn,
+			interface_type,
+			request_msg,
+			response_msg,
+			resend_num,
+			resend_time,
+			last_resend_time,
+			is_valid
+		)
+		values
+		(
+			#{openId},
+			#{orderSn},
+			#{interfaceType},
+			#{requestMsg},
+			#{responseMsg},
+			#{isValid}
+		)
+	</insert>
+	 
+
+
+</mapper>