24282 2 rokov pred
rodič
commit
225ced1bcf

+ 0 - 3
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/constants/RedisConstant.java

@@ -4,7 +4,4 @@ public interface RedisConstant {
 
     String PREFIX = "victoriatourist:";
 
-    // 发送快递100订阅信息
-    String KD_100_SEND_SUBSCRIBE = PREFIX + "kd100SendSubscribe:";
-
 }

+ 8 - 6
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/constants/logistics/LogisticsConstant.java

@@ -31,17 +31,19 @@ public interface LogisticsConstant {
      * 物流状态(快递100的状态)
      */
     class KD100Status {
-        //在途
+        // 未找到快递信息
+        public static final Integer STATUS_N = -1;
+        // 在途
         public static final Integer STATUS_0 = 0;
-        //揽收
+        // 揽收
         public static final Integer STATUS_1 = 1;
-        //疑难
+        // 疑难
         public static final Integer STATUS_2 = 2;
-        //签收
+        // 签收
         public static final Integer STATUS_3 = 3;
-        //退签
+        // 退签
         public static final Integer STATUS_4 = 4;
-        //派件
+        // 派件
         public static final Integer STATUS_5 = 5;
         //退回
         public static final Integer STATUS_6 = 6;

+ 5 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/product/ProductInfo.java

@@ -123,6 +123,11 @@ public class ProductInfo extends BaseEntity {
     private Date clearancePeriod;
 
     /**
+     * 移交部门id
+     */
+    private Long transferDetpId;
+
+    /**
      * 备注
      */
     private String remark;

+ 5 - 5
hx-service/victoriatourist/src/main/java/com/fjhx/config/KD100Config.java

@@ -17,27 +17,27 @@ public class KD100Config {
     /**
      * 授权key
      */
-    private static String key;
+    private static String key = "wcANdFXq6090";
 
     /**
      * customer
      */
-    private static String customer;
+    private static String customer = "618C16AEAF03A764FD04458F97CADBCD";
 
     /**
      * secret
      */
-    private static String secret;
+    private static String secret = "c66c82c245824c9fbbef814a5070e8db";
 
     /**
      * userid
      */
-    private static String userid;
+    private static String userid = "9f579a24ceb94cc8853e14c79a388dcd";
 
     /**
      * 推送回调地址
      */
-    private static String callbackurl;
+    private static String callbackurl = "http://36.134.91.96:10001/api/victoriatourist/third/party/push/kd100";
 
     public static String getKey() {
         return key;

+ 22 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/controller/product/ProductInfoController.java

@@ -2,6 +2,7 @@ package com.fjhx.controller.product;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.base.Condition;
+import com.fjhx.entity.product.ProductInfo;
 import com.fjhx.params.product.ProductCombinationEx;
 import com.fjhx.params.product.ProductInfoVo;
 import com.fjhx.service.product.ProductInfoService;
@@ -62,5 +63,26 @@ public class ProductInfoController {
         return R.success(page);
     }
 
+    /**
+     * 提交移交部门申请
+     */
+    @PostMapping("/submitTransferRequest")
+    public R submitTransferRequest(@RequestBody ProductInfo dto) {
+        ProductInfo productInfo = new ProductInfo();
+        productInfo.setId(dto.getId());
+        productInfo.setTransferDetpId(dto.getTransferDetpId());
+        productInfoService.updateById(productInfo);
+        return R.success();
+    }
+
+    /**
+     * 移交部门
+     */
+    @PostMapping("/submitTransfer")
+    public R submitTransfer(@RequestBody ProductInfo dto) {
+        productInfoService.submitTransfer(dto);
+        return R.success();
+    }
+
 }
 

+ 10 - 6
hx-service/victoriatourist/src/main/java/com/fjhx/controller/thirdpartypush/ThirdPartyPushController.java

@@ -3,6 +3,7 @@ package com.fjhx.controller.thirdpartypush;
 import com.alibaba.fastjson.JSONObject;
 import com.fjhx.service.logistics.LogisticsInfoService;
 import com.fjhx.uitl.kd100.KD100Util;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @author ${author}
  * @since 2022-12-09
  */
+@Slf4j
 @RestController
 @RequestMapping("/third/party/push")
 public class ThirdPartyPushController {
@@ -32,16 +34,18 @@ public class ThirdPartyPushController {
      */
     @PostMapping("/kd100")
     public JSONObject kd100(@RequestBody String data) {
-        JSONObject returnResult = new JSONObject();
-        returnResult.put("result", true);
-        returnResult.put("returnCode", "200");
-        returnResult.put("message", "成功");
-
+        // 解析回调参数
         JSONObject result = KD100Util.parsePushData(data);
 
-        //更新物流信息
+        log.error("快递100回调:" + result.toJSONString());
+
+        // 更新物流信息
         logisticsInfoService.updateStatusByCode(result.getString("nu"), result.getInteger("state"));
 
+        JSONObject returnResult = new JSONObject();
+        returnResult.put("result", true);
+        returnResult.put("returnCode", "200");
+        returnResult.put("message", "成功");
         return returnResult;
     }
 }

+ 2 - 1
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/product/ProductInfoMapper.xml

@@ -28,7 +28,8 @@
                    WHEN datediff(now(), computing_time) < new_products_day THEN 1
                    WHEN datediff(now(), computing_time) < (new_products_day + grow_up_day) THEN 2
                    ELSE 3
-                   END life_cycle
+                   END life_cycle,
+               transfer_detp_id
         from product_info ${ew.customSqlSegment}
     </select>
 

+ 5 - 17
hx-service/victoriatourist/src/main/java/com/fjhx/service/logistics/impl/LogisticsInfoServiceImpl.java

@@ -1,7 +1,6 @@
 package com.fjhx.service.logistics.impl;
 
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.base.BaseIdEntity;
@@ -45,7 +44,10 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -158,21 +160,7 @@ public class LogisticsInfoServiceImpl extends ServiceImpl<LogisticsInfoMapper, L
                 .collect(Collectors.toList());
         Assert.notEmpty(details, "发货数量不能全为0");
 
-
-        Integer state = -1;
-        // 查询快递100的物流信息
-        try {
-            JSONObject result = KD100Util.queryTrack(logisticsInfoVo.getLogisticsCompanyCode(), logisticsInfoVo.getCode());
-            state = result.getInteger("state");
-        } catch (Exception e) {
-            log.error("未找到快递消息", e);
-        }
-
-        if (!Objects.equals(state, LogisticsConstant.KD100Status.STATUS_3)) {
-            // 如果不是已签收状态,则开启订阅(物流状态跟踪并推送)
-            KD100Util.subscribe(logisticsInfoVo.getLogisticsCompanyCode(), logisticsInfoVo.getCode(), new Date());
-        }
-
+        Integer state = KD100Util.getStateAndMonitor(logisticsInfoVo.getLogisticsCompanyCode(), logisticsInfoVo.getCode());
         logisticsInfoVo.setLogisticsStatus(state);
         logisticsInfoVo.setStatus(LogisticsConstant.Status.STATUS_0);
         logisticsInfoVo.setInStockStatus(LogisticsConstant.InStockStatus.STATUS_10);

+ 1 - 1
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderDetailsServiceImpl.java

@@ -116,7 +116,7 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
         logisticsInfo.setLogisticsCompanyCode(issueDto.getLogisticsCompanyCode());
         logisticsInfo.setWarehouseId(issueDto.getWarehouseId());
         // 查询快递100的物流信息
-        Integer logisticsStatus = KD100Util.getLogisticsStatus(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode());
+        Integer logisticsStatus = KD100Util.getStateAndMonitor(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode());
         logisticsInfo.setLogisticsStatus(logisticsStatus);
         logisticsInfo.setStatus(0);
         logisticsInfoService.save(logisticsInfo);

+ 2 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/service/product/ProductInfoService.java

@@ -29,4 +29,6 @@ public interface ProductInfoService extends BaseService<ProductInfo> {
 
     Page<ProductCombinationEx> getCombinationPage(Condition condition);
 
+    void submitTransfer(ProductInfo dto);
+
 }

+ 48 - 6
hx-service/victoriatourist/src/main/java/com/fjhx/service/product/impl/ProductInfoServiceImpl.java

@@ -8,12 +8,14 @@ import com.fjhx.base.Condition;
 import com.fjhx.constants.StatusConstant;
 import com.fjhx.entity.product.ProductCombination;
 import com.fjhx.entity.product.ProductInfo;
+import com.fjhx.entity.product.ProductTag;
 import com.fjhx.entity.stock.Stock;
 import com.fjhx.mapper.product.ProductInfoMapper;
 import com.fjhx.params.product.ProductCombinationEx;
 import com.fjhx.params.product.ProductInfoVo;
 import com.fjhx.service.product.ProductCombinationService;
 import com.fjhx.service.product.ProductInfoService;
+import com.fjhx.service.product.ProductTagService;
 import com.fjhx.service.stock.StockService;
 import com.fjhx.uitl.code.CodeEnum;
 import com.fjhx.utils.Assert;
@@ -54,11 +56,22 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
     @Autowired
     private StockService stockService;
 
+    @Autowired
+    private ProductTagService productTagService;
+
     @Override
     public Page<Map<String, Object>> getPage(Map<String, Object> condition) {
+
+        List<String> tagNameList = Convert.toList(String.class, condition.get("tagNameList"));
+
+        List<Long> productIdList = null;
+        if (tagNameList.size() > 0) {
+            productIdList = productTagService.listObj(ProductTag::getProductInfoId, q -> q.in(ProductTag::getTagName, tagNameList));
+        }
+
         IWrapper<ProductInfo> wrapper = IWrapper.getWrapper(condition);
-        wrapper
-                .keyword(new KeywordData(ProductInfo::getName), new KeywordData(ProductInfo::getCode))
+        wrapper.keyword(new KeywordData(ProductInfo::getName), new KeywordData(ProductInfo::getCode))
+                .in(ProductInfo::getId, productIdList)
                 .eq(ProductInfo::getDefinition)
                 .eq(ProductInfo::getDeptId)
                 .eq(ProductInfo::getType)
@@ -93,10 +106,16 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         }
 
         // 赋值部门名称
-        List<Long> deptIdList = records.stream().map(item -> Convert.toLong(item.get("deptId"))).collect(Collectors.toList());
-        Map<Long, Dept> deptMap = iSysClient.getDeptByIdsToMap(deptIdList);
+        Set<Long> deptIdList = new HashSet<>();
+        for (Map<String, Object> record : records) {
+            deptIdList.add(Convert.toLong(record.get("deptId")));
+            deptIdList.add(Convert.toLong(record.get("transferDetpId")));
+        }
+        deptIdList.remove(null);
+
+        Map<Long, Dept> deptMap = iSysClient.getDeptByIdsToMap(new ArrayList<>(deptIdList));
 
-        //查询产品库存
+        // 查询产品库存
         Map<Long, Stock> stockMap = new HashMap<>();
 
         // 查询库存量
@@ -111,18 +130,30 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
         // 产品部门
         for (Map<String, Object> record : records) {
+
+            // 负责部门
             Dept dept = deptMap.get(Convert.toLong(record.get("deptId")));
             record.put("deptName", dept == null ? "" : dept.getDeptName());
 
-            if (Func.isNotEmpty(stockMap) && Func.isNotEmpty(stockMap.get(Convert.toLong(record.get("id"))))) {
+            // 移交部门
+            Dept transferDetp = deptMap.get(Convert.toLong(record.get("transferDetpId")));
+            if (ObjectUtil.isNotEmpty(transferDetp) && transferDetp.getPersonInChargeId().equals(AuthUtil.getUserId())) {
+                record.put("receiveDetp", transferDetp.getDeptName());
+                record.put("receiveFlag", true);
+            }
+
+            // 库存数量
+            if (Func.isNotEmpty(stockMap)) {
                 Stock stock = stockMap.get(Convert.toLong(record.get("id")));
                 record.put("stockQuantity", stock.getQuantity());
             }
+
         }
 
         return page;
     }
 
+
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void add(ProductInfoVo productInfoVo) {
@@ -218,4 +249,15 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         return baseMapper.getCombinationPage(createPage(condition), wrapper);
     }
 
+    @Override
+    public void submitTransfer(ProductInfo dto) {
+        ProductInfo productInfo = getById(dto.getId());
+        Long transferDetpId = productInfo.getTransferDetpId();
+        Assert.notEmpty(transferDetpId, "没有发起移交请求或移交请求已被处理");
+
+        productInfo.setDeptId(transferDetpId);
+        productInfo.setTransferDetpId(null);
+        updateById(productInfo);
+    }
+
 }

+ 34 - 19
hx-service/victoriatourist/src/main/java/com/fjhx/task/ScheduleTaskController.java

@@ -1,48 +1,63 @@
 package com.fjhx.task;
 
-import com.alibaba.fastjson.JSONObject;
-import com.fjhx.constants.RedisConstant;
+import cn.hutool.core.date.DateUtil;
+import com.fjhx.base.BaseEntity;
+import com.fjhx.base.BaseIdEntity;
+import com.fjhx.constants.logistics.LogisticsConstant;
+import com.fjhx.entity.logistics.LogisticsInfo;
+import com.fjhx.service.logistics.LogisticsInfoService;
 import com.fjhx.uitl.kd100.KD100Util;
 import lombok.extern.slf4j.Slf4j;
 import org.springblade.core.launch.BladeApplication;
-import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.tool.utils.ThreadUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
-import javax.annotation.Resource;
 import java.util.Date;
-import java.util.Set;
+import java.util.List;
+import java.util.Objects;
 
 @Configuration
 @EnableScheduling
 @Slf4j
 public class ScheduleTaskController {
 
-    @Resource
-    private BladeRedis bladeRedis;
+    @Autowired
+    private LogisticsInfoService logisticsInfoService;
 
     /**
      * 定时查询快递
      */
-    @Scheduled(cron = "0 0/10 * * * ?")
+    @Scheduled(cron = "0 0 0/2 * * ?")
     private void stockAcceptActionTask() {
         if (BladeApplication.isLocalDev()) {
             return;
         }
 
-        log.info("定时查询快递");
-        Set<String> keys = bladeRedis.keys(RedisConstant.KD_100_SEND_SUBSCRIBE + "*");
-
-        for (String key : keys) {
-            JSONObject jsonObject = bladeRedis.get(key);
-            if (jsonObject != null) {
-                bladeRedis.del(key);
-                String com = jsonObject.getString("com");
-                String num = jsonObject.getString("num");
-                Date date = jsonObject.getDate("date");
-                KD100Util.subscribe(com, num, date);
+        List<LogisticsInfo> list = logisticsInfoService.list(q -> q
+                .eq(LogisticsInfo::getLogisticsStatus, LogisticsConstant.KD100Status.STATUS_N)
+                .le(BaseEntity::getCreateTime, DateUtil.offsetDay(new Date(), 1))
+        );
+
+        if (list.size() == 0) {
+            return;
+        }
+
+        for (LogisticsInfo logisticsInfo : list) {
+            String code = logisticsInfo.getCode();
+            String logisticsCompanyCode = logisticsInfo.getLogisticsCompanyCode();
+            Integer state = KD100Util.getStateAndMonitor(logisticsCompanyCode, code);
+
+            if (!Objects.equals(state, LogisticsConstant.KD100Status.STATUS_N)) {
+                logisticsInfoService.update(q -> q
+                        .eq(BaseIdEntity::getId, logisticsInfo.getId())
+                        .eq(LogisticsInfo::getLogisticsStatus, LogisticsConstant.KD100Status.STATUS_N)
+                        .set(LogisticsInfo::getLogisticsStatus, state)
+                );
             }
+            ThreadUtil.sleep(1000L);
         }
 
     }

+ 55 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/uitl/kd100/KD100Result.java

@@ -0,0 +1,55 @@
+package com.fjhx.uitl.kd100;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter
+@Setter
+public class KD100Result {
+
+    /**
+     * 消息体
+     */
+    private String message;
+
+    /**
+     * 单号
+     */
+    private String nu;
+
+    /**
+     * 快递公司编码,一律用小写字母
+     */
+    private String com;
+
+    /**
+     * -1未找到快递信息,0在途,1揽收,2疑难,3签收,4退签,5派件,6退回,7转投,8清关,14拒签
+     *
+     * @link { com.fjhx.constants.logistics.LogisticsConstant.KD100Status }
+     */
+    private Integer state;
+
+    /**
+     * 明细数据
+     */
+    private List<Data> data;
+
+    @Getter
+    @Setter
+    public static class Data {
+
+        /**
+         * 时间
+         */
+        private String ftime;
+
+        /**
+         * 提示
+         */
+        private String context;
+
+    }
+
+}

+ 56 - 94
hx-service/victoriatourist/src/main/java/com/fjhx/uitl/kd100/KD100Util.java

@@ -1,12 +1,10 @@
 package com.fjhx.uitl.kd100;
 
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.extra.spring.SpringUtil;
+import cn.hutool.http.HttpStatus;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fjhx.config.KD100Config;
-import com.fjhx.constants.RedisConstant;
 import com.fjhx.constants.logistics.LogisticsConstant;
-import com.google.gson.Gson;
 import com.kuaidi100.sdk.api.QueryTrack;
 import com.kuaidi100.sdk.api.Subscribe;
 import com.kuaidi100.sdk.contant.ApiInfoConstant;
@@ -17,46 +15,75 @@ import com.kuaidi100.sdk.utils.SignUtils;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
 import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.redis.cache.BladeRedis;
-import org.springblade.core.tool.api.ResultCode;
 import org.springblade.core.tool.utils.Func;
 
 import java.net.URLDecoder;
-import java.util.Date;
 import java.util.Objects;
 
 @Log4j2
 public class KD100Util {
 
-    private final static BladeRedis bladeRedis = SpringUtil.getBean(BladeRedis.class);
-
     /**
      * 实时快递查询接口
      *
      * @param com 快递公司编码
      * @param num 快递单号
-     * @return
      */
-    public static JSONObject queryTrack(String com, String num) {
-        HttpResult result;
+    public static KD100Result queryTrack(String com, String num) {
+        HttpResult httpResult;
+
         try {
-            QueryTrackReq queryTrackReq = new QueryTrackReq();
+            // 参数组合成的json对象
             QueryTrackParam queryTrackParam = new QueryTrackParam();
             queryTrackParam.setCom(com);
             queryTrackParam.setNum(num);
-            String param = new Gson().toJson(queryTrackParam);
+            String param = JSON.toJSONString(queryTrackParam);
 
+            // 快递100入参
+            QueryTrackReq queryTrackReq = new QueryTrackReq();
             queryTrackReq.setParam(param);
             queryTrackReq.setCustomer(KD100Config.getCustomer());
             queryTrackReq.setSign(SignUtils.querySign(param, KD100Config.getKey(), KD100Config.getCustomer()));
 
-            IBaseClient baseClient = new QueryTrack();
-            result = baseClient.execute(queryTrackReq);
+            // 查询快递100
+            httpResult = new QueryTrack().execute(queryTrackReq);
         } catch (Exception e) {
-            log.error(e.toString());
-            throw new ServiceException("请求第三方快递信息异常,请联系管理员!");
+            log.error("请求kd100发生异常", e);
+            throw new ServiceException("请求kd100发生异常,异常原因:" + e);
+        }
+
+        if (Objects.equals(httpResult.getStatus(), HttpStatus.HTTP_OK)) {
+            return JSON.parseObject(httpResult.getBody()).toJavaObject(KD100Result.class);
+        } else {
+            log.error("查询快递100失败,失败原因:{}", httpResult.getBody());
+            throw new ServiceException("查询快递100失败,失败原因:" + httpResult.getBody());
         }
-        return parseQueryResult(result);
+    }
+
+    /**
+     * 获取快递状态并监听未到货快递
+     *
+     * @param com 快递公司编码
+     * @param num 快递单号
+     * @return state
+     */
+    public static Integer getStateAndMonitor(String com, String num) {
+        // 查询快递100的物流信息
+        KD100Result result = KD100Util.queryTrack(com, num);
+        String message = result.getMessage();
+        if (Objects.equals(message, "查询无结果,请隔段时间再查")) {
+            return LogisticsConstant.KD100Status.STATUS_N;
+        }
+        if (Objects.equals(message, "ok")) {
+            Integer state = result.getState();
+            if (!Objects.equals(state, LogisticsConstant.KD100Status.STATUS_3)) {
+                // 如果不是已签收状态,则开启订阅(物流状态跟踪并推送)
+                KD100Util.subscribe(com, num);
+            }
+        } else {
+            throw new ServiceException("快递100异常:" + message);
+        }
+        return result.getState();
     }
 
     /**
@@ -64,9 +91,8 @@ public class KD100Util {
      *
      * @param com 快递公司编码
      * @param num 快递单号
-     * @return
      */
-    public static JSONObject subscribe(String com, String num, Date date) {
+    public static void subscribe(String com, String num) {
         HttpResult result;
         try {
             SubscribeParameters subscribeParameters = new SubscribeParameters();
@@ -80,65 +106,23 @@ public class KD100Util {
 
             SubscribeReq subscribeReq = new SubscribeReq();
             subscribeReq.setSchema(ApiInfoConstant.SUBSCRIBE_SCHEMA);
-            subscribeReq.setParam(new Gson().toJson(subscribeParam));
+            subscribeReq.setParam(JSON.toJSONString(subscribeParam));
 
             IBaseClient subscribe = new Subscribe();
             result = subscribe.execute(subscribeReq);
         } catch (Exception e) {
             log.error(e.toString());
-            throw new ServiceException("请求第三方快递订阅功能异常,请联系管理员!");
-        }
-        return parseSubscribeData(result, com, num, date);
-    }
-
-    /**
-     * 解析数据:查询结果
-     *
-     * @param result 数据结果
-     * @return
-     */
-    private static JSONObject parseQueryResult(HttpResult result) {
-        if (Func.isNotEmpty(result) && result.getStatus() == ResultCode.SUCCESS.getCode()) {
-            JSONObject body = JSONObject.parseObject(result.getBody());
-            if (Func.isNotEmpty(body.get("message")) && StringUtils.equalsIgnoreCase(body.getString("message"), "ok")) {
-                return body;
-            } else {
-                throw new ServiceException("操作失败,原因:物流信息【" + body.getString("message") + "】,请稍后重试,或者联系管理员!");
-            }
-        } else {
-            throw new ServiceException("物流信息查询失败,请稍后重试,或者联系管理员!");
+            throw new ServiceException("请求第三方快递订阅功能异常:" + e);
         }
-    }
-
-    /**
-     * 解析数据:订阅结果
-     *
-     * @param result 数据结果
-     * @return
-     */
-    private static JSONObject parseSubscribeData(HttpResult result, String com, String num, Date date) {
-        if (Func.isNotEmpty(result) && result.getStatus() == ResultCode.SUCCESS.getCode()) {
-            JSONObject body = JSONObject.parseObject(result.getBody());
-            if (Func.isNotEmpty(body) && body.getBoolean("result")) {
-                return body;
-            } else {
-
-                if (DateUtil.betweenDay(new Date(), date, false) < 3) {
-                    JSONObject jsonObject = new JSONObject();
-                    jsonObject.put("com", com);
-                    jsonObject.put("num", num);
-                    jsonObject.put("date", date);
-                    bladeRedis.set(RedisConstant.KD_100_SEND_SUBSCRIBE + com + ":" + num, jsonObject);
-                }
-
-                log.error("监听物流消息失败: com:{}, num:{}, messageL{}", com, num, body.toString());
 
-                return body;
-
-                // throw new ServiceException("操作失败,原因:物流信息【" + body.getString("message") + "】,请稍后重试,或者联系管理员!");
+        if (Objects.equals(result.getStatus(), HttpStatus.HTTP_OK)) {
+            JSONObject body = JSON.parseObject(result.getBody());
+            if (!Objects.equals(body.getBoolean("result"), Boolean.TRUE)) {
+                log.error("监听物流消息失败: com:{}, num:{}, message:{}", com, num, result.getBody());
+                throw new ServiceException("监听物流消息失败:" + result.getBody());
             }
         } else {
-            throw new ServiceException("物流信息订阅失败,请稍后重试,或者联系管理员!");
+            throw new ServiceException("监听物流消息失败:" + result.getError());
         }
     }
 
@@ -146,7 +130,6 @@ public class KD100Util {
      * 解析数据:推送结果
      *
      * @param data 物流信息
-     * @return
      */
     public static JSONObject parsePushData(String data) {
         if (StringUtils.isNotBlank(data) && StringUtils.indexOf(data, "param=") != -1) {
@@ -157,7 +140,7 @@ public class KD100Util {
                 throw new ServiceException("物流信息推送失败,参数解码异常!");
             }
 
-            JSONObject object = JSONObject.parseObject(data);
+            JSONObject object = JSON.parseObject(data);
             if (Func.isNotEmpty(object) && Func.isNotEmpty(object.getJSONObject("lastResult"))) {
                 JSONObject body = object.getJSONObject("lastResult");
                 if (Func.isNotEmpty(body.get("message")) && StringUtils.equalsIgnoreCase(body.getString("message"), "ok")) {
@@ -173,25 +156,4 @@ public class KD100Util {
         }
     }
 
-    public static Integer getLogisticsStatus(String logisticsCompanyCode, String code) {
-        Integer itemState = -1;
-
-        // 查询快递100的物流信息
-        try {
-            JSONObject result = KD100Util.queryTrack(logisticsCompanyCode, code);
-            itemState = result.getInteger("state");
-        } catch (Exception e) {
-
-        }
-
-        Integer state = itemState;
-        new Thread(() -> {
-            if (!Objects.equals(state, LogisticsConstant.KD100Status.STATUS_3)) {
-                // 如果不是已签收状态,则开启订阅(物流状态跟踪并推送)
-                KD100Util.subscribe(logisticsCompanyCode, code, new Date());
-            }
-        }).start();
-        return state;
-    }
-
 }