Przeglądaj źródła

物流信息订阅查询,直播数据修复

yuhongqi 1 tydzień temu
rodzic
commit
5712b3d14b
20 zmienionych plików z 147 dodań i 113 usunięć
  1. 1 1
      fs-admin/src/main/java/com/fs/hisStore/task/MallStoreTask.java
  2. 2 1
      fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java
  3. 2 1
      fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java
  4. 1 1
      fs-company/src/main/java/com/fs/hisStore/controller/FsStoreOrderScrmController.java
  5. 1 1
      fs-company/src/main/resources/application.yml
  6. 10 0
      fs-service/src/main/java/com/fs/hisStore/domain/FsUserScrm.java
  7. 2 1
      fs-service/src/main/java/com/fs/hisStore/enums/ShipperCodeEnum.java
  8. 1 1
      fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java
  9. 13 13
      fs-service/src/main/java/com/fs/hisStore/service/impl/FsExpressScrmServiceImpl.java
  10. 8 8
      fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java
  11. 1 1
      fs-service/src/main/java/com/fs/live/mapper/LiveOrderMapper.java
  12. 4 0
      fs-service/src/main/java/com/fs/live/param/LiveDataParam.java
  13. 29 31
      fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java
  14. 1 0
      fs-service/src/main/java/com/fs/live/vo/FsMyLiveOrderListQueryVO.java
  15. 1 0
      fs-service/src/main/java/com/fs/live/vo/LiveDataListVo.java
  16. 1 0
      fs-service/src/main/java/com/fs/live/vo/LiveDataStatisticsVo.java
  17. 2 1
      fs-service/src/main/resources/mapper/hisStore/FsUserScrmMapper.xml
  18. 51 51
      fs-service/src/main/resources/mapper/live/LiveDataMapper.xml
  19. 15 0
      fs-user-app/src/main/java/com/fs/app/controller/live/LiveOrderController.java
  20. 1 1
      fs-user-app/src/main/resources/application.yml

+ 1 - 1
fs-admin/src/main/java/com/fs/hisStore/task/MallStoreTask.java

@@ -386,7 +386,7 @@ public class MallStoreTask
         for (Long orderId : list){
             FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
             String lastFourNumber = "";
-            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())  || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                 lastFourNumber = order.getUserPhone();
                 if (lastFourNumber.length() == 11) {
                     lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);

+ 2 - 1
fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java

@@ -8,6 +8,7 @@ import com.fs.live.domain.LiveData;
 import com.fs.live.param.LiveDataParam;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.vo.LiveUserFirstVo;
+import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -49,7 +50,7 @@ public class LiveDataController extends BaseController {
     @PostMapping("/listLiveData")
     public R listLiveData(@RequestBody LiveDataParam param, HttpServletRequest request)
     {
-        startPage();
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
         return liveDataService.listLiveData(param);
     }
 

+ 2 - 1
fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java

@@ -14,6 +14,7 @@ import com.fs.live.domain.LiveData;
 import com.fs.live.param.LiveDataParam;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.vo.ColumnsConfigVo;
+import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -67,7 +68,7 @@ public class LiveDataController extends BaseController
     public R listLiveData(@RequestBody LiveDataParam param, HttpServletRequest request)
     {
         param.setCompanyId(tokenService.getLoginUser(request).getUser().getCompanyId());
-        startPage();
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
         return liveDataService.listLiveData(param);
     }
 

+ 1 - 1
fs-company/src/main/java/com/fs/hisStore/controller/FsStoreOrderScrmController.java

@@ -270,7 +270,7 @@ public class FsStoreOrderScrmController extends BaseController
         if(StringUtils.isNotEmpty(order.getDeliveryId())){
 
             String lastFourNumber = "";
-            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                 lastFourNumber = order.getUserPhone();
                 if (lastFourNumber.length() == 11) {
                     lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);

+ 1 - 1
fs-company/src/main/resources/application.yml

@@ -7,7 +7,7 @@ spring:
 #    active: druid-jnmy-test
 #    active: druid-jzzx-test
 #    active: druid-hdt
-    active: druid-sxjz-test
+    active: druid-bjzm-test
 #    active: druid-yzt
 #    active: druid-myhk
 #    active: druid-sft

+ 10 - 0
fs-service/src/main/java/com/fs/hisStore/domain/FsUserScrm.java

@@ -215,6 +215,16 @@ public class FsUserScrm extends BaseEntity
     private String companyName;
     private String rank;
     private String react;
+    /** 绑定的公司用户ID */
+    private Long bindCompanyUserId;
+
+    public Long getBindCompanyUserId() {
+        return bindCompanyUserId;
+    }
+
+    public void setBindCompanyUserId(Long bindCompanyUserId) {
+        this.bindCompanyUserId = bindCompanyUserId;
+    }
 
     /**
      * 项目ID

+ 2 - 1
fs-service/src/main/java/com/fs/hisStore/enums/ShipperCodeEnum.java

@@ -6,7 +6,8 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum  ShipperCodeEnum {
-    SF("SF","顺丰速运");
+    SF("SF","顺丰速运"),
+    ZTO("ZTO","中通快递");
 
     private String value;
     private String desc;

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -181,7 +181,7 @@ public interface FsStoreProductScrmMapper
     @Select("select * from fs_store_product_scrm where  is_del=0 and is_show=1 order by sort desc limit #{count}")
     List<FsStoreProductListQueryVO> selectFsStoreProductByCateIdQuery(Long cateId);
     @Select({"<script> " +
-            "select p.* from fs_store_product_scrm p  " +
+            "select distinct p.* from fs_store_product_scrm p  " +
             //新增审核状态及所属店铺审核状态
             "<if test = 'maps.isStores != null and maps.isStores == 1   '>"+
             "inner join fs_store_scrm fs on fs.store_id = p.store_id and fs.is_audit = 1 " +

+ 13 - 13
fs-service/src/main/java/com/fs/hisStore/service/impl/FsExpressScrmServiceImpl.java

@@ -36,12 +36,12 @@ import org.springframework.util.Base64Utils;
 
 /**
  * 快递公司Service业务层处理
- * 
+ *
  * @author fs
  * @date 2022-03-15
  */
 @Service
-public class FsExpressScrmServiceImpl implements IFsExpressScrmService 
+public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 {
     Logger logger = LoggerFactory.getLogger(FsExpressScrmServiceImpl.class);
     @Autowired
@@ -53,7 +53,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
     /**
      * 查询快递公司
-     * 
+     *
      * @param id 快递公司ID
      * @return 快递公司
      */
@@ -65,7 +65,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
     /**
      * 查询快递公司列表
-     * 
+     *
      * @param fsExpress 快递公司
      * @return 快递公司
      */
@@ -77,7 +77,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
     /**
      * 新增快递公司
-     * 
+     *
      * @param fsExpress 快递公司
      * @return 结果
      */
@@ -90,7 +90,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
     /**
      * 修改快递公司
-     * 
+     *
      * @param fsExpress 快递公司
      * @return 结果
      */
@@ -103,7 +103,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
     /**
      * 批量删除快递公司
-     * 
+     *
      * @param ids 需要删除的快递公司ID
      * @return 结果
      */
@@ -115,7 +115,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
     /**
      * 删除快递公司信息
-     * 
+     *
      * @param id 快递公司ID
      * @return 结果
      */
@@ -130,7 +130,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
         //处理顺丰查询轨迹需手机号码后4位
         String requestData;
-        if (ShipperCode.equals(ShipperCodeEnum.SF.getValue())) {
+        if (ShipperCode.equals(ShipperCodeEnum.SF.getValue()) || ShipperCode.equals(ShipperCodeEnum.ZTO.getValue())) {
             requestData = "{'OrderCode':'" + OrderCode + "','ShipperCode':'" + ShipperCode + "','LogisticCode':'" + LogisticCode + "','CustomerName':'" + lastFourNumber + "'}";
         } else {
             requestData = "{'OrderCode':'" + OrderCode + "','ShipperCode':'" + ShipperCode + "','LogisticCode':'" + LogisticCode + "'}";
@@ -177,7 +177,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
     public void subscribeEspress(String orderCode, String deliverySn, String deliveryId, String userPhone) {
         //处理顺丰查询轨迹需手机号码后4位
         String requestData;
-        if (deliverySn.equals(ShipperCodeEnum.SF.getValue())) {
+        if (deliverySn.equals(ShipperCodeEnum.SF.getValue()) || deliverySn.equals(ShipperCodeEnum.ZTO.getValue())) {
             requestData = "{'OrderCode':'" + orderCode + "','ShipperCode':'" + deliverySn + "','LogisticCode':'" + deliveryId + "','CustomerName':'" + userPhone + "'}";
         } else {
             requestData = "{'OrderCode':'" + orderCode + "','ShipperCode':'" + deliverySn + "','LogisticCode':'" + deliveryId + "'}";
@@ -189,7 +189,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
             FSSysConfig sysConfig= JSON.parseObject(json,FSSysConfig.class);
             params.put("RequestData", URLEncoder.encode(requestData, "UTF-8"));
             params.put("EBusinessID",sysConfig.getKdnId().trim());
-            params.put("RequestType", "8008");
+            params.put("RequestType", "8001");
             String dataSign = encrypt(requestData, sysConfig.getKdnKeyId().trim(), "UTF-8");
             params.put("DataSign", URLEncoder.encode(dataSign, "UTF-8"));
             params.put("DataType", "2");
@@ -235,7 +235,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
         if(order!=null){
 
             String lastFourNumber = "";
-            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())  || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                 lastFourNumber = order.getUserPhone();
                 if (lastFourNumber.length() == 11) {
                     lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -244,7 +244,7 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
 
             //处理顺丰查询轨迹需手机号码后4位
             String requestData;
-            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())  || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                 requestData = "{'OrderCode':'" + order.getOrderCode() + "','ShipperCode':'" + order.getDeliverySn() + "','LogisticCode':'" + param.getPackageno() + "','CustomerName':'" + lastFourNumber + "'}";
             } else {
                 requestData = "{'OrderCode':'" + order.getOrderCode() + "','ShipperCode':'" + order.getDeliverySn() + "','LogisticCode':'" + param.getPackageno() + "'}";

+ 8 - 8
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -1360,7 +1360,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                     OrderLogEnum.DELIVERY_GOODS.getDesc());
             //订阅物流回调
             String lastFourNumber = "";
-            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())  || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                 lastFourNumber = order.getUserPhone();
                 if (lastFourNumber.length() == 11) {
                     lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -1409,7 +1409,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                         OrderLogEnum.DELIVERY_GOODS.getDesc());
                 //订阅物流回调
                 String lastFourNumber = "";
-                if (express.getCode().equals(ShipperCodeEnum.SF.getValue())) {
+                if (express.getCode().equals(ShipperCodeEnum.SF.getValue())  || express.getCode().equals(ShipperCodeEnum.ZTO.getValue())) {
                     lastFourNumber = order.getUserPhone();
                     if (lastFourNumber.length() == 11) {
                         lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -1468,7 +1468,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
     public R getExpress(FsStoreOrderScrm order) {
         //顺丰轨迹查询处理
         String lastFourNumber = "";
-        if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+        if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
             lastFourNumber = order.getUserPhone();
             if (lastFourNumber.length() == 11) {
                 lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -2518,7 +2518,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
     public R syncExpress(FsStoreOrderExpressEditParam param) {
         FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(param.getOrderId());
         String lastFourNumber = "";
-        if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+        if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
             lastFourNumber = order.getUserPhone();
             if (lastFourNumber.length() == 11) {
                 lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -3215,7 +3215,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                             if ((!dto.isSuccess() && dto.getReason().equals("三天无轨迹")) || (!dto.isSuccess() && dto.getReason().equals("七天内无轨迹变化"))) {
                                 //订阅物流回调
                                 String lastFourNumber = "";
-                                if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+                                if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())  || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                                     lastFourNumber = order.getUserPhone();
                                     if (lastFourNumber.length() == 11) {
                                         lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -3571,7 +3571,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 FsStoreScrm store = fsStoreMapper.selectFsStoreByStoreId(o.getStoreId());
                 int i = fsStoreOrderMapper.updateFsStoreOrderByOrderCode(fsStoreOrder);
                 String lastFourNumber = "";
-                if (fsStoreOrder.getDeliveryCode().equals(com.fs.his.enums.ShipperCodeEnum.SF.getValue())) {
+                if (fsStoreOrder.getDeliveryCode().equals(com.fs.his.enums.ShipperCodeEnum.SF.getValue())  || fsStoreOrder.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
                     if (store.getSendPhone() != null) {
                         lastFourNumber = store.getSendPhone();
                     } else {
@@ -3671,7 +3671,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
         fsStoreOrderLogsMapper.insertFsStoreOrderLogs(Logs);
 
         String lastFourNumber = "";
-        if (order.getDeliveryCode().equals(com.fs.his.enums.ShipperCodeEnum.SF.getValue())) {
+        if (order.getDeliveryCode().equals(com.fs.his.enums.ShipperCodeEnum.SF.getValue())  || order.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
             lastFourNumber = order.getUserPhone();
             if (lastFourNumber.length() == 11) {
                 lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -3999,7 +3999,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                     FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(dto.getOrderNumber());
                     //订阅物流回调
                     String lastFourNumber = "";
-                    if (dto.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+                    if (dto.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())  || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
                         lastFourNumber = order.getUserPhone();
                         if (lastFourNumber.length() == 11) {
                             lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);

+ 1 - 1
fs-service/src/main/java/com/fs/live/mapper/LiveOrderMapper.java

@@ -369,7 +369,7 @@ public interface LiveOrderMapper {
     int batchUpdateErpByOrderIds(@Param("maps")ArrayList<Map<String, String>> maps);
 
     @Select({"<script> " +
-            "select o.order_id,o.order_code,o.item_json,o.pay_price,o.status,o.delivery_sn as delivery_id,o.finish_time  from live_order o  " +
+            "select o.order_id ,o.order_code,o.item_json,o.pay_price,o.status,o.delivery_sn as delivery_id,o.finish_time  from live_order o  " +
             "where o.is_del=0 " +
             "<if test = 'maps.status != null and maps.status != \"\"     '> " +
             "and o.status =#{maps.status} " +

+ 4 - 0
fs-service/src/main/java/com/fs/live/param/LiveDataParam.java

@@ -91,4 +91,8 @@ public class LiveDataParam {
     private Date endTime;
 
 
+    private Integer pageNum;
+    private Integer pageSize;
+
+
 }

+ 29 - 31
fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -275,7 +275,6 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
     @Autowired
     private FsWxExpressTaskMapper fsWxExpressTaskMapper;
 
-
     //ERP 类型到服务的映射
     private Map<Integer, IErpOrderService> erpServiceMap;
     @PostConstruct
@@ -809,12 +808,6 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 //            liveOrder.setDeliveryStatus(delivers.getStatus());
 //            liveOrder.setDeliveryType(String.valueOf(delivers.getStateEx()));
 //        } else {
-            liveOrder.setDeliveryCode(null);
-            liveOrder.setDeliveryName(null);
-            liveOrder.setDeliverySn(null);
-
-            liveOrder.setDeliveryStatus(null);
-            liveOrder.setDeliveryType(null);
 //        }
         return liveOrder;
     }
@@ -1699,13 +1692,13 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                     OrderLogEnum.DELIVERY_GOODS.getDesc());
             //订阅物流回调
             String lastFourNumber = "";
-            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
                 lastFourNumber = order.getUserPhone();
                 if (lastFourNumber.length() == 11) {
                     lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
                 }
             }
-            expressService.subscribeEspress(order.getOrderCode(), order.getDeliverySn(), order.getDeliverySn(), lastFourNumber);
+            expressService.subscribeEspress(order.getOrderCode(), order.getDeliveryCode(), order.getDeliverySn(), lastFourNumber);
 
             TemplateBean templateBean = TemplateBean.builder()
                     .orderId(order.getOrderId().toString())
@@ -2058,32 +2051,37 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
     @Override
     public R getExpressMulti(LiveOrder order) {
-//        //顺丰轨迹查询处理
-//        String lastFourNumber = PhoneUtils.getLastFourNum(order.getUserPhone());
-//        // 获取该订单关联的物流信息
-//        List<FsStoreDelivers> fsStoreDelivers = fsStoreDeliversMapper.findByOrderIdWithType(order.getOrderId(),1);
-//        if(CollectionUtils.isEmpty(fsStoreDelivers)){
-//            return R.ok("当前订单号暂无物流信息");
-//        }
-//
-//        List<ExpressInfoDTO> result = new ArrayList<>();
-//        for (FsStoreDelivers fsStoreDeliver : fsStoreDelivers) {
-//            ExpressInfoDTO dto=expressService.getExpressInfo(order.getOrderCode(),
-//                    fsStoreDeliver.getDeliverSn(),
-//                    fsStoreDeliver.getDeliverId(),
-//                    lastFourNumber);
-//            result.add(dto);
-//        }
+        //顺丰轨迹查询处理
+        String lastFourNumber = getLastFourNum(order.getUserPhone());
 
-//        return R.ok().put("data",result);
-        return R.ok();
+
+        ExpressInfoDTO expressInfoDTO =null;
+        if (StringUtils.isNotEmpty(order.getDeliverySn())) {
+            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
+                lastFourNumber = order.getUserPhone();
+                if (lastFourNumber.length() == 11) {
+                    lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
+                }
+            }
+            expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(), order.getDeliveryCode(), order.getDeliverySn(), lastFourNumber);
+        }
+        return R.ok().put("data", expressInfoDTO);
+    }
+
+    public static String getLastFourNum(String phone) {
+
+        String lastFourNumber = phone;
+        if (lastFourNumber.length() == 11) {
+            lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
+        }
+        return lastFourNumber;
     }
 
     @Override
     public R getExpress(LiveOrder order) {
         //顺丰轨迹查询处理
         String lastFourNumber = "";
-        if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
+        if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
             lastFourNumber = order.getUserPhone();
             if (lastFourNumber.length() == 11) {
                 lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -2576,7 +2574,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
     public R syncExpress(Long id) {
         LiveOrder order = baseMapper.selectLiveOrderByOrderId(String.valueOf(id));
         String lastFourNumber = "";
-        if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
+        if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
             lastFourNumber = order.getUserPhone();
             if (lastFourNumber.length() == 11) {
                 lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -2592,7 +2590,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         }
         if("0".equals(dto.getStateEx())&&"0".equals(dto.getState())){
             lastFourNumber = "19923690275";
-            if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
+            if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
                 lastFourNumber = order.getUserPhone();
                 if (lastFourNumber.length() == 11) {
                     lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
@@ -2655,7 +2653,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 baseMapper.updateLiveOrder(updateEntity);
                 // 订阅物流回调
                 String lastFourNumber = "";
-                if (fsExpress.getCode().equals(ShipperCodeEnum.SF.getValue())) {
+                if (fsExpress.getCode().equals(ShipperCodeEnum.SF.getValue())  || fsExpress.getCode().equals(ShipperCodeEnum.ZTO.getValue())) {
                     lastFourNumber = existOrder.getUserPhone();
                     if (lastFourNumber.length() == 11) {
                         lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);

+ 1 - 0
fs-service/src/main/java/com/fs/live/vo/FsMyLiveOrderListQueryVO.java

@@ -24,6 +24,7 @@ public class FsMyLiveOrderListQueryVO implements Serializable
 
     /** 订单ID */
     private Long id;
+    private Long orderId;
 
     /** 订单号 */
     private String orderCode;

+ 1 - 0
fs-service/src/main/java/com/fs/live/vo/LiveDataListVo.java

@@ -78,3 +78,4 @@ public class LiveDataListVo {
 
 
 
+

+ 1 - 0
fs-service/src/main/java/com/fs/live/vo/LiveDataStatisticsVo.java

@@ -59,3 +59,4 @@ public class LiveDataStatisticsVo {
 
 
 
+

+ 2 - 1
fs-service/src/main/resources/mapper/hisStore/FsUserScrmMapper.xml

@@ -70,10 +70,11 @@
         <result property="rank"    column="rank"    />
         <result property="react"    column="react"    />
         <result property="orderCount"    column="order_count"    />
+        <result property="bindCompanyUserId"    column="bind_company_user_id"    />
     </resultMap>
 
     <sql id="selectFsUserVo">
-        select user_id, username, nick_name, avatar, phone, integral, status, `level`, spread_user_id, spread_time, user_type, is_promoter, pay_count, spread_count, addres, tui_user_id, tui_time, tui_user_count, ma_open_id, mp_open_id, union_id, is_del, user_code, remark, nickname, create_time, update_time, last_ip, now_money, brokerage_price, balance, sign_num, integral_status, is_buy, password, real_name, birthday, id_card, jpush_id, is_vip, vip_start_date, vip_end_date, vip_level, vip_status, sex, store_open_id, is_official_account_auth, is_push, is_individuation_push, is_weixin_auth, company_id, company_user_id, register_date, register_code, test, login_device, source, is_add_qw, qw_user_id, is_show, parent_id, course_ma_open_id, history_app, qw_ext_id, `rank`, react,order_count from fs_user
+        select user_id, username, nick_name, avatar, phone, integral, status, `level`, spread_user_id, spread_time, user_type, is_promoter, pay_count, spread_count, addres, tui_user_id, tui_time, tui_user_count, ma_open_id, mp_open_id, union_id, is_del, user_code, remark, nickname, create_time, update_time, last_ip, now_money, brokerage_price, balance, sign_num, integral_status, is_buy, password, real_name, birthday, id_card, jpush_id, is_vip, vip_start_date, vip_end_date, vip_level, vip_status, sex, store_open_id, is_official_account_auth, is_push, is_individuation_push, is_weixin_auth, company_id, company_user_id, register_date, register_code, test, login_device, source, is_add_qw, qw_user_id, is_show, parent_id, course_ma_open_id, history_app, qw_ext_id, `rank`, react,order_count,bind_company_user_id from fs_user
     </sql>
 
     <select id="selectFsUserList" parameterType="FsUserScrm" resultMap="FsUserResult">

+ 51 - 51
fs-service/src/main/resources/mapper/live/LiveDataMapper.xml

@@ -283,58 +283,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!-- 查询直播间统计数据 -->
     <select id="selectLiveDataStatistics" resultType="com.fs.live.vo.LiveDataStatisticsVo">
         SELECT
-            COUNT(DISTINCT lwu.user_id) AS totalViewers,
-            COUNT(DISTINCT CASE WHEN l.live_type = 1 THEN lwu.user_id END) AS liveViewers,
-            COUNT(DISTINCT CASE WHEN l.live_type = 3 THEN lwu.user_id END) AS playbackViewers,
-            COALESCE(AVG(CASE WHEN l.live_type = 1 THEN lwu.online_seconds END), 0) AS liveAvgDuration,
-            COALESCE(AVG(CASE WHEN l.live_type = 3 THEN lwu.online_seconds END), 0) AS playbackAvgDuration,
-            COUNT(DISTINCT CASE 
-                WHEN lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0 
-                THEN lwu.user_id 
+            COUNT( lwu.user_id) AS totalViewers,
+            COUNT( CASE WHEN lwu.live_flag = 1 and lwu.replay_flag = 0 THEN lwu.user_id END) AS liveViewers,
+            COUNT( CASE WHEN lwu.live_flag = 0 and lwu.replay_flag = 1 THEN lwu.user_id END) AS playbackViewers,
+            COALESCE(AVG(CASE WHEN lwu.live_flag = 1 and lwu.replay_flag = 0 THEN lwu.online_seconds END), 0) AS liveAvgDuration,
+            COALESCE(AVG(CASE WHEN lwu.live_flag = 0 and lwu.replay_flag = 1 THEN lwu.online_seconds END), 0) AS playbackAvgDuration,
+            COUNT( CASE
+                WHEN lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0
+                THEN lwu.user_id
             END) AS totalCompletedCourses,
-            COUNT(DISTINCT CASE 
-                WHEN l.live_type = 1 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0 
-                THEN lwu.user_id 
+            COUNT( CASE
+                WHEN lwu.live_flag = 1 and lwu.replay_flag = 0 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0
+                THEN lwu.user_id
             END) AS liveCompletedCourses,
-            COUNT(DISTINCT CASE 
-                WHEN l.live_type = 3 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0 
-                THEN lwu.user_id 
+            COUNT( CASE
+                WHEN lwu.live_flag = 0 and lwu.replay_flag = 1 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0
+                THEN lwu.user_id
             END) AS playbackCompletedCourses,
             COALESCE((
-                SELECT SUM(pay_price) 
-                FROM live_order 
-                WHERE live_id IN 
+                SELECT SUM( pay_price)
+                FROM live_order
+                WHERE live_id IN
                 <foreach collection="liveIds" item="liveId" open="(" separator="," close=")">
                     #{liveId}
                 </foreach>
                 AND is_pay = '1'
             ), 0) AS gmv,
             COALESCE((
-                SELECT COUNT(DISTINCT user_id) 
-                FROM live_order 
-                WHERE live_id IN 
-                <foreach collection="liveIds" item="liveId" open="(" separator="," close=")">
-                    #{liveId}
-                </foreach>
-                AND is_pay = '1'
+                select sum(acs.paid) from (SELECT COUNT(DISTINCT user_id) as paid
+                    FROM live_order
+                    WHERE live_id IN
+                    <foreach collection="liveIds" item="liveId" open="(" separator="," close=")">
+                        #{liveId}
+                    </foreach>
+                    AND is_pay = '1'
+                    group by live_id
+                ) acs
             ), 0) AS paidUsers,
             COALESCE((
-                SELECT COUNT(DISTINCT order_id) 
-                FROM live_order 
-                WHERE live_id IN 
+                SELECT COUNT(DISTINCT order_id)
+                FROM live_order
+                WHERE live_id IN
                 <foreach collection="liveIds" item="liveId" open="(" separator="," close=")">
                     #{liveId}
                 </foreach>
                 AND is_pay = '1'
             ), 0) AS paidOrders,
             COALESCE((
-                SELECT COUNT(DISTINCT order_id) 
-                FROM live_order 
-                WHERE live_id IN 
+                SELECT COUNT(DISTINCT order_id)
+                FROM live_order
+                WHERE live_id IN
                 <foreach collection="liveIds" item="liveId" open="(" separator="," close=")">
                     #{liveId}
                 </foreach>
-                AND is_pay = '1'
             ), 0) AS salesCount
         FROM live l
         LEFT JOIN live_watch_user lwu ON l.live_id = lwu.live_id
@@ -359,22 +360,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             l.status AS status,
             l.start_time AS startTime,
             l.finish_time AS finishTime,
-            COUNT(DISTINCT lwu.user_id) AS totalViewers,
-            COUNT(DISTINCT CASE WHEN l.live_type = 1 THEN lwu.user_id END) AS liveViewers,
-            COUNT(DISTINCT CASE WHEN l.live_type = 3 THEN lwu.user_id END) AS playbackViewers,
-            COALESCE(AVG(CASE WHEN l.live_type = 1 THEN lwu.online_seconds END), 0) AS liveAvgDuration,
-            COALESCE(AVG(CASE WHEN l.live_type = 3 THEN lwu.online_seconds END), 0) AS playbackAvgDuration,
-            COUNT(DISTINCT CASE 
-                WHEN lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0 
-                THEN lwu.user_id 
+            COUNT(1) AS totalViewers,
+            COUNT(CASE WHEN lwu.live_flag = 1 and lwu.replay_flag = 0 THEN lwu.user_id END) AS liveViewers,
+            COUNT(CASE WHEN lwu.live_flag = 0 and lwu.replay_flag = 1 THEN lwu.user_id END) AS playbackViewers,
+            COALESCE(AVG(CASE WHEN lwu.live_flag = 1 and lwu.replay_flag = 0 THEN lwu.online_seconds END), 0) AS liveAvgDuration,
+            COALESCE(AVG(CASE WHEN lwu.live_flag = 0 and lwu.replay_flag = 1 THEN lwu.online_seconds END), 0) AS playbackAvgDuration,
+            COUNT(CASE
+                WHEN lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0
+                THEN lwu.user_id
             END) AS totalCompletedCourses,
-            COUNT(DISTINCT CASE 
-                WHEN l.live_type = 1 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0 
-                THEN lwu.user_id 
+            COUNT(CASE
+                WHEN lwu.live_flag = 1  and lwu.replay_flag = 0 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0
+                THEN lwu.user_id
             END) AS liveCompletedCourses,
-            COUNT(DISTINCT CASE 
-                WHEN l.live_type = 3 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0 
-                THEN lwu.user_id 
+            COUNT(CASE
+                WHEN lwu.live_flag = 0  and lwu.replay_flag = 1 AND lwu.online_seconds >= COALESCE(video_duration.total_duration, 0) AND video_duration.total_duration > 0
+                THEN lwu.user_id
             END) AS playbackCompletedCourses,
             COALESCE(order_stats.gmv, 0) AS gmv,
             COALESCE(order_stats.paidUsers, 0) AS paidUsers,
@@ -389,21 +390,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             GROUP BY live_id
         ) video_duration ON l.live_id = video_duration.live_id
         LEFT JOIN (
-            SELECT 
+            SELECT
                 live_id,
-                SUM(pay_price) AS gmv,
-                COUNT(DISTINCT user_id) AS paidUsers,
-                COUNT(DISTINCT order_id) AS paidOrders,
+                SUM( case when is_pay = '1' then pay_price else 0 end) AS gmv,
+                COUNT(distinct CASE WHEN is_pay = '1' THEN user_id END) AS paidUsers,
+                sum(CASE WHEN is_pay = '1' THEN 1 else 0 END) AS paidOrders,
                 COUNT(DISTINCT order_id) AS salesCount
             FROM live_order
-            WHERE is_pay = '1'
             GROUP BY live_id
         ) order_stats ON l.live_id = order_stats.live_id
         WHERE l.live_id IN
         <foreach collection="liveIds" item="liveId" open="(" separator="," close=")">
             #{liveId}
         </foreach>
-        GROUP BY l.live_id, l.live_name, l.live_type, l.status, l.start_time, l.finish_time, 
+        GROUP BY l.live_id, l.live_name, l.live_type, l.status, l.start_time, l.finish_time,
                  order_stats.gmv, order_stats.paidUsers, order_stats.paidOrders, order_stats.salesCount
         ORDER BY l.start_time DESC
     </select>

+ 15 - 0
fs-user-app/src/main/java/com/fs/app/controller/live/LiveOrderController.java

@@ -1159,6 +1159,21 @@ public class LiveOrderController extends AppBaseController
         return orderService.getExpress(order);
     }
 
+    @Login
+    @ApiOperation("物流查询多运单号")
+    @PostMapping("/getExpressMulti")
+    public R getExpressMulti( @Validated @RequestBody FsStoreOrderExpressParam param){
+        log.info("物流查询多运单号 请求参数: {}", JSON.toJSONString(param));
+        LiveOrder order=orderService.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
+        if (ObjectUtil.isNull(order)) {
+            throw new CustomException("订单不存在");
+        }
+//        if (order.getStatus() < 2) {
+//            throw new CustomException("未发货订单不能查询");
+//        }
+        return orderService.getExpressMulti(order);
+    }
+
 
 
     @Login

+ 1 - 1
fs-user-app/src/main/resources/application.yml

@@ -13,4 +13,4 @@ spring:
 #    active: druid-sxjz
 #    active: druid-qdtst
 #    active: druid-yzt
-    active: dev
+    active: druid-bjzm-test