Browse Source

修复数据查询接口

pre-production
pref_mail@163.com 2 days ago
parent
commit
eaa0d97a9c
  1. 23
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineCarsLoadLineClient.java
  2. 57
      blade-service/logpm-data-sharing/src/main/java/com/logpm/datasharing/service/impl/LogpmDataSearchServiceImpl.java
  3. 20
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineCarsLoadLineClient.java

23
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<TrunklineCarsLoadLineEntity> findListByLoadId(@RequestParam Long loadId);
}

57
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<String, List<TrunklineCarsLoadScanEntity>> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadCode));
Set<String> strings = groupedByLoadId.keySet();
for (String key : strings) {
Map<Long, List<TrunklineCarsLoadScanEntity>> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadId));
Set<Long> strings = groupedByLoadId.keySet();
for (Long key : strings) {
// 查询改车次所有卸车作业数据集合
List<TrunklineCarsLoadLineEntity> listByLoadId = traceCarsLoadLineClient.findListByLoadId(key);
List<TrunklineCarsLoadScanEntity> 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<String, List<TrunklineCarsLoadScanEntity>> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadCode));
Set<String> strings = groupedByLoadId.keySet();
for (String key : strings) {
Map<Long, List<TrunklineCarsLoadScanEntity>> groupedByLoadId = allListByWaybillNo.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getLoadId));
Set<Long> strings = groupedByLoadId.keySet();
for (Long key : strings) {
//
List<TrunklineCarsLoadLineEntity> listByLoadId = traceCarsLoadLineClient.findListByLoadId(key);
List<TrunklineCarsLoadScanEntity> 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<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities, String key) {
private NodeInfoVO buildTrunklineByUnLoadCar(List<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities, List<TrunklineCarsLoadLineEntity> listByLoadId ) {
// 获取卸车集合
List<TrunklineCarsLoadScanEntity> 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<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities, String key) {
private NodeInfoVO buildTrunklineByLoadCar(List<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities, List<TrunklineCarsLoadLineEntity> 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;
}

20
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<TrunklineCarsLoadLineEntity> findListByLoadId(Long loadId) {
return trunklineCarsLoadLineService.findListByLoadId(loadId);
}
}
Loading…
Cancel
Save