|
@@ -15,18 +15,21 @@ 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.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;
|
|
|
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.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
|
|
+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;
|
|
|
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.CapacityStatusReq;
|
|
import com.sckw.fleet.model.request.CapacityStatusReq;
|
|
|
|
|
+import com.sckw.fleet.model.request.TruckInfoReq;
|
|
|
import com.sckw.fleet.model.vo.*;
|
|
import com.sckw.fleet.model.vo.*;
|
|
|
import com.sckw.fleet.repository.KwfFleetRepository;
|
|
import com.sckw.fleet.repository.KwfFleetRepository;
|
|
|
import com.sckw.fleet.repository.KwfFleetTruckRepository;
|
|
import com.sckw.fleet.repository.KwfFleetTruckRepository;
|
|
@@ -34,6 +37,7 @@ import com.sckw.fleet.repository.KwfTruckRepository;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportRemoteService;
|
|
import com.sckw.transport.api.dubbo.TransportRemoteService;
|
|
@@ -1411,4 +1415,62 @@ public class KwfTruckService {
|
|
|
capacityTotalStatusVo.setAbnormalTotalTruckNum("0");
|
|
capacityTotalStatusVo.setAbnormalTotalTruckNum("0");
|
|
|
return capacityTotalStatusVo;
|
|
return capacityTotalStatusVo;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分页查询车辆信息
|
|
|
|
|
+ * @param req 请求参数
|
|
|
|
|
+ * @return 车辆信息
|
|
|
|
|
+ */
|
|
|
|
|
+ public PageDataResult<TruckInfoVo> pageTruckInfo(TruckInfoReq req) {
|
|
|
|
|
+ log.info("分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
|
|
|
+ //查询车辆信息
|
|
|
|
|
+ Long entId = null;
|
|
|
|
|
+ if (StringUtils.isBlank(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(), null);
|
|
|
|
|
+ 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);
|
|
|
|
|
+ //将车辆信息按照企业id进行分组
|
|
|
|
|
+ Map<Long, List<KwfTruck>> entIdAndTruckMap = truckList.stream().collect(Collectors.groupingBy(KwfTruck::getEntId));
|
|
|
|
|
+
|
|
|
|
|
+ //遍历所有企业
|
|
|
|
|
+ List<TruckInfoVo> ents = enterpriseResDtoList.stream()
|
|
|
|
|
+ .map(e -> getTruckInfoVo(e, entIdAndTruckMap))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ return PageDataResult.success(page.getPageNum(),page.getPageSize(),page.getTotal(),ents);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private static TruckInfoVo getTruckInfoVo(KwsEnterpriseResDto e, Map<Long, List<KwfTruck>> entIdAndTruckMap) {
|
|
|
|
|
+ TruckInfoVo ent = new TruckInfoVo();
|
|
|
|
|
+ ent.setEntId(String.valueOf(e.getId()));
|
|
|
|
|
+ ent.setEntName(e.getFirmName());
|
|
|
|
|
+ List<KwfTruck> kwfTrucks = entIdAndTruckMap.get(e.getId());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(kwfTrucks)) {
|
|
|
|
|
+ List<TruckInfoVo.TruckData> truckDataList = kwfTrucks.stream()
|
|
|
|
|
+ .map(t -> getTruckData(t))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ ent.setTruck(truckDataList);
|
|
|
|
|
+ }
|
|
|
|
|
+ return ent;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static TruckInfoVo.TruckData getTruckData(KwfTruck t) {
|
|
|
|
|
+ TruckInfoVo.TruckData truck = new TruckInfoVo.TruckData();
|
|
|
|
|
+ truck.setTruckId(String.valueOf(t.getId()));
|
|
|
|
|
+ truck.setTruckNo(t.getTruckNo());
|
|
|
|
|
+ return truck;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|