|
@@ -22,7 +22,6 @@ import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.base.BaseModel;
|
|
import com.sckw.core.model.base.BaseModel;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.EntTypeEnum;
|
|
import com.sckw.core.model.enums.EntTypeEnum;
|
|
|
-import com.sckw.core.model.enums.ForkliftStatusEnum;
|
|
|
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.model.file.FileInfo;
|
|
import com.sckw.core.model.file.FileInfo;
|
|
|
import com.sckw.core.utils.*;
|
|
import com.sckw.core.utils.*;
|
|
@@ -31,7 +30,6 @@ import com.sckw.core.web.context.LoginEntHolder;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.request.HttpClientUtil;
|
|
import com.sckw.core.web.request.HttpClientUtil;
|
|
|
import com.sckw.core.web.response.BaseIotResult;
|
|
import com.sckw.core.web.response.BaseIotResult;
|
|
|
-import com.sckw.core.web.response.BaseResult;
|
|
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.core.web.response.result.PageDataResult;
|
|
import com.sckw.core.web.response.result.PageDataResult;
|
|
|
import com.sckw.excel.easyexcel.ExcelImportListener;
|
|
import com.sckw.excel.easyexcel.ExcelImportListener;
|
|
@@ -40,15 +38,13 @@ import com.sckw.fleet.config.UrlConfigProperties;
|
|
|
import com.sckw.fleet.dao.*;
|
|
import com.sckw.fleet.dao.*;
|
|
|
import com.sckw.fleet.model.*;
|
|
import com.sckw.fleet.model.*;
|
|
|
import com.sckw.fleet.model.dto.*;
|
|
import com.sckw.fleet.model.dto.*;
|
|
|
|
|
+import com.sckw.fleet.model.enums.TruckEevEnum;
|
|
|
|
|
+import com.sckw.fleet.model.enums.TruckEnergyTypeEnum;
|
|
|
import com.sckw.fleet.model.enums.TruckStatusEnum;
|
|
import com.sckw.fleet.model.enums.TruckStatusEnum;
|
|
|
-import com.sckw.fleet.model.reponse.TruckBlacklistParam;
|
|
|
|
|
-import com.sckw.fleet.model.reponse.TruckQueryParam;
|
|
|
|
|
|
|
+import com.sckw.fleet.model.enums.TruckTypeEnum;
|
|
|
|
|
+import com.sckw.fleet.model.reponse.TruckDetailResp;
|
|
|
|
|
+import com.sckw.fleet.model.request.*;
|
|
|
import com.sckw.fleet.model.reponse.TruckResp;
|
|
import com.sckw.fleet.model.reponse.TruckResp;
|
|
|
-import com.sckw.fleet.model.reponse.TruckUpdateStatusParam;
|
|
|
|
|
-import com.sckw.fleet.model.request.BatchTruckValidateReq;
|
|
|
|
|
-import com.sckw.fleet.model.request.CapacityStatusReq;
|
|
|
|
|
-import com.sckw.fleet.model.request.TruckInfoReq;
|
|
|
|
|
-import com.sckw.fleet.model.request.TruckNoReq;
|
|
|
|
|
import com.sckw.fleet.model.vo.*;
|
|
import com.sckw.fleet.model.vo.*;
|
|
|
import com.sckw.fleet.repository.*;
|
|
import com.sckw.fleet.repository.*;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
@@ -2084,9 +2080,17 @@ public class KwfTruckService {
|
|
|
.eq(KwfTruck::getType, param.getType())
|
|
.eq(KwfTruck::getType, param.getType())
|
|
|
.eq(KwfTruck::getCarAxis, param.getCarAxis())
|
|
.eq(KwfTruck::getCarAxis, param.getCarAxis())
|
|
|
.eq(KwfTruck::getEnergyType, param.getEnergyTyp())
|
|
.eq(KwfTruck::getEnergyType, param.getEnergyTyp())
|
|
|
- .eq(KwfTruck::getEev, param.getEev())
|
|
|
|
|
- .eq(KwfTruck::getStatus, param.getStatus());
|
|
|
|
|
- // 查询该你了司机
|
|
|
|
|
|
|
+ .eq(KwfTruck::getEev, param.getEev());
|
|
|
|
|
+ //黑名单
|
|
|
|
|
+ if (param.getStatus() != null) {
|
|
|
|
|
+ if (Objects.equals(param.getStatus(), 4)) {
|
|
|
|
|
+ wrapper.eq(KwfTruck::getBlacklist, 1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wrapper.eq(KwfTruck::getStatus, param.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询关联司机
|
|
|
if (CollectionUtils.isNotEmpty(validTruckIds)) {
|
|
if (CollectionUtils.isNotEmpty(validTruckIds)) {
|
|
|
wrapper.in(KwfTruck::getId, validTruckIds);
|
|
wrapper.in(KwfTruck::getId, validTruckIds);
|
|
|
}
|
|
}
|
|
@@ -2111,22 +2115,17 @@ public class KwfTruckService {
|
|
|
*/
|
|
*/
|
|
|
public List<TruckResp> getTruckResp(List<KwfTruck> trucks) {
|
|
public List<TruckResp> getTruckResp(List<KwfTruck> trucks) {
|
|
|
List<TruckResp> truckResps = new ArrayList<>();
|
|
List<TruckResp> truckResps = new ArrayList<>();
|
|
|
- Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.TRUCK_TYPE.getType()));
|
|
|
|
|
- Map<String, String> truckTypeMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(dict)) {
|
|
|
|
|
- truckTypeMap = dict.get(DictTypeEnum.TRUCK_TYPE.getType());
|
|
|
|
|
- }
|
|
|
|
|
for (KwfTruck truck : trucks) {
|
|
for (KwfTruck truck : trucks) {
|
|
|
TruckResp truckResp = new TruckResp();
|
|
TruckResp truckResp = new TruckResp();
|
|
|
truckResp.setId(truck.getId());
|
|
truckResp.setId(truck.getId());
|
|
|
truckResp.setTruckNo(truck.getTruckNo());
|
|
truckResp.setTruckNo(truck.getTruckNo());
|
|
|
truckResp.setType(truck.getType());
|
|
truckResp.setType(truck.getType());
|
|
|
- truckResp.setTypeDesc(CollectionUtils.isNotEmpty(truckTypeMap) ? truckTypeMap.get(String.valueOf(truck.getType())) : null);
|
|
|
|
|
|
|
+ truckResp.setTypeDesc(TruckTypeEnum.getName(truck.getType()));
|
|
|
truckResp.setBrand(truck.getBrand());
|
|
truckResp.setBrand(truck.getBrand());
|
|
|
truckResp.setStatus(truck.getStatus());
|
|
truckResp.setStatus(truck.getStatus());
|
|
|
truckResp.setStatusDesc(TruckStatusEnum.getName(truck.getStatus()));
|
|
truckResp.setStatusDesc(TruckStatusEnum.getName(truck.getStatus()));
|
|
|
truckResp.setCreateTime(truck.getCreateTime());
|
|
truckResp.setCreateTime(truck.getCreateTime());
|
|
|
-
|
|
|
|
|
|
|
+ truckResp.setBlacklist(truck.getBlacklist());
|
|
|
//查询车辆轴数
|
|
//查询车辆轴数
|
|
|
TmsTruckAxleNum axleNum = getCarAxisInfo(truck.getCarAxis());
|
|
TmsTruckAxleNum axleNum = getCarAxisInfo(truck.getCarAxis());
|
|
|
truckResp.setCarAxis(truck.getCarAxis());
|
|
truckResp.setCarAxis(truck.getCarAxis());
|
|
@@ -2146,19 +2145,145 @@ public class KwfTruckService {
|
|
|
* @param param
|
|
* @param param
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
|
|
+ public TruckDetailResp truckDetail(Long id) {
|
|
|
|
|
+ log.info("查询司机详情,id:{}", id);
|
|
|
|
|
+ KwfTruck truck = kwfTruckRepository.getOne(Wrappers.<KwfTruck>lambdaQuery()
|
|
|
|
|
+ .eq(KwfTruck::getId, id));
|
|
|
|
|
+ if (truck == null) {
|
|
|
|
|
+ return new TruckDetailResp();
|
|
|
|
|
+ }
|
|
|
|
|
+ TruckDetailResp truckDetailResp = new TruckDetailResp();
|
|
|
|
|
+ truckDetailResp.setId(truck.getId());
|
|
|
|
|
+ truckDetailResp.setTruckNo(truck.getTruckNo());
|
|
|
|
|
+ truckDetailResp.setType(truck.getType());
|
|
|
|
|
+ truckDetailResp.setTypeDesc(TruckTypeEnum.getName(truck.getType()));
|
|
|
|
|
+
|
|
|
|
|
+ truckDetailResp.setVin(truck.getVin());
|
|
|
|
|
+ truckDetailResp.setBrand(truck.getBrand());
|
|
|
|
|
+ truckDetailResp.setEnergyType(truck.getEnergyType());
|
|
|
|
|
+ truckDetailResp.setEnergyTypeDesc(TruckEnergyTypeEnum.getName(truck.getEnergyType()));
|
|
|
|
|
+ truckDetailResp.setEev(truck.getEev());
|
|
|
|
|
+ truckDetailResp.setEevDesc(TruckEevEnum.getName(truck.getEev()));
|
|
|
|
|
+ truckDetailResp.setStatus(truck.getStatus());
|
|
|
|
|
+ truckDetailResp.setStatusDesc(TruckStatusEnum.getName(truck.getStatus()));
|
|
|
|
|
+ truckDetailResp.setEngineNo(truck.getEngineNo());
|
|
|
|
|
+ truckDetailResp.setAnnualInspectionTime(truck.getAnnualInspectionTime());
|
|
|
|
|
+ truckDetailResp.setTransportValidityTime(truck.getTransportValidityTime());
|
|
|
|
|
+ truckDetailResp.setPositionDevice(truck.getPositionDevice());
|
|
|
|
|
+ truckDetailResp.setTruckLicense(truck.getTruckLicense());
|
|
|
|
|
+ truckDetailResp.setTransportLicense(truck.getTransportLicense());
|
|
|
|
|
+ truckDetailResp.setEnvironmentalList(truck.getEnvironmentalList());
|
|
|
|
|
+ truckDetailResp.setBlacklist(truck.getBlacklist());
|
|
|
|
|
+ //轴数
|
|
|
|
|
+ TmsTruckAxleNum axleNum = getCarAxisInfo(truck.getCarAxis());
|
|
|
|
|
+ truckDetailResp.setCarAxis(truck.getCarAxis());
|
|
|
|
|
+ truckDetailResp.setCarAxisName(axleNum.getName());
|
|
|
|
|
+
|
|
|
|
|
+ //车队班组
|
|
|
|
|
+ KwfFleet fleet = findByFleetTruck(truck.getId(), LoginUserHolder.getEntId());
|
|
|
|
|
+ truckDetailResp.setFleetId(fleet.getId());
|
|
|
|
|
+ truckDetailResp.setFleetName(fleet.getName());
|
|
|
|
|
+
|
|
|
|
|
+ //查询司机信息
|
|
|
|
|
+ KwfDriver driver = getDriverInfo(truck.getId(), LoginUserHolder.getEntId());
|
|
|
|
|
+ truckDetailResp.setDriverName(driver.getName());
|
|
|
|
|
+
|
|
|
|
|
+ return truckDetailResp;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 保存车辆
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public void saveTruck(TruckSaveParam param) {
|
|
|
|
|
+ log.info("保存车辆,id:{}", JSON.toJSONString(param));
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ if (param.getId() == null) {
|
|
|
|
|
+ KwfTruck kwfTruck = kwfTruckRepository.getOne(Wrappers.<KwfTruck>lambdaQuery()
|
|
|
|
|
+ .eq(KwfTruck::getTruckNo, param.getTruckNo()));
|
|
|
|
|
+ if (kwfTruck != null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_EXIST, "车牌号已存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ KwfTruck truck = new KwfTruck();
|
|
|
|
|
+ truck.setTruckNo(param.getTruckNo());
|
|
|
|
|
+ truck.setType(param.getType());
|
|
|
|
|
+ truck.setEnergyType(param.getEnergyType());
|
|
|
|
|
+ truck.setEev(param.getEev());
|
|
|
|
|
+ truck.setCarAxis(param.getCarAxis());
|
|
|
|
|
+ truck.setBrand(param.getBrand());
|
|
|
|
|
+ truck.setVin(param.getVin());
|
|
|
|
|
+ truck.setEngineNo(param.getEngineNo());
|
|
|
|
|
+ truck.setAnnualInspectionTime(param.getAnnualInspectionTime());
|
|
|
|
|
+ truck.setTransportValidityTime(param.getTransportValidityTime());
|
|
|
|
|
+ truck.setPositionDevice(param.getPositionDevice());
|
|
|
|
|
+ truck.setTruckLicense(param.getTruckLicense());
|
|
|
|
|
+ truck.setTransportLicense(param.getTransportLicense());
|
|
|
|
|
+ truck.setEnvironmentalList(param.getEnvironmentalList());
|
|
|
|
|
+ truck.setStatus(TruckStatusEnum.PENDING_REVIEW.getCode());
|
|
|
|
|
+ truck.setDelFlag(0);
|
|
|
|
|
+ truck.setBlacklist(0);
|
|
|
|
|
+ truck.setCreateTime(new Date());
|
|
|
|
|
+ kwfTruckRepository.save(truck);
|
|
|
|
|
+
|
|
|
|
|
+ // 车队班组绑定
|
|
|
|
|
+ truckFleetEdit(truck.getId(), param.getFleetId());
|
|
|
|
|
+
|
|
|
|
|
+ // 车辆信息与企业关联信息
|
|
|
|
|
+ truckEntEdit(truck);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 更新车辆
|
|
|
|
|
+ KwfTruck truck = kwfTruckRepository.getById(param.getId());
|
|
|
|
|
+ if (truck == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_NOT_FOUND, "车辆不已存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ truck.setTruckNo(param.getTruckNo());
|
|
|
|
|
+ truck.setType(param.getType());
|
|
|
|
|
+ truck.setEnergyType(param.getEnergyType());
|
|
|
|
|
+ truck.setEev(param.getEev());
|
|
|
|
|
+ truck.setCarAxis(param.getCarAxis());
|
|
|
|
|
+ truck.setBrand(param.getBrand());
|
|
|
|
|
+ truck.setVin(param.getVin());
|
|
|
|
|
+ truck.setEngineNo(param.getEngineNo());
|
|
|
|
|
+ truck.setAnnualInspectionTime(param.getAnnualInspectionTime());
|
|
|
|
|
+ truck.setTransportValidityTime(param.getTransportValidityTime());
|
|
|
|
|
+ truck.setPositionDevice(param.getPositionDevice());
|
|
|
|
|
+ truck.setTruckLicense(param.getTruckLicense());
|
|
|
|
|
+ truck.setTransportLicense(param.getTransportLicense());
|
|
|
|
|
+ truck.setEnvironmentalList(param.getEnvironmentalList());
|
|
|
|
|
+ truck.setUpdateTime(new Date());
|
|
|
|
|
+ kwfTruckRepository.updateById(truck);
|
|
|
|
|
+
|
|
|
|
|
+ // 车队班组绑定
|
|
|
|
|
+ truckFleetEdit(truck.getId(), param.getFleetId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 车辆停用/启用
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
public void batchUpdateStatus(TruckUpdateStatusParam param) {
|
|
public void batchUpdateStatus(TruckUpdateStatusParam param) {
|
|
|
log.info("车辆停用/启用,param:{}", JSON.toJSONString(param));
|
|
log.info("车辆停用/启用,param:{}", JSON.toJSONString(param));
|
|
|
// 1. 校验状态合法性
|
|
// 1. 校验状态合法性
|
|
|
if (param.getStatus() != 0 && param.getStatus() != 1) {
|
|
if (param.getStatus() != 0 && param.getStatus() != 1) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_STATUS_ERROR, "仅支持修改为正常(0)或停用(1)状态");
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_STATUS_ERROR, "仅支持修改为正常(0)或停用(1)状态");
|
|
|
}
|
|
}
|
|
|
- if (param.getStatus() == null) {
|
|
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_STATUS_ERROR, "状态参数不能为空");
|
|
|
|
|
|
|
+ int targetStatus;
|
|
|
|
|
+ if (param.getStatus() == 0) {
|
|
|
|
|
+ // 如果当前已经是正常,则操作为“停用”,目标状态设为正常(1)
|
|
|
|
|
+ targetStatus = 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果当前已经是停用,则操作为“正常”,目标状态设为停用(0)
|
|
|
|
|
+ targetStatus = 0;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
LambdaUpdateWrapper<KwfTruck> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<KwfTruck> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.in(KwfTruck::getId, param.getIds());
|
|
updateWrapper.in(KwfTruck::getId, param.getIds());
|
|
|
- updateWrapper.set(KwfTruck::getStatus, param.getStatus());
|
|
|
|
|
|
|
+ updateWrapper.set(KwfTruck::getStatus, targetStatus);
|
|
|
kwfTruckRepository.update(updateWrapper);
|
|
kwfTruckRepository.update(updateWrapper);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2170,20 +2295,36 @@ public class KwfTruckService {
|
|
|
*/
|
|
*/
|
|
|
public void toggleBlacklist(TruckBlacklistParam param) {
|
|
public void toggleBlacklist(TruckBlacklistParam param) {
|
|
|
log.info("黑名单业务:{}", JSON.toJSONString(param));
|
|
log.info("黑名单业务:{}", JSON.toJSONString(param));
|
|
|
- if (param.getId() == null) {
|
|
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_NOT_FOUND, "车辆不存在");
|
|
|
|
|
- }
|
|
|
|
|
- int targetStatus;
|
|
|
|
|
- if (param.getStatus() == 4) {
|
|
|
|
|
- // 如果当前已经是黑名单,则操作为“移出”,目标状态设为正常(0)
|
|
|
|
|
- targetStatus = 0;
|
|
|
|
|
|
|
+ int targetBlacklist;
|
|
|
|
|
+ if (param.getBlacklist() == 1) {
|
|
|
|
|
+ // 如果当前已经是黑名单,则操作为“移出”,黑名单状态设为正常(0)
|
|
|
|
|
+ targetBlacklist = 0;
|
|
|
} else {
|
|
} else {
|
|
|
- // 如果当前不是黑名单,则操作为“加入”,目标状态设为黑名单(4)
|
|
|
|
|
- targetStatus = 4;
|
|
|
|
|
|
|
+ // 如果当前不是黑名单,则操作为“加入”,黑名单状态设为黑名单(1)
|
|
|
|
|
+ targetBlacklist = 1;
|
|
|
}
|
|
}
|
|
|
kwfTruckRepository.update(Wrappers.<KwfTruck>lambdaUpdate()
|
|
kwfTruckRepository.update(Wrappers.<KwfTruck>lambdaUpdate()
|
|
|
.eq(KwfTruck::getId, param.getId())
|
|
.eq(KwfTruck::getId, param.getId())
|
|
|
- .set(KwfTruck::getStatus, targetStatus));
|
|
|
|
|
|
|
+ .set(KwfTruck::getBlacklist, targetBlacklist));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 车辆审核
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public void reviewTruck(TruckReviewParam param) {
|
|
|
|
|
+ log.info("车辆审核:{}", JSON.toJSONString(param));
|
|
|
|
|
+ KwfTruck truck = kwfTruckRepository.getById(param.getId());
|
|
|
|
|
+ if (truck == null || !Objects.equals(TruckStatusEnum.PENDING_REVIEW.getCode(), param.getStatus())) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_REVIEW_ERROR, "车辆审核状态异常:当前状态非待审核");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.equals(TruckStatusEnum.REVIEW_REJECTED.getCode(), param.getStatus())
|
|
|
|
|
+ && StringUtils.isBlank(param.getRemark())) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_REVIEW_ERROR, "审核理由不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ truck.setStatus(param.getStatus());
|
|
|
|
|
+ kwfTruckRepository.updateById(truck);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|