From 1a6c6ed58bf19a5b33b993eb902e2985dcc47a59 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Fri, 25 Oct 2024 17:13:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E4=BF=AE=E6=94=B9=E9=87=91?= =?UTF-8?q?=E7=89=8C=E6=89=8B=E5=8A=A8=E5=9B=9E=E6=8E=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 增加金牌回推工厂的具体业务逻辑优化 --- .../jinpai/entity/PushOrderEntity.java | 2 + .../jinpai/mq/NodeDataPushListener.java | 55 ++++++++++++++++--- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/entity/PushOrderEntity.java b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/entity/PushOrderEntity.java index 5f23a8cbd..2f2bfb45e 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/entity/PushOrderEntity.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/entity/PushOrderEntity.java @@ -47,6 +47,8 @@ public class PushOrderEntity extends BaseEntity { private String userName; @ApiModelProperty(name = "基地") private String orgName; + @ApiModelProperty(name = "仓库") + private String warehouse; @ApiModelProperty(name = "预留1", notes = "") private String reserve1; diff --git a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/mq/NodeDataPushListener.java b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/mq/NodeDataPushListener.java index 0f28c8fcb..181a2b733 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/mq/NodeDataPushListener.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/mq/NodeDataPushListener.java @@ -106,21 +106,21 @@ public class NodeDataPushListener { ); if (CollUtil.isEmpty(orderDetailEntities)) { // 去老系统查 - if(StrUtil.isNotEmpty(jinPaiProperties.getOldSystemHost()) && StrUtil.isNotEmpty(jinPaiProperties.getFindOldDataUrl())){ + if (StrUtil.isNotEmpty(jinPaiProperties.getOldSystemHost()) && StrUtil.isNotEmpty(jinPaiProperties.getFindOldDataUrl())) { try { String result = HttpUtil.get(jinPaiProperties.getOldSystemHost() + jinPaiProperties.getFindOldDataUrl() + "?orderCode=" + sendOrderCode); - if(StrUtil.isNotEmpty(result)){ + if (StrUtil.isNotEmpty(result)) { JSONObject jsonObject = JSONUtil.parseObj(result); Integer code = jsonObject.getInt("code"); - if(NumberUtil.equals(code, 200)){ + if (NumberUtil.equals(code, 200)) { JSONArray data = jsonObject.getJSONArray("data"); if (CollUtil.isNotEmpty(data)) { orderDetailEntities = data.toList(PushOrderDetailEntity.class); } } } - }catch (Exception e){ - log.error("老系统查询失败",e); + } catch (Exception e) { + log.error("老系统查询失败", e); } } } @@ -128,6 +128,7 @@ public class NodeDataPushListener { log.info("未查到包件数据,不处理:{}", JSONUtil.toJsonStr(content)); return; } + // 订单 warehouse 不为空为干线,否则为仓配,推送干线的同时回推仓配 Map orderCodeMap = orderDetailEntities.stream().collect(Collectors.toMap(PushOrderDetailEntity::getOrderId, PushOrderDetailEntity::getCustomItemNo)); Map detailEntityMap = orderDetailEntities.stream().collect(Collectors.toMap(PushOrderDetailEntity::getCustomItemNo, v -> v)); List orderIds = orderDetailEntities.stream().map(PushOrderDetailEntity::getOrderId).collect(Collectors.toList()); @@ -143,6 +144,7 @@ public class NodeDataPushListener { List pushEntities = factoryNodePushService.list(Wrappers.lambdaQuery() .in(FactoryNodePushEntity::getOrderCode, orderCodes) ); + // 到站还是入库 if (workNodeEnums.equals(WorkNodeEnums.FINAL_NET_ARRIVE_CAR)) { Map pushEntityMap = new HashMap<>(); @@ -157,6 +159,11 @@ public class NodeDataPushListener { if (pushEntityMap.containsKey(orderCode)) { continue; } + String arriveFor = "stock"; + PushOrderEntity pushOrderEntity = pushOrderEntityMap.get(orderCode); + if (StrUtil.isNotEmpty(pushOrderEntity.getWarehouse())) { + arriveFor = "carrier"; + } PushOrderDetailEntity pushOrderDetailEntity = detailEntityMap.get(orderCode); String boxCodeList = pushOrderDetailEntity.getBoxCodeList(); JSONArray boxCodeListJson = JSONUtil.parseArray(boxCodeList); @@ -173,7 +180,7 @@ public class NodeDataPushListener { js.set("extWaybillNO", mainJson.getStr("serviceNumber")); js.set("detail", detail); js.set("shipNo", mainJson.getStr("waybillNumber")); - js.set("targetNo", pushOrderEntityMap.get(orderCode).getTransportNo()); + js.set("targetNo", pushOrderEntity.getTransportNo()); js.set("targetType", "1"); js.set("doType", "32"); js.set("doLocation", ""); @@ -182,7 +189,7 @@ public class NodeDataPushListener { js.set("endSite", mainJson.getStr("warehouseName")); js.set("passSite", mainJson.getStr("acceptWarehouseName")); js.set("doRemark", ""); - js.set("reqSn", pushOrderEntityMap.get(orderCode).getId()); + js.set("reqSn", pushOrderEntity.getId()); js.set("syscode", "huitong"); js.set("carNo", mainJson.getStr("carNumber")); js.set("carHangNo", ""); @@ -190,7 +197,7 @@ public class NodeDataPushListener { js.set("driverPhone", mainJson.getStr("driverMobile")); js.set("carType", "A"); js.set("carSize", "1"); - // js.set("arriveFor", ""); + js.set("arriveFor", arriveFor); log.info("推送工厂:{}", js); String url = jinPaiProperties.getOldSystemHost() + jinPaiProperties.getOldSystemArrivedUrl(); try { @@ -204,6 +211,18 @@ public class NodeDataPushListener { .content(JSONUtil.toJsonStr(js)) .resultContent(result) .build()); + if (StrUtil.isNotEmpty(pushOrderEntity.getWarehouse())) { + js.set("arriveFor", "stock"); + result = HttpUtil.post(url, JSONUtil.toJsonStr(js)); + log.info("推送工厂结果:{}", result); + // 保存推送记录 + factoryNodePushService.save(FactoryNodePushEntity.builder() + .orderCode(orderCode) + .node(FactoryNodeEnums.FINAL_NET_ARRIVE_CAR.getCode().toString()) + .content(JSONUtil.toJsonStr(js)) + .resultContent(result) + .build()); + } } } catch (Exception e) { log.error("推送工厂失败:{}", e); @@ -220,6 +239,11 @@ public class NodeDataPushListener { } for (PushData pushData : content) { if (!CollUtil.contains(pushEntityMap.keySet(), pushData.getPackageCode())) { + String arriveFor = "stock"; + PushOrderEntity pushOrderEntity = pushOrderEntityMap.get(pushData.getOrderCode()); + if (StrUtil.isNotEmpty(pushOrderEntity.getWarehouse())) { + arriveFor = "carrier"; + } JSONObject js = new JSONObject(); js.set("extOrderNo", pushData.getOrderCode()); js.set("extWaybillNO", detailEntityMap.get(pushData.getOrderCode()).getCustomOrderNo()); @@ -227,7 +251,7 @@ public class NodeDataPushListener { js.set("doTime", entries.getStr("operatorTime")); js.set("syscode", "huitong"); js.set("reqSn", UUID.randomUUID()); - // js.set("arriveFor", ""); + js.set("arriveFor", arriveFor); JSONObject detailJson = new JSONObject(); detailJson.set(pushData.getPackageCode(), 1); js.set("detail", detailJson.toString()); @@ -246,6 +270,19 @@ public class NodeDataPushListener { .packageCode(pushData.getPackageCode()) .resultContent(result) .build()); + if (StrUtil.isNotEmpty(pushOrderEntity.getWarehouse())) { + js.set("arriveFor", "stock"); + result = HttpUtil.post(url, JSONUtil.toJsonStr(js)); + log.info("推送工厂结果:{}", result); + // 保存推送记录 + factoryNodePushService.save(FactoryNodePushEntity.builder() + .orderCode(pushData.getOrderCode()) + .node(FactoryNodeEnums.END_WAREHOUSE_UNLOADING.getCode().toString()) + .content(JSONUtil.toJsonStr(js)) + .packageCode(pushData.getPackageCode()) + .resultContent(result) + .build()); + } } } catch (Exception e) { log.error("推送工厂失败:{}", e);