|
|
|
@ -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<String, String> orderCodeMap = orderDetailEntities.stream().collect(Collectors.toMap(PushOrderDetailEntity::getOrderId, PushOrderDetailEntity::getCustomItemNo)); |
|
|
|
|
Map<String, PushOrderDetailEntity> detailEntityMap = orderDetailEntities.stream().collect(Collectors.toMap(PushOrderDetailEntity::getCustomItemNo, v -> v)); |
|
|
|
|
List<String> orderIds = orderDetailEntities.stream().map(PushOrderDetailEntity::getOrderId).collect(Collectors.toList()); |
|
|
|
@ -143,6 +144,7 @@ public class NodeDataPushListener {
|
|
|
|
|
List<FactoryNodePushEntity> pushEntities = factoryNodePushService.list(Wrappers.<FactoryNodePushEntity>lambdaQuery() |
|
|
|
|
.in(FactoryNodePushEntity::getOrderCode, orderCodes) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 到站还是入库
|
|
|
|
|
if (workNodeEnums.equals(WorkNodeEnums.FINAL_NET_ARRIVE_CAR)) { |
|
|
|
|
Map<String, FactoryNodePushEntity> 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); |
|
|
|
|