From 15eb7bf63cc857f77329f00798277514d8bb6ee0 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 20 三月 2026 11:56:57 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi
---
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleDetectionController.java | 131 ++++++++++++++++++++++++++-----------------
1 files changed, 78 insertions(+), 53 deletions(-)
diff --git a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleDetectionController.java b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleDetectionController.java
index 3831e36..b9c1eb2 100644
--- a/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleDetectionController.java
+++ b/xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleDetectionController.java
@@ -15,6 +15,7 @@
import com.xiaopeng.maintenance.service.XpTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType;
import org.apache.shardingsphere.transaction.core.TransactionType;
@@ -27,6 +28,7 @@
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
/**
* <p>
@@ -36,6 +38,7 @@
* @author xiaochen
* @since 2026-02-06
*/
+@Slf4j
@Api(tags = "车辆检测")
@RestController
@RequestMapping("")
@@ -102,8 +105,13 @@
String vehiclePictures = xpVehicleDetectionVO.getVehiclePictures();
if (vehiclePictures != null && !vehiclePictures.isEmpty()) {
JSONObject jsonObject = JSONObject.parseObject(vehiclePictures);
- // 1
- String downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
+ // 2
+ 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);
xpVehicleDetectionVO.setVehiclePictures(jsonObject.toJSONString());
}
@@ -112,14 +120,14 @@
String sensorCleaningPicture = xpVehicleDetectionVO.getSensorCleaningPicture();
if (StringUtils.isNotBlank(sensorCleaningPicture)) {
JSONArray jsonArray = JSONArray.parseArray(sensorCleaningPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -130,14 +138,14 @@
String interactiveScreenPicture = xpVehicleDetectionVO.getInteractiveScreenPicture();
if (StringUtils.isNotBlank(interactiveScreenPicture)) {
JSONArray jsonArray = JSONArray.parseArray(interactiveScreenPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -148,14 +156,14 @@
String helpButtonPicture = xpVehicleDetectionVO.getHelpButtonPicture();
if (StringUtils.isNotBlank(helpButtonPicture)) {
JSONArray jsonArray = JSONArray.parseArray(helpButtonPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -166,14 +174,14 @@
String paymentFunctionPicture = xpVehicleDetectionVO.getPaymentFunctionPicture();
if (StringUtils.isNotBlank(paymentFunctionPicture)) {
JSONArray jsonArray = JSONArray.parseArray(paymentFunctionPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -184,14 +192,14 @@
String systemCheckPicture = xpVehicleDetectionVO.getSystemCheckPicture();
if (StringUtils.isNotBlank(systemCheckPicture)) {
JSONArray jsonArray = JSONArray.parseArray(systemCheckPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -216,7 +224,12 @@
if (vehiclePictures != null && !vehiclePictures.isEmpty()) {
JSONObject jsonObject = JSONObject.parseObject(vehiclePictures);
// 1
- String downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
+ 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);
xpVehicleDetectionVO.setVehiclePictures(jsonObject.toJSONString());
}
@@ -225,14 +238,14 @@
String sensorCleaningPicture = xpVehicleDetectionVO.getSensorCleaningPicture();
if (StringUtils.isNotBlank(sensorCleaningPicture)) {
JSONArray jsonArray = JSONArray.parseArray(sensorCleaningPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- // 1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -243,14 +256,17 @@
String interactiveScreenPicture = xpVehicleDetectionVO.getInteractiveScreenPicture();
if (StringUtils.isNotBlank(interactiveScreenPicture)) {
JSONArray jsonArray = JSONArray.parseArray(interactiveScreenPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ if (Objects.isNull(jsonObject)) {
+ continue;
+ }
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -261,14 +277,17 @@
String helpButtonPicture = xpVehicleDetectionVO.getHelpButtonPicture();
if (StringUtils.isNotBlank(helpButtonPicture)) {
JSONArray jsonArray = JSONArray.parseArray(helpButtonPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ if (Objects.isNull(jsonObject)) {
+ continue;
+ }
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -279,14 +298,17 @@
String paymentFunctionPicture = xpVehicleDetectionVO.getPaymentFunctionPicture();
if (StringUtils.isNotBlank(paymentFunctionPicture)) {
JSONArray jsonArray = JSONArray.parseArray(paymentFunctionPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ if (Objects.isNull(jsonObject)) {
+ continue;
+ }
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
@@ -297,14 +319,17 @@
String systemCheckPicture = xpVehicleDetectionVO.getSystemCheckPicture();
if (StringUtils.isNotBlank(systemCheckPicture)) {
JSONArray jsonArray = JSONArray.parseArray(systemCheckPicture);
- for (Object o : jsonArray) {
- JSONObject jsonObject = (JSONObject)o;
- String downloadUrl = null;
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ if (Objects.isNull(jsonObject)) {
+ continue;
+ }
+ // 1
+ String downloadUrl = jsonObject.getString("url");;
try {
- //1
downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ log.error("获取图片下载地址失败", e);
}
jsonObject.put("url", downloadUrl);
}
--
Gitblit v1.7.1