|
@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
|
import com.google.common.collect.Sets;
|
|
import com.google.common.collect.Sets;
|
|
|
import com.sckw.contract.api.RemoteContractService;
|
|
import com.sckw.contract.api.RemoteContractService;
|
|
|
|
|
+import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.UrlConstants;
|
|
import com.sckw.core.model.constant.UrlConstants;
|
|
|
import com.sckw.core.model.enums.AddressTypeEnum;
|
|
import com.sckw.core.model.enums.AddressTypeEnum;
|
|
@@ -35,6 +36,7 @@ import com.sckw.redis.utils.RedissonUtils;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
|
|
import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.transport.common.config.UrlConfigProperties;
|
|
import com.sckw.transport.common.config.UrlConfigProperties;
|
|
|
import com.sckw.transport.model.*;
|
|
import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.dto.TruckDto;
|
|
import com.sckw.transport.model.dto.TruckDto;
|
|
@@ -811,10 +813,24 @@ public class kwfTruckTraceService {
|
|
|
List<Long> wOrderIds = waybillOrders.stream()
|
|
List<Long> wOrderIds = waybillOrders.stream()
|
|
|
.map(KwtWaybillOrder::getId)
|
|
.map(KwtWaybillOrder::getId)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
-
|
|
|
|
|
|
|
+ //获取车辆id
|
|
|
|
|
+ List<Long> truckIds = waybillOrders.stream()
|
|
|
|
|
+ .map(KwtWaybillOrder::getTruckId)
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ //根据车辆id获取车辆信息
|
|
|
|
|
+ List<RTruckVo> truckVos = fleetService.findTruckByTruckIds(truckIds);
|
|
|
|
|
+ Map<Long, RTruckVo> truckIdMap = new HashMap<>();
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(truckVos)){
|
|
|
|
|
+ // 构建车辆ID到车辆信息的映射
|
|
|
|
|
+ truckIdMap = truckVos.stream()
|
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
|
+ .collect(Collectors.toMap(RTruckVo::getId, Function.identity(), (k1, k2) -> k1));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 查询子运单信息
|
|
// 查询子运单信息
|
|
|
List<KwtWaybillOrderSubtask> subtasks = kwtWaybillOrderSubtaskRepository.queryByWOrderIds(wOrderIds);
|
|
List<KwtWaybillOrderSubtask> subtasks = kwtWaybillOrderSubtaskRepository.queryByWOrderIds(wOrderIds);
|
|
|
- final Map<Long, KwtWaybillOrderSubtask> wOrderIdSubtaskMap;
|
|
|
|
|
|
|
+ Map<Long, KwtWaybillOrderSubtask> wOrderIdSubtaskMap;
|
|
|
if (CollectionUtils.isNotEmpty(subtasks)) {
|
|
if (CollectionUtils.isNotEmpty(subtasks)) {
|
|
|
wOrderIdSubtaskMap = subtasks.stream()
|
|
wOrderIdSubtaskMap = subtasks.stream()
|
|
|
.filter(subtask -> subtask.getWOrderId() != null)
|
|
.filter(subtask -> subtask.getWOrderId() != null)
|
|
@@ -889,12 +905,23 @@ public class kwfTruckTraceService {
|
|
|
})
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ //查询字段
|
|
|
|
|
+ List<SysDictResDto> sysDictResDtos = remoteSystemService.queryDictByType(DictTypeEnum.ENERGY_TYPE.getType());
|
|
|
|
|
+ Map<String, SysDictResDto> energyTypeMap = new HashMap<>();
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(sysDictResDtos)) {
|
|
|
|
|
+ // 构建字典映射
|
|
|
|
|
+ energyTypeMap = sysDictResDtos.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(SysDictResDto::getValue, Function.identity(), (k1, k2) -> k1));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 转换为 VO
|
|
// 转换为 VO
|
|
|
Map<String, KwtLogisticsOrderUnit> finalUnitMap = unitMap;
|
|
Map<String, KwtLogisticsOrderUnit> finalUnitMap = unitMap;
|
|
|
Map<Long, KwtLogisticsOrderGoods> finalGoodsMap = goodsMap;
|
|
Map<Long, KwtLogisticsOrderGoods> finalGoodsMap = goodsMap;
|
|
|
|
|
+ Map<Long, RTruckVo> finalTruckIdMap = truckIdMap;
|
|
|
|
|
+ Map<String, SysDictResDto> finalEnergyTypeMap = energyTypeMap;
|
|
|
List<MapVehicleVo> result = filteredOrders.stream()
|
|
List<MapVehicleVo> result = filteredOrders.stream()
|
|
|
- .map(order -> buildMapVehicleVo(order, wOrderIdSubtaskMap, finalUnitMap, finalGoodsMap, locationInfoMap, exceptionCountMap))
|
|
|
|
|
|
|
+ .map(order -> buildMapVehicleVo(order, wOrderIdSubtaskMap, finalUnitMap, finalGoodsMap,
|
|
|
|
|
+ locationInfoMap, exceptionCountMap, finalTruckIdMap, finalEnergyTypeMap))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
// 根据排序类型进行排序
|
|
// 根据排序类型进行排序
|
|
@@ -1126,7 +1153,9 @@ public class kwfTruckTraceService {
|
|
|
Map<String, KwtLogisticsOrderUnit> unitMap,
|
|
Map<String, KwtLogisticsOrderUnit> unitMap,
|
|
|
Map<Long, KwtLogisticsOrderGoods> goodsMap,
|
|
Map<Long, KwtLogisticsOrderGoods> goodsMap,
|
|
|
Map<String, VehicleLocationInfo> locationInfoMap,
|
|
Map<String, VehicleLocationInfo> locationInfoMap,
|
|
|
- Map<String, Integer> exceptionCountMap) {
|
|
|
|
|
|
|
+ Map<String, Integer> exceptionCountMap,
|
|
|
|
|
+ Map<Long, RTruckVo> truckIdMap,
|
|
|
|
|
+ Map<String, SysDictResDto> energyTypeMap) {
|
|
|
MapVehicleVo vo = new MapVehicleVo();
|
|
MapVehicleVo vo = new MapVehicleVo();
|
|
|
|
|
|
|
|
// 车辆和司机信息
|
|
// 车辆和司机信息
|
|
@@ -1204,7 +1233,10 @@ public class kwfTruckTraceService {
|
|
|
// 从异常表查询该运单的异常数量
|
|
// 从异常表查询该运单的异常数量
|
|
|
Integer exceptionCount = exceptionCountMap.getOrDefault(order.getWOrderNo(), 0);
|
|
Integer exceptionCount = exceptionCountMap.getOrDefault(order.getWOrderNo(), 0);
|
|
|
vo.setExceptionCount(exceptionCount);
|
|
vo.setExceptionCount(exceptionCount);
|
|
|
-
|
|
|
|
|
|
|
+ RTruckVo truckVo = truckIdMap.getOrDefault(order.getTruckId(), new RTruckVo());
|
|
|
|
|
+ vo.setEnergyType(Objects.isNull(truckVo.getEnergyType())? "":String.valueOf(truckVo.getEnergyType()));
|
|
|
|
|
+ SysDictResDto dictResDto = energyTypeMap.getOrDefault(String.valueOf(truckVo.getEnergyType()), new SysDictResDto());
|
|
|
|
|
+ vo.setEnergyType(dictResDto.getLabel());
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|
|
|
|
|
|