“mitao”
2026-03-27 b0507edcc31730a226bd45686e84dd0a6458f579
fix:运维IOS端上传的异常图片json格式兼容
1个文件已修改
243 ■■■■■ 已修改文件
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java 243 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
@@ -492,27 +492,7 @@
        if (Objects.nonNull(xpTaskRule)) {
            res.setCanArriveRange(xpTaskRule.getCanArriveRange());
        }
        String taskImage = res.getTaskImage();
        if (StringUtils.isNotBlank(taskImage)) {
            JSONArray jsonArray = JSONArray.parseArray(taskImage);
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                if (Objects.isNull(jsonObject)) {
                    continue;
                }
                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);
            }
            res.setTaskImage(JSONArray.toJSONString(jsonArray));
        }
        res.setTaskImage(aliOssDownloadUtil.getPictureJsonArray(res.getTaskImage()));
        return R.ok(res);
    }
@@ -602,26 +582,7 @@
                res.setHandleUserName(data.getNickName());
            }
        }
        String taskImage = res.getTaskImage();
        if (StringUtils.isNotBlank(taskImage)) {
            JSONArray jsonArray = JSONArray.parseArray(taskImage);
            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) {
                    log.error("获取图片下载地址失败", e);
                }
                jsonObject.put("url", downloadUrl);
            }
            res.setTaskImage(JSONArray.toJSONString(jsonArray));
        }
        res.setTaskImage(aliOssDownloadUtil.getPictureJsonArray(res.getTaskImage()));
        return R.ok(res);
    }
@@ -660,51 +621,10 @@
                .eq(XpChargingRecord::getTaskId, id).last("limit 1").orderByDesc(XpChargingRecord::getCreateTime));
        if (chargingRecord != null) {
            res.setStartRemainingBattery(chargingRecord.getStartRemainingBattery());
            String startChargingPicture = res.getStartChargingPicture();
            if (StringUtils.isNotBlank(startChargingPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(startChargingPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setStartChargingPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setStartChargingPicture(aliOssDownloadUtil.getPictureJsonArray(chargingRecord.getStartChargingPicture()));
            res.setStartTime(chargingRecord.getStartTime());
            res.setEndRemainingBattery(chargingRecord.getEndRemainingBattery());
            String endChargingPicture = chargingRecord.getEndChargingPicture();
            if (StringUtils.isNotBlank(endChargingPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(endChargingPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setEndChargingPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setEndChargingPicture(aliOssDownloadUtil.getPictureJsonArray(chargingRecord.getEndChargingPicture()));
            res.setEndTime(chargingRecord.getEndTime());
            res.setStartOperationsUserId(chargingRecord.getStartOperationsUserId());
@@ -766,26 +686,7 @@
            res.setRepairReason(vehicleRepair.getRepairReason());
            String startRepairPicture = vehicleRepair.getStartRepairPicture();
            if (StringUtils.isNotBlank(startRepairPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(startRepairPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setStartRepairPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setStartRepairPicture(aliOssDownloadUtil.getPictureJsonArray(vehicleRepair.getStartRepairPicture()));
            res.setRepairMoney(vehicleRepair.getRepairMoney());
            res.setRepairMoneyDetail(vehicleRepair.getRepairMoneyDetail());
            res.setSendUserId(vehicleRepair.getSendUserId());
@@ -910,118 +811,16 @@
            res.setCollisionPrevention(vehicleDetection.getCollisionPrevention());
            res.setSensorSelfCheck(vehicleDetection.getSensorSelfCheck());
            res.setSensorCleaning(vehicleDetection.getSensorCleaning());
            String SensorCleaningPicture = vehicleDetection.getSensorCleaningPicture();
            if (StringUtils.isNotBlank(SensorCleaningPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(SensorCleaningPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setSensorCleaningPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setSensorCleaningPicture(aliOssDownloadUtil.getPictureJsonArray(vehicleDetection.getSensorCleaningPicture()));
            res.setInteractiveScreen(vehicleDetection.getInteractiveScreen());
            String InteractiveScreenPicture = vehicleDetection.getInteractiveScreenPicture();
            if (StringUtils.isNotBlank(InteractiveScreenPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(InteractiveScreenPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setInteractiveScreenPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setInteractiveScreenPicture(aliOssDownloadUtil.getPictureJsonArray(vehicleDetection.getInteractiveScreenPicture()));
            res.setHelpButton(vehicleDetection.getHelpButton());
            String HelpButtonPicture = vehicleDetection.getHelpButtonPicture();
            if (StringUtils.isNotBlank(HelpButtonPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(HelpButtonPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setHelpButtonPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setHelpButtonPicture(aliOssDownloadUtil.getPictureJsonArray(vehicleDetection.getHelpButtonPicture()));
            res.setPaymentFunction(vehicleDetection.getPaymentFunction());
            String PaymentFunctionPicture = vehicleDetection.getPaymentFunctionPicture();
            if (StringUtils.isNotBlank(PaymentFunctionPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(PaymentFunctionPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setPaymentFunctionPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setPaymentFunctionPicture(aliOssDownloadUtil.getPictureJsonArray(vehicleDetection.getPaymentFunctionPicture()));
            res.setSystemCheck(vehicleDetection.getSystemCheck());
            String SystemCheckPicture = vehicleDetection.getSystemCheckPicture();
            if (StringUtils.isNotBlank(SystemCheckPicture)) {
                JSONArray jsonArray = JSONArray.parseArray(SystemCheckPicture);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setSystemCheckPicture(JSONArray.toJSONString(jsonArray));
            }
            res.setSystemCheckPicture(aliOssDownloadUtil.getPictureJsonArray(vehicleDetection.getSystemCheckPicture()));
            res.setCheckTime(vehicleDetection.getCheckTime());
            res.setOperationsUserId(vehicleDetection.getOperationsUserId());
            if (vehicleDetection.getOperationsUserId() != null) {
@@ -1111,27 +910,7 @@
            res.setTaskImage(vehicleDetection.getTaskImage());
            String taskImage = res.getTaskImage();
            if (StringUtils.isNotBlank(taskImage)) {
                JSONArray jsonArray = JSONArray.parseArray(taskImage);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    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);
                }
                res.setTaskImage(JSONArray.toJSONString(jsonArray));
            }
            res.setTaskImage(aliOssDownloadUtil.getPictureJsonArray(vehicleDetection.getTaskImage()));
            res.setOperationUserId(vehicleDetection.getOperationsUserId());
            if (vehicleDetection.getOperationsUserId() != null) {
                XpOperationsUser operationsUser = xpOperationUserClient.queryById(vehicleDetection.getOperationsUserId()).getData();