From fd6fa31e8034164a408900f404140379508133ca Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Thu, 14 Dec 2023 15:24:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=90=E5=8D=95=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E6=95=B0=E6=8D=AE=E5=85=A5=E5=BA=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/IOldSystemWaybillClient.java | 28 +++++ ...ushClient.java => IOldSignPushClient.java} | 2 +- .../oldproject/feign/IOldWaybillClient.java | 38 ++++++ .../ClerkCheckPushDataQueueHandler.java | 11 +- .../factory/feign/OldSystemWaybillClient.java | 27 +++++ .../receiver/OpOldReceivingDataHandler.java | 7 +- blade-service/logpm-old-project/pom.xml | 11 ++ .../oldproject/feign/OldWaybillClient.java | 111 ++++++++++++++++++ .../oldproject/feign/SignPushClient.java | 2 +- .../java/com/logpm/oldproject/CodeTest.java | 24 ++++ .../launch/OldProjectLauncherServiceImpl.java | 60 ++++++++++ blade-service/logpm-warehouse/pom.xml | 2 + .../com/logpm/warehouse/dto/WaybillDTO.java | 13 ++ .../receiver/WaybillDataHandler.java | 17 ++- .../impl/WarehouseWaybillServiceImpl.java | 15 ++- 15 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/feign/IOldSystemWaybillClient.java rename blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/{IOldSystemDataPushClient.java => IOldSignPushClient.java} (94%) create mode 100644 blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldWaybillClient.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/feign/OldSystemWaybillClient.java create mode 100644 blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java create mode 100644 blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/CodeTest.java create mode 100644 blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/launch/OldProjectLauncherServiceImpl.java diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/feign/IOldSystemWaybillClient.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/feign/IOldSystemWaybillClient.java new file mode 100644 index 000000000..e2790e7c1 --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/feign/IOldSystemWaybillClient.java @@ -0,0 +1,28 @@ +package com.logpm.factory.feign; + + +import org.springblade.common.constant.ModuleNameConstant; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@FeignClient( + value = ModuleNameConstant.APPLICATION_FACTORY_NAME +) +public interface IOldSystemWaybillClient { + + String API_PREFIX = "/client"; + String HANDLEDATATOPLATFORM = API_PREFIX + "/handleDataToPlatform"; + + /** + * 处理订单入库数据 + * @param unitNo + * @param operationTime + */ + @GetMapping(HANDLEDATATOPLATFORM) + void handleDataToPlatform(@RequestParam("unitNo") String unitNo, @RequestParam("operationTime") String operationTime); + + + + +} diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldSystemDataPushClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldSignPushClient.java similarity index 94% rename from blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldSystemDataPushClient.java rename to blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldSignPushClient.java index 34b34d08b..f5c0818e6 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldSystemDataPushClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldSignPushClient.java @@ -14,7 +14,7 @@ import java.util.Map; @FeignClient( value = ModuleNameConstant.APPLICATION_OLDPROJECT_NAME ) -public interface IOldSystemDataPushClient { +public interface IOldSignPushClient { String API_PREFIX = "/client"; diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldWaybillClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldWaybillClient.java new file mode 100644 index 000000000..556f07eaa --- /dev/null +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOldWaybillClient.java @@ -0,0 +1,38 @@ +package com.logpm.oldproject.feign; + +import com.logpm.oldproject.dto.SignPushDataDTO; +import org.checkerframework.checker.units.qual.A; +import org.springblade.common.constant.ModuleNameConstant; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Map; + +/** + * 老系统的开单的运单推送入库接口 + */ +@FeignClient( + value = ModuleNameConstant.APPLICATION_OLDPROJECT_NAME +) +public interface IOldWaybillClient { + + + String API_PREFIX = "/client"; + + + /** + * 查询处理系统运单信息 + * @param waybillId + * @param waybillNo + * @return + */ + @GetMapping(API_PREFIX+"/waybillDataHandler") + R waybillDataHandler(@RequestParam String waybillId, @RequestParam String waybillNo); + + + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushDataQueueHandler.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushDataQueueHandler.java index 6737a6866..54415898d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushDataQueueHandler.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushDataQueueHandler.java @@ -1,41 +1,34 @@ package com.logpm.distribution.receiver; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataTripartiteWarehouseClient; import com.logpm.distribution.dto.DistributionSignforDTO; import com.logpm.distribution.entity.*; import com.logpm.distribution.mapper.*; import com.logpm.distribution.service.IDistributionStockService; import com.logpm.distribution.vo.DistributionSignPrintVO; -import com.logpm.distribution.vo.DistributionStockupStockListVO; import com.logpm.oldproject.dto.SignPushDataContactDTO; import com.logpm.oldproject.dto.SignPushDataDTO; import com.logpm.oldproject.dto.SignPushDataUnitDTO; import com.logpm.oldproject.entity.WarehouseEntity; -import com.logpm.oldproject.feign.IOldSystemDataPushClient; +import com.logpm.oldproject.feign.IOldSignPushClient; import com.logpm.oldproject.feign.IWarehouseClient; import com.rabbitmq.client.Channel; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.RabbitConstant; -import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.stockup.StockAssignStatusConstant; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.entity.User; import org.springblade.system.feign.IUserClient; -import org.springblade.system.feign.IUserSearchClient; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -55,7 +48,7 @@ public class ClerkCheckPushDataQueueHandler { @Autowired private IDistributionStockService distributionStockService; @Autowired - private IOldSystemDataPushClient oldSystemDataPushClient; + private IOldSignPushClient oldSystemDataPushClient; @Autowired private DistributionSignforMapper distributionSignforMapper; @Autowired diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/feign/OldSystemWaybillClient.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/feign/OldSystemWaybillClient.java new file mode 100644 index 000000000..350d332ed --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/feign/OldSystemWaybillClient.java @@ -0,0 +1,27 @@ +package com.logpm.factory.feign; + +import com.logpm.factory.pan.service.IPanFactoryDataService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +@Slf4j +@ApiIgnore() +@RestController +@AllArgsConstructor +public class OldSystemWaybillClient implements IOldSystemWaybillClient{ + + + + private final IPanFactoryDataService panFactoryDataService; + + @GetMapping(HANDLEDATATOPLATFORM) + @Override + public void handleDataToPlatform(String unitNo, String operationTime) { + log.info(">>>>>>>>> 运单开单 保存包件数据 {}",unitNo); + panFactoryDataService.handleDataToPlatform(unitNo,operationTime); + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java index 8bfcef739..e38228a21 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java @@ -1,7 +1,5 @@ package com.logpm.factory.oupai.receiver; -import cn.hutool.http.HttpRequest; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; @@ -11,10 +9,9 @@ import com.logpm.factory.oupai.entity.FactoryPackageEntity; import com.logpm.factory.oupai.service.IFactoryPackageService; import com.logpm.factory.pan.service.IPanFactoryDataService; import com.logpm.oldproject.entity.WarehouseEntity; -import com.logpm.oldproject.feign.IOldSystemDataPushClient; +import com.logpm.oldproject.feign.IOldSignPushClient; import com.logpm.oldproject.feign.IWarehouseClient; import com.rabbitmq.client.Channel; -import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.RabbitConstant; import org.springblade.core.redis.cache.BladeRedis; @@ -51,7 +48,7 @@ public class OpOldReceivingDataHandler { @Autowired - private IOldSystemDataPushClient oldSystemDataPushClient; + private IOldSignPushClient oldSystemDataPushClient; @Autowired private IFactoryPackageService factoryPackageService; diff --git a/blade-service/logpm-old-project/pom.xml b/blade-service/logpm-old-project/pom.xml index c34c39e7d..d3a9b5aa2 100644 --- a/blade-service/logpm-old-project/pom.xml +++ b/blade-service/logpm-old-project/pom.xml @@ -35,6 +35,14 @@ logpm-old-project-api ${bladex.project.version} + + + org.springblade + logpm-factory-api + ${bladex.project.version} + + + com.baomidou dynamic-datasource-spring-boot-starter @@ -54,6 +62,9 @@ provided + + + diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java new file mode 100644 index 000000000..53730dc2e --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java @@ -0,0 +1,111 @@ +package com.logpm.oldproject.feign; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.logpm.factory.feign.IOldSystemWaybillClient; +import com.logpm.oldproject.entity.WayBillEntity; +import com.logpm.oldproject.props.OldSystemProperties; +import com.logpm.oldproject.service.IWayBillService; +import jodd.util.StringUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.redis.cache.BladeRedis; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@ApiIgnore() +@RestController +@AllArgsConstructor +@Slf4j +public class OldWaybillClient implements IOldWaybillClient { + @Autowired + private IOldSystemWaybillClient oldSystemWaybillClient; + @Autowired + private BladeRedis bladeRedis; + @Autowired + private OldSystemProperties oldSystemProperties; + @Autowired + private IWayBillService wayBillService; + + @Override + public R waybillDataHandler(String waybillId, String waybillNo) { + + // 更加运单ID查询系统数据 + log.info("##################pushOldSystemSignInfo: 请求老系统接口 start waybillId {},waybillNo {}", waybillId, waybillNo); + + WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId)); + + String authCode = oldLogin(byWaybillId.getArriveSiteId() + ""); + + String url = oldSystemProperties.getUrl() + "openApi/newSystem.WaybillQuery/index?waybillId=" + waybillId; + + String body = HttpRequest.get(url).header("token", authCode).execute().body(); + JSONObject jsonObject = JSONObject.parseObject(body); + if (200 == Integer.parseInt(jsonObject.get("code").toString())) { + // 请求成功 + JSONArray jsonArray = jsonObject.getJSONArray("data"); + // 循环结果 + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject temp = jsonArray.getJSONObject(i); + // 订单编号 + String orderSelfNum = temp.getString("orderSelfNum"); + JSONArray unitNos = temp.getJSONArray("unitNo"); + + for (int i1 = 0; i1 < unitNos.size(); i1++) { + String unitNo = unitNos.getString(i1); + log.info(">>>>>>>> 保存开单推送的已入库包件 {} 保存到新系统",unitNo); + + String operationTime = DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss"); + oldSystemWaybillClient.handleDataToPlatform(unitNo,operationTime); + } + + + } + } else { + // 请求失败 + } + + return null; + } + + /** + * 登录老系统 + * + * @param warhouseId 仓库ID + * @return 成功token + */ + private String oldLogin(String warhouseId) { + String o = bladeRedis.get(oldSystemProperties.getUserId() + "_" + warhouseId); + if (StringUtil.isBlank(o)) { + String url = oldSystemProperties.getUrl() + "api/fakeLogin"; + + Map map = new HashMap<>(); + map.put("pwd", oldSystemProperties.getPwd()); + map.put("user_id", oldSystemProperties.getUserId()); + map.put("warehouse_id", warhouseId); + String body = HttpRequest.post(url).form(map).execute().body(); + log.info("##################opReceivingDataHandler: 请求老系统接口,url:{},body:{}", url, body); + + + JSONObject authCode = JSON.parseObject(body); + + if ("200".equals(authCode.getString("code"))) { + + o = authCode.getJSONObject("data").getJSONObject("token").getString("token"); + bladeRedis.setEx(oldSystemProperties.getUserId() + "_" + warhouseId, o, 30 * 60L); + + } + } + + return o; + } +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/SignPushClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/SignPushClient.java index 03b62849f..5b2346c28 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/SignPushClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/SignPushClient.java @@ -20,7 +20,7 @@ import java.util.Map; @RestController @AllArgsConstructor @Slf4j -public class SignPushClient implements IOldSystemDataPushClient { +public class SignPushClient implements IOldSignPushClient { @Autowired private BladeRedis bladeRedis; @Autowired diff --git a/blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/CodeTest.java b/blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/CodeTest.java new file mode 100644 index 000000000..ecfc62570 --- /dev/null +++ b/blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/CodeTest.java @@ -0,0 +1,24 @@ +package com.logpm.oldproject; + +import com.logpm.oldproject.feign.IOldWaybillClient; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springblade.core.test.BladeBootTest; +import org.springblade.core.test.BladeSpringExtension; +import org.springframework.beans.factory.annotation.Autowired; + +@ExtendWith(BladeSpringExtension.class) +@BladeBootTest(appName = "logpm-old-project-pref", enableLoader = true) +public class CodeTest { + + @Autowired + private IOldWaybillClient oldWaybillClient; + + + @Test + public void test1(){ + + oldWaybillClient.waybillDataHandler("100001","编号"); + + } +} diff --git a/blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/launch/OldProjectLauncherServiceImpl.java b/blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/launch/OldProjectLauncherServiceImpl.java new file mode 100644 index 000000000..7a8000e61 --- /dev/null +++ b/blade-service/logpm-old-project/src/test/java/com/logpm/oldproject/launch/OldProjectLauncherServiceImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.oldproject.launch; + +import org.springblade.core.auto.service.AutoService; +import org.springblade.core.launch.constant.NacosConstant; +import org.springblade.core.launch.service.LauncherService; +import org.springblade.core.launch.utils.PropsUtil; +import org.springframework.boot.builder.SpringApplicationBuilder; + +import java.util.Properties; + +/** + * 启动参数拓展 + * + * @author Chill + */ +@AutoService(LauncherService.class) +public class OldProjectLauncherServiceImpl implements LauncherService { + + @Override + public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) { + Properties props = System.getProperties(); + // 开启多数据源 + PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true"); + // 指定注册配置信息 + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].data-id", NacosConstant.dataId("factory", profile)); + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].group", NacosConstant.NACOS_CONFIG_GROUP); + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH); + // 指定注册IP + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1"); + // 指定注册端口 + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "8200"); + // 自定义命名空间 + // PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE); + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE); + // 自定义分组 + // PropsUtil.setProperty(props, "spring.cloud.nacos.config.group", NacosConstant.NACOS_CONFIG_GROUP); + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.group", NacosConstant.NACOS_CONFIG_GROUP); + } + + @Override + public int getOrder() { + return 20; + } +} diff --git a/blade-service/logpm-warehouse/pom.xml b/blade-service/logpm-warehouse/pom.xml index ff1cf0cf7..2da45894c 100644 --- a/blade-service/logpm-warehouse/pom.xml +++ b/blade-service/logpm-warehouse/pom.xml @@ -80,6 +80,8 @@ ${bladex.project.version} + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java index 16de4af33..2e41aa583 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java @@ -1,5 +1,6 @@ package com.logpm.warehouse.dto; +import io.swagger.models.auth.In; import lombok.Data; import java.io.Serializable; @@ -8,6 +9,11 @@ import java.io.Serializable; public class WaybillDTO implements Serializable { + /** + * 如果不是零担 就会推送运单号给我 + * + */ + /** * 运单号ID */ @@ -23,5 +29,12 @@ public class WaybillDTO implements Serializable { */ private Integer number; + /** + * 零担 1 正常运单 0 + */ + private Integer isZero; + + + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java index 9f3fbf241..8f95bd949 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/WaybillDataHandler.java @@ -1,5 +1,6 @@ package com.logpm.warehouse.receiver; +import com.logpm.oldproject.feign.IOldWaybillClient; import com.logpm.warehouse.dto.WaybillDTO; import com.logpm.warehouse.service.IWarehouseWaybillService; import com.rabbitmq.client.Channel; @@ -27,6 +28,8 @@ import java.util.Objects; public class WaybillDataHandler { private final IWarehouseWaybillService warehouseWaybillService; + private final IOldWaybillClient oldWaybillClient; + @RabbitHandler public void waybillDataHandler(Map map, Message message, Channel channel) { @@ -38,7 +41,19 @@ public class WaybillDataHandler { if (!Objects.isNull(waybillDTO)) { try { - warehouseWaybillService.waybillDataHandler(waybillDTO); + + if (waybillDTO.getIsZero() == 1) { + // 零担处理 + warehouseWaybillService.waybillDataHandler(waybillDTO); + } else if (waybillDTO.getIsZero() == 0) { + // 正常运单 + oldWaybillClient.waybillDataHandler(waybillDTO.getId()+"",waybillDTO.getWaybillNo()); + + } else { + log.error(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的运单类型"); + } + + } catch (Exception e) { log.error(e.getMessage()); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index 98e9f7105..7d5e06df6 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java @@ -82,7 +82,14 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl