xuhy
2026-03-20 5d69dd309795358d6bbdef2fe2ac805f4e6df6d4
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;
                try {
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                    //1
                String downloadUrl = jsonObject.getString("url");;
                try {
                    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;
                try {
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                    //1
                String downloadUrl = jsonObject.getString("url");;
                try {
                    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;
                try {
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                    //1
                String downloadUrl = jsonObject.getString("url");;
                try {
                    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;
                try {
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                    //1
                String downloadUrl = jsonObject.getString("url");;
                try {
                    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;
                try {
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                    //1
                String downloadUrl = jsonObject.getString("url");;
                try {
                    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;
                    try {
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                        // 1
                    String downloadUrl = jsonObject.getString("url");;
                    try {
                        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;
                    try {
                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 {
                        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;
                    try {
                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 {
                        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;
                    try {
                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 {
                        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;
                    try {
                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 {
                        downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
                    } catch (UnsupportedEncodingException e) {
                        throw new RuntimeException(e);
                        log.error("获取图片下载地址失败", e);
                    }
                    jsonObject.put("url", downloadUrl);
                }