| | |
| | | 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; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2026-02-06 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "车辆检测") |
| | | @RestController |
| | | @RequestMapping("") |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |