From bbd837a72bb9ec1bcef044624960345f98969a49 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期四, 26 三月 2026 16:53:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java | 493 +++++++++++++++++++++++++++++++++---------------------
1 files changed, 302 insertions(+), 191 deletions(-)
diff --git a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
index a60d610..1d50114 100644
--- a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
+++ b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
@@ -224,37 +224,33 @@
String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);
xpTask.setTaskCode(code);
xpTask.setTaskCategory(2);
- String[] split = dto.getTaskTypeId().split(",");
- List<String> typeIds = new ArrayList<>();
- for (String s : split) {
- typeIds.add(s.trim());
- }
- StringBuilder temp = new StringBuilder(dto.getTaskTypeId());
- List<Long> children = typeIds.stream().map(Long::parseLong).collect(Collectors.toList());
- List<Long> parentIds = errorTypeMapper.selectList(new LambdaQueryWrapper<XpErrorType>()
- .in(XpErrorType::getId, children)).stream().map(XpErrorType::getParentId).distinct().collect(Collectors.toList());
- for (Long parentId : parentIds) {
- temp.append(",").append(parentId);
- }
- xpTask.setTaskTypeId(temp.toString());
+ xpTask.setTaskTypeId(normalizeAccidentTaskTypeId(dto.getTaskTypeId()));
xpTask.setTaskUrgencyLevel(dto.getTaskUrgencyLevel());
xpTask.setTaskDescription(dto.getTaskDescription());
xpTask.setTaskImage(dto.getTaskImage());
xpTask.setVehicleId(dto.getId());
XpVehicle vehicle = xpVehicleClient.queryById(xpTask.getVehicleId()).getData();
-// if (vehicle!=null){
-// VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class);
-// if (vehiclePosition != null) {
-// double x = vehiclePosition.getPoint().getX();
-// double y = vehiclePosition.getPoint().getY();
-// xpTask.setVehicleLon(new BigDecimal(x));
-// xpTask.setVehicleLat(new BigDecimal(y));
-// }
-// }
+ if (Objects.isNull(vehicle)) {
+ throw new ServiceException("上报失败,未获取到车辆信息", I18nKeyConstant.TASK_VEHICLE_NOT_EXIST);
+ }
+ VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class);
+ if (Objects.isNull(vehiclePosition)) {
+ log.error("事故上报未获取到车辆当前定位");
+ throw new ServiceException("获取车辆实时定位信息失败,请稍后重试", I18nKeyConstant.TASK_SAVE_ERROR);
+ }
+ xpTask.setVehicleLon(new BigDecimal(vehiclePosition.getPoint().getX()));
+ xpTask.setVehicleLat(new BigDecimal(vehiclePosition.getPoint().getY()));
+ Map<String, String> geocode = gdMapGeocodingUtil.geocode(xpTask.getVehicleLon().toString(), xpTask.getVehicleLat().toString());
+ String address = geocode == null ? null : geocode.get("address");
+ if (StringUtils.isBlank(address)) {
+ log.error("事故上报通过车辆定位从高德获取地址信息失败");
+ throw new ServiceException("获取车辆实时定位信息失败,请稍后重试", I18nKeyConstant.TASK_SAVE_ERROR);
+ }
+ xpTask.setVehicleLocation(address);
// 临时处理
- xpTask.setVehicleLon(new BigDecimal("104.055683"));
- xpTask.setVehicleLat(new BigDecimal("30.585991"));
- xpTask.setVehicleLocation("四川省成都市武侯区石羊街道天府新谷");
+// xpTask.setVehicleLon(new BigDecimal("104.055683"));
+// xpTask.setVehicleLat(new BigDecimal("30.585991"));
+// xpTask.setVehicleLocation("四川省成都市武侯区石羊街道天府新谷");
xpTask.setVehicleId(dto.getId());
xpTask.setReportUserId(xpOperationsUser.getId());
xpTask.setReportTime(LocalDateTime.now());
@@ -323,38 +319,58 @@
}
// 构建通知内容
- String content = String.format("车辆%s在%s发生了紧急事故,请在%d分钟内到达现场!", plateNumber, xpTask.getVehicleLocation(), processingTimeLimit);
- String bodyJson = buildAccidentPushBodyJson(content, xpTask);
-
- // 构建通知记录(包含 notificationExt)
- List<XpOperationsUserNotification> notifications = data.stream().map(item -> {
- XpOperationsUserNotification notification = new XpOperationsUserNotification();
- notification.setOperationsUserId(item.getId());
- notification.setNotificationType(NotificationTypeEnum.ACCIDENT_NEW.getCode());
- notification.setNotificationContent(content);
- notification.setDataId(xpTask.getId());
- notification.setReadStatus(0);
- notification.setNotificationExt(bodyJson);
- return notification;
- }).collect(Collectors.toList());
-
- // 批量保存通知记录
- xpOperationUserNotificationClient.addNotificationBatch(notifications);
- log.info("事故通知记录保存成功,共 {} 条", notifications.size());
-
- // 按设备类型分组发送阿里云推送
- Map<Integer, List<XpOperationsUser>> operationUserMap = data.stream()
- .filter(u -> u.getDeviceType() != null && u.getPhoneNumber() != null)
- .collect(Collectors.groupingBy(XpOperationsUser::getDeviceType));
- for (Map.Entry<Integer, List<XpOperationsUser>> entry : operationUserMap.entrySet()) {
- pushAliMessage(entry.getValue(), content, xpTask);
- }
+ String content = buildAccidentNotificationContent(xpTask, plateNumber, processingTimeLimit);
+ saveAndPushAccidentNotification(data, content, xpTask);
} catch (Exception e) {
log.error("发送事故通知失败,任务ID={}", xpTask.getId(), e);
}
});
executor.shutdown();
+ }
+
+ /**
+ * 异步发送事故任务分配通知
+ *
+ * @param xpTask 任务信息
+ * @param handlerUserId 当前分配的处理人
+ * @param plateNumber 车牌号
+ * @param processingTimeLimit 处理时限(分钟)
+ */
+ private void sendAssignedAccidentNotificationAsync(XpTask xpTask, Long handlerUserId, String plateNumber, Integer processingTimeLimit) {
+ ThreadPoolExecutor executor = new ThreadPoolExecutor(
+ 1, 1, 0L, TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<Runnable>()
+ );
+
+ executor.execute(() -> {
+ try {
+ R<List<XpOperationsUser>> xpOperationUserResult = xpOperationUserClient.listByIds(Collections.singletonList(handlerUserId));
+ List<XpOperationsUser> data = xpOperationUserResult == null ? Collections.emptyList() : xpOperationUserResult.getData();
+ if (CollUtil.isEmpty(data)) {
+ return;
+ }
+
+ String content = buildAccidentNotificationContent(xpTask, plateNumber, processingTimeLimit);
+ saveAndPushAccidentNotification(data, content, xpTask);
+ } catch (Exception e) {
+ log.error("发送事故任务分配通知失败,任务ID={}, handlerUserId={}", xpTask.getId(), handlerUserId, e);
+ }
+ });
+
+ executor.shutdown();
+ }
+
+ /**
+ * 构建事故通知文案
+ *
+ * @param xpTask 任务信息
+ * @param plateNumber 车牌号
+ * @param processingTimeLimit 处理时限(分钟)
+ * @return 通知内容
+ */
+ private String buildAccidentNotificationContent(XpTask xpTask, String plateNumber, Integer processingTimeLimit) {
+ return String.format("车辆%s在%s发生了紧急事故,请在%d分钟内到达现场!", plateNumber, xpTask.getVehicleLocation(), processingTimeLimit);
}
/**
@@ -370,6 +386,40 @@
param.put("type", TaskTypeNotificationEnum.ACCIDENT_TASK.getCode());
param.put("id", xpTask.getId().toString());
return JSONObject.toJSONString(param);
+ }
+
+ /**
+ * 保存事故通知记录并发送阿里云推送
+ *
+ * @param data 接收通知的运维人员
+ * @param content 通知内容
+ * @param xpTask 任务信息
+ */
+ private void saveAndPushAccidentNotification(List<XpOperationsUser> data, String content, XpTask xpTask) {
+ String bodyJson = buildAccidentPushBodyJson(content, xpTask);
+
+ List<XpOperationsUserNotification> notifications = data.stream().map(item -> {
+ XpOperationsUserNotification notification = new XpOperationsUserNotification();
+ notification.setOperationsUserId(item.getId());
+ notification.setNotificationType(NotificationTypeEnum.ACCIDENT_NEW.getCode());
+ notification.setNotificationContent(content);
+ notification.setDataId(xpTask.getId());
+ notification.setReadStatus(0);
+ notification.setNotificationExt(bodyJson);
+ return notification;
+ }).collect(Collectors.toList());
+
+ if (CollUtil.isNotEmpty(notifications)) {
+ xpOperationUserNotificationClient.addNotificationBatch(notifications);
+ log.info("事故通知记录保存成功,共 {} 条", notifications.size());
+ }
+
+ Map<Integer, List<XpOperationsUser>> operationUserMap = data.stream()
+ .filter(u -> u.getDeviceType() != null && StringUtils.isNotBlank(u.getPhoneNumber()))
+ .collect(Collectors.groupingBy(XpOperationsUser::getDeviceType));
+ for (Map.Entry<Integer, List<XpOperationsUser>> entry : operationUserMap.entrySet()) {
+ pushAliMessage(entry.getValue(), content, xpTask);
+ }
}
/**
@@ -606,7 +656,7 @@
res.setTaskTypeId(task.getTaskTypeId());
res.setStatus(task.getStatus());
XpChargingRecord chargingRecord = chargingRecordMapper.selectOne(new LambdaQueryWrapper<XpChargingRecord>()
- .eq(XpChargingRecord::getTaskId, id).last("limit 1"));
+ .eq(XpChargingRecord::getTaskId, id).last("limit 1").orderByDesc(XpChargingRecord::getCreateTime));
if (chargingRecord != null) {
res.setStartRemainingBattery(chargingRecord.getStartRemainingBattery());
@@ -1335,60 +1385,7 @@
taskManagementPageListVO.setHandleUserName(handleUserName.toString());
}
}
- if (taskManagementPageListVO.getTaskCategory() == 1) {
- switch (taskManagementPageListVO.getTaskTypeId()) {
- case "1":
- taskManagementPageListVO.setTaskTypeName("车辆检查");
- break;
- case "2":
- taskManagementPageListVO.setTaskTypeName("车辆充电");
- break;
- case "3":
- taskManagementPageListVO.setTaskTypeName("车辆整备");
- break;
- case "4":
- taskManagementPageListVO.setTaskTypeName("整备洗车");
- break;
- case "5":
- taskManagementPageListVO.setTaskTypeName("车辆维修");
- break;
- case "6":
- taskManagementPageListVO.setTaskTypeName("车辆保养");
- break;
- case "7":
- taskManagementPageListVO.setTaskTypeName("车辆保险到期");
- break;
- case "8":
- taskManagementPageListVO.setTaskTypeName("车辆年检到期");
- break;
- case "9":
- taskManagementPageListVO.setTaskTypeName("车辆运营资质到期");
- break;
- default:
- taskManagementPageListVO.setTaskTypeName("");
- break;
- }
- } else {
- StringBuilder taskTypeName = new StringBuilder();
- String[] typeIds = taskManagementPageListVO.getTaskTypeId().split(",");
- List<XpErrorType> xpErrorTypes = errorTypeMapper.selectList(new LambdaQueryWrapper<XpErrorType>()
- .in(XpErrorType::getId, Arrays.asList(typeIds)).orderByAsc(XpErrorType::getParentId));
- List<XpErrorType> parents = new ArrayList<>();
- for (XpErrorType xpErrorType : xpErrorTypes) {
- if (xpErrorType.getParentId() == 0) {
- parents.add(xpErrorType);
- }
- }
- for (XpErrorType parent : parents) {
- List<XpErrorType> children = xpErrorTypes.stream().filter(e -> e.getParentId().equals(parent.getId())).collect(Collectors.toList());
- taskTypeName.append(parent.getErrorName()).append(">");
- for (XpErrorType child : children) {
- taskTypeName.append(child.getErrorName()).append(";");
- }
- }
-
- taskManagementPageListVO.setTaskTypeName(taskTypeName.substring(0, taskTypeName.length() - 1));
- }
+ taskManagementPageListVO.setTaskTypeName(resolveManagementTaskTypeName(taskManagementPageListVO));
}
pageInfo.setRecords(list);
return pageInfo;
@@ -1409,62 +1406,174 @@
taskManagementPageListVO.setHandleUserName(handleUserName.toString());
}
}
- if (taskManagementPageListVO.getTaskCategory() == 1) {
- switch (taskManagementPageListVO.getTaskTypeId()) {
- case "1":
- taskManagementPageListVO.setTaskTypeName("车辆检查");
- break;
- case "2":
- taskManagementPageListVO.setTaskTypeName("车辆充电");
- break;
- case "3":
- taskManagementPageListVO.setTaskTypeName("车辆整备");
- break;
- case "4":
- taskManagementPageListVO.setTaskTypeName("整备洗车");
- break;
- case "5":
- taskManagementPageListVO.setTaskTypeName("车辆维修");
- break;
- case "6":
- taskManagementPageListVO.setTaskTypeName("车辆保养");
- break;
- case "7":
- taskManagementPageListVO.setTaskTypeName("车辆保险到期");
- break;
- case "8":
- taskManagementPageListVO.setTaskTypeName("车辆年检到期");
- break;
- case "9":
- taskManagementPageListVO.setTaskTypeName("车辆运营资质到期");
- break;
- default:
- taskManagementPageListVO.setTaskTypeName("");
- break;
- }
- } else {
- StringBuilder taskTypeName = new StringBuilder();
- String[] typeIds = taskManagementPageListVO.getTaskTypeId().split(",");
- List<XpErrorType> xpErrorTypes = errorTypeMapper.selectList(new LambdaQueryWrapper<XpErrorType>()
- .in(XpErrorType::getId, Arrays.asList(typeIds)).orderByAsc(XpErrorType::getParentId));
- List<XpErrorType> parents = new ArrayList<>();
- for (XpErrorType xpErrorType : xpErrorTypes) {
- if (xpErrorType.getParentId() == 0) {
- parents.add(xpErrorType);
- }
- }
- for (XpErrorType parent : parents) {
- List<XpErrorType> children = xpErrorTypes.stream().filter(e -> e.getParentId().equals(parent.getId())).collect(Collectors.toList());
- taskTypeName.append(parent.getErrorName()).append(">");
- for (XpErrorType child : children) {
- taskTypeName.append(child.getErrorName()).append(";");
- }
- }
-
- taskManagementPageListVO.setTaskTypeName(taskTypeName.substring(0, taskTypeName.length() - 1));
- }
+ taskManagementPageListVO.setTaskTypeName(resolveManagementTaskTypeName(taskManagementPageListVO));
}
return list;
+ }
+
+ private String resolveManagementTaskTypeName(TaskManagementPageListVO taskManagementPageListVO) {
+ if (Integer.valueOf(1).equals(taskManagementPageListVO.getTaskCategory())) {
+ return resolveRoutineTaskTypeName(taskManagementPageListVO.getTaskTypeId());
+ }
+ if (Integer.valueOf(2).equals(taskManagementPageListVO.getTaskCategory())) {
+ return resolveAccidentTaskTypeName(taskManagementPageListVO.getTaskTypeId());
+ }
+ return "";
+ }
+
+ private String resolveRoutineTaskTypeName(String taskTypeId) {
+ if (StringUtils.isBlank(taskTypeId)) {
+ return "";
+ }
+ switch (taskTypeId) {
+ case "1":
+ return "车辆检查";
+ case "2":
+ return "车辆充电";
+ case "3":
+ return "车辆整备";
+ case "4":
+ return "整备洗车";
+ case "5":
+ return "车辆维修";
+ case "6":
+ return "车辆保养";
+ case "7":
+ return "车辆保险到期";
+ case "8":
+ return "车辆年检到期";
+ case "9":
+ return "车辆运营资质到期";
+ default:
+ return "";
+ }
+ }
+
+ private String resolveAccidentTaskTypeName(String taskTypeId) {
+ List<Long> orderedTypeIds = parseAccidentTaskTypeIds(taskTypeId);
+ if (orderedTypeIds.isEmpty()) {
+ return "";
+ }
+
+ Map<Long, XpErrorType> errorTypeMap = getAccidentErrorTypeMap(orderedTypeIds);
+ if (errorTypeMap.isEmpty()) {
+ return "";
+ }
+
+ LinkedHashSet<Long> orderedParentIds = new LinkedHashSet<>();
+ LinkedHashMap<Long, List<XpErrorType>> childrenByParent = new LinkedHashMap<>();
+ for (Long typeId : orderedTypeIds) {
+ XpErrorType errorType = errorTypeMap.get(typeId);
+ if (errorType == null || StringUtils.isBlank(errorType.getErrorName())) {
+ continue;
+ }
+
+ if (isTopLevelErrorType(errorType)) {
+ orderedParentIds.add(errorType.getId());
+ continue;
+ }
+
+ Long parentId = errorType.getParentId();
+ if (parentId == null) {
+ continue;
+ }
+ orderedParentIds.add(parentId);
+ childrenByParent.computeIfAbsent(parentId, key -> new ArrayList<>()).add(errorType);
+ }
+
+ List<String> displayNames = new ArrayList<>();
+ for (Long parentId : orderedParentIds) {
+ XpErrorType parent = errorTypeMap.get(parentId);
+ List<XpErrorType> children = childrenByParent.get(parentId);
+ if (CollectionUtils.isEmpty(children)) {
+ if (parent != null && StringUtils.isNotBlank(parent.getErrorName())) {
+ displayNames.add(parent.getErrorName());
+ }
+ continue;
+ }
+
+ String parentName = parent == null ? null : parent.getErrorName();
+ for (XpErrorType child : children) {
+ if (StringUtils.isBlank(parentName)) {
+ displayNames.add(child.getErrorName());
+ } else {
+ displayNames.add(parentName + ">" + child.getErrorName());
+ }
+ }
+ }
+ return String.join(";", displayNames);
+ }
+
+ private Map<Long, XpErrorType> getAccidentErrorTypeMap(List<Long> orderedTypeIds) {
+ Map<Long, XpErrorType> errorTypeMap = getErrorTypeMap(orderedTypeIds);
+ if (errorTypeMap.isEmpty()) {
+ return errorTypeMap;
+ }
+
+ Set<Long> missingParentIds = new LinkedHashSet<>();
+ for (Long typeId : orderedTypeIds) {
+ XpErrorType errorType = errorTypeMap.get(typeId);
+ if (errorType == null || isTopLevelErrorType(errorType)) {
+ continue;
+ }
+ if (errorType.getParentId() != null && !errorTypeMap.containsKey(errorType.getParentId())) {
+ missingParentIds.add(errorType.getParentId());
+ }
+ }
+ if (!missingParentIds.isEmpty()) {
+ errorTypeMap.putAll(getErrorTypeMap(missingParentIds));
+ }
+ return errorTypeMap;
+ }
+
+ private boolean isTopLevelErrorType(XpErrorType errorType) {
+ return errorType.getParentId() == null || errorType.getParentId() == 0L;
+ }
+
+ private String normalizeAccidentTaskTypeId(String taskTypeId) {
+ List<Long> orderedTypeIds = parseAccidentTaskTypeIds(taskTypeId);
+ if (orderedTypeIds.isEmpty()) {
+ return taskTypeId;
+ }
+
+ LinkedHashSet<Long> normalizedTypeIds = new LinkedHashSet<>(orderedTypeIds);
+ Map<Long, XpErrorType> errorTypeMap = getErrorTypeMap(orderedTypeIds);
+ for (Long typeId : orderedTypeIds) {
+ XpErrorType errorType = errorTypeMap.get(typeId);
+ if (errorType == null || errorType.getParentId() == null || errorType.getParentId() == 0L) {
+ continue;
+ }
+ normalizedTypeIds.add(errorType.getParentId());
+ }
+ return normalizedTypeIds.stream().map(String::valueOf).collect(Collectors.joining(","));
+ }
+
+ private List<Long> parseAccidentTaskTypeIds(String taskTypeId) {
+ if (StringUtils.isBlank(taskTypeId)) {
+ return Collections.emptyList();
+ }
+
+ LinkedHashSet<Long> typeIds = new LinkedHashSet<>();
+ for (String typeId : taskTypeId.split(",")) {
+ if (StringUtils.isBlank(typeId)) {
+ continue;
+ }
+ try {
+ typeIds.add(Long.parseLong(typeId.trim()));
+ } catch (NumberFormatException ignored) {
+ }
+ }
+ return new ArrayList<>(typeIds);
+ }
+
+ private Map<Long, XpErrorType> getErrorTypeMap(Collection<Long> typeIds) {
+ if (CollectionUtils.isEmpty(typeIds)) {
+ return Collections.emptyMap();
+ }
+
+ return errorTypeMapper.selectBatchIds(typeIds).stream()
+ .filter(Objects::nonNull)
+ .collect(Collectors.toMap(XpErrorType::getId, errorType -> errorType, (left, right) -> left));
}
@Override
@@ -1523,16 +1632,41 @@
@Override
public R assigneeTask(Long id, Long handlerUserId, Long assigneeUserId) {
XpTask task = this.getById(id);
- // 查询规则 任务结束时间从任务分配时开始计算
- XpTaskRule taskRule = xpTaskRuleMapper.selectOne(null);
- if (taskRule != null) {
- task.setEndTime(LocalDateTime.now().plusMinutes(taskRule.getProcessingTimeLimit()));
+ if (task == null) {
+ throw new ServiceException(
+ "任务不存在",
+ I18nKeyConstant.TASK_NOT_EXIST
+ );
+ }
+
+ boolean isAccidentTask = Integer.valueOf(2).equals(task.getTaskCategory());
+ Long vehicleId = task.getVehicleId();
+ Integer processingTimeLimit = null;
+ String plateNumber = "";
+ if (isAccidentTask) {
+ // 查询规则 任务结束时间从任务分配时开始计算
+ XpTaskRule taskRule = xpTaskRuleMapper.selectOne(null);
+ if (taskRule != null) {
+ processingTimeLimit = taskRule.getProcessingTimeLimit();
+ task.setEndTime(LocalDateTime.now().plusMinutes(taskRule.getProcessingTimeLimit()));
+ }
+ if (vehicleId != null) {
+ XpVehicle vehicle = xpVehicleClient.queryById(vehicleId).getData();
+ if (vehicle != null && StringUtils.isNotBlank(vehicle.getPlateNumber())) {
+ plateNumber = vehicle.getPlateNumber();
+ }
+ }
+ } else {
+ task.setEndTime(LocalDateTime.now().plusDays(3));
}
task.setAssigneeTime(LocalDateTime.now());
task.setHandleUserId(handlerUserId.toString());
task.setVehicleId(null);
task.setAssigneeUserId(assigneeUserId);
this.updateById(task);
+ if (isAccidentTask && processingTimeLimit != null) {
+ sendAssignedAccidentNotificationAsync(task, handlerUserId, plateNumber, processingTimeLimit);
+ }
return R.ok();
}
@@ -1540,6 +1674,7 @@
public void saveTask(SaveErrorTaskDto dto, Long reportUserId) {
List<XpTask> saveTask = new ArrayList<>();
+ String normalizedTaskTypeId = normalizeAccidentTaskTypeId(dto.getTaskTypeId());
for (Long vehicleId : dto.getVehicleIds()) {
XpTask task = new XpTask();
BeanUtils.copyProperties(dto, task);
@@ -1549,7 +1684,7 @@
String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);
task.setTaskCode(code);
task.setTaskCategory(2);
- task.setTaskTypeId(dto.getTaskTypeId());
+ task.setTaskTypeId(normalizedTaskTypeId);
task.setTaskUrgencyLevel(dto.getTaskUrgencyLevel());
task.setTaskDescription(dto.getTaskDescription());
task.setTaskImage(dto.getTaskImage());
@@ -1585,19 +1720,7 @@
I18nKeyConstant.VEHICLE_NOT_EXIST
);
}
- String vehiclePicture = vehicle.getVehiclePictures();
- if (vehicle.getVehiclePictures() != null) {
- JSONObject jsonObject = JSONObject.parseObject(vehicle.getVehiclePictures());
- // 1
- String downloadUrl = jsonObject.getString("url");
- try {
- downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
- } catch (UnsupportedEncodingException e) {
- log.error("获取图片下载地址失败", e);
- }
- jsonObject.put("url", downloadUrl);
- vehiclePicture = jsonObject.toJSONString();
- }
+ String vehiclePicture = aliOssDownloadUtil.getPictureJSONObject(vehicle.getVehiclePictures());
if (task.getTaskCategory() == 1) {
// 常规任务
@@ -1613,19 +1736,7 @@
taskManagementDetectionDetailVO.setVehicleCode(vehicle.getVehicleCode());
taskManagementDetectionDetailVO.setVehicleVin(vehicle.getVehicleVin());
taskManagementDetectionDetailVO.setVehicleLocation(task.getVehicleLocation());
-
- if (vehicle.getVehiclePictures() != null) {
- JSONObject jsonObject = JSONObject.parseObject(vehicle.getVehiclePictures());
- // 1
- String downloadUrl = jsonObject.getString("url");
- try {
- downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
- } catch (UnsupportedEncodingException e) {
- log.error("获取图片下载地址失败", e);
- }
- jsonObject.put("url", downloadUrl);
- taskManagementDetectionDetailVO.setVehiclePictures(jsonObject.toJSONString());
- }
+ taskManagementDetectionDetailVO.setVehiclePictures(vehiclePicture);
taskManagementDetectionDetailVO.setTaskCode(task.getTaskCode());
XpVehicleDetection vehicleDetection = vehicleDetectionMapper.selectOne(new LambdaQueryWrapper<XpVehicleDetection>()
--
Gitblit v1.7.1