From eaa0d97a9c06a2e2eb9a3faa30efbeef70d8385f Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Fri, 17 Jan 2025 10:55:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/ITrunklineCarsLoadLineClient.java | 23 ++++++++ .../impl/LogpmDataSearchServiceImpl.java | 57 ++++++++++++++----- .../feign/TrunklineCarsLoadLineClient.java | 20 +++++++ 3 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineCarsLoadLineClient.java create mode 100644 blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineCarsLoadLineClient.java diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineCarsLoadLineClient.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineCarsLoadLineClient.java new file mode 100644 index 000000000..643dc5612 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineCarsLoadLineClient.java @@ -0,0 +1,23 @@ +package com.logpm.trunkline.feign; + +import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; +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; + +import java.util.List; + +@FeignClient( + value = ModuleNameConstant.APPLICATION_TRUNKLINE_NAME +) +public interface ITrunklineCarsLoadLineClient { + + + String API_PREFIX = "trunklineCarsLoadLine/client"; + + @GetMapping(API_PREFIX+"/findListByLoadId") + List findListByLoadId(@RequestParam Long loadId); + + +} diff --git a/blade-service/logpm-data-sharing/src/main/java/com/logpm/datasharing/service/impl/LogpmDataSearchServiceImpl.java b/blade-service/logpm-data-sharing/src/main/java/com/logpm/datasharing/service/impl/LogpmDataSearchServiceImpl.java index 13859a0d5..d29087cf2 100644 --- a/blade-service/logpm-data-sharing/src/main/java/com/logpm/datasharing/service/impl/LogpmDataSearchServiceImpl.java +++ b/blade-service/logpm-data-sharing/src/main/java/com/logpm/datasharing/service/impl/LogpmDataSearchServiceImpl.java @@ -10,8 +10,10 @@ import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.QualityDeliverEntity; import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.distribution.feign.IQualityDeliverClient; +import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity; import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; +import com.logpm.trunkline.feign.ITrunklineCarsLoadLineClient; import com.logpm.trunkline.feign.ITrunklineCarsLoadScanClient; import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient; import com.logpm.warehouse.entity.WarehouseWaybillEntity; @@ -41,6 +43,7 @@ public class LogpmDataSearchServiceImpl implements ILogpmDataSearchService { private final IBasicdataWarehouseClient basicdataWarehouseClient; private final ISysClient systemClient; private final ITrunklineWaybillOrderClient trunklineWaybillOrderClient; + private final ITrunklineCarsLoadLineClient traceCarsLoadLineClient; @Override public R data(String type, String order) { @@ -140,18 +143,23 @@ public class LogpmDataSearchServiceImpl implements ILogpmDataSearchService { if (allListByWaybillNo != null && !allListByWaybillNo.isEmpty()) { // 按照 车次号进行分组 - Map> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadCode)); - Set strings = groupedByLoadId.keySet(); - for (String key : strings) { + Map> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadId)); + Set strings = groupedByLoadId.keySet(); + for (Long key : strings) { + + + // 查询改车次所有卸车作业数据集合 + List listByLoadId = traceCarsLoadLineClient.findListByLoadId(key); + List trunklineCarsLoadScanEntities = groupedByLoadId.get(key); //干线发车 - nodeInfoVO = buildTrunklineByLoadCar(trunklineCarsLoadScanEntities, key); + nodeInfoVO = buildTrunklineByLoadCar(trunklineCarsLoadScanEntities, listByLoadId ); if (nodeInfoVO != null) { nodeInfoVOList.add(nodeInfoVO); } // 干线到达 - nodeInfoVO = buildTrunklineByUnLoadCar(trunklineCarsLoadScanEntities, key); + nodeInfoVO = buildTrunklineByUnLoadCar(trunklineCarsLoadScanEntities, listByLoadId); if (nodeInfoVO != null) { nodeInfoVOList.add(nodeInfoVO); } @@ -296,18 +304,20 @@ public class LogpmDataSearchServiceImpl implements ILogpmDataSearchService { log.info( ">> allListByWaybillNo ={}",allListByWaybillNo); if (allListByWaybillNo != null && !allListByWaybillNo.isEmpty()) { // 按照 车次号进行分组 - Map> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadCode)); - Set strings = groupedByLoadId.keySet(); - for (String key : strings) { + Map> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadId)); + Set strings = groupedByLoadId.keySet(); + for (Long key : strings) { + // + List listByLoadId = traceCarsLoadLineClient.findListByLoadId(key); List trunklineCarsLoadScanEntities = groupedByLoadId.get(key); //干线发车 - nodeInfoVO = buildTrunklineByLoadCar(trunklineCarsLoadScanEntities, key); + nodeInfoVO = buildTrunklineByLoadCar(trunklineCarsLoadScanEntities, listByLoadId); if (nodeInfoVO != null) { nodeInfoVOList.add(nodeInfoVO); } // 干线到达 - nodeInfoVO = buildTrunklineByUnLoadCar(trunklineCarsLoadScanEntities, key); + nodeInfoVO = buildTrunklineByUnLoadCar(trunklineCarsLoadScanEntities, listByLoadId); if (nodeInfoVO != null) { nodeInfoVOList.add(nodeInfoVO); } @@ -368,7 +378,7 @@ public class LogpmDataSearchServiceImpl implements ILogpmDataSearchService { return result; } - private NodeInfoVO buildTrunklineByUnLoadCar(List trunklineCarsLoadScanEntities, String key) { + private NodeInfoVO buildTrunklineByUnLoadCar(List trunklineCarsLoadScanEntities, List listByLoadId ) { // 获取卸车集合 List collect = trunklineCarsLoadScanEntities.stream().filter(t -> t.getScanStatus().equals("2")).collect(Collectors.toList()); @@ -376,17 +386,29 @@ public class LogpmDataSearchServiceImpl implements ILogpmDataSearchService { if (collect.isEmpty()) { return null; } + + if(listByLoadId.isEmpty()){ + return null; + } + + // 判断该卸车作业节点 TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity = collect.get(0); + TrunklineCarsLoadLineEntity trunklineCarsLoadLineEntity = listByLoadId.stream().filter(t -> t.getNodeName().equals(trunklineCarsLoadScanEntity.getUnloadNodeName())).findFirst().orElse(null); + + if(trunklineCarsLoadLineEntity == null){ + return null; + } + NodeInfoVO nodeInfoVO = new NodeInfoVO(); nodeInfoVO.setOperateName("干线到达"); nodeInfoVO.setOperateNumber(collect.size() + ""); nodeInfoVO.setOperateWarehouseName(trunklineCarsLoadScanEntity.getUnloadNodeName()); - nodeInfoVO.setOperateTime(trunklineCarsLoadScanEntity.getCreateTime()); + nodeInfoVO.setOperateTime(trunklineCarsLoadLineEntity.getArriveDate()); return nodeInfoVO; } - private NodeInfoVO buildTrunklineByLoadCar(List trunklineCarsLoadScanEntities, String key) { + private NodeInfoVO buildTrunklineByLoadCar(List trunklineCarsLoadScanEntities, List listByLoadId ) { // 判断trunklineCarsLoadScanEntities 中 warehouseId 不是null的集合 log.info(">>> trunklineCarsLoadScanEntities ={}",trunklineCarsLoadScanEntities); @@ -396,11 +418,18 @@ public class LogpmDataSearchServiceImpl implements ILogpmDataSearchService { return null; } TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity = collect.get(0); + + TrunklineCarsLoadLineEntity trunklineCarsLoadLineEntity = listByLoadId.stream().filter(t -> t.getNodeName().equals(trunklineCarsLoadScanEntity.getWarehouseName())).findFirst().orElse(null); + + if(trunklineCarsLoadLineEntity == null){ + return null; + } + NodeInfoVO nodeInfoVO = new NodeInfoVO(); nodeInfoVO.setOperateName("干线发车"); nodeInfoVO.setOperateNumber(collect.size() + ""); nodeInfoVO.setOperateWarehouseName(trunklineCarsLoadScanEntity.getWarehouseName()); - nodeInfoVO.setOperateTime(trunklineCarsLoadScanEntity.getUnloadTime()); + nodeInfoVO.setOperateTime(trunklineCarsLoadLineEntity.getStartDate()); return nodeInfoVO; } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineCarsLoadLineClient.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineCarsLoadLineClient.java new file mode 100644 index 000000000..3419e9ce3 --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineCarsLoadLineClient.java @@ -0,0 +1,20 @@ +package com.logpm.trunkline.feign; + +import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; +import com.logpm.trunkline.service.ITrunklineCarsLoadLineService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +@Slf4j +@RestController +@AllArgsConstructor +public class TrunklineCarsLoadLineClient implements ITrunklineCarsLoadLineClient { + + private final ITrunklineCarsLoadLineService trunklineCarsLoadLineService; + @Override + public List findListByLoadId(Long loadId) { + return trunklineCarsLoadLineService.findListByLoadId(loadId); + } +}