From 41251b892bf44b99d8b87058ca658f019c49857e Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Fri, 22 Dec 2023 09:46:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8E=A8=E9=80=81=E5=BC=80=E5=8D=95=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oldproject/feign/OldWaybillClient.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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 index d27f5775e..c20cecb94 100644 --- 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 @@ -13,7 +13,6 @@ import jodd.util.StringUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.OldSystemDataPushConfig; -import org.springblade.common.exception.CustomerException; import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +22,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Objects; @ApiIgnore() @RestController @@ -48,10 +48,10 @@ public class OldWaybillClient implements IOldWaybillClient { WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId)); - - if(byWaybillId==null){ - return null; + while (Objects.isNull(byWaybillId)){ + byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId)); } + log.info(">>>>>>>>>>>>>>>>> 运单信息 {}", byWaybillId); log.info(">>>>>>>>>>>>>>>>> 旧仓库ID 集合 {}", OldSystemDataPushConfig.getWarehourseIdList()); @@ -59,17 +59,18 @@ public class OldWaybillClient implements IOldWaybillClient { // 需要验证当前需要开启的数据推送仓库 null+"" if (!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId() + "")) { log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId()); - return null; + return R.fail(405,"当前仓不处理"); } String authCode = oldLogin(byWaybillId.getArriveSiteId() + ""); String url = oldSystemProperties.getUrl() + "openApi/newSystem.WaybillQuery/index?waybillId=" + waybillId; - + log.info("#############waybillDataHandler: 请求地址为 url={}",url); String body = HttpRequest.get(url).header("token", authCode).execute().body(); log.info(">>>>> waybillDataHandler 老系统返回结果 {} ",body); JSONObject jsonObject = JSONObject.parseObject(body); - if (200 == Integer.parseInt(jsonObject.get("code").toString())) { + Integer code = jsonObject.getInteger("code"); + if (200 == code) { // 请求成功 JSONArray jsonArray = jsonObject.getJSONArray("data"); // 循环结果 @@ -85,12 +86,9 @@ public class OldWaybillClient implements IOldWaybillClient { String operationTime = DateUtil.format(new Date(), "yyyy-MM-dd hh:mm:ss"); oldSystemWaybillClient.handleDataToPlatform(unitNo, operationTime); } - } } else { log.error("##################waybillDataHandler: 请求老系统接口 失败,url:{},waybillId:{}", url, waybillId); - - // 请求失败 } } catch (Exception e) { log.error(">>>> 运单信息查询解析报错 ", e);