调查取证手动航线更新图斑调查状态,新增媒体查询接口视频图片筛查,调整定时任务时间,新增航线任务错误代码识别
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; |
| | |
| | | |
| | | @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, |
| | |
| | | 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") |
| | |
| | | |
| | | /** |
| | | * 子查询 |
| | | * |
| | | * @param workspaceId |
| | | * @return |
| | | */ |
| | |
| | | return ResponseResult.success(waylineJobEntity); |
| | | } |
| | | |
| | | @GetMapping("/code") |
| | | public ResponseResult errotCode(@RequestParam Integer code) { |
| | | return ResponseResult.success(ErrorCodeUtil.codeToReason(code)); |
| | | } |
| | | |
| | | /** |
| | | * 发送命令取消作业。 |
| | |
| | | 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); |
| | | |
| | | /** |
| | | * 获取最新的航线任务 |
| | |
| | | } |
| | | |
| | | @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( |
| | |
| | | } |
| | | 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>() |
| | |
| | | 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> 中 |
| 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)); |
| | | } |
| | | } |