| | |
| | | package com.xiaopeng.maintenance.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.xiaopeng.api.dto.pushMessage.AliPushMessageDTO; |
| | | import com.xiaopeng.api.feignClient.account.SysUserClient; |
| | | import com.xiaopeng.api.feignClient.account.XpOperationUserClient; |
| | |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetVehicleClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.account.XpOperationsRole; |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.model.account.XpOperationsUserNotification; |
| | |
| | | import com.xiaopeng.common.core.enums.TaskTypeNotificationEnum; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import com.xiaopeng.maintenance.constant.I18nKeyConstant; |
| | | import com.xiaopeng.maintenance.dto.HandleVehicleAccidentDto; |
| | | import com.xiaopeng.maintenance.dto.SaveErrorTaskDto; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | |
| | | @Resource |
| | | private XpFleetOperationsClient xpFleetOperationsClient; |
| | | |
| | | @Resource |
| | | private AliOssService aliOssService; |
| | | |
| | | @Override |
| | | public PageInfo<WorkBenchVO> workbench(WorkBenchQuery query) { |
| | | public PageInfo<WorkBenchVO> workbench(WorkBenchQuery query) throws UnsupportedEncodingException { |
| | | PageInfo<WorkBenchVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<WorkBenchVO> list = this.baseMapper.workbench(pageInfo, query); |
| | | |
| | | for (WorkBenchVO workBenchVO : list) { |
| | | String vehiclePictures = workBenchVO.getVehiclePictures(); |
| | | if (StringUtils.isNotBlank(vehiclePictures)) { |
| | | 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); |
| | | workBenchVO.setVehiclePictures(jsonObject.toJSONString()); |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TaskAccidentDetailVO> vehicleAccidentDetail(Long id) { |
| | | public R<TaskAccidentDetailVO> vehicleAccidentDetail(Long id) throws UnsupportedEncodingException { |
| | | TaskAccidentDetailVO res = new TaskAccidentDetailVO(); |
| | | XpTask task = this.getById(id); |
| | | if (task == null) { |
| | |
| | | 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)); |
| | | } |
| | | |
| | | return R.ok(res); |
| | | } |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TaskRoutineDetailVO> vehicleRoutineDetail(Long id) { |
| | | public R<TaskRoutineDetailVO> vehicleRoutineDetail(Long id) throws UnsupportedEncodingException { |
| | | TaskRoutineDetailVO res = new TaskRoutineDetailVO(); |
| | | XpTask task = this.getById(id); |
| | | if (task == null) { |
| | |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | return R.ok(res); |
| | | } |
| | | |
| | |
| | | .eq(XpChargingRecord::getTaskId, id).last("limit 1")); |
| | | if (chargingRecord != null) { |
| | | res.setStartRemainingBattery(chargingRecord.getStartRemainingBattery()); |
| | | res.setStartChargingPicture(chargingRecord.getStartChargingPicture()); |
| | | |
| | | |
| | | 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.setStartTime(chargingRecord.getStartTime()); |
| | | res.setEndRemainingBattery(chargingRecord.getEndRemainingBattery()); |
| | | res.setEndChargingPicture(chargingRecord.getEndChargingPicture()); |
| | | |
| | | |
| | | |
| | | |
| | | 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.setEndTime(chargingRecord.getEndTime()); |
| | | res.setStartOperationsUserId(chargingRecord.getStartOperationsUserId()); |
| | | res.setEndOperationsUserId(chargingRecord.getEndOperationsUserId()); |
| | |
| | | res.setStartTime(vehicleRepair.getStartTime()); |
| | | res.setEndTime(vehicleRepair.getEndTime()); |
| | | res.setRepairReason(vehicleRepair.getRepairReason()); |
| | | res.setStartRepairPicture(vehicleRepair.getStartRepairPicture()); |
| | | |
| | | |
| | | |
| | | 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.setRepairMoney(vehicleRepair.getRepairMoney()); |
| | | res.setRepairMoneyDetail(vehicleRepair.getRepairMoneyDetail()); |
| | | res.setSendUserId(vehicleRepair.getSendUserId()); |
| | |
| | | res.setReturnUserName(operationsUser.getNickName()); |
| | | } |
| | | } |
| | | |
| | | if (vehicleRepair.getSendUserId() != null) { |
| | | XpOperationsUser operationsUser = xpOperationUserClient.queryById(vehicleRepair.getSendUserId()).getData(); |
| | | if (operationsUser != null) { |
| | |
| | | res.setCollisionPrevention(vehicleDetection.getCollisionPrevention()); |
| | | res.setSensorSelfCheck(vehicleDetection.getSensorSelfCheck()); |
| | | res.setSensorCleaning(vehicleDetection.getSensorCleaning()); |
| | | res.setSensorCleaningPicture(vehicleDetection.getSensorCleaningPicture()); |
| | | |
| | | |
| | | |
| | | 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.setInteractiveScreen(vehicleDetection.getInteractiveScreen()); |
| | | res.setInteractiveScreenPicture(vehicleDetection.getInteractiveScreenPicture()); |
| | | 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.setHelpButton(vehicleDetection.getHelpButton()); |
| | | res.setHelpButtonPicture(vehicleDetection.getHelpButtonPicture()); |
| | | |
| | | |
| | | |
| | | |
| | | 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.setPaymentFunction(vehicleDetection.getPaymentFunction()); |
| | | res.setPaymentFunctionPicture(vehicleDetection.getPaymentFunctionPicture()); |
| | | |
| | | |
| | | |
| | | 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.setSystemCheck(vehicleDetection.getSystemCheck()); |
| | | res.setSystemCheckPicture(vehicleDetection.getSystemCheckPicture()); |
| | | |
| | | |
| | | 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.setCheckTime(vehicleDetection.getCheckTime()); |
| | | res.setOperationsUserId(vehicleDetection.getOperationsUserId()); |
| | | if (vehicleDetection.getOperationsUserId() != null) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TaskCleanDetailVO> cleanDetail(Long id) { |
| | | public R<TaskCleanDetailVO> cleanDetail(Long id) throws UnsupportedEncodingException { |
| | | TaskCleanDetailVO res = new TaskCleanDetailVO(); |
| | | XpTask task = this.getById(id); |
| | | if (task == null) { |
| | |
| | | .eq(XpVehicleClean::getTaskId, id).last("limit 1")); |
| | | if (vehicleDetection != null) { |
| | | res.setHandleTime(vehicleDetection.getCreateTime()); |
| | | |
| | | |
| | | |
| | | 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.setOperationUserId(vehicleDetection.getOperationsUserId()); |
| | | if (vehicleDetection.getOperationsUserId() != null) { |
| | | XpOperationsUser operationsUser = xpOperationUserClient.queryById(vehicleDetection.getOperationsUserId()).getData(); |
| | |
| | | .account(operationsUser.getPhoneNumber()) |
| | | .title("任务状态变更") |
| | | .body(bodyJson) |
| | | .pushType(AliPushTypeConstant.NOTICE) |
| | | .pushType(AliPushTypeConstant.MESSAGE) |
| | | .build()); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | |
| | | // 4. 构建分页结果 |
| | | PageInfo<XpTaskRecordVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | for (XpTaskRecordVO record : records) { |
| | | |
| | | String taskImage =record.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 { |
| | | // 1 |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | record.setTaskImage(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | pageInfo.setRecords(records); |
| | | pageInfo.setTotal(resultPage.getTotal()); |
| | | return pageInfo; |
| | |
| | | task.setReportTime(LocalDateTime.now()); |
| | | task.setExpiredNoticeSent(0); |
| | | task.setWillTimeoutNoticeSent(0); |
| | | task.setTaskSource(2); |
| | | saveTask.add(task); |
| | | } |
| | | this.saveBatch(saveTask); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TaskManagementDetailVO> taskDetail(Long id) { |
| | | public R<TaskManagementDetailVO> taskDetail(Long id) throws UnsupportedEncodingException { |
| | | TaskManagementDetailVO managementDetailVO = new TaskManagementDetailVO(); |
| | | XpTask task = this.getById(id); |
| | | if (task == null) { |
| | |
| | | taskManagementDetectionDetailVO.setVehicleCode(vehicle.getVehicleCode()); |
| | | taskManagementDetectionDetailVO.setVehicleVin(vehicle.getVehicleVin()); |
| | | taskManagementDetectionDetailVO.setVehicleLocation(task.getVehicleLocation()); |
| | | taskManagementDetectionDetailVO.setVehiclePictures(vehicle.getVehiclePictures()); |
| | | |
| | | if(vehicle.getVehiclePictures()!=null){ |
| | | JSONObject jsonObject = JSONObject.parseObject(vehicle.getVehiclePictures()); |
| | | // 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); |
| | | taskManagementDetectionDetailVO.setVehiclePictures(jsonObject.toJSONString()); |
| | | } |
| | | |
| | | taskManagementDetectionDetailVO.setTaskCode(task.getTaskCode()); |
| | | XpVehicleDetection vehicleDetection = vehicleDetectionMapper.selectOne(new LambdaQueryWrapper<XpVehicleDetection>() |
| | | .eq(XpVehicleDetection::getTaskId, id).last("limit 1")); |
| | |
| | | taskManagementDetectionDetailVO.setCollisionPrevention(vehicleDetection.getCollisionPrevention()); |
| | | taskManagementDetectionDetailVO.setSensorSelfCheck(vehicleDetection.getSensorSelfCheck()); |
| | | taskManagementDetectionDetailVO.setSensorCleaning(vehicleDetection.getSensorCleaning()); |
| | | taskManagementDetectionDetailVO.setSensorCleaningPicture(vehicleDetection.getSensorCleaningPicture()); |
| | | |
| | | |
| | | 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); |
| | | } |
| | | taskManagementDetectionDetailVO.setSensorCleaningPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | |
| | | taskManagementDetectionDetailVO.setInteractiveScreen(vehicleDetection.getInteractiveScreen()); |
| | | taskManagementDetectionDetailVO.setInteractiveScreenPicture(vehicleDetection.getInteractiveScreenPicture()); |
| | | |
| | | |
| | | 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); |
| | | } |
| | | taskManagementDetectionDetailVO.setInteractiveScreenPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | taskManagementDetectionDetailVO.setHelpButton(vehicleDetection.getHelpButton()); |
| | | taskManagementDetectionDetailVO.setHelpButtonPicture(vehicleDetection.getHelpButtonPicture()); |
| | | |
| | | |
| | | 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); |
| | | } |
| | | taskManagementDetectionDetailVO.setHelpButtonPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | taskManagementDetectionDetailVO.setPaymentFunction(vehicleDetection.getPaymentFunction()); |
| | | taskManagementDetectionDetailVO.setPaymentFunctionPicture(vehicleDetection.getPaymentFunctionPicture()); |
| | | |
| | | |
| | | 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); |
| | | } |
| | | taskManagementDetectionDetailVO.setPaymentFunctionPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | taskManagementDetectionDetailVO.setSystemCheck(vehicleDetection.getSystemCheck()); |
| | | taskManagementDetectionDetailVO.setSystemCheckPicture(vehicleDetection.getSystemCheckPicture()); |
| | | |
| | | |
| | | 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); |
| | | } |
| | | taskManagementDetectionDetailVO.setSystemCheckPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | taskManagementDetectionDetailVO.setCheckTime(vehicleDetection.getCheckTime()); |
| | | taskManagementDetectionDetailVO.setOperationsUserId(vehicleDetection.getOperationsUserId()); |
| | | if (vehicleDetection.getOperationsUserId() != null) { |
| | |
| | | res.setReportUserPhone("111111"); |
| | | res.setReportUserAvatar("[]"); |
| | | }else{ |
| | | XpOperationsUser data = xpOperationUserClient.queryById(task.getReportUserId()).getData(); |
| | | if (data != null ) { |
| | | res.setReportUserId(data.getId()); |
| | | res.setReportUserName(data.getNickName()); |
| | | res.setReportUserPhone(data.getPhoneNumber()); |
| | | res.setReportUserAvatar(data.getAvatar()); |
| | | if (Objects.nonNull(task.getTaskSource()) && task.getTaskSource().equals(2)) { |
| | | List<SysUser> list = sysUserClient.listByIds(Lists.newArrayList(task.getReportUserId())).getData(); |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | SysUser sysUser = list.get(0); |
| | | res.setReportUserId(sysUser.getId()); |
| | | res.setReportUserName(sysUser.getNickName()); |
| | | res.setReportUserPhone(sysUser.getPhoneNumber()); |
| | | } |
| | | }else{ |
| | | XpOperationsUser data = xpOperationUserClient.queryById(task.getReportUserId()).getData(); |
| | | if (data != null ) { |
| | | res.setReportUserId(data.getId()); |
| | | res.setReportUserName(data.getNickName()); |
| | | res.setReportUserPhone(data.getPhoneNumber()); |
| | | res.setReportUserAvatar(data.getAvatar()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (task.getHandleUserId().split(",").length == 1) { |
| | | if (task.getHandleUserId()!=null && task.getHandleUserId().split(",").length == 1) { |
| | | XpOperationsUser operationsUser = xpOperationUserClient.queryById(Long.valueOf(task.getHandleUserId())).getData(); |
| | | if (operationsUser != null) { |
| | | res.setHandleUserId(operationsUser.getId()); |
| | |
| | | |
| | | managementDetailVO.setAccidentDetailVO(res); |
| | | } |
| | | |
| | | |
| | | |
| | | return R.ok(managementDetailVO); |
| | | } |
| | | |