From 305b36bf908a5037fe1e1ab9e730102dc93fbc6b Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Fri, 15 Dec 2023 20:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/logpm/factory/TestService.java | 2 +- .../oldproject/feign/OldWaybillClient.java | 69 ++++++++++--------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index 8099f4101..1d5870c70 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java @@ -772,7 +772,7 @@ public class TestService { public void test17(){ // 解析 Excel - String file ="D:\\data\\工作文件\\slwk\\软件项目\\hyw\\新带解析数据1.2.xlsx"; + String file ="D:\\data\\工作文件\\slwk\\软件项目\\hyw\\新带解析数据1.3.xlsx"; EasyExcel.read(file, OrderStatusLogMode.class, new OrderStatusLogListener()).sheet("Sheet1").doRead(); 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 2761e9029..167d05b83 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 @@ -41,49 +41,56 @@ public class OldWaybillClient implements IOldWaybillClient { @Override public R waybillDataHandler(String waybillId, String waybillNo) { - // 更加运单ID查询系统数据 - log.info("##################pushOldSystemSignInfo: 请求老系统接口 start waybillId {},waybillNo {}", waybillId, waybillNo); - WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId)); + try { + // 更加运单ID查询系统数据 + log.info("##################pushOldSystemSignInfo: 请求老系统接口 start waybillId {},waybillNo {}", waybillId, waybillNo); + WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId)); - // 需要验证当前需要开启的数据推送仓库 - if(!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId()+"")){ - log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId()); - return null; - } - - String authCode = oldLogin(byWaybillId.getArriveSiteId() + ""); + log.info(">>>>>>>>>>>>>>>>> 运单信息 {}", byWaybillId); + log.info(">>>>>>>>>>>>>>>>> 旧仓库ID 集合 {}", OldSystemDataPushConfig.getWarehourseIdList()); - 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"); + // 需要验证当前需要开启的数据推送仓库 null+"" + if (!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId() + "")) { + log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId()); + return null; + } - for (int i1 = 0; i1 < unitNos.size(); i1++) { - String unitNo = unitNos.getString(i1); - log.info(">>>>>>>> 保存开单推送的已入库包件 {} 保存到新系统",unitNo); + 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); + } - String operationTime = DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss"); - oldSystemWaybillClient.handleDataToPlatform(unitNo,operationTime); } - - + } else { + // 请求失败 } - } else { - // 请求失败 + } catch (Exception e) { + log.error(">>>> 运单信息查询解析报错 ", e); } + return null; }