|
|
@@ -156,24 +156,6 @@ public class GatekeeperOrderService {
|
|
|
Map<Long, KwtLogisticsOrder> logisticsOrderMap = logisticsOrder.stream().collect(Collectors.toMap(KwtLogisticsOrder::getId, Function.identity(), (x, y) -> x));
|
|
|
Set<Long> tOrderIds = logisticsOrder.stream().map(KwtLogisticsOrder::getTOrderId).collect(Collectors.toSet());
|
|
|
|
|
|
- //查询物流商品
|
|
|
- List<KwtLogisticsOrderGoods> logisticsOrderGoods = logisticsOrderGoodsRepository.queryByLogOrderIds((List<Long>) lOrderIds);
|
|
|
- if (CollectionUtils.isEmpty(logisticsOrderGoods)) {
|
|
|
- log.info("【门卫】无订单商品信息,物流订单id:{}", JSON.toJSONString(lOrderIds));
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
- Map<Long, KwtLogisticsOrderGoods> logisticsOrderGoodsMap = logisticsOrderGoods.stream().collect(Collectors.toMap(KwtLogisticsOrderGoods::getId, Function.identity(), (x, y) -> x));
|
|
|
-
|
|
|
- //交易商品信息
|
|
|
- List<Long> goodsIds = logisticsOrderGoods.stream().map(KwtLogisticsOrderGoods::getGoodsId).distinct().collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(goodsIds)) {
|
|
|
- log.info("【门卫】无订单商品信息,商品id:{}", JSON.toJSONString(goodsIds));
|
|
|
- }
|
|
|
- Map<Long, KwpGoods> goodsIdAndGoodsMap = goodsInfoService.getGoodsByIds(goodsIds);
|
|
|
-
|
|
|
- //查询字典
|
|
|
- Map<String, Map<String, String>> dictValueAndDictResDtoMap = remoteSystemService.queryDictByType(Arrays.asList(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
|
|
|
-
|
|
|
//查询贸易订单企业信息
|
|
|
List<OrderUnitInfoDetailVO> orderUnitInfoDetailVOS = tradeOrderInfoService.queryOrderUnitInfByTOrderId(tOrderIds);
|
|
|
if (CollectionUtils.isEmpty(orderUnitInfoDetailVOS)) {
|
|
|
@@ -184,7 +166,7 @@ public class GatekeeperOrderService {
|
|
|
|
|
|
//组装铲车订单数据
|
|
|
return records.stream()
|
|
|
- .map(gatekeeperWaybillOrder -> buildGatekeeperOrderResp(gatekeeperWaybillOrder, waybillOrderMap, waybillOrderTicketMap, logisticsOrderMap, logisticsOrderGoodsMap, goodsIdAndGoodsMap, dictValueAndDictResDtoMap, tradeOrderAndUnit))
|
|
|
+ .map(gatekeeperWaybillOrder -> buildGatekeeperOrderResp(gatekeeperWaybillOrder, waybillOrderMap, waybillOrderTicketMap, logisticsOrderMap, tradeOrderAndUnit))
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@@ -199,9 +181,6 @@ public class GatekeeperOrderService {
|
|
|
Map<Long, KwtWaybillOrder> waybillOrderMap,
|
|
|
Map<String, KwtWaybillOrderTicket> waybillOrderTicketMap,
|
|
|
Map<Long, KwtLogisticsOrder> logisticsOrderMap,
|
|
|
- Map<Long, KwtLogisticsOrderGoods> logisticsOrderGoodsMap,
|
|
|
- Map<Long, KwpGoods> goodsIdAndGoodsMap,
|
|
|
- Map<String, Map<String, String>> dictValueAndDictResDtoMap,
|
|
|
Map<String, OrderUnitInfoDetailVO> tradeOrderAndUnit) {
|
|
|
|
|
|
GatekeeperOrderResp gatekeeper = new GatekeeperOrderResp();
|
|
|
@@ -211,13 +190,16 @@ public class GatekeeperOrderService {
|
|
|
gatekeeper.setWaybillOrderId(gatekeeperWaybillOrder.getWOrderId());
|
|
|
gatekeeper.setLogisticsOrderId(gatekeeperWaybillOrder.getLOrderId());
|
|
|
gatekeeper.setStatus(gatekeeperWaybillOrder.getStatus());
|
|
|
+ gatekeeper.setStatusDesc(GatekeeperStatusEnum.getDesc(gatekeeperWaybillOrder.getStatus()));
|
|
|
gatekeeper.setCarAxisName(gatekeeperWaybillOrder.getCarAxis());
|
|
|
- gatekeeper.setLegalLoad(gatekeeper.getLegalLoad());
|
|
|
+ gatekeeper.setLegalLoad(gatekeeperWaybillOrder.getLegalLoad());
|
|
|
gatekeeper.setTruckType(gatekeeperWaybillOrder.getTruckType());
|
|
|
gatekeeper.setIntoTime(gatekeeperWaybillOrder.getIntoTime());
|
|
|
gatekeeper.setLeaveTime(gatekeeperWaybillOrder.getLeaveTime());
|
|
|
gatekeeper.setWaybillAcceptTime(gatekeeperWaybillOrder.getWaybillAcceptTime());
|
|
|
gatekeeper.setEntrustAmount(gatekeeperWaybillOrder.getEntrustAmount());
|
|
|
+ gatekeeper.setGoodsId(gatekeeperWaybillOrder.getGoodsId());
|
|
|
+ gatekeeper.setGoodsName(gatekeeperWaybillOrder.getGoodsName());
|
|
|
|
|
|
//运单数据
|
|
|
KwtWaybillOrder waybillOrder = waybillOrderMap.getOrDefault(gatekeeperWaybillOrder.getWOrderId(), new KwtWaybillOrder());
|
|
|
@@ -233,13 +215,6 @@ public class GatekeeperOrderService {
|
|
|
gatekeeper.setPrEntId(orderUnit.getEntId());
|
|
|
gatekeeper.setPrEntName(orderUnit.getFirmName());
|
|
|
|
|
|
- //商品信息
|
|
|
- KwtLogisticsOrderGoods orderGoods = logisticsOrderGoodsMap.getOrDefault(waybillOrder.getLOrderId(), new KwtLogisticsOrderGoods());
|
|
|
- KwpGoods goods = goodsIdAndGoodsMap.getOrDefault(orderGoods.getGoodsId(), new KwpGoods());
|
|
|
- Map<String, String> goodsTypeMap= dictValueAndDictResDtoMap.getOrDefault(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), new HashMap<>());
|
|
|
- Map<String, String> goodsSpecMap= dictValueAndDictResDtoMap.getOrDefault(DictTypeEnum.GOODS_SPEC.getType(), new HashMap<>());
|
|
|
- gatekeeper.setGoodsName(goods.getName()+"/"+goodsTypeMap.getOrDefault(goods.getGoodsType(),"")+"/"+goodsSpecMap.getOrDefault(goods.getSpec(), ""));
|
|
|
- gatekeeper.setGoodsId(goods.getId());
|
|
|
|
|
|
//装卸货信息
|
|
|
KwtWaybillOrderTicket ticket = waybillOrderTicketMap.getOrDefault(gatekeeperWaybillOrder.getWOrderId() + "-" + 1, new KwtWaybillOrderTicket());
|
|
|
@@ -372,12 +347,15 @@ public class GatekeeperOrderService {
|
|
|
* @return
|
|
|
*/
|
|
|
private static List<StatisticsWaybillResp.OrderBillStatusStatistics> calculateStatusStatistics(List<GatekeeperOrderResp> gatekeeperOrderList) {
|
|
|
+ //车辆停留超时配置
|
|
|
+ double configHours = 2000;
|
|
|
+
|
|
|
// 定义状态码聚合规则
|
|
|
- Map<List<String>, String[]> aggregateRules = Map.of(
|
|
|
- Arrays.asList("1", "5", "10", "11", "15"), new String[]{"1", "待进场"},
|
|
|
- Arrays.asList("10", "15", "20"), new String[]{"2", "待离场"},
|
|
|
- Arrays.asList("5", "10", "15", "20"), new String[]{"3", "场内车辆"},
|
|
|
- Arrays.asList("5", "10", "15", "20"), new String[]{"4", "异常车辆"}
|
|
|
+ Map<String[], List<String>> aggregateRules = Map.of(
|
|
|
+ new String[]{"1", "待进场"}, Arrays.asList("1"),
|
|
|
+ new String[]{"2", "待离场"}, Arrays.asList("10", "15", "20"),
|
|
|
+ new String[]{"3", "场内车辆"}, Arrays.asList("5", "10", "15", "20"),
|
|
|
+ new String[]{"4", "异常车辆"}, Arrays.asList("5", "10", "15", "20")
|
|
|
);
|
|
|
|
|
|
// 按原始状态统计数量
|
|
|
@@ -387,13 +365,12 @@ public class GatekeeperOrderService {
|
|
|
// 进行状态聚合
|
|
|
List<StatisticsWaybillResp.OrderBillStatusStatistics> aggregatedList = aggregateRules.entrySet().stream()
|
|
|
.map(rule -> {
|
|
|
- List<String> originalStatuses = rule.getKey();
|
|
|
- String[] aggregateInfo = rule.getValue();
|
|
|
+ String[] aggregateInfo = rule.getKey();
|
|
|
+ List<String> originalStatuses = rule.getValue();
|
|
|
long totalNum = 0;
|
|
|
|
|
|
// 处理状态为4的异常车辆
|
|
|
- if (Objects.equals(aggregateInfo[0],4)) {
|
|
|
- double configHours = 0;
|
|
|
+ if (Objects.equals(aggregateInfo[0],"4")) {
|
|
|
totalNum = gatekeeperOrderList.stream().filter(order -> {
|
|
|
// 1. 必须包含在定义的异常状态源中 (5,10,15,20)
|
|
|
if (!originalStatuses.contains(String.valueOf(order.getStatus()))) {
|
|
|
@@ -439,8 +416,8 @@ public class GatekeeperOrderService {
|
|
|
if (gatekeeperWaybillOrder == null) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.FORKLIFT_ORDER_NOT_FOUND, "当前车辆订单不存在!");
|
|
|
}
|
|
|
- if (GatekeeperStatusEnum.PENDING_EXIT.getCode().equals(gatekeeperWaybillOrder.getStatus())
|
|
|
- || GatekeeperStatusEnum.EMPTY_PENDING_EXIT.getCode().equals(gatekeeperWaybillOrder.getStatus())) {
|
|
|
+ if (!(GatekeeperStatusEnum.PENDING_EXIT.getCode().equals(gatekeeperWaybillOrder.getStatus())
|
|
|
+ || GatekeeperStatusEnum.EMPTY_PENDING_EXIT.getCode().equals(gatekeeperWaybillOrder.getStatus()))) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.FORKLIFT_ORDER_STATUS_ERROR, "当前车辆订单状态异常,不能装载完成!");
|
|
|
}
|
|
|
//车辆放行后状态更改为:已放行未离场
|