|
|
@@ -115,7 +115,9 @@ public class KwtWaybillOrderService {
|
|
|
**/
|
|
|
public Map<String, Object> findStatisticsCountByDriver(Long driverId, HttpServletRequest request) {
|
|
|
//参数
|
|
|
- Map<String, Object> params = new HashMap<>(){{put("driverId", driverId);}};
|
|
|
+ Map<String, Object> params = new HashMap<>() {{
|
|
|
+ put("driverId", driverId);
|
|
|
+ }};
|
|
|
|
|
|
//专场逻辑
|
|
|
String accessSpecial = request.getHeader("Access-Special");
|
|
|
@@ -475,10 +477,10 @@ public class KwtWaybillOrderService {
|
|
|
List<Long> lOrderIds = new ArrayList<>();
|
|
|
//物流订单装卸货地址委派量统计
|
|
|
Map<Long, BigDecimal> truckTotalEntrustAmount = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
- for (SendCarInfoDto sendCar:sends) {
|
|
|
+ for (SendCarInfoDto sendCar : sends) {
|
|
|
//趟次(循环单默认趟次为1)
|
|
|
int count = params.getType() == Global.NUMERICAL_ONE ? sendCar.getCount() : Global.NUMERICAL_ONE;
|
|
|
- for (int i=0; i<count; i++) {
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
//新增运单信息
|
|
|
KwtWaybillOrderV1 waybillOrder = sendCarDriver(sendCar, params.getType());
|
|
|
//运输委托信息
|
|
|
@@ -490,7 +492,7 @@ public class KwtWaybillOrderService {
|
|
|
//物流订单委派卸货时间
|
|
|
Map<Long, List<Date>> unloadTime = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
/**数据组装**/
|
|
|
- for (SendCarEntrustDto sendCarEntrust:entrusts) {
|
|
|
+ for (SendCarEntrustDto sendCarEntrust : entrusts) {
|
|
|
//物流运单ID
|
|
|
Long lOrderId = sendCarEntrust.getLOrderId();
|
|
|
//委派量
|
|
|
@@ -501,7 +503,9 @@ public class KwtWaybillOrderService {
|
|
|
if (sendCarEntrust.getAddressType() == AddressDefaultTypeEnum.SHIPMENT.getCode()) {
|
|
|
if (entrustAmount.get(lOrderId) == null) {
|
|
|
entrustAmount.put(lOrderId, amount);
|
|
|
- loadTime.put(lOrderId, new ArrayList<>(){{add(planTime);}});
|
|
|
+ loadTime.put(lOrderId, new ArrayList<>() {{
|
|
|
+ add(planTime);
|
|
|
+ }});
|
|
|
} else {
|
|
|
List<Date> time = loadTime.get(lOrderId);
|
|
|
time.add(planTime);
|
|
|
@@ -510,7 +514,9 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
} else {
|
|
|
if (entrustAmount.get(lOrderId) == null) {
|
|
|
- unloadTime.put(lOrderId, new ArrayList<>(){{add(planTime);}});
|
|
|
+ unloadTime.put(lOrderId, new ArrayList<>() {{
|
|
|
+ add(planTime);
|
|
|
+ }});
|
|
|
} else {
|
|
|
List<Date> time = unloadTime.get(lOrderId);
|
|
|
time.add(planTime);
|
|
|
@@ -537,7 +543,6 @@ public class KwtWaybillOrderService {
|
|
|
/**4、更新承运订单状态(包括上级承运订单)**/
|
|
|
|
|
|
|
|
|
-
|
|
|
System.out.println(JSON.toJSONString(params));
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
@@ -605,7 +610,7 @@ public class KwtWaybillOrderService {
|
|
|
if (CollectionUtils.isEmpty(params.getSends())) {
|
|
|
return HttpResult.error("请选择委派信息!");
|
|
|
} else {
|
|
|
- for (SendCarInfoDto sendCar:params.getSends()) {
|
|
|
+ for (SendCarInfoDto sendCar : params.getSends()) {
|
|
|
if (CollectionUtils.isEmpty(sendCar.getEntrusts())) {
|
|
|
return HttpResult.error("请选择委派信息!");
|
|
|
}
|
|
|
@@ -618,7 +623,7 @@ public class KwtWaybillOrderService {
|
|
|
List<Long> lOrderIds = new ArrayList<>();
|
|
|
//物流订单装卸货地址委派量统计
|
|
|
Map<Long, BigDecimal> truckTotalEntrustAmount = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
- for (SendCarInfoDto sendCar:sends) {
|
|
|
+ for (SendCarInfoDto sendCar : sends) {
|
|
|
//运输委托信息
|
|
|
List<SendCarEntrustDto> entrusts = sendCar.getEntrusts();
|
|
|
/**数据组装**/
|
|
|
@@ -636,10 +641,10 @@ public class KwtWaybillOrderService {
|
|
|
List<Long> lOrderIdsList = lOrderIds.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
|
/**校验物流运单是否可以派车**/
|
|
|
- for (Long lOrderId:lOrderIdsList) {
|
|
|
+ for (Long lOrderId : lOrderIdsList) {
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(lOrderId);
|
|
|
if (logisticsOrder == null) {
|
|
|
- return HttpResult.error("订单"+lOrderId+"已不存在!");
|
|
|
+ return HttpResult.error("订单" + lOrderId + "已不存在!");
|
|
|
}
|
|
|
|
|
|
//状态校验
|
|
|
@@ -662,7 +667,7 @@ public class KwtWaybillOrderService {
|
|
|
queryAmount.setLOrderId(lOrderId);
|
|
|
queryAmount.setAddressType(AddressDefaultTypeEnum.SHIPMENT.getCode());
|
|
|
List<KwtLogisticsOrderAmount> logisticsOrderAmounts = logisticsOrderAmountDao.findByAddress(queryAmount);
|
|
|
- for (KwtLogisticsOrderAmount orderAmount:logisticsOrderAmounts) {
|
|
|
+ for (KwtLogisticsOrderAmount orderAmount : logisticsOrderAmounts) {
|
|
|
BigDecimal truckEntrustAmount = truckTotalEntrustAmount.get(orderAmount.getLAddressId());
|
|
|
//当前下游司机委派量 + 历史下游司机委派量 + 分包量
|
|
|
BigDecimal actualAmount = truckEntrustAmount.add(entrustAmountTotal);
|
|
|
@@ -677,7 +682,7 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* @param sendCar 车辆司机信息
|
|
|
- * @param type 派车类型(1 趟次、2 循环)
|
|
|
+ * @param type 派车类型(1 趟次、2 循环)
|
|
|
* @desc 运单信息
|
|
|
* @author zk
|
|
|
* @date 2024/3/4
|
|
|
@@ -692,7 +697,7 @@ public class KwtWaybillOrderService {
|
|
|
//运单信息
|
|
|
KwtWaybillOrderV1 waybillOrder = new KwtWaybillOrderV1();
|
|
|
waybillOrder.setEntId(LoginUserHolder.getEntId());
|
|
|
- waybillOrder.setWOrderNo("W"+System.currentTimeMillis());
|
|
|
+ waybillOrder.setWOrderNo("W" + System.currentTimeMillis());
|
|
|
waybillOrder.setType(type);
|
|
|
waybillOrder.setTruckId(sendCar.getTruckId());
|
|
|
waybillOrder.setTruckNo(truck != null ? truck.getTruckNo() : null);
|
|
|
@@ -706,16 +711,16 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param waybillOrder 运单信息
|
|
|
+ * @param waybillOrder 运单信息
|
|
|
* @param entrustAmount 运输委托信息
|
|
|
- * @param loadTime 装货时间
|
|
|
- * @param unloadTime 卸货时间
|
|
|
+ * @param loadTime 装货时间
|
|
|
+ * @param unloadTime 卸货时间
|
|
|
* @desc 车辆运单-子运单信息
|
|
|
* @author zk
|
|
|
* @date 2024/3/4
|
|
|
**/
|
|
|
public List<KwtWaybillOrderSubtask> sendCarSubtask(KwtWaybillOrderV1 waybillOrder, Map<Long, BigDecimal> entrustAmount,
|
|
|
- Map<Long, List<Date>> loadTime, Map<Long, List<Date>> unloadTime) {
|
|
|
+ Map<Long, List<Date>> loadTime, Map<Long, List<Date>> unloadTime) {
|
|
|
List<KwtWaybillOrderSubtask> subtasks = new ArrayList<>();
|
|
|
for (Long key : entrustAmount.keySet()) {
|
|
|
List<Date> loadTime1 = loadTime.get(key);
|
|
|
@@ -741,7 +746,7 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* @param sendCarEntrust 运输委托信息
|
|
|
- * @param waybillOrder 运单信息
|
|
|
+ * @param waybillOrder 运单信息
|
|
|
* @desc 运单地址信息
|
|
|
* @author zk
|
|
|
* @date 2024/3/4
|
|
|
@@ -764,8 +769,6 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* @param params 派车请求参数
|
|
|
* @param logisticsOrder 物流订单
|
|
|
@@ -2079,10 +2082,10 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
|
|
|
/**6跟新司机/车辆数据**/
|
|
|
- //更新司机信息
|
|
|
- editDriver(waybillOrder.getDriverId());
|
|
|
- //更新车辆信息
|
|
|
- editTruck(waybillOrder.getTruckId());
|
|
|
+ //更新司机信息
|
|
|
+ editDriver(waybillOrder.getDriverId());
|
|
|
+ //更新车辆信息
|
|
|
+ editTruck(waybillOrder.getTruckId());
|
|
|
|
|
|
/**7更新承运订单entrustAmount
|
|
|
//更新卸货量/卸货时间/亏吨/亏吨扣款
|
|
|
@@ -3135,6 +3138,7 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* 承运订单-托运订单-订单详情数据统计
|
|
|
+ *
|
|
|
* @param orderId
|
|
|
* @param type
|
|
|
* @return
|
|
|
@@ -3153,6 +3157,7 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* 承运数据统计
|
|
|
+ *
|
|
|
* @param orderId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -3173,12 +3178,14 @@ public class KwtWaybillOrderService {
|
|
|
orderStatusList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.APPROVAL_IN.getCode());
|
|
|
- Integer proceed = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+// Integer proceed = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+ Integer proceed = waybillOrderSubtaskDao.selectCountByOrderId(orderId, orderStatusList);
|
|
|
map.put("proceed", proceed);
|
|
|
orderStatusList.clear();
|
|
|
|
|
|
orderStatusList.add(CarWaybillEnum.APPROVAL_PASS.getCode());
|
|
|
- Integer finish = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+// Integer finish = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+ Integer finish = waybillOrderSubtaskDao.selectCountByOrderId(orderId, orderStatusList);
|
|
|
map.put("finish", finish);
|
|
|
|
|
|
orderStatusList.clear();
|
|
|
@@ -3186,7 +3193,8 @@ public class KwtWaybillOrderService {
|
|
|
orderStatusList.add(CarWaybillEnum.REFUSE_TRAFFIC.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.REVOKED.getCode());
|
|
|
// orderStatusList.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode());
|
|
|
- Integer cancel = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+// Integer cancel = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+ Integer cancel = waybillOrderSubtaskDao.selectCountByOrderId(orderId, orderStatusList);
|
|
|
map.put("cancel", cancel);
|
|
|
|
|
|
map.put("total", proceed + finish + cancel);
|
|
|
@@ -3195,6 +3203,7 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* 托运数据统计
|
|
|
+ *
|
|
|
* @param orderId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -3217,19 +3226,22 @@ public class KwtWaybillOrderService {
|
|
|
orderStatusList.add(CarWaybillEnum.APPROVAL_IN.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode());
|
|
|
- Integer proceed = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+// Integer proceed = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+ Integer proceed = waybillOrderSubtaskDao.selectCountByOrderId(orderId, orderStatusList);
|
|
|
map.put("proceed", proceed);
|
|
|
|
|
|
orderStatusList.clear();
|
|
|
orderStatusList.add(CarWaybillEnum.APPROVAL_PASS.getCode());
|
|
|
- Integer finish = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+// Integer finish = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+ Integer finish = waybillOrderSubtaskDao.selectCountByOrderId(orderId, orderStatusList);
|
|
|
map.put("finish", finish);
|
|
|
|
|
|
orderStatusList.clear();
|
|
|
orderStatusList.add(CarWaybillEnum.REJECT_ORDER.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.REFUSE_TRAFFIC.getCode());
|
|
|
orderStatusList.add(CarWaybillEnum.REVOKED.getCode());
|
|
|
- Integer cancel = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+// Integer cancel = logisticsOrderDao.selectCountByLorderId(orderId, orderStatusList);
|
|
|
+ Integer cancel = waybillOrderSubtaskDao.selectCountByOrderId(orderId, orderStatusList);
|
|
|
map.put("cancel", cancel);
|
|
|
|
|
|
map.put("total", proceed + finish + cancel);
|
|
|
@@ -3238,6 +3250,7 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* 查询已排量、待运量数据
|
|
|
+ *
|
|
|
* @param orderId 物流订单id
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -3273,12 +3286,6 @@ public class KwtWaybillOrderService {
|
|
|
/*--------------------多装多卸--------------------*/
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* @param type 字典类型
|
|
|
* @param value 字典值
|