|
|
@@ -8,10 +8,10 @@ import com.sckw.core.exception.BusinessPlatfromException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.AddressTypeEnum;
|
|
|
import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
|
+import com.sckw.core.model.enums.DispatchWayEnums;
|
|
|
import com.sckw.core.model.enums.LogisticsOrderV1Enum;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
-import com.sckw.fleet.api.model.vo.RDriverVo;
|
|
|
-import com.sckw.fleet.api.model.vo.RTruckVo;
|
|
|
+import com.sckw.fleet.api.model.vo.*;
|
|
|
import com.sckw.order.api.model.OrderDetailVo;
|
|
|
import com.sckw.order.api.model.UpdateActualAmountParam;
|
|
|
import com.sckw.transport.model.*;
|
|
|
@@ -171,11 +171,30 @@ public class TakingOrderHandler extends AbstractWaybillOrderHandler<OrderCircula
|
|
|
* @return
|
|
|
*/
|
|
|
private RDriverVo checkDriver(OrderCirculateTakingQueryParam param) {
|
|
|
- RDriverVo driver = remoteFleetService.findDriver(param.getDriverId());
|
|
|
- if (driver == null || driver.getStatus() == Global.NUMERICAL_ONE) {
|
|
|
+ RDriverVo driverVo = remoteFleetService.findDriver(param.getDriverId());
|
|
|
+ if (driverVo == null || driverVo.getStatus() == Global.NUMERICAL_ONE) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_STATUS_ERROR, "当前司机已锁定");
|
|
|
}
|
|
|
- return driver;
|
|
|
+ //校验是否是自动派单
|
|
|
+ KwtLogisticsOrder logisticsOrder = getLogisticsOrder(param.getLogOrderId());
|
|
|
+ if (!DispatchWayEnums.AUTO_DISPATCH.getCode().equals(logisticsOrder.getDispatchWay())) {
|
|
|
+ return driverVo;
|
|
|
+ }
|
|
|
+ //查询订单托运单位
|
|
|
+ KwtLogisticsOrderUnit logisticsOrderUnit = logisticsOrderUnitRepository.queryByLOrderIdAndUnitType(param.getLogOrderId(), 1);
|
|
|
+ if (logisticsOrderUnit == null || logisticsOrderUnit.getEntId() == null) {
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.LOGISTICS_ORDER_NOT_ENT, "未找到关联的物流订单托运企业(供应商)!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询司机派车系数
|
|
|
+ TruckDispatchCoefficientVO dispatchCoefficient = getAutoTruckDispatchByEntId(logisticsOrderUnit.getEntId());
|
|
|
+ Integer driverOrderLimit = dispatchCoefficient.getDriverOrderLimit();
|
|
|
+ //查询司机分数
|
|
|
+ RDriverScoreVo driverScore = remoteFleetService.findDriverScore(logisticsOrderUnit.getEntId(), param.getEntId(), param.getDriverId());
|
|
|
+ if (driverScore == null || driverScore.getScore() == null || driverOrderLimit == 0 || driverScore.getScore().compareTo(BigDecimal.valueOf(driverOrderLimit)) < 0) {
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_STATUS_ERROR, "当前司机分数过低,不能继续接单");
|
|
|
+ }
|
|
|
+ return driverVo;
|
|
|
}
|
|
|
|
|
|
/**
|