Pārlūkot izejas kodu

物流数据,异常管理 页面优化

yzc 1 gadu atpakaļ
vecāks
revīzija
2d82b29c83

+ 4 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/controller/logistics/LogisticsInfosController.java

@@ -116,4 +116,8 @@ public class LogisticsInfosController {
             }
         }
     }
+    @PostMapping("/test1")
+    public void test1(@RequestBody LogisticsInfosDto dto){
+        KD100Util.subscribe("","");
+    }
 }

+ 3 - 3
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/mapper/abnormal/AbnormalInfoMapper.java

@@ -1,8 +1,8 @@
 package com.fjhx.victoriatourist.mapper.abnormal;
 
-import com.fjhx.victoriatourist.entity.abnormal.po.AbnormalInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.victoriatourist.entity.abnormal.po.AbnormalInfo;
 import com.fjhx.victoriatourist.entity.abnormal.vo.AbnormalInfoVo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
  * 异常记录 Mapper 接口
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-04-11
  */
 public interface AbnormalInfoMapper extends BaseMapper<AbnormalInfo> {
@@ -21,6 +21,6 @@ public interface AbnormalInfoMapper extends BaseMapper<AbnormalInfo> {
     /**
      * 异常记录分页
      */
-    Page<AbnormalInfoVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<AbnormalInfo> wrapper);
+    Page<AbnormalInfoVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<AbnormalInfo> wrapper, @Param("businessType") Integer businessType);
 
 }

+ 1 - 1
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/mapper/logistics/LogisticsInfosMapper.java

@@ -24,7 +24,7 @@ public interface LogisticsInfosMapper extends BaseMapper<LogisticsInfos> {
     /**
      * 物流信息分页
      */
-    Page<LogisticsInfosVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<LogisticsInfos> wrapper);
+    Page<LogisticsInfosVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<LogisticsInfos> wrapper, @Param("businessType") Integer businessType);
 
     /**
      * 获取物流关联产品部门列表

+ 7 - 5
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/abnormal/impl/AbnormalInfoServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.common.utils.Assert;
 import com.fjhx.victoriatourist.entity.abnormal.dto.AbnormalInfoSelectDto;
 import com.fjhx.victoriatourist.entity.abnormal.po.AbnormalInfo;
 import com.fjhx.victoriatourist.entity.abnormal.vo.AbnormalInfoVo;
@@ -39,14 +40,14 @@ public class AbnormalInfoServiceImpl extends ServiceImpl<AbnormalInfoMapper, Abn
     @Override
     public Page<AbnormalInfoVo> getPage(AbnormalInfoSelectDto dto) {
         IWrapper<AbnormalInfo> wrapper = getWrapper();
-        wrapper.eq("ai",AbnormalInfo::getType, dto.getType())
-                .eq("ai",AbnormalInfo::getStatus, dto.getStatus());
+        wrapper.eq("ai", AbnormalInfo::getType, dto.getType())
+                .eq("ai", AbnormalInfo::getStatus, dto.getStatus());
 
         //采购人id过滤
         wrapper.eq("p.create_user", dto.getPurchaseUserId());
         wrapper.keyword(dto.getKeyword(),
-                new SqlField("ai",AbnormalInfo::getTitle),
-                new SqlField("ai",AbnormalInfo::getLinkCode),
+                new SqlField("ai", AbnormalInfo::getTitle),
+                new SqlField("ai", AbnormalInfo::getLinkCode),
                 new SqlField("pi.custom_code"),
                 new SqlField("pi.name")
         );
@@ -66,7 +67,8 @@ public class AbnormalInfoServiceImpl extends ServiceImpl<AbnormalInfoMapper, Abn
         wrapper.groupBy("ai.id");
 
         wrapper.orderByDesc("ai", AbnormalInfo::getId);
-        Page<AbnormalInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        Assert.notEmpty(dto.getType(), "异常来源类型不能为空");
+        Page<AbnormalInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper, dto.getType());
         //赋值创建人名称
         UserUtil.assignmentNickName(page.getRecords(), AbnormalInfo::getCreateUser, AbnormalInfoVo::setCreateUserName);
         //赋值跟进人名称

+ 6 - 1
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/logistics/impl/LogisticsInfosServiceImpl.java

@@ -105,7 +105,8 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
         wrapper.groupBy("li.id");
 
         wrapper.orderByDesc("li", LogisticsInfos::getId);
-        Page<LogisticsInfosVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        Assert.notEmpty(dto.getBusinessType(), "物流数据来源类型不能为空");
+        Page<LogisticsInfosVo> page = this.baseMapper.getPage(dto.getPage(), wrapper, dto.getBusinessType());
         List<LogisticsInfosVo> records = page.getRecords();
         //赋值物流公司名字
         List<String> codes = records.stream().map(LogisticsInfosVo::getLogisticsCompanyCode).collect(Collectors.toList());
@@ -204,6 +205,10 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
         KD100Result kd100Result = KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode());
         Integer state = kd100Result.getState();
         if (ObjectUtil.notEqual(state, logisticsInfo.getLogisticsStatus())) {
+            //原来是异常物流信息 限制刷新到状态就添加订阅
+            if (logisticsInfo.getLogisticsStatus() == -1) {
+                KD100Util.subscribe(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode());
+            }
             logisticsInfo.setLogisticsStatus(state);
             updateById(logisticsInfo);
             //如果是京东退货且物流状态为完成

+ 22 - 14
hx-victoriatourist/src/main/resources/mapper/abnormal/AbnormalInfoMapper.xml

@@ -16,22 +16,30 @@
             ai.create_time,
             ai.update_user,
             ai.update_time,
-            p.create_user purchaseUserId,
             ai.purchase_id
+            <if test="businessType eq 10 or businessType eq 50">
+                ,p.create_user purchaseUserId
+            </if>
         from abnormal_info ai
-                 left JOIN bytesailing_purchase.purchase p ON ai.purchase_id = p.id
-                 LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = p.id
-                <!-- 调仓来源 -->
-                left JOIN stock_transfer st ON ai.link_id = st.id
-                left JOIN stock_transfer_details std ON std.stock_transfer_id = st.id
-                <!-- 到货来源 -->
-                left JOIN bytesailing_purchase.arrival arr ON ai.link_id = arr.id and arr.del_flag = 0
-                left JOIN bytesailing_purchase.arrival_detail arrd ON arrd.arrival_id = arr.id and arr.del_flag = 0
-                <!-- 产品信息 -->
-                 LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
-                    or std.product_id = pi.id or arrd.bussiness_id = pi.id
-                 LEFT JOIN bytesailing_base.sys_dept de
-                           ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
+                <!-- 到货质检 待入库 来源 -->
+                <if test="businessType eq 10 or businessType eq 50">
+                        left JOIN bytesailing_purchase.purchase p ON ai.purchase_id = p.id
+                        LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = p.id
+                        LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
+                </if>
+                <!-- 京东订单出库 调仓来源 -->
+                <if test="businessType eq 20 or businessType eq 30">
+                        left JOIN stock_transfer st ON ai.link_id = st.id
+                        left JOIN stock_transfer_details std ON std.stock_transfer_id = st.id
+                        LEFT JOIN bytesailing_item.product_info pi ON std.product_id = pi.id
+                </if>
+                <!-- 到货异常来源 -->
+                <if test="businessType eq 40">
+                        left JOIN bytesailing_purchase.arrival arr ON ai.link_id = arr.id and arr.del_flag = 0
+                        left JOIN bytesailing_purchase.arrival_detail arrd ON arrd.arrival_id = arr.id and arr.del_flag = 0
+                        LEFT JOIN bytesailing_item.product_info pi ON arrd.bussiness_id = pi.id
+                </if>
+                LEFT JOIN bytesailing_base.sys_dept de ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
             ${ew.customSqlSegment}
     </select>
 

+ 27 - 18
hx-victoriatourist/src/main/resources/mapper/logistics/LogisticsInfosMapper.xml

@@ -23,28 +23,37 @@
             li.city_id,
             li.address,
             li.purchase_id,
-            de.dept_name,
-            dg.status arrivalStatus
+            de.dept_name
+            <if test="businessType eq 1 or businessType eq 5">
+               ,dg.status arrivalStatus
+            </if>
         from logistics_infos li
-                LEFT JOIN deliver_goods dg on li.business_id = dg.id
-                LEFT JOIN bytesailing_purchase.purchase p ON li.purchase_id = p.id
-                LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = p.id
+                <!-- 采购到货 采购退货 来源 -->
+                <if test="businessType eq 1 or businessType eq 5">
+                    LEFT JOIN deliver_goods dg on li.business_id = dg.id
+                    LEFT JOIN bytesailing_purchase.purchase p ON li.purchase_id = p.id
+                    LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = p.id
+                    LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
+                </if>
                 <!-- 京东退货来源 -->
-                LEFT JOIN jd_back jb ON li.business_id = jb.id
-                LEFT JOIN jd_back_details jbd ON jbd.jd_back_id = jb.id
+                <if test="businessType eq 4">
+                    LEFT JOIN jd_back jb ON li.business_id = jb.id
+                    LEFT JOIN jd_back_details jbd ON jbd.jd_back_id = jb.id
+                    LEFT JOIN bytesailing_item.product_info pi ON jbd.product_code = pi.custom_code
+                </if>
                 <!-- 京东订单来源 -->
-                LEFT JOIN jd_order jo ON li.business_id = jo.id
-                LEFT JOIN jd_order_details jod ON jod.jd_order_id = jo.id
+                <if test="businessType eq 2">
+                    LEFT JOIN jd_order jo ON li.business_id = jo.id
+                    LEFT JOIN jd_order_details jod ON jod.jd_order_id = jo.id
+                    LEFT JOIN bytesailing_item.product_info pi ON jod.product_id = pi.id
+                </if>
                 <!-- 销售订单来源 -->
-                LEFT JOIN order_info oi ON li.business_id = oi.id
-                LEFT JOIN order_details od ON od.order_id = oi.id
-                <!-- 关联产品 -->
-                LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
-                OR jbd.product_code = pi.custom_code
-                OR jod.product_id = pi.id
-                OR od.product_id = pi.id
-        LEFT JOIN bytesailing_base.sys_dept de
-                           ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
+                <if test="businessType eq 3">
+                    LEFT JOIN order_info oi ON li.business_id = oi.id
+                    LEFT JOIN order_details od ON od.order_id = oi.id
+                    LEFT JOIN bytesailing_item.product_info pi ON od.product_id = pi.id
+                </if>
+                LEFT JOIN bytesailing_base.sys_dept de ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
             ${ew.customSqlSegment}
     </select>
     <select id="getDepts" resultType="com.ruoyi.common.core.domain.entity.SysDept">