|
@@ -9,9 +9,11 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.common.enums.enums.FileEnum;
|
|
import com.sckw.core.common.enums.enums.FileEnum;
|
|
|
|
|
+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;
|
|
@@ -25,6 +27,7 @@ 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;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
|
|
|
+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.*;
|
|
@@ -85,6 +88,7 @@ public class KwfTruckService {
|
|
|
KwfFleetTruckMapper fleetTruckDao;
|
|
KwfFleetTruckMapper fleetTruckDao;
|
|
|
private final KwfTruckRepository kwfTruckRepository;
|
|
private final KwfTruckRepository kwfTruckRepository;
|
|
|
private final KwfFleetRepository kwfFleetRepository;
|
|
private final KwfFleetRepository kwfFleetRepository;
|
|
|
|
|
+ private final UrlConfigProperties urlConfigProperties;
|
|
|
|
|
|
|
|
private final KwfFleetTruckRepository kwfFleetTruckRepository;
|
|
private final KwfFleetTruckRepository kwfFleetTruckRepository;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
@@ -1425,7 +1429,7 @@ public class KwfTruckService {
|
|
|
log.info("分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
log.info("分页查询车辆信息,请求参数:{}",JSON.toJSONString(req));
|
|
|
//查询车辆信息
|
|
//查询车辆信息
|
|
|
Long entId = null;
|
|
Long entId = null;
|
|
|
- if (StringUtils.isBlank(req.getTruckNo())){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(req.getTruckNo())){
|
|
|
KwfTruck kwfTruck = kwfTruckRepository.queryByTruckNo(req.getTruckNo());
|
|
KwfTruck kwfTruck = kwfTruckRepository.queryByTruckNo(req.getTruckNo());
|
|
|
entId = Optional.ofNullable(kwfTruck).map(KwfTruck::getEntId).orElse(null);
|
|
entId = Optional.ofNullable(kwfTruck).map(KwfTruck::getEntId).orElse(null);
|
|
|
}
|
|
}
|
|
@@ -1442,6 +1446,11 @@ public class KwfTruckService {
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
//获取车辆信息
|
|
//获取车辆信息
|
|
|
List<KwfTruck> truckList = kwfTruckRepository.queryByEntIds(entIds);
|
|
List<KwfTruck> truckList = kwfTruckRepository.queryByEntIds(entIds);
|
|
|
|
|
+ if (StringUtils.isNotBlank(req.getTruckNo())){
|
|
|
|
|
+ truckList = truckList.stream()
|
|
|
|
|
+ .filter(x -> org.apache.commons.lang3.StringUtils.equals(x.getTruckNo(), req.getTruckNo()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
//将车辆信息按照企业id进行分组
|
|
//将车辆信息按照企业id进行分组
|
|
|
Map<Long, List<KwfTruck>> entIdAndTruckMap = truckList.stream()
|
|
Map<Long, List<KwfTruck>> entIdAndTruckMap = truckList.stream()
|
|
|
.collect(Collectors.groupingBy(KwfTruck::getEntId));
|
|
.collect(Collectors.groupingBy(KwfTruck::getEntId));
|
|
@@ -1454,7 +1463,7 @@ public class KwfTruckService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- private static TruckInfoVo getTruckInfoVo(KwsEnterpriseResDto e, Map<Long, List<KwfTruck>> entIdAndTruckMap) {
|
|
|
|
|
|
|
+ private TruckInfoVo getTruckInfoVo(KwsEnterpriseResDto e, Map<Long, List<KwfTruck>> entIdAndTruckMap) {
|
|
|
TruckInfoVo ent = new TruckInfoVo();
|
|
TruckInfoVo ent = new TruckInfoVo();
|
|
|
ent.setEntId(String.valueOf(e.getId()));
|
|
ent.setEntId(String.valueOf(e.getId()));
|
|
|
ent.setEntName(e.getFirmName());
|
|
ent.setEntName(e.getFirmName());
|
|
@@ -1468,10 +1477,32 @@ public class KwfTruckService {
|
|
|
return ent;
|
|
return ent;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private static TruckInfoVo.TruckData getTruckData(KwfTruck t) {
|
|
|
|
|
|
|
+ private TruckInfoVo.TruckData getTruckData(KwfTruck t) {
|
|
|
TruckInfoVo.TruckData truck = new TruckInfoVo.TruckData();
|
|
TruckInfoVo.TruckData truck = new TruckInfoVo.TruckData();
|
|
|
truck.setTruckId(String.valueOf(t.getId()));
|
|
truck.setTruckId(String.valueOf(t.getId()));
|
|
|
truck.setTruckNo(t.getTruckNo());
|
|
truck.setTruckNo(t.getTruckNo());
|
|
|
|
|
+ truck.setBusinessStatus(String.valueOf(t.getBusinessStatus()));
|
|
|
|
|
+ // VehicleReturnData vehicleReturnData = getVehicleReturnData(t.getTruckNo());
|
|
|
|
|
+// if (Objects.nonNull(vehicleReturnData)){
|
|
|
|
|
+// truck.setLatitude(vehicleReturnData.getLatitude());
|
|
|
|
|
+// truck.setLongitude(vehicleReturnData.getLongitude());
|
|
|
|
|
+// }
|
|
|
return truck;
|
|
return truck;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public VehicleReturnData getVehicleReturnData(String carNo) {
|
|
|
|
|
+ VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
|
|
|
|
|
+ vehicleDataDTO.setCarNo(carNo);
|
|
|
|
|
+ String s;
|
|
|
|
|
+ try {
|
|
|
|
|
+ s = HttpUtil.postJson(urlConfigProperties.getApiBaseUrl()+ UrlConstants.QUERY_REAL_TIME_TRACE_URL, JSON.toJSONString(vehicleDataDTO), null);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("查询任务轨迹异常",e);
|
|
|
|
|
+ throw new BusinessException("查询任务轨迹异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(s)){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return JSON.parseObject(s, VehicleReturnData.class);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|