Przeglądaj źródła

发货物流单号同步刷新问题处理

yzc 1 rok temu
rodzic
commit
99e49009c9

+ 9 - 7
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/controller/deliver/DeliverGoodsController.java

@@ -1,16 +1,18 @@
 package com.fjhx.victoriatourist.controller.deliver;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.purchase.entity.purchase.vo.PurchaseVo;
-import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
+import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsDto;
+import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsSelectDto;
 import com.fjhx.victoriatourist.entity.deliver.vo.DeliverGoodsDetailsVo;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.victoriatourist.entity.deliver.vo.DeliverGoodsVo;
-import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsSelectDto;
-import com.fjhx.victoriatourist.entity.deliver.dto.DeliverGoodsDto;
-import com.ruoyi.common.core.domain.BaseSelectDto;
 import com.fjhx.victoriatourist.service.deliver.DeliverGoodsService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
@@ -76,7 +78,7 @@ public class DeliverGoodsController {
      * @return
      */
     @PostMapping("/list")
-    public List<DeliverGoods> list(@RequestBody BaseSelectDto dto) {
+    public List<DeliverGoodsVo> list(@RequestBody BaseSelectDto dto) {
         return deliverGoodsService.list(dto.getId());
     }
 

+ 2 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/mapper/deliver/DeliverGoodsMapper.java

@@ -26,6 +26,8 @@ public interface DeliverGoodsMapper extends BaseMapper<DeliverGoods> {
      * 发货分页
      */
     Page<DeliverGoodsVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<DeliverGoods> wrapper);
+    List<DeliverGoodsVo> getList( @Param("ew") IWrapper<Object> wrapper);
+
 
     List<DeliverGoodsDetailsVo> listDeliverGoodsDetails(@Param("ew") IWrapper<DeliverGoods> wrapper);
 

+ 1 - 1
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/deliver/DeliverGoodsService.java

@@ -53,7 +53,7 @@ public interface DeliverGoodsService extends BaseService<DeliverGoods> {
      *
      * @return
      */
-    List<DeliverGoods> list(Long id);
+    List<DeliverGoodsVo> list(Long id);
 
     /**
      * 维多利亚到货明细

+ 2 - 2
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/deliver/impl/DeliverGoodsServiceImpl.java

@@ -254,9 +254,9 @@ public class DeliverGoodsServiceImpl extends ServiceImpl<DeliverGoodsMapper, Del
     }
 
     @Override
-    public List<DeliverGoods> list(Long id) {
+    public List<DeliverGoodsVo> list(Long id) {
         //根据采购id查发货列表
-        List<DeliverGoods> list = list(q -> q.eq(DeliverGoods::getPurchaseId, id).eq(DeliverGoods::getStatus, 0));
+        List<DeliverGoodsVo> list = baseMapper.getList(IWrapper.getWrapper().eq(DeliverGoods::getPurchaseId, id).eq(DeliverGoods::getStatus, 0));
         return list;
     }
 

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

@@ -2,6 +2,7 @@ package com.fjhx.victoriatourist.service.logistics.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -20,12 +21,14 @@ import com.fjhx.kd100.util.KD100Result;
 import com.fjhx.kd100.util.KD100Util;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.service.purchase.PurchaseService;
+import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
 import com.fjhx.victoriatourist.entity.logistics.dto.LogisticsInfosDto;
 import com.fjhx.victoriatourist.entity.logistics.dto.LogisticsInfosSelectDto;
 import com.fjhx.victoriatourist.entity.logistics.po.LogisticsDetails;
 import com.fjhx.victoriatourist.entity.logistics.po.LogisticsInfos;
 import com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo;
 import com.fjhx.victoriatourist.mapper.logistics.LogisticsInfosMapper;
+import com.fjhx.victoriatourist.service.deliver.DeliverGoodsService;
 import com.fjhx.victoriatourist.service.jd.JdBackService;
 import com.fjhx.victoriatourist.service.logistics.LogisticsDetailsService;
 import com.fjhx.victoriatourist.service.logistics.LogisticsInfosService;
@@ -68,6 +71,8 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
     private ISysRoleService sysRoleService;
     @Autowired
     private ConfigInfoService configInfoService;
+    @Autowired
+    private DeliverGoodsService deliverGoodsService;
 
 
     @Override
@@ -86,10 +91,10 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
             wrapper.and(q -> q.like("li", LogisticsInfos::getCode, dto.getKeyword())
                     .or().like("IF( li.business_type IN ( 1, 5 ), p.contractCode, li.business_code ) ", dto.getKeyword())
                     .or().in("li", LogisticsInfos::getLogisticsCompanyCode, companyCodes)
-                    .or(flag).like(flag,"pi.custom_code", dto.getKeyword())
-                    .or(flag).like(flag,"pi.name", dto.getKeyword())
+                    .or(flag).like(flag, "pi.custom_code", dto.getKeyword())
+                    .or(flag).like(flag, "pi.name", dto.getKeyword())
                     //采购到货 采购退货 来源
-                    .or().inSql("p.id","select pd.purchase_id from bytesailing_purchase.purchase_detail pd LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id where ( pi.`name` LIKE CONCAT( '%', '"+dto.getKeyword()+"', '%' ) OR pi.custom_code LIKE CONCAT( '%', '"+dto.getKeyword()+"', '%' ))")
+                    .or().inSql("p.id", "select pd.purchase_id from bytesailing_purchase.purchase_detail pd LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id where ( pi.`name` LIKE CONCAT( '%', '" + dto.getKeyword() + "', '%' ) OR pi.custom_code LIKE CONCAT( '%', '" + dto.getKeyword() + "', '%' ))")
             );
         }
 
@@ -184,7 +189,10 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
 
     @Override
     public void edit(LogisticsInfosDto logisticsInfosDto) {
-        if (logisticsInfosDto.getIsKd100() == 1) {
+        //只在生产环境调用Kd100
+        String activeProfile = SpringUtil.getActiveProfile();
+
+        if ("prod".equals(activeProfile) && logisticsInfosDto.getIsKd100() == 1) {
             //发起快递100订阅
             DynamicDataSourceContextHolder.push(SourceConstant.KD100);
             Integer state = KD100Util.monitor(logisticsInfosDto.getLogisticsCompanyCode(), logisticsInfosDto.getCode(), logisticsInfosDto.getId(), logisticsInfosDto.getBusinessType(), LogisticsInfos.class).getState();
@@ -194,6 +202,15 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
         }
 
         this.updateById(logisticsInfosDto);
+
+        //更新发货单号
+        if (ObjectUtil.equals(logisticsInfosDto.getBusinessType(), 1)) {
+            deliverGoodsService.update(q -> q
+                    .eq(DeliverGoods::getId, logisticsInfosDto.getBusinessId())
+                    .set(DeliverGoods::getLogisticsCompanyCode, logisticsInfosDto.getLogisticsCompanyCode())
+                    .set(DeliverGoods::getCode, logisticsInfosDto.getCode())
+            );
+        }
     }
 
     @Override
@@ -205,7 +222,7 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
     public KD100Result getLogistics(Long id) {
         LogisticsInfos logisticsInfo = this.getById(id);
         Assert.notEmpty(logisticsInfo, "没有找到物流信息");
-        return KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(),logisticsInfo.getPhone());
+        return KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(), logisticsInfo.getPhone());
     }
 
     @Override
@@ -213,7 +230,7 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
     public void dataInfoEdit(Long id) {
         LogisticsInfos logisticsInfo = getById(id);
         Assert.notEmpty(logisticsInfo, "没有找到物流信息");
-        KD100Result kd100Result = KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(),logisticsInfo.getPhone());
+        KD100Result kd100Result = KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(), logisticsInfo.getPhone());
         Integer state = kd100Result.getState();
         if (ObjectUtil.notEqual(state, logisticsInfo.getLogisticsStatus())) {
             //原来是异常物流信息 限制刷新到状态就添加订阅

+ 10 - 0
hx-victoriatourist/src/main/resources/mapper/deliver/DeliverGoodsMapper.xml

@@ -43,5 +43,15 @@
             sw.business_id = #{id}
           and sw.del_flag = 0
     </select>
+    <select id="getList" resultType="com.fjhx.victoriatourist.entity.deliver.vo.DeliverGoodsVo">
+        SELECT
+            li.logistics_company_code,
+            li.`code`,
+            dg.*
+        FROM
+            deliver_goods dg
+                LEFT JOIN logistics_infos li ON li.business_id = dg.id
+        ${ew.customSqlSegment}
+    </select>
 
 </mapper>