| | |
| | | import com.xiaopeng.maintenance.model.vo.XpVehicleDetectionVO; |
| | | import com.xiaopeng.maintenance.service.IXpVehicleDetectionService; |
| | | import com.xiaopeng.maintenance.service.XpTaskService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private XpOperationUserClient xpOperationUserClient; |
| | | @Autowired |
| | | private XpTaskService xpTaskService; |
| | | |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | /** |
| | | * 车辆运维-车辆运维-开始自检 |
| | | */ |
| | |
| | | if (vehiclePictures != null && !vehiclePictures.isEmpty()) { |
| | | JSONObject jsonObject = JSONObject.parseObject(vehiclePictures); |
| | | // 2 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | public R<PageInfo<XpVehicleDetectionVO>> queryDetectionByVehicleId(@Valid @RequestBody XpVehicleDetectionPageQuery query) throws UnsupportedEncodingException { |
| | | PageInfo<XpVehicleDetectionVO> pageInfo = xpVehicleDetectionService.queryDetectionByVehicleId(query); |
| | | for (XpVehicleDetectionVO xpVehicleDetectionVO : pageInfo.getRecords()) { |
| | | String vehiclePictures = xpVehicleDetectionVO.getVehiclePictures(); |
| | | if (vehiclePictures != null && !vehiclePictures.isEmpty()) { |
| | | JSONObject jsonObject = JSONObject.parseObject(vehiclePictures); |
| | | // 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); |
| | | xpVehicleDetectionVO.setVehiclePictures(jsonObject.toJSONString()); |
| | | } |
| | | xpVehicleDetectionVO.setVehiclePictures(aliOssDownloadUtil.getPictureJSONObject(xpVehicleDetectionVO.getVehiclePictures())); |
| | | |
| | | xpVehicleDetectionVO.setSensorCleaningPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getSensorCleaningPicture())); |
| | | |
| | | String sensorCleaningPicture = xpVehicleDetectionVO.getSensorCleaningPicture(); |
| | | if (StringUtils.isNotBlank(sensorCleaningPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(sensorCleaningPicture); |
| | | 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); |
| | | } |
| | | xpVehicleDetectionVO.setSensorCleaningPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | xpVehicleDetectionVO.setInteractiveScreenPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getInteractiveScreenPicture())); |
| | | |
| | | xpVehicleDetectionVO.setHelpButtonPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getHelpButtonPicture())); |
| | | |
| | | String interactiveScreenPicture = xpVehicleDetectionVO.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; |
| | | } |
| | | // 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); |
| | | } |
| | | xpVehicleDetectionVO.setInteractiveScreenPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | xpVehicleDetectionVO.setPaymentFunctionPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getPaymentFunctionPicture())); |
| | | |
| | | |
| | | String helpButtonPicture = xpVehicleDetectionVO.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; |
| | | } |
| | | // 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); |
| | | } |
| | | xpVehicleDetectionVO.setHelpButtonPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | String paymentFunctionPicture = xpVehicleDetectionVO.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; |
| | | } |
| | | // 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); |
| | | } |
| | | xpVehicleDetectionVO.setPaymentFunctionPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | String systemCheckPicture = xpVehicleDetectionVO.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; |
| | | } |
| | | // 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); |
| | | } |
| | | xpVehicleDetectionVO.setSystemCheckPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | xpVehicleDetectionVO.setSystemCheckPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getSystemCheckPicture())); |
| | | } |
| | | return R.ok(pageInfo); |
| | | } |