|
@@ -6,7 +6,6 @@ import com.sckw.core.web.response.result.PageDataResult;
|
|
|
import com.sckw.transport.api.feign.VehicleTraceClient;
|
|
import com.sckw.transport.api.feign.VehicleTraceClient;
|
|
|
import com.sckw.transport.api.model.dto.VehicleDataDTO;
|
|
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.core.web.response.BaseResult;
|
|
|
|
|
import com.sckw.transport.model.KwtVehicleException;
|
|
import com.sckw.transport.model.KwtVehicleException;
|
|
|
import com.sckw.transport.model.dto.VehicleExceptionQueryReq;
|
|
import com.sckw.transport.model.dto.VehicleExceptionQueryReq;
|
|
|
import com.sckw.transport.model.enuma.VehicleExceptionTypeEnum;
|
|
import com.sckw.transport.model.enuma.VehicleExceptionTypeEnum;
|
|
@@ -164,4 +163,47 @@ public class VehicleExceptionService {
|
|
|
|
|
|
|
|
return locationStatusMap;
|
|
return locationStatusMap;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public PageDataResult<VehicleExceptionVo> exceptionJkList(VehicleExceptionQueryReq req) {
|
|
|
|
|
+ // 分页查询异常图片数据
|
|
|
|
|
+ IPage<KwtVehicleException> page = exceptionImageRepository.queryExceptionImagePage1(
|
|
|
|
|
+ req.getEntId(),
|
|
|
|
|
+ req.getExceptionType(),
|
|
|
|
|
+ req.getTruckNo(),
|
|
|
|
|
+ req.getPageNum(),
|
|
|
|
|
+ req.getPageSize()
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ List<KwtVehicleException> records = page.getRecords();
|
|
|
|
|
+ if (CollectionUtils.isEmpty(records)) {
|
|
|
|
|
+ return PageDataResult.empty(req.getPageNum(), req.getPageSize());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果有定位状态筛选,需要查询车辆实时定位
|
|
|
|
|
+ Map<String, Integer> truckLocationStatusMap = new HashMap<>();
|
|
|
|
|
+ if (req.getLocationStatus() != null) {
|
|
|
|
|
+ List<String> truckNos = records.stream()
|
|
|
|
|
+ .map(KwtVehicleException::getTruckNo)
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ truckLocationStatusMap = queryVehicleLocationStatus(truckNos);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 转换为VO
|
|
|
|
|
+ final Map<String, Integer> finalLocationStatusMap = truckLocationStatusMap;
|
|
|
|
|
+ List<VehicleExceptionVo> voList = records.stream()
|
|
|
|
|
+ .map(image -> buildVehicleExceptionVo(image, finalLocationStatusMap))
|
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 如果有定位状态筛选,过滤结果
|
|
|
|
|
+ if (req.getLocationStatus() != null) {
|
|
|
|
|
+ voList = voList.stream()
|
|
|
|
|
+ .filter(vo -> req.getLocationStatus().equals(vo.getLocationStatus()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return PageDataResult.of(page, voList);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|