|
@@ -3,17 +3,19 @@ package com.sckw.transport.handler;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.sckw.contract.api.RemoteContractService;
|
|
|
|
|
+import com.sckw.contract.api.model.vo.ContractLogisticsScoreVO;
|
|
|
import com.sckw.core.common.enums.enums.ErrorCodeEnum;
|
|
import com.sckw.core.common.enums.enums.ErrorCodeEnum;
|
|
|
import com.sckw.core.exception.BusinessPlatfromException;
|
|
import com.sckw.core.exception.BusinessPlatfromException;
|
|
|
import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.fleet.api.RemoteFleetService;
|
|
import com.sckw.fleet.api.RemoteFleetService;
|
|
|
|
|
+import com.sckw.fleet.api.model.dto.RUpdateDriverScoreDto;
|
|
|
import com.sckw.fleet.api.model.vo.DriverConductRulesVO;
|
|
import com.sckw.fleet.api.model.vo.DriverConductRulesVO;
|
|
|
|
|
+import com.sckw.fleet.api.model.vo.RDriverScoreVo;
|
|
|
import com.sckw.fleet.api.model.vo.TruckDispatchCoefficientVO;
|
|
import com.sckw.fleet.api.model.vo.TruckDispatchCoefficientVO;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
-import com.sckw.transport.model.KwtWaybillOrder;
|
|
|
|
|
-import com.sckw.transport.model.KwtWaybillOrderNode;
|
|
|
|
|
-import com.sckw.transport.model.KwtWaybillOrderSubtask;
|
|
|
|
|
|
|
+import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.param.*;
|
|
import com.sckw.transport.model.param.*;
|
|
|
import com.sckw.transport.repository.*;
|
|
import com.sckw.transport.repository.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -21,6 +23,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -53,6 +56,8 @@ public abstract class AbstractWaybillOrderHandler<T extends WaybillOrderProcessP
|
|
|
protected KwtLogisticsOrderAddressRepository logisticsOrderAddressRepository;
|
|
protected KwtLogisticsOrderAddressRepository logisticsOrderAddressRepository;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
protected KwtLogisticsOrderCirculateRepository logisticsOrderCirculateRepository;
|
|
protected KwtLogisticsOrderCirculateRepository logisticsOrderCirculateRepository;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ protected KwtLogisticsOrderUnitRepository logisticsOrderUnitRepository;
|
|
|
|
|
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
|
protected RemoteFleetService remoteFleetService;
|
|
protected RemoteFleetService remoteFleetService;
|
|
@@ -60,6 +65,8 @@ public abstract class AbstractWaybillOrderHandler<T extends WaybillOrderProcessP
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 80000)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 80000)
|
|
|
protected TradeOrderInfoService tradeOrderInfoService;
|
|
protected TradeOrderInfoService tradeOrderInfoService;
|
|
|
|
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
|
|
+ private RemoteContractService remoteContractService;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -219,9 +226,18 @@ public abstract class AbstractWaybillOrderHandler<T extends WaybillOrderProcessP
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 查询供应商id
|
|
|
|
|
+ protected Long getSupplierId(KwtWaybillOrder waybillOrder) {
|
|
|
|
|
+ if (waybillOrder == null) {
|
|
|
|
|
+ return 0L;
|
|
|
|
|
+ }
|
|
|
|
|
+ //查询订单托运单位(自动派单订单承运单位只为供应商)
|
|
|
|
|
+ KwtLogisticsOrderUnit logisticsOrderUnit = logisticsOrderUnitRepository.queryByLOrderIdAndUnitType(waybillOrder.getLOrderId(), 1);
|
|
|
|
|
+ if (logisticsOrderUnit == null || logisticsOrderUnit.getEntId() == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.LOGISTICS_ORDER_NOT_ENT, "未找到关联的物流订单托运企业(供应商)!");
|
|
|
|
|
+ }
|
|
|
|
|
+ return logisticsOrderUnit.getEntId();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -307,6 +323,46 @@ public abstract class AbstractWaybillOrderHandler<T extends WaybillOrderProcessP
|
|
|
return diffMinutes;
|
|
return diffMinutes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 修改司机评分
|
|
|
|
|
+ * @param supeEntId
|
|
|
|
|
+ * @param entId
|
|
|
|
|
+ * @param driverId
|
|
|
|
|
+ * @param score
|
|
|
|
|
+ */
|
|
|
|
|
+ public void updateDriverScore(Long supeEntId, Long entId, Long driverId, Integer score) {
|
|
|
|
|
+ if (score == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "加分分数不能为空!");
|
|
|
|
|
+ }
|
|
|
|
|
+ //1. 查询司机的评分
|
|
|
|
|
+ RDriverScoreVo driverScore = remoteFleetService.findDriverScoreIdByEntIds(supeEntId, entId, driverId);
|
|
|
|
|
+ //2.司机没评分,初始化时间分数(企业分数)
|
|
|
|
|
+ if (driverScore == null) {
|
|
|
|
|
+ ContractLogisticsScoreVO logisticsScore = remoteContractService.findLogisticsScoreByEntId(supeEntId, entId);
|
|
|
|
|
+ if (logisticsScore == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "修改司机分数,企业无评分!");
|
|
|
|
|
+ }
|
|
|
|
|
+ driverScore = remoteFleetService.addDriverScoreIdByEntIds(supeEntId, entId, driverId, logisticsScore.getScore());
|
|
|
|
|
+ if (driverScore == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "初始化司机评分失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //司机当前分数
|
|
|
|
|
+ BigDecimal currentScore = driverScore.getScore() == null || driverScore.getScore() .compareTo(BigDecimal.ZERO) < 0
|
|
|
|
|
+ ? BigDecimal.ZERO : driverScore.getScore();
|
|
|
|
|
+ //司机加减分数
|
|
|
|
|
+ BigDecimal scoreChange = BigDecimal.valueOf(score);
|
|
|
|
|
+
|
|
|
|
|
+ //3. 修改司机评分
|
|
|
|
|
+ RUpdateDriverScoreDto driverScoreDto = new RUpdateDriverScoreDto();
|
|
|
|
|
+ driverScoreDto.setId(driverScore.getDriverId());
|
|
|
|
|
+ driverScoreDto.setScore(currentScore.add(scoreChange));
|
|
|
|
|
+ remoteFleetService.updateDriverScoreIdByEntIds(driverScoreDto);
|
|
|
|
|
+
|
|
|
|
|
+ //4.新增司机评分明细
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|