|
|
@@ -9,6 +9,9 @@ import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
+import com.sckw.fleet.api.RemoteFleetService;
|
|
|
+import com.sckw.fleet.api.model.vo.RDriverVo;
|
|
|
+import com.sckw.fleet.api.model.vo.RTruckVo;
|
|
|
import com.sckw.mongo.enums.BusinessTypeEnum;
|
|
|
import com.sckw.mongo.model.SckwLogisticsOrder;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
@@ -66,6 +69,8 @@ public class KwtWaybillOrderService {
|
|
|
private StreamBridge streamBridge;
|
|
|
@DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ private RemoteFleetService remoteFleetService;
|
|
|
|
|
|
/**
|
|
|
* @param driverId 司机ID
|
|
|
@@ -267,6 +272,7 @@ public class KwtWaybillOrderService {
|
|
|
waybillOrder.setDriverIdcard(driver.getDriverIdcard());
|
|
|
}
|
|
|
if (truck != null) {
|
|
|
+ waybillOrder.setId(truck.getWOrderId());
|
|
|
waybillOrder.setTruckId(truck.getTruckId());
|
|
|
waybillOrder.setTruckNo(truck.getTruckNo());
|
|
|
}
|
|
|
@@ -624,6 +630,7 @@ public class KwtWaybillOrderService {
|
|
|
order.setUnloadGrossAmount(new BigDecimal(Global.AMOUNT));
|
|
|
order.setUnloadUrls(Global.EMPTY_STRING);
|
|
|
order.setDeficitAmount(new BigDecimal(Global.AMOUNT));
|
|
|
+ order.setDeficitPrice(new BigDecimal(Global.AMOUNT));
|
|
|
order.setLoss(logisticsOrder.getLoss());
|
|
|
order.setLossUnit(logisticsOrder.getLossUnit());
|
|
|
order.setGoodsPrice(logisticsOrder.getGoodsPrice());
|
|
|
@@ -887,13 +894,19 @@ public class KwtWaybillOrderService {
|
|
|
/**2新增运单状态记录**/
|
|
|
setWaybillOrderTrack(waybillOrder.getId(), waybillOrder.getStatus(), params.getRemark());
|
|
|
|
|
|
- /**3Mongodb数据更新**/
|
|
|
+ /**3跟新司机/车辆数据**/
|
|
|
+ //更新司机信息
|
|
|
+ editDriver(waybillOrder.getDriverId());
|
|
|
+ //更新车辆信息
|
|
|
+ editTruck(waybillOrder.getTruckId());
|
|
|
+
|
|
|
+ /**4Mongodb数据更新**/
|
|
|
//1车辆运单
|
|
|
SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
wOrder.set_id(waybillOrder.getId());
|
|
|
editSckwWaybillOrder(wOrder, waybillOrder, 2);
|
|
|
|
|
|
- /**4发送消息**/
|
|
|
+ /**5发送消息**/
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1233,7 +1246,13 @@ public class KwtWaybillOrderService {
|
|
|
ticket.setTime(params.getTime());
|
|
|
waybillOrderTicketDao.insert(ticket);
|
|
|
|
|
|
- /**4更新承运订单entrustAmount**/
|
|
|
+ /**4跟新司机/车辆数据**/
|
|
|
+ //更新司机信息
|
|
|
+ editDriver(waybillOrder.getDriverId());
|
|
|
+ //更新车辆信息
|
|
|
+ editTruck(waybillOrder.getTruckId());
|
|
|
+
|
|
|
+ /**5更新承运订单entrustAmount**/
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
//承运订单已装货量=承运订单原装货量+当前车辆运单装货量
|
|
|
BigDecimal loadAmount = logisticsOrder.getLoadAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getLoadAmount();
|
|
|
@@ -1244,7 +1263,7 @@ public class KwtWaybillOrderService {
|
|
|
//校验当前承运订单是否运输完成(修改状态+统计量)
|
|
|
checkLogisticsByStatusV1(waybillOrder.getLOrderId());
|
|
|
|
|
|
- /**5Mongodb数据更新**/
|
|
|
+ /**6Mongodb数据更新**/
|
|
|
//1车辆运单
|
|
|
SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
wOrder.set_id(waybillOrder.getId());
|
|
|
@@ -1259,7 +1278,7 @@ public class KwtWaybillOrderService {
|
|
|
lOrder.setLoadAmount(logisticsOrder.getLoadAmount());
|
|
|
editSckwLogisticsOrder(lOrder, logisticsOrder);
|
|
|
|
|
|
- /**6发送消息**/
|
|
|
+ /**7发送消息**/
|
|
|
|
|
|
return HttpResult.ok("装货成功!");
|
|
|
}
|
|
|
@@ -1320,9 +1339,13 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
|
|
|
/**业务处理**/
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
/**1更新车辆运单**/
|
|
|
waybillOrder.setUnloadAmount(params.getAmount());
|
|
|
waybillOrder.setDeficitAmount(waybillOrder.getLoadAmount().subtract(waybillOrder.getUnloadAmount()));
|
|
|
+ BigDecimal deficitPrice = deficitPrice(waybillOrder.getLoadAmount(), waybillOrder.getDeficitAmount(),
|
|
|
+ logisticsOrder.getLoss(), logisticsOrder.getGoodsPrice());
|
|
|
+ waybillOrder.setDeficitPrice(deficitPrice);
|
|
|
waybillOrder.setStatus(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
|
|
|
waybillOrderDao.updateById(waybillOrder);
|
|
|
|
|
|
@@ -1347,9 +1370,14 @@ public class KwtWaybillOrderService {
|
|
|
logisticsOrderCirculateDao.updateByPrimaryKey(circulate);
|
|
|
}
|
|
|
|
|
|
+ /**5跟新司机/车辆数据**/
|
|
|
+ //更新司机信息
|
|
|
+ editDriver(waybillOrder.getDriverId());
|
|
|
+ //更新车辆信息
|
|
|
+ editTruck(waybillOrder.getTruckId());
|
|
|
+
|
|
|
/**5更新承运订单entrustAmount**/
|
|
|
//更新卸货量/卸货时间/亏吨/亏吨扣款
|
|
|
- KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
//承运订单卸货量=承运订单原卸货量+当前车辆运单卸货量
|
|
|
BigDecimal unloadAmount = logisticsOrder.getUnloadAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getUnloadAmount();
|
|
|
logisticsOrder.setUnloadAmount(unloadAmount.add(waybillOrder.getUnloadAmount()));
|
|
|
@@ -1357,7 +1385,8 @@ public class KwtWaybillOrderService {
|
|
|
//承运订单亏吨量=承运订单装货量-承运订单卸货量
|
|
|
logisticsOrder.setDeficitAmount(logisticsOrder.getLoadAmount().subtract(logisticsOrder.getUnloadAmount()));
|
|
|
//承运订单亏吨扣款
|
|
|
- BigDecimal deficitPrice = deficitPrice(logisticsOrder.getLoadAmount(), logisticsOrder.getDeficitAmount(), logisticsOrder.getLoss(), logisticsOrder.getGoodsPrice());
|
|
|
+ deficitPrice = deficitPrice(logisticsOrder.getLoadAmount(), logisticsOrder.getDeficitAmount(),
|
|
|
+ logisticsOrder.getLoss(), logisticsOrder.getGoodsPrice());
|
|
|
logisticsOrder.setDeficitPrice(deficitPrice);
|
|
|
logisticsOrderDao.updateById(logisticsOrder);
|
|
|
|
|
|
@@ -1369,6 +1398,8 @@ public class KwtWaybillOrderService {
|
|
|
SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
wOrder.set_id(waybillOrder.getId());
|
|
|
wOrder.setUnloadAmount(waybillOrder.getUnloadAmount());
|
|
|
+ wOrder.setDeficitAmount(waybillOrder.getDeficitAmount());
|
|
|
+ wOrder.setDeficitPrice(waybillOrder.getDeficitPrice());
|
|
|
wOrder.setUnloadUrls(params.getUrls());
|
|
|
wOrder.setUnloadTime(waybillOrder.getUpdateTime());
|
|
|
editSckwWaybillOrder(wOrder, waybillOrder, 2);
|
|
|
@@ -1591,16 +1622,26 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
|
|
|
/**2更新车辆运单信息**/
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
waybillOrder.setLoadAmount(params.getType() == 1 ? params.getAmount() : waybillOrder.getLoadAmount());
|
|
|
waybillOrder.setUnloadAmount(params.getType() == 2 ? params.getAmount() : waybillOrder.getUnloadAmount());
|
|
|
waybillOrder.setDeficitAmount(waybillOrder.getLoadAmount().subtract(waybillOrder.getUnloadAmount()));
|
|
|
+ BigDecimal deficitPrice = deficitPrice(waybillOrder.getLoadAmount(), waybillOrder.getDeficitAmount(),
|
|
|
+ logisticsOrder.getLoss(), logisticsOrder.getGoodsPrice());
|
|
|
+ waybillOrder.setDeficitPrice(deficitPrice);
|
|
|
waybillOrderDao.updateById(waybillOrder);
|
|
|
|
|
|
/**3更新榜单信息**/
|
|
|
BeanUtils.copyProperties(params, ticket);
|
|
|
waybillOrderTicketDao.updateById(ticket);
|
|
|
|
|
|
- /**4更新承运订单信息**/
|
|
|
+ /**4跟新司机/车辆数据**/
|
|
|
+ //更新司机信息
|
|
|
+ editDriver(waybillOrder.getDriverId());
|
|
|
+ //更新车辆信息
|
|
|
+ editTruck(waybillOrder.getTruckId());
|
|
|
+
|
|
|
+ /**5更新承运订单信息**/
|
|
|
Map queryParams = new HashMap();
|
|
|
queryParams.put("lOrderId", waybillOrder.getLOrderId());
|
|
|
queryParams.put("loadCountStatus", params.getType() == 1 ? 1 : null);
|
|
|
@@ -1608,13 +1649,12 @@ public class KwtWaybillOrderService {
|
|
|
WaybillCountVo waybillCount = waybillOrderDao.findWaybillOrderCount(queryParams);
|
|
|
|
|
|
//更新卸货量/卸货时间/亏吨/亏吨扣款
|
|
|
- KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
logisticsOrder.setLoadAmount(waybillCount.getLoadAmount());
|
|
|
logisticsOrder.setLoadTime(waybillCount.getLoadTime());
|
|
|
logisticsOrder.setUnloadAmount(waybillCount.getUnloadAmount());
|
|
|
logisticsOrder.setUnloadTime(waybillCount.getUnloadTime());
|
|
|
logisticsOrder.setDeficitAmount(waybillCount.getDeficitAmount());
|
|
|
- BigDecimal deficitPrice = deficitPrice(waybillCount.getLoadAmount(), waybillCount.getDeficitAmount(),
|
|
|
+ deficitPrice = deficitPrice(waybillCount.getLoadAmount(), waybillCount.getDeficitAmount(),
|
|
|
logisticsOrder.getLoss(), logisticsOrder.getGoodsPrice());
|
|
|
logisticsOrder.setDeficitPrice(deficitPrice);
|
|
|
logisticsOrderDao.updateById(logisticsOrder);
|
|
|
@@ -1626,8 +1666,7 @@ public class KwtWaybillOrderService {
|
|
|
checkLogisticsByStatusV1(waybillOrder.getLOrderId());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**5Mongodb数据更新**/
|
|
|
+ /**6Mongodb数据更新**/
|
|
|
//1车辆运单
|
|
|
SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
wOrder.set_id(waybillOrder.getId());
|
|
|
@@ -1638,6 +1677,7 @@ public class KwtWaybillOrderService {
|
|
|
wOrder.setUnloadTime(params.getType() == 2 ? params.getTime() : null);
|
|
|
wOrder.setLoadUrls(params.getType() == 2 ? params.getUrls() : null);
|
|
|
wOrder.setDeficitAmount(waybillOrder.getDeficitAmount());
|
|
|
+ wOrder.setDeficitPrice(waybillOrder.getDeficitPrice());
|
|
|
editSckwWaybillOrder(wOrder, waybillOrder, 2);
|
|
|
|
|
|
//2承运订单
|
|
|
@@ -1696,4 +1736,39 @@ public class KwtWaybillOrderService {
|
|
|
return HttpResult.ok("车辆运单审核完成!");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param driverId 司机档案ID
|
|
|
+ * @desc 更新司机信息
|
|
|
+ * @author zk
|
|
|
+ * @date 2023/8/3
|
|
|
+ **/
|
|
|
+ public void editDriver(Long driverId) {
|
|
|
+ //数据统计
|
|
|
+ WaybillCountVo countVo = waybillOrderDao.findWaybillOrderCount(new HashMap(){{put("driverId", driverId);}});
|
|
|
+ RDriverVo driver = new RDriverVo();
|
|
|
+ driver.setId(driverId);
|
|
|
+ driver.setTotalComplete(countVo.getTotalComplete());
|
|
|
+ driver.setTotalTake(countVo.getTotalTake());
|
|
|
+ driver.setTotalWeight(countVo.getLoadAmount());
|
|
|
+ driver.setBusinessStatus(countVo.getTotalExecute() != null && countVo.getTotalExecute() > 0 ? 1 : 0 );
|
|
|
+ remoteFleetService.updateById(driver);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param driverId 车辆档案ID
|
|
|
+ * @desc 更新车辆信息
|
|
|
+ * @author zk
|
|
|
+ * @date 2023/8/3
|
|
|
+ **/
|
|
|
+ public void editTruck(Long truckId) {
|
|
|
+ //数据统计
|
|
|
+ WaybillCountVo countVo = waybillOrderDao.findWaybillOrderCount(new HashMap(){{put("truckId", truckId);}});
|
|
|
+ RTruckVo truck = new RTruckVo();
|
|
|
+ truck.setId(truckId);
|
|
|
+ truck.setTotalComplete(countVo.getTotalComplete());
|
|
|
+ truck.setTotalTake(countVo.getTotalTake());
|
|
|
+ truck.setTotalWeight(countVo.getLoadAmount());
|
|
|
+ truck.setBusinessStatus(countVo.getTotalExecute() != null && countVo.getTotalExecute() > 0 ? 1 : 0 );
|
|
|
+ remoteFleetService.updateById(truck);
|
|
|
+ }
|
|
|
}
|