调查取证手动航线更新图斑调查状态,新增媒体查询接口视频图片筛查,调整定时任务时间,新增航线任务错误代码识别
10 files modified
1 files added
| | |
| | | @RequestParam(name = "photoEnd", required = false) Long updateEnd, |
| | | @RequestParam(name = "updateStart", required = false) Long photoStart, |
| | | @RequestParam(name = "updateEnd", required = false) Long photoEnd, |
| | | @RequestParam(name = "jobName", required = false) String jobName) { |
| | | @RequestParam(name = "jobName", required = false) String jobName, |
| | | @RequestParam( required = false) String type |
| | | ) { |
| | | |
| | | return ResponseResult.success(fileService.MediaQuery(page, pageSize, updateStart, updateEnd, photoStart, photoEnd, jobName,workspaceId)); |
| | | return ResponseResult.success(fileService.MediaQuery(page, pageSize, updateStart, updateEnd, photoStart, photoEnd, jobName,workspaceId,type)); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | List<MediaFileDTO> getAllFilesByWorkspaceId(String workspaceId); |
| | | |
| | | PaginationData<MediaFileEntity> MediaQuery(Integer page, Integer pageSize, Long updateStart, Long updateEnd, Long photoStart, Long photoEnd, String jobName,String worksapceId); |
| | | PaginationData<MediaFileEntity> MediaQuery(Integer page, Integer pageSize, Long updateStart, Long updateEnd, Long photoStart, Long photoEnd, String jobName,String worksapceId,String isVedio); |
| | | /** |
| | | * 获取图斑图片集合 |
| | | * @param dkbh |
| | |
| | | import com.dji.sample.territory.pojo.TerritoryConfigPojo; |
| | | import com.dji.sample.territory.service.impl.TbFjServiceImpl; |
| | | import com.dji.sample.territory.utils.WaterMarkUtil; |
| | | import com.dji.sample.wayline.service.IWaylineFileService; |
| | | import com.dji.sample.wayline.service.IWaylineJobService; |
| | | import com.drew.imaging.ImageProcessingException; |
| | | import io.minio.MinioClient; |
| | |
| | | private TerritoryConfigPojo territoryConfigPojo; |
| | | @Autowired |
| | | private IWaylineJobService waylineJobService; |
| | | @Autowired |
| | | private IWaylineFileService waylineFileService; |
| | | |
| | | private Optional<MediaFileEntity> getMediaByFingerprint(String workspaceId, String fingerprint) { |
| | | MediaFileEntity fileEntity = mapper.selectOne(new LambdaQueryWrapper<MediaFileEntity>() |
| | |
| | | MediaFileEntity fileEntity = this.fileUploadConvertToEntity(file); |
| | | fileEntity.setWorkspaceId(workspaceId); |
| | | fileEntity.setFileId(UUID.randomUUID().toString()); |
| | | updateInvestigate(file.getExt().getFlightId()); |
| | | return mapper.insert(fileEntity); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PaginationData<MediaFileEntity> MediaQuery(Integer page, Integer pageSize, Long updateStart, Long updateEnd, Long photoStart, Long photoEnd, String jobName, String workspaceId) { |
| | | public PaginationData<MediaFileEntity> MediaQuery(Integer page, Integer pageSize, Long updateStart, Long updateEnd, Long photoStart, Long photoEnd, String jobName, String workspaceId,String type) { |
| | | // 创建分页对象 |
| | | Page<MediaFileEntity> pageObj = new Page<>(page, pageSize); |
| | | |
| | |
| | | } |
| | | |
| | | if (jobName != null && !jobName.isEmpty()) { |
| | | List<String> jobIds = waylineJobService.getJobId(jobName); |
| | | List<String> jobIds = waylineJobService.getJobIds(jobName); |
| | | queryWrapper.in(MediaFileEntity::getJobId, jobIds); |
| | | } |
| | | |
| | | if (type != null && !type.isEmpty()) { |
| | | if ("图片".equals(type)) { |
| | | queryWrapper.likeLeft(MediaFileEntity::getFileName, ".jpeg"); |
| | | } else if ("视频".equals(type)) { |
| | | queryWrapper.likeLeft(MediaFileEntity::getFileName, ".mp4"); |
| | | } |
| | | } |
| | | queryWrapper.orderByDesc(MediaFileEntity::getCreateTime); |
| | | // 执行分页查询 |
| | | Page<MediaFileEntity> resultPage = mapper.selectPage(pageObj, queryWrapper); |
| | | |
| | |
| | | String taskNameResult = waylineJobService.getName(mediaFile.getJobId()); |
| | | mediaFile.setJobName(taskNameResult); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | .collect(Collectors.toList() |
| | | ); |
| | | |
| | | // 返回分页数据 |
| | | return new PaginationData<>(records, new Pagination(resultPage)); |
| | | |
| | | } |
| | | |
| | | public void updateInvestigate(String jobId){ |
| | | String waylineId=waylineJobService.getWaylineId(jobId); |
| | | String patchesId=waylineFileService.getPatchesId(waylineId); |
| | | if (patchesId==null){ |
| | | return; |
| | | } |
| | | List<Long> ids = Arrays.stream(patchesId.split(",")) |
| | | .map(Long::parseLong) |
| | | .collect(Collectors.toList()); |
| | | LambdaUpdateWrapper<LotInfo> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.in(LotInfo::getId, ids) |
| | | .set(LotInfo::getInvestigate, 1); |
| | | patchesMapper.update(null, updateWrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<MediaFileEntity> listMediaFileEntity(String workspaceId, String jobId) { |
| | | return mapper.selectList(new LambdaQueryWrapper<MediaFileEntity>() |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.*; |
| | | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | String times = convertTimestampToFormattedString(time); |
| | | sendPostWithParameters(waylineName, waylineFile.getWaylineId(), times, lists1, listOfLists); |
| | | updatePatchesStatu(list); |
| | | time = addOneHourToTimestamp(time,1,30); |
| | | time = addOneHourToTimestamp(time, 1, 30); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void mytask5() throws IOException { |
| | | Long time = getCurrentTimestampPlus8Hours(10); |
| | | Long time = getCurrentTimestampPlus8Hours(9); |
| | | time = addOneHourToTimestamp(time, 0, 50); |
| | | List<List<Long>> listOfLists = new ArrayList<>(); |
| | | List<Long> sublist = new ArrayList<>(); |
| | | sublist.add(time); // 添加整数值 |
| | |
| | | |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void mytask6() throws IOException { |
| | | Long time = getCurrentTimestampPlus8Hours(11); |
| | | Long time = getCurrentTimestampPlus8Hours(9); |
| | | time = addOneHourToTimestamp(time, 1, 40); |
| | | List<List<Long>> listOfLists = new ArrayList<>(); |
| | | List<Long> sublist = new ArrayList<>(); |
| | | sublist.add(time); // 添加整数值 |
| | |
| | | |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void mytask7() throws IOException { |
| | | Long time = getCurrentTimestampPlus8Hours(13); |
| | | Long time = getCurrentTimestampPlus8Hours(9); |
| | | time = addOneHourToTimestamp(time, 2, 50); |
| | | List<List<Long>> listOfLists = new ArrayList<>(); |
| | | List<Long> sublist = new ArrayList<>(); |
| | | sublist.add(time); // 添加整数值 |
| | |
| | | |
| | | // 发送请求 |
| | | ResponseEntity<String> response = restTemplate.exchange( |
| | | "https://jxlandcloud.org.cn/landCloudWork/artifact/media/upload.action", |
| | | "http://39.98.49.177:8083/landCloudWork/artifact/media/upload.action", |
| | | // "http://localhost:6789/territory/tbdkjbxx/upload", |
| | | HttpMethod.POST, |
| | | requestEntity, |
| | |
| | | return timestamp / 1000; |
| | | } |
| | | |
| | | public static Long addOneHourToTimestamp(Long timestampInSeconds,long hours,long min) { |
| | | public static Long addOneHourToTimestamp(Long timestampInSeconds, long hours, long min) { |
| | | // 将输入的秒级时间戳转换为Instant对象 |
| | | Instant instant = Instant.ofEpochSecond(timestampInSeconds); |
| | | |
| | |
| | | import com.dji.sample.wayline.model.param.*; |
| | | import com.dji.sample.wayline.service.IWaylineJobService; |
| | | import com.dji.sample.wayline.service.impl.WaylineJobServiceImpl; |
| | | import com.dji.sample.wayline.util.ErrorCodeUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | /** |
| | | * 断点任务 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/{workspace_id}/breakpoint-tasks") |
| | | @SysLogAnnotation(operModul = "计划库", operType = "断点续飞", operDesc = "创建航路任务(重复定时和连续执行)") |
| | | public ResponseResult breakPointJob(HttpServletRequest request, @Valid @RequestBody BreakPointJobParam param, |
| | | @PathVariable(name = "workspace_id") String workspaceId) throws SQLException { |
| | | Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, param.getJobId(),param.isBreakPoint()); |
| | | Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, param.getJobId(), param.isBreakPoint()); |
| | | return waylineJobService.publishOneFlightTask(waylineJobDTO.get()); |
| | | } |
| | | |
| | |
| | | @GetMapping("/{workspace_id}/jobs-dp") |
| | | @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询") |
| | | public ResponseResult<PaginationData<WaylineJobDTO>> getJobsByState(@RequestParam(defaultValue = "1") Long page, |
| | | @RequestParam(name = "page_size", defaultValue = "10") Long pageSize, |
| | | @PathVariable(name = "workspace_id") String workspaceId, |
| | | @RequestParam(name = "order", defaultValue = "") String order, |
| | | WaylineJobQueryParam waylineJobQueryParam) { |
| | | PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceIdNew(workspaceId, page, pageSize, waylineJobQueryParam,order); |
| | | @RequestParam(name = "page_size", defaultValue = "10") Long pageSize, |
| | | @PathVariable(name = "workspace_id") String workspaceId, |
| | | @RequestParam(name = "order", defaultValue = "") String order, |
| | | WaylineJobQueryParam waylineJobQueryParam) { |
| | | PaginationData<WaylineJobDTO> data = waylineJobService.getJobsByWorkspaceIdNew(workspaceId, page, pageSize, waylineJobQueryParam, order); |
| | | return ResponseResult.success(data); |
| | | } |
| | | |
| | | /** |
| | | * 子查询 |
| | | * |
| | | * @param workspaceId |
| | | * @return |
| | | */ |
| | | @GetMapping("/{workspace_id}/getChildrenJobs") |
| | | @SysLogAnnotation(operModul = "计划库", operType = "查询", operDesc = "分页查询") |
| | | public ResponseResult<List<WaylineJobDTO>> getChildrenJobs( |
| | | @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam) { |
| | | @PathVariable(name = "workspace_id") String workspaceId, WaylineJobQueryParam waylineJobQueryParam) { |
| | | List<WaylineJobDTO> data = waylineJobService.getChildrenJobs(workspaceId, waylineJobQueryParam); |
| | | return ResponseResult.success(data); |
| | | } |
| | |
| | | return ResponseResult.success(waylineJobEntity); |
| | | } |
| | | |
| | | @GetMapping("/code") |
| | | public ResponseResult errotCode(@RequestParam Integer code) { |
| | | return ResponseResult.success(ErrorCodeUtil.codeToReason(code)); |
| | | } |
| | | |
| | | /** |
| | | * 发送命令取消作业。 |
| | |
| | | * 统计飞行次数 |
| | | */ |
| | | @PostMapping("/{workspace_id}/patrol_statistics") |
| | | public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId,String queryTime,String deviceSn) { |
| | | public ResponseResult<WaylineJobCountDTO> patrolStatistics(@PathVariable(name = "workspace_id") String workspaceId, String queryTime, String deviceSn) { |
| | | |
| | | WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId,queryTime,deviceSn); |
| | | WaylineJobCountDTO waylineJobCountDTO = waylineJobService.patrolStatistics(workspaceId, queryTime, deviceSn); |
| | | |
| | | return ResponseResult.success(waylineJobCountDTO); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/{sn}/jobs/{device_sn}/flyByArea") |
| | | @SysLogAnnotation(operModul = "根据区域飞行", operType = "根据区域飞行", operDesc = "根据区域飞行") |
| | | public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam,@PathVariable(name = "device_sn")String deviceSn)throws Exception { |
| | | return waylineJobService.flyByArea(sn, flyAreaParam,deviceSn); |
| | | public ResponseResult flyByArea(@PathVariable(name = "sn") String sn, @RequestBody FlyAreaParam flyAreaParam, @PathVariable(name = "device_sn") String deviceSn) throws Exception { |
| | | return waylineJobService.flyByArea(sn, flyAreaParam, deviceSn); |
| | | } |
| | | } |
| | |
| | | private WaylineJobBreakPointEntity waylineJobBreakPointEntity; |
| | | |
| | | private Boolean breakPoint; |
| | | |
| | | private String reason; |
| | | } |
| | |
| | | */ |
| | | PaginationData<WaylineFileDTO> getWaylinesByParam(String workspaceId, WaylineQueryParam param); |
| | | |
| | | String getPatchesId(String waylineId); |
| | | /** |
| | | * Query the information of this wayline file according to the wayline file id. |
| | | * @param workspaceId |
| | |
| | | * @return |
| | | */ |
| | | Optional<WaylineJobDTO> createWaylineJobByParent(String workspaceId, String parentId); |
| | | |
| | | String getWaylineId(String jobId); |
| | | /** |
| | | * Issue wayline mission to the dock. |
| | | * 向机场发出航线任务 |
| | |
| | | * @param param |
| | | */ |
| | | void updateJobStatus(String workspaceId, String jobId, UpdateJobParam param); |
| | | |
| | | List<String> getJobNamesByPartialName(String partialJobName); |
| | | /** |
| | | * Query the wayline execution status of the dock. |
| | | * @param dockSn |
| | |
| | | */ |
| | | WaylineJobStatusEnum getWaylineState(String dockSn); |
| | | String getName(String jobId); |
| | | List<String> getJobId(String jobName); |
| | | List<String> getJobIds(String jobNames); |
| | | |
| | | /** |
| | | * 获取最新的航线任务 |
| | |
| | | new LambdaQueryWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .eq(param.isFavorited(), WaylineFileEntity::getFavorited, param.isFavorited()) |
| | | .and(param.getTemplateType() != null, wrapper -> { |
| | | for (Integer type : param.getTemplateType()) { |
| | | wrapper.like(WaylineFileEntity::getTemplateTypes, type).or(); |
| | | } |
| | | .and(param.getTemplateType() != null, wrapper -> { |
| | | for (Integer type : param.getTemplateType()) { |
| | | wrapper.like(WaylineFileEntity::getTemplateTypes, type).or(); |
| | | } |
| | | }) |
| | | // There is a risk of SQL injection |
| | | .last(StringUtils.hasText(param.getOrderBy()), " order by " + param.getOrderBy())); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getPatchesId(String waylineId) { |
| | | WaylineFileEntity entity = mapper.selectOne(new LambdaQueryWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWaylineId, waylineId)); |
| | | return entity.getPatchesId(); |
| | | } |
| | | |
| | | @Override |
| | | public Optional<WaylineFileDTO> getWaylineByWaylineId(String workspaceId, String waylineId) { |
| | | return Optional.ofNullable( |
| | | this.entityConvertToDTO( |
| | | mapper.selectOne( |
| | | new LambdaQueryWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .eq(WaylineFileEntity::getWaylineId, waylineId)))); |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .eq(WaylineFileEntity::getWaylineId, waylineId)))); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<String> getDuplicateNames(String workspaceId, List<String> names) { |
| | | return mapper.selectList(new LambdaQueryWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .in(WaylineFileEntity::getName, names)) |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .in(WaylineFileEntity::getName, names)) |
| | | .stream() |
| | | .map(WaylineFileEntity::getName) |
| | | .collect(Collectors.toList()); |
| | |
| | | } |
| | | WaylineFileDTO wayline = waylineOpt.get(); |
| | | boolean isDel = mapper.delete(new LambdaUpdateWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .eq(WaylineFileEntity::getWaylineId, waylineId)) |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .eq(WaylineFileEntity::getWaylineId, waylineId)) |
| | | > 0; |
| | | if (!isDel) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void importKmzFile(MultipartFile file, String workspaceId, String creator,String patchesId) { |
| | | public void importKmzFile(MultipartFile file, String workspaceId, String creator, String patchesId) { |
| | | Optional<WaylineFileDTO> waylineFileOpt = validKmzFile(file); |
| | | if (waylineFileOpt.isEmpty()) { |
| | | throw new RuntimeException("文件格式错误"); |
| | |
| | | waylineFile.setUsername(creator); |
| | | |
| | | ossService.putObject(OssConfiguration.bucket, waylineFile.getObjectKey(), file.getInputStream()); |
| | | this.saveWaylineFiles(workspaceId, waylineFile,patchesId); |
| | | this.saveWaylineFiles(workspaceId, waylineFile, patchesId); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public WaylineFileDTO importKmzFileBack(MultipartFile file, String workspaceId, String creator) { |
| | | WaylineFileDTO waylineFile=null; |
| | | WaylineFileDTO waylineFile = null; |
| | | Optional<WaylineFileDTO> waylineFileOpt = validKmzFile(file); |
| | | if (waylineFileOpt.isEmpty()) { |
| | | throw new RuntimeException("文件格式错误"); |
| | |
| | | |
| | | @Override |
| | | public WaylineFileEntity selectByName(String name) { |
| | | return mapper.selectOne(new LambdaQueryWrapper<WaylineFileEntity>().eq(WaylineFileEntity::getName,name)); |
| | | return mapper.selectOne(new LambdaQueryWrapper<WaylineFileEntity>().eq(WaylineFileEntity::getName, name)); |
| | | } |
| | | |
| | | @Override |
| | | public List<WaylineListDTO> waylineList(String workspaceId,String droneName) { |
| | | public List<WaylineListDTO> waylineList(String workspaceId, String droneName) { |
| | | LambdaQueryChainWrapper<WaylineFileEntity> wrapper = |
| | | new LambdaQueryChainWrapper<>(mapper).eq(WaylineFileEntity::getWorkspaceId, workspaceId); |
| | | if (StringUtils.hasText(droneName)){ |
| | | wrapper.like(WaylineFileEntity::getName,droneName); |
| | | if (StringUtils.hasText(droneName)) { |
| | | wrapper.like(WaylineFileEntity::getName, droneName); |
| | | } |
| | | |
| | | return wrapper.list().stream().map(r -> WaylineListDTO.builder().waylineFileId(r.getWaylineId()).name(r.getName()).build()) |
| | | return wrapper.list().stream().map(r -> WaylineListDTO.builder().waylineFileId(r.getWaylineId()).name(r.getName()).build()) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | |
| | | |
| | | return Optional.of(WaylineFileDTO.builder() |
| | | .droneModelKey(String.format("%s-%s-%s", DeviceDomainEnum.SUB_DEVICE.getVal(), type, subType)) |
| | | .payloadModelKeys(List.of(String.format("%s-%s-%s",DeviceDomainEnum.PAYLOAD.getVal(), payloadType, payloadSubType))) |
| | | .payloadModelKeys(List.of(String.format("%s-%s-%s", DeviceDomainEnum.PAYLOAD.getVal(), payloadType, payloadSubType))) |
| | | // .objectKey(OssConfiguration.objectDirPrefix + File.separator + filename) |
| | | .objectKey(OssConfiguration.objectDirPrefix + "/" + filename) |
| | | .name(filename.substring(0, filename.lastIndexOf(WAYLINE_FILE_SUFFIX))) |
| | |
| | | } |
| | | return Optional.empty(); |
| | | } |
| | | |
| | | /** |
| | | * Convert database entity objects into wayline data transfer object. |
| | | * |
| | | * @param entity |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Convert the received wayline object into a database entity object. |
| | | * |
| | | * @param file |
| | | * @return |
| | | */ |
| | |
| | | |
| | | return builder.build(); |
| | | } |
| | | |
| | | @Override |
| | | public int updateWayline(WaylineFileEntity entity) { |
| | | return mapper.update(entity,new LambdaQueryWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWaylineId,entity.getWaylineId())); |
| | | return mapper.update(entity, new LambdaQueryWrapper<WaylineFileEntity>() |
| | | .eq(WaylineFileEntity::getWaylineId, entity.getWaylineId())); |
| | | } |
| | | } |
| | |
| | | import com.dji.sample.wayline.service.IWaylineJobBreakPointService; |
| | | import com.dji.sample.wayline.service.IWaylineJobService; |
| | | import com.dji.sample.wayline.service.IWaylineRedisService; |
| | | import com.dji.sample.wayline.util.ErrorCodeUtil; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | jobEntity.setParentId(parentId); |
| | | |
| | | return this.insertWaylineJob(jobEntity); |
| | | } |
| | | @Override |
| | | public String getWaylineId(String jobId){ |
| | | WaylineJobEntity waylineJob=mapper.selectOne(new LambdaQueryWrapper<WaylineJobEntity>().select(WaylineJobEntity::getFileId).eq(WaylineJobEntity::getJobId,jobId)); |
| | | return waylineJob.getFileId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getJobNamesByPartialName(String partialJobName) { |
| | | LambdaQueryWrapper<WaylineJobEntity> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(WaylineJobEntity::getName, partialJobName); |
| | | return mapper.selectList(queryWrapper).stream() |
| | | .map(WaylineJobEntity::getName) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | public WaylineJobStatusEnum getWaylineState(String dockSn) { |
| | | Optional<DeviceDTO> dockOpt = deviceRedisService.getDeviceOnline(dockSn); |
| | | if (dockOpt.isEmpty() || !StringUtils.hasText(dockOpt.get().getChildDeviceSn())) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getJobId(String jobName) { |
| | | public List<String> getJobIds(String jobNames) { |
| | | List<String> names = getJobNamesByPartialName(jobNames); |
| | | // 使用 LambdaQueryWrapper 进行查询 |
| | | List<Object> jobIdList = mapper.selectObjs( |
| | | new LambdaQueryWrapper<WaylineJobEntity>() |
| | | .select(WaylineJobEntity::getJobId) |
| | | .eq(WaylineJobEntity::getName, jobName) |
| | | .in(WaylineJobEntity::getName, names) // 使用 IN 子句 |
| | | ); |
| | | |
| | | // 将 Object 类型的 jobId 转换为 String 类型,并放入 List<String> 中 |
| | | // 将 Object 类型的 jobId 转换为 String 类型,并放入 List<String> 中 |
| | | List<String> jobIdStringList = new ArrayList<>(); |
| | | for (Object jobIdObj : jobIdList) { |
| | | jobIdStringList.add(String.valueOf(jobIdObj)); |
| New file |
| | |
| | | package com.dji.sample.wayline.util; |
| | | |
| | | import cn.hutool.core.io.resource.ResourceUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | public class ErrorCodeUtil { |
| | | private static Map DistrictCode = new HashMap(); |
| | | static { |
| | | try { |
| | | String result = ResourceUtil.readUtf8Str("classpath:errorCode.json"); |
| | | DistrictCode = JSONObject.parseObject(result, Map.class); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | public static boolean isChinese(String str) { |
| | | return str.matches("[\\u4E00-\\u9FFF]+"); |
| | | } |
| | | public static String codeToReason(Integer name1) { |
| | | if (Objects.equals(name1, 0)){ |
| | | return null; |
| | | } |
| | | String name=name1.toString(); |
| | | boolean bs = isChinese(name); |
| | | if (!bs) { |
| | | return codeToName(name); |
| | | } |
| | | Map<String, Object> jsonObject = new HashMap<>(DistrictCode); |
| | | for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { |
| | | if (entry.getValue().equals(name)) { |
| | | return entry.getKey(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | public static String codeToName(String code) { |
| | | if (!DistrictCode.containsKey(code)) { |
| | | return null; |
| | | } |
| | | return DistrictCode.get(code).toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(codeToReason(315002)); |
| | | } |
| | | } |