|
@@ -16,11 +16,9 @@ import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
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.constant.UrlConstants;
|
|
|
|
|
import com.sckw.core.model.enums.EntTypeEnum;
|
|
import com.sckw.core.model.enums.EntTypeEnum;
|
|
|
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.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginEntHolder;
|
|
import com.sckw.core.web.context.LoginEntHolder;
|
|
@@ -28,7 +26,6 @@ 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.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
-import com.sckw.core.web.response.BaseResult;
|
|
|
|
|
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;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
@@ -36,7 +33,10 @@ 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.request.*;
|
|
|
|
|
|
|
+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;
|
|
@@ -52,7 +52,6 @@ import com.sckw.transport.api.model.dto.VehicleDataDTO;
|
|
|
import com.sckw.transport.api.model.dto.VehicleReturnData;
|
|
import com.sckw.transport.api.model.dto.VehicleReturnData;
|
|
|
import com.sckw.transport.api.model.vo.RTruckMonitorVo;
|
|
import com.sckw.transport.api.model.vo.RTruckMonitorVo;
|
|
|
import com.sckw.transport.api.model.vo.RWaybillOrderVo;
|
|
import com.sckw.transport.api.model.vo.RWaybillOrderVo;
|
|
|
-import com.sckw.transport.api.model.vo.VehicleTraceResponse;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
@@ -99,6 +98,7 @@ public class KwfTruckService {
|
|
|
private final UrlConfigProperties urlConfigProperties;
|
|
private final UrlConfigProperties urlConfigProperties;
|
|
|
private final KwfFleetDriverRepository kwfFleetDriverRepository;
|
|
private final KwfFleetDriverRepository kwfFleetDriverRepository;
|
|
|
private final KwfTruckAxleNumRepository truckAxleNumRepository;
|
|
private final KwfTruckAxleNumRepository truckAxleNumRepository;
|
|
|
|
|
+ private final KwfTruckEntRepository truckEntRepository;
|
|
|
|
|
|
|
|
private final KwfFleetTruckRepository kwfFleetTruckRepository;
|
|
private final KwfFleetTruckRepository kwfFleetTruckRepository;
|
|
|
private final VehicleTraceClient vehicleTraceClient;
|
|
private final VehicleTraceClient vehicleTraceClient;
|
|
@@ -608,8 +608,8 @@ public class KwfTruckService {
|
|
|
}});
|
|
}});
|
|
|
if (CollectionUtils.isEmpty(trucks)) {
|
|
if (CollectionUtils.isEmpty(trucks)) {
|
|
|
/**新增**/
|
|
/**新增**/
|
|
|
- params.setEntId(LoginUserHolder.getEntId());
|
|
|
|
|
- params.setEntId(params.getEntId() == null ? 1 : params.getEntId());// 暂时处理---------------zk
|
|
|
|
|
|
|
+// params.setEntId(LoginUserHolder.getEntId());
|
|
|
|
|
+// params.setEntId(params.getEntId() == null ? 1 : params.getEntId());// 暂时处理---------------zk
|
|
|
params.setBusinessStatus(Global.NO);
|
|
params.setBusinessStatus(Global.NO);
|
|
|
params.setStatus(Global.NO);
|
|
params.setStatus(Global.NO);
|
|
|
int count = truckDao.insert(params);
|
|
int count = truckDao.insert(params);
|
|
@@ -624,7 +624,7 @@ public class KwfTruckService {
|
|
|
|
|
|
|
|
/**车辆信息与企业关联信息**/
|
|
/**车辆信息与企业关联信息**/
|
|
|
KwfTruck truckEnt = new KwfTruck();
|
|
KwfTruck truckEnt = new KwfTruck();
|
|
|
- truckEnt.setEntId(LoginUserHolder.getEntId());
|
|
|
|
|
|
|
+// truckEnt.setEntId(LoginUserHolder.getEntId());
|
|
|
truckEnt.setId(truck.getId());
|
|
truckEnt.setId(truck.getId());
|
|
|
truckEntEdit(truckEnt);
|
|
truckEntEdit(truckEnt);
|
|
|
return count > 0 ? HttpResult.ok("车辆信息修改成功!", truck) : HttpResult.error("车辆信息修改失败!");
|
|
return count > 0 ? HttpResult.ok("车辆信息修改成功!", truck) : HttpResult.error("车辆信息修改失败!");
|
|
@@ -752,7 +752,7 @@ public class KwfTruckService {
|
|
|
public int truckEntEdit(KwfTruck params) {
|
|
public int truckEntEdit(KwfTruck params) {
|
|
|
KwfTruckEnt truckEnt = new KwfTruckEnt();
|
|
KwfTruckEnt truckEnt = new KwfTruckEnt();
|
|
|
truckEnt.setTruckId(params.getId());
|
|
truckEnt.setTruckId(params.getId());
|
|
|
- truckEnt.setEntId(params.getEntId() == null ? LoginUserHolder.getEntId() : params.getEntId());
|
|
|
|
|
|
|
+ truckEnt.setEntId(LoginUserHolder.getEntId());
|
|
|
KwfTruckEnt ent = truckEntDao.findByTruckEnt(truckEnt);
|
|
KwfTruckEnt ent = truckEntDao.findByTruckEnt(truckEnt);
|
|
|
if (ent == null) {
|
|
if (ent == null) {
|
|
|
int count = truckEntDao.insert(truckEnt);
|
|
int count = truckEntDao.insert(truckEnt);
|
|
@@ -833,6 +833,41 @@ public class KwfTruckService {
|
|
|
return truckDao.truckStatistics(LoginUserHolder.getEntId());
|
|
return truckDao.truckStatistics(LoginUserHolder.getEntId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过企业id查询车辆ids
|
|
|
|
|
+ * @param entId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<Long> findTruckIdListByEntIds(Long entId) {
|
|
|
|
|
+ //先查询车辆企业关联关系
|
|
|
|
|
+ List<KwfTruckEnt> truckEntByEntIds = truckEntRepository.findTruckEntByEntIds(entId);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(truckEntByEntIds)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ return truckEntByEntIds.stream().map(KwfTruckEnt::getTruckId).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过企业id查询车辆信息
|
|
|
|
|
+ * @param entId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<KwfTruck> findTruckByEntIds(Long entId) {
|
|
|
|
|
+ //先查询车辆企业关联关系
|
|
|
|
|
+ List<KwfTruckEnt> truckEntByEntIds = truckEntRepository.findTruckEntByEntIds(entId);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(truckEntByEntIds)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> truckIds = truckEntByEntIds.stream().map(KwfTruckEnt::getTruckId).collect(Collectors.toList());
|
|
|
|
|
+ //通过车牌id查询车辆
|
|
|
|
|
+ List<KwfTruck> truckList = kwfTruckRepository.findTruckByTruckIds(truckIds);
|
|
|
|
|
+ if(CollectionUtils.isEmpty(truckList)){
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ return truckList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 统计车辆业务状态数量(全部、空闲、任务中)
|
|
* 统计车辆业务状态数量(全部、空闲、任务中)
|
|
|
* @return 统计结果
|
|
* @return 统计结果
|
|
@@ -843,7 +878,7 @@ public class KwfTruckService {
|
|
|
log.info("统计车辆业务状态数量(全部、空闲、任务中)");
|
|
log.info("统计车辆业务状态数量(全部、空闲、任务中)");
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
// 统计全部车辆数量
|
|
// 统计全部车辆数量
|
|
|
- List<KwfTruck> trucks = kwfTruckRepository.countByEntId(entId);
|
|
|
|
|
|
|
+ List<KwfTruck> trucks = findTruckByEntIds(entId);
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty( trucks)){
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty( trucks)){
|
|
|
return TruckBusinessStatusStatisticsVo.of(0L, 0L, 0L);
|
|
return TruckBusinessStatusStatisticsVo.of(0L, 0L, 0L);
|
|
|
}
|
|
}
|
|
@@ -1000,15 +1035,15 @@ public class KwfTruckService {
|
|
|
put("truckNo", truckNo);
|
|
put("truckNo", truckNo);
|
|
|
}});
|
|
}});
|
|
|
KwfTruck truck = CollectionUtils.isEmpty(trucks) ? null : trucks.get(Global.NUMERICAL_ZERO);
|
|
KwfTruck truck = CollectionUtils.isEmpty(trucks) ? null : trucks.get(Global.NUMERICAL_ZERO);
|
|
|
- if (truck != null) {
|
|
|
|
|
- //企业数据集
|
|
|
|
|
- List<Long> entIds = new ArrayList<>() {{
|
|
|
|
|
- add(truck.getEntId());
|
|
|
|
|
- }};
|
|
|
|
|
- Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
|
|
|
|
|
- EntCacheResDto ent = ents == null ? null : ents.get(truck.getEntId());
|
|
|
|
|
- firmName = ent != null ? ent.getFirmName() : null;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (truck != null) {
|
|
|
|
|
+// //企业数据集
|
|
|
|
|
+// List<Long> entIds = new ArrayList<>() {{
|
|
|
|
|
+// add(truck.getEntId());
|
|
|
|
|
+// }};
|
|
|
|
|
+// Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
|
|
|
|
|
+// EntCacheResDto ent = ents == null ? null : ents.get(truck.getEntId());
|
|
|
|
|
+// firmName = ent != null ? ent.getFirmName() : null;
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
//详细地址
|
|
//详细地址
|
|
|
String detailAddress = truckGps != null
|
|
String detailAddress = truckGps != null
|
|
@@ -1566,58 +1601,58 @@ public class KwfTruckService {
|
|
|
*/
|
|
*/
|
|
|
public PageDataResult<TruckInfoVo> pageTruckInfo(TruckInfoReq req) {
|
|
public PageDataResult<TruckInfoVo> pageTruckInfo(TruckInfoReq req) {
|
|
|
log.info("分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
log.info("分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
|
- //查询车辆信息
|
|
|
|
|
- Long entId = req.getEntId();
|
|
|
|
|
- if (StringUtils.isNotBlank(req.getTruckNo())){
|
|
|
|
|
- KwfTruck kwfTruck = kwfTruckRepository.queryByTruckNo(req.getTruckNo());
|
|
|
|
|
- entId = Optional.ofNullable(kwfTruck).map(KwfTruck::getEntId).orElse(null);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //分页查询所有企业
|
|
|
|
|
- PageDataResult<KwsEnterpriseResDto> page = remoteSystemService.pageEnt(req.getPageNum(), req.getPageSize(), entId);
|
|
|
|
|
- List<KwsEnterpriseResDto> enterpriseResDtoList = page.getList();
|
|
|
|
|
- if (CollectionUtils.isEmpty(page.getList())){
|
|
|
|
|
- return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
|
|
- }
|
|
|
|
|
- //获取企业id
|
|
|
|
|
- List<Long> entIds = enterpriseResDtoList.stream()
|
|
|
|
|
- .map(KwsEnterpriseResDto::getId)
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- //获取车辆信息
|
|
|
|
|
- List<KwfTruck> truckList = kwfTruckRepository.queryByEntIds(entIds, req.getTruckMark(), req.getStartTime(), req.getEndTime());
|
|
|
|
|
- if (CollectionUtils.isEmpty(truckList)){
|
|
|
|
|
- return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(req.getEntId())){
|
|
|
|
|
- truckList = truckList.stream()
|
|
|
|
|
- .filter(x->Objects.equals(x.getEntId(), req.getEntId()))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isNotBlank(req.getTruckNo())){
|
|
|
|
|
- truckList = truckList.stream()
|
|
|
|
|
- .filter(x-> org.apache.commons.lang3.StringUtils.equals(x.getTruckNo(), req.getTruckNo()))
|
|
|
|
|
- .collect(Collectors.toList()) ;
|
|
|
|
|
- }
|
|
|
|
|
- //将车辆信息按照企业id进行分组
|
|
|
|
|
- Map<Long, List<KwfTruck>> entIdAndTruckMap = truckList.stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(KwfTruck::getEntId));
|
|
|
|
|
-
|
|
|
|
|
- //查询订单
|
|
|
|
|
- List<RWaybillOrderVo> rWaybillOrderVos = transportRemoteService.queryWaybillOrderByEntId(req.getEntId());
|
|
|
|
|
- Map<Long, List<RWaybillOrderVo>> truckIdAndOrderMap = Maps.newHashMap() ;
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(rWaybillOrderVos)){
|
|
|
|
|
- truckIdAndOrderMap = rWaybillOrderVos.stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(RWaybillOrderVo::getTruckId));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //遍历所有企业
|
|
|
|
|
- Map<Long, List<RWaybillOrderVo>> finalTruckIdAndOrderMap = truckIdAndOrderMap;
|
|
|
|
|
- List<TruckInfoVo> ents = enterpriseResDtoList.stream()
|
|
|
|
|
- .map(e -> getTruckInfoVo(e, entIdAndTruckMap, finalTruckIdAndOrderMap))
|
|
|
|
|
- .filter(x->CollectionUtils.isNotEmpty(x.getTruck()))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- return PageDataResult.success(page.getPageNum(),page.getPageSize(),page.getTotal(),ents);
|
|
|
|
|
|
|
+// //查询车辆信息
|
|
|
|
|
+// Long entId = req.getEntId();
|
|
|
|
|
+// if (StringUtils.isNotBlank(req.getTruckNo())){
|
|
|
|
|
+// KwfTruck kwfTruck = kwfTruckRepository.queryByTruckNo(req.getTruckNo());
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// //分页查询所有企业
|
|
|
|
|
+// PageDataResult<KwsEnterpriseResDto> page = remoteSystemService.pageEnt(req.getPageNum(), req.getPageSize(), entId);
|
|
|
|
|
+// List<KwsEnterpriseResDto> enterpriseResDtoList = page.getList();
|
|
|
|
|
+// if (CollectionUtils.isEmpty(page.getList())){
|
|
|
|
|
+// return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
|
|
+// }
|
|
|
|
|
+// //获取企业id
|
|
|
|
|
+// List<Long> entIds = enterpriseResDtoList.stream()
|
|
|
|
|
+// .map(KwsEnterpriseResDto::getId)
|
|
|
|
|
+// .collect(Collectors.toList());
|
|
|
|
|
+// //获取车辆信息
|
|
|
|
|
+// List<KwfTruck> truckList = kwfTruckRepository.queryByEntIds(entIds, req.getTruckMark(), req.getStartTime(), req.getEndTime());
|
|
|
|
|
+// if (CollectionUtils.isEmpty(truckList)){
|
|
|
|
|
+// return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
|
|
+// }
|
|
|
|
|
+// if (Objects.nonNull(req.getEntId())){
|
|
|
|
|
+// truckList = truckList.stream()
|
|
|
|
|
+// .filter(x->Objects.equals(x.getEntId(), req.getEntId()))
|
|
|
|
|
+// .collect(Collectors.toList());
|
|
|
|
|
+// }
|
|
|
|
|
+// if (StringUtils.isNotBlank(req.getTruckNo())){
|
|
|
|
|
+// truckList = truckList.stream()
|
|
|
|
|
+// .filter(x-> org.apache.commons.lang3.StringUtils.equals(x.getTruckNo(), req.getTruckNo()))
|
|
|
|
|
+// .collect(Collectors.toList()) ;
|
|
|
|
|
+// }
|
|
|
|
|
+// //将车辆信息按照企业id进行分组
|
|
|
|
|
+// Map<Long, List<KwfTruck>> entIdAndTruckMap = truckList.stream()
|
|
|
|
|
+// .collect(Collectors.groupingBy(KwfTruck::getEntId));
|
|
|
|
|
+//
|
|
|
|
|
+// //查询订单
|
|
|
|
|
+// List<RWaybillOrderVo> rWaybillOrderVos = transportRemoteService.queryWaybillOrderByEntId(req.getEntId());
|
|
|
|
|
+// Map<Long, List<RWaybillOrderVo>> truckIdAndOrderMap = Maps.newHashMap() ;
|
|
|
|
|
+// if (CollectionUtils.isNotEmpty(rWaybillOrderVos)){
|
|
|
|
|
+// truckIdAndOrderMap = rWaybillOrderVos.stream()
|
|
|
|
|
+// .collect(Collectors.groupingBy(RWaybillOrderVo::getTruckId));
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// //遍历所有企业
|
|
|
|
|
+// Map<Long, List<RWaybillOrderVo>> finalTruckIdAndOrderMap = truckIdAndOrderMap;
|
|
|
|
|
+// List<TruckInfoVo> ents = enterpriseResDtoList.stream()
|
|
|
|
|
+// .map(e -> getTruckInfoVo(e, entIdAndTruckMap, finalTruckIdAndOrderMap))
|
|
|
|
|
+// .filter(x->CollectionUtils.isNotEmpty(x.getTruck()))
|
|
|
|
|
+// .collect(Collectors.toList());
|
|
|
|
|
+// return PageDataResult.success(page.getPageNum(),page.getPageSize(),page.getTotal(),ents);
|
|
|
|
|
+ return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1695,17 +1730,14 @@ public class KwfTruckService {
|
|
|
log.info("app端分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
log.info("app端分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
|
//查询车辆信息
|
|
//查询车辆信息
|
|
|
Long entId = req.getEntId();
|
|
Long entId = req.getEntId();
|
|
|
- IPage<KwfTruck> page = kwfTruckRepository.queryByCondition(entId,req.getTruckNo(),req.getTruckMark(),req.getStartTime(),req.getEndTime(),req.getPageNum(),req.getPageSize());
|
|
|
|
|
|
|
+ List<Long> truckIdList = findTruckIdListByEntIds(entId);
|
|
|
|
|
+ IPage<KwfTruck> page = kwfTruckRepository.queryByCondition(truckIdList,req.getTruckNo(),req.getTruckMark(),req.getStartTime(),req.getEndTime(),req.getPageNum(),req.getPageSize());
|
|
|
List<KwfTruck> truckList = page.getRecords();
|
|
List<KwfTruck> truckList = page.getRecords();
|
|
|
if (CollectionUtils.isEmpty(truckList)){
|
|
if (CollectionUtils.isEmpty(truckList)){
|
|
|
return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
}
|
|
}
|
|
|
- List<Long> entIds = truckList.stream()
|
|
|
|
|
- .map(KwfTruck::getEntId)
|
|
|
|
|
- .distinct()
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
//entId映射企业信息
|
|
//entId映射企业信息
|
|
|
- Map<Long, KwsEnterpriseResDto> entIdKwsEnterpriseResDtoMap = remoteSystemService.queryEnterpriseByEntIds(entIds);
|
|
|
|
|
|
|
+ Map<Long, KwsEnterpriseResDto> entIdKwsEnterpriseResDtoMap = remoteSystemService.queryEnterpriseByEntIds(Lists.newArrayList(entId));
|
|
|
//根据车辆车辆id,查询车队
|
|
//根据车辆车辆id,查询车队
|
|
|
Set<Long> truckIds = truckList.stream().map(BaseModel::getId).collect(Collectors.toSet());
|
|
Set<Long> truckIds = truckList.stream().map(BaseModel::getId).collect(Collectors.toSet());
|
|
|
List<KwfFleetTruck> kwfFleetTrucks = kwfFleetTruckRepository.queryByTruckIds(truckIds);
|
|
List<KwfFleetTruck> kwfFleetTrucks = kwfFleetTruckRepository.queryByTruckIds(truckIds);
|
|
@@ -1770,7 +1802,7 @@ public class KwfTruckService {
|
|
|
Map<Long, List<KwfFleetDriver>> finalFleetIdAndDriverMap = fleetIdAndDriverMap;
|
|
Map<Long, List<KwfFleetDriver>> finalFleetIdAndDriverMap = fleetIdAndDriverMap;
|
|
|
Map<Long, List<RWaybillOrderVo>> finalTruckIdAndWaybillOrderMap = truckIdAndWaybillOrderMap;
|
|
Map<Long, List<RWaybillOrderVo>> finalTruckIdAndWaybillOrderMap = truckIdAndWaybillOrderMap;
|
|
|
List<AppTruckInfoVo> ents = truckList.stream()
|
|
List<AppTruckInfoVo> ents = truckList.stream()
|
|
|
- .map(t-> getAppTruckInfoVo(t, entIdKwsEnterpriseResDtoMap, finalTruckIdAndFleetTruckMap
|
|
|
|
|
|
|
+ .map(t-> getAppTruckInfoVo(t, entId, entIdKwsEnterpriseResDtoMap, finalTruckIdAndFleetTruckMap
|
|
|
, finalFleetIdAndFleetMap, finalDriverIdAndDriverMap, finalFleetIdAndDriverMap, finalTruckIdAndWaybillOrderMap))
|
|
, finalFleetIdAndFleetMap, finalDriverIdAndDriverMap, finalFleetIdAndDriverMap, finalTruckIdAndWaybillOrderMap))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
@@ -1778,15 +1810,15 @@ public class KwfTruckService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- private AppTruckInfoVo getAppTruckInfoVo(KwfTruck t, Map<Long, KwsEnterpriseResDto> entIdKwsEnterpriseResDtoMap
|
|
|
|
|
|
|
+ private AppTruckInfoVo getAppTruckInfoVo(KwfTruck t, Long entId, Map<Long, KwsEnterpriseResDto> entIdKwsEnterpriseResDtoMap
|
|
|
,Map<Long, List<KwfFleetTruck>> truckIdAndFleetTruckMap
|
|
,Map<Long, List<KwfFleetTruck>> truckIdAndFleetTruckMap
|
|
|
,Map<Long, KwfFleet> fleetIdAndFleetMap
|
|
,Map<Long, KwfFleet> fleetIdAndFleetMap
|
|
|
, Map<Long, KwfDriver> driverIdAndDriverMap
|
|
, Map<Long, KwfDriver> driverIdAndDriverMap
|
|
|
,Map<Long, List<KwfFleetDriver>> fleetIdAndDriverMap
|
|
,Map<Long, List<KwfFleetDriver>> fleetIdAndDriverMap
|
|
|
,Map<Long, List<RWaybillOrderVo>> finalTruckIdAndWaybillOrderMap) {
|
|
,Map<Long, List<RWaybillOrderVo>> finalTruckIdAndWaybillOrderMap) {
|
|
|
AppTruckInfoVo truckInfoVo = new AppTruckInfoVo();
|
|
AppTruckInfoVo truckInfoVo = new AppTruckInfoVo();
|
|
|
- truckInfoVo.setEntId(String.valueOf(t.getEntId()));
|
|
|
|
|
- KwsEnterpriseResDto enterpriseResDto = entIdKwsEnterpriseResDtoMap.getOrDefault(t.getEntId(), new KwsEnterpriseResDto());
|
|
|
|
|
|
|
+ truckInfoVo.setEntId(String.valueOf(entId));
|
|
|
|
|
+ KwsEnterpriseResDto enterpriseResDto = entIdKwsEnterpriseResDtoMap.getOrDefault(entId, new KwsEnterpriseResDto());
|
|
|
truckInfoVo.setEntName(enterpriseResDto.getFirmName());
|
|
truckInfoVo.setEntName(enterpriseResDto.getFirmName());
|
|
|
truckInfoVo.setTruckId(String.valueOf(t.getId()));
|
|
truckInfoVo.setTruckId(String.valueOf(t.getId()));
|
|
|
truckInfoVo.setTruckNo(t.getTruckNo());
|
|
truckInfoVo.setTruckNo(t.getTruckNo());
|
|
@@ -1829,7 +1861,8 @@ public class KwfTruckService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public List<KwfTruckVo> queryTruckNo(TruckNoReq req) {
|
|
public List<KwfTruckVo> queryTruckNo(TruckNoReq req) {
|
|
|
- List<KwfTruck> turkNoList = kwfTruckRepository.getTurkNoList(req.getEntId(), req.getTruckNo());
|
|
|
|
|
|
|
+ List<Long> truckIds = findTruckIdListByEntIds(req.getEntId());
|
|
|
|
|
+ List<KwfTruck> turkNoList = kwfTruckRepository.getTurkNoList(truckIds, req.getTruckNo());
|
|
|
if (CollectionUtils.isEmpty(turkNoList)) {
|
|
if (CollectionUtils.isEmpty(turkNoList)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
|
}
|
|
}
|
|
@@ -1857,7 +1890,9 @@ public class KwfTruckService {
|
|
|
}
|
|
}
|
|
|
Integer businessStatus = org.apache.commons.lang3.StringUtils.isBlank(req.getBusinessStatus()) ? null :
|
|
Integer businessStatus = org.apache.commons.lang3.StringUtils.isBlank(req.getBusinessStatus()) ? null :
|
|
|
Integer.parseInt(req.getBusinessStatus());
|
|
Integer.parseInt(req.getBusinessStatus());
|
|
|
- IPage<KwfTruck> kwfTruckIPage = kwfTruckRepository.queryByPage(req.getPageNum(), req.getPageSize(), req.getEntId(), businessStatus,
|
|
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> truckIds = findTruckIdListByEntIds(req.getEntId());
|
|
|
|
|
+ IPage<KwfTruck> kwfTruckIPage = kwfTruckRepository.queryByPage(req.getPageNum(), req.getPageSize(), truckIds, businessStatus,
|
|
|
req.getTruckNo());
|
|
req.getTruckNo());
|
|
|
List<KwfTruck> records = kwfTruckIPage.getRecords();
|
|
List<KwfTruck> records = kwfTruckIPage.getRecords();
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty( records)){
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty( records)){
|
|
@@ -1917,23 +1952,20 @@ public class KwfTruckService {
|
|
|
// 批量查询车辆信息
|
|
// 批量查询车辆信息
|
|
|
Map<String, KwfTruck> truckMap = new HashMap<>();
|
|
Map<String, KwfTruck> truckMap = new HashMap<>();
|
|
|
if (!truckNoList.isEmpty()) {
|
|
if (!truckNoList.isEmpty()) {
|
|
|
- List<KwfTruck> trucks = kwfTruckRepository.queryByTruckNosAndEntId(truckNoList,entId);
|
|
|
|
|
|
|
+ List<KwfTruck> kwfTruckList = findTruckByEntIds(entId);
|
|
|
|
|
+ List<KwfTruck> trucks = kwfTruckList.stream().filter(Objects::nonNull)
|
|
|
|
|
+ .filter(truck -> truck.getTruckNo() != null && truckNoList.contains(truck.getTruckNo()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
truckMap = trucks.stream()
|
|
truckMap = trucks.stream()
|
|
|
.collect(Collectors.toMap(KwfTruck::getTruckNo, Function.identity(), (k1, k2) -> k1));
|
|
.collect(Collectors.toMap(KwfTruck::getTruckNo, Function.identity(), (k1, k2) -> k1));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 批量查询企业信息
|
|
|
|
|
- Set<Long> entIds = truckMap.values().stream()
|
|
|
|
|
- .map(KwfTruck::getEntId)
|
|
|
|
|
- .collect(Collectors.toSet());
|
|
|
|
|
- Map<Long, EntCacheResDto> entMap = new HashMap<>();
|
|
|
|
|
- if (!entIds.isEmpty()) {
|
|
|
|
|
- entMap = remoteSystemService.queryEntCacheMapByIds(new ArrayList<>(entIds));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 查询企业信息
|
|
|
|
|
+ EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(entId);
|
|
|
|
|
|
|
|
// 处理每个车牌号
|
|
// 处理每个车牌号
|
|
|
for (String originalTruckNo : truckNoList) {
|
|
for (String originalTruckNo : truckNoList) {
|
|
|
- TruckValidateVo vo = validateSingleTruckNo(originalTruckNo, truckMap, entMap);
|
|
|
|
|
|
|
+ TruckValidateVo vo = validateSingleTruckNo(originalTruckNo, truckMap, entCacheResDto);
|
|
|
result.add(vo);
|
|
result.add(vo);
|
|
|
}
|
|
}
|
|
|
if (CollectionUtils.isNotEmpty( result)){
|
|
if (CollectionUtils.isNotEmpty( result)){
|
|
@@ -1952,7 +1984,7 @@ public class KwfTruckService {
|
|
|
*/
|
|
*/
|
|
|
private TruckValidateVo validateSingleTruckNo(String originalTruckNo,
|
|
private TruckValidateVo validateSingleTruckNo(String originalTruckNo,
|
|
|
Map<String, KwfTruck> truckMap,
|
|
Map<String, KwfTruck> truckMap,
|
|
|
- Map<Long, EntCacheResDto> entMap) {
|
|
|
|
|
|
|
+ EntCacheResDto ent) {
|
|
|
TruckValidateVo.TruckValidateVoBuilder builder = TruckValidateVo.builder()
|
|
TruckValidateVo.TruckValidateVoBuilder builder = TruckValidateVo.builder()
|
|
|
.originalTruckNo(originalTruckNo);
|
|
.originalTruckNo(originalTruckNo);
|
|
|
|
|
|
|
@@ -1981,10 +2013,9 @@ public class KwfTruckService {
|
|
|
builder.exists(true)
|
|
builder.exists(true)
|
|
|
.truckId(truck.getId())
|
|
.truckId(truck.getId())
|
|
|
.carAxis(axleNum.getName())
|
|
.carAxis(axleNum.getName())
|
|
|
- .entId(truck.getEntId());
|
|
|
|
|
|
|
+ .entId(ent.getId());
|
|
|
|
|
|
|
|
// 获取企业名称
|
|
// 获取企业名称
|
|
|
- EntCacheResDto ent = entMap.get(truck.getEntId());
|
|
|
|
|
if (ent != null) {
|
|
if (ent != null) {
|
|
|
builder.entName(ent.getFirmName());
|
|
builder.entName(ent.getFirmName());
|
|
|
}
|
|
}
|