修改智能航线规划,修改南昌机场和西安机场人工接管时图片绑定图斑问题
3 files modified
144 ■■■■ changed files
src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java 74 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/patches/controller/PatchesController.java 68 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
@@ -457,9 +457,7 @@
    public void updateMediaFileNames(String jobId) {
        // 查询符合条件的数据
        List<MediaFileEntity> mediaFiles = mapper.selectList(new LambdaQueryWrapper<MediaFileEntity>()
                        .eq(MediaFileEntity::getJobId, jobId)
//                .eq(MediaFileMarkEntity::getIsadd, 0)
        );
                .eq(MediaFileEntity::getJobId, jobId));
        boolean allContainTilde = mediaFiles.stream().allMatch(file -> file.getFileName().contains("~"));
        boolean noneContainTilde = mediaFiles.stream().noneMatch(file -> file.getFileName().contains("~"));
@@ -512,22 +510,28 @@
            closestFileOpt.ifPresent(closestFile -> {
                String closestName = closestFile.getFileName();
                int startIndex = closestName.indexOf("V");
                if (closestName.contains("W")) {
                    startIndex = closestName.indexOf("W");
                }
                if (closestName.contains("Z")) {
                    startIndex = closestName.indexOf("Z");
                if (startIndex == -1) startIndex = closestName.indexOf("W");
                if (startIndex == -1) startIndex = closestName.indexOf("Z");
                if (startIndex == -1) startIndex = closestName.indexOf("T");
                if (startIndex == -1) {
                    return;
                }
                int endIndex = closestName.indexOf(".", startIndex);
                if (endIndex == -1) {
                    return;
                }
                String replacement = closestName.substring(startIndex, endIndex);
                int currentStartIndex = currentName.indexOf("V");
                if (currentName.contains("W")) {
                    currentStartIndex = closestName.indexOf("W");
                }
                if (currentName.contains("Z")) {
                    currentStartIndex = closestName.indexOf("Z");
                if (currentStartIndex == -1) currentStartIndex = currentName.indexOf("W");
                if (currentStartIndex == -1) currentStartIndex = currentName.indexOf("Z");
                if (currentStartIndex == -1) currentStartIndex = currentName.indexOf("T");
                if (currentStartIndex == -1) {
                    return;
                }
                int currentEndIndex = currentName.indexOf(".", currentStartIndex);
                if (currentEndIndex == -1) {
                    return;
                }
                String newName = currentName.substring(0, currentStartIndex)
                        + replacement
                        + currentName.substring(currentEndIndex);
@@ -540,13 +544,10 @@
    @Override
    public void updateMarkMediaFileNames(String jobId) {
        try {
            // 查询符合条件的数据
            List<MediaFileMarkEntity> mediaFiles = markMapper.selectList(new LambdaQueryWrapper<MediaFileMarkEntity>()
                            .eq(MediaFileMarkEntity::getJobId, jobId)
//                .eq(MediaFileMarkEntity::getIsadd, 0)
            );
                    .eq(MediaFileMarkEntity::getJobId, jobId));
            // 判断所有 fileName 是否都包含 '~' 或者都不包含 '~'
            boolean allContainTilde = mediaFiles.stream().allMatch(file -> file.getFileName().contains("~"));
            boolean noneContainTilde = mediaFiles.stream().noneMatch(file -> file.getFileName().contains("~"));
@@ -557,9 +558,9 @@
                    file.setIsadd(1);
                    updateById(file.getId(), file);
                });
                    return;
                return;
            }
            // 筛选出name字段不包含'~'的数据
            List<MediaFileMarkEntity> filteredFiles = mediaFiles.stream()
                    .filter(file -> !file.getFileName().contains("~"))
@@ -569,6 +570,7 @@
                String currentName = currentFile.getFileName();
                Map<String, Object> currentMetadata = JSON.parseObject(JSON.toJSONString(currentFile.getMetadata()), Map.class);
                Long currentCreatedTime = (Long) currentMetadata.get("createdTime");
                // 找到metadata中的createdTime小于当前数据的createdTime且最接近的那条数据
                Optional<MediaFileMarkEntity> closestFileOpt = mediaFiles.stream()
                        .filter(file -> {
@@ -584,6 +586,7 @@
                            Long time2 = (Long) metadata2.get("createdTime");
                            return Long.compare(currentCreatedTime - time1, currentCreatedTime - time2);
                        });
                if (closestFileOpt.isEmpty()) {
                    // 找不到小于的文件,尝试找大于且最接近的文件
                    closestFileOpt = mediaFiles.stream()
@@ -601,26 +604,34 @@
                                return Long.compare(time1 - currentCreatedTime, time2 - currentCreatedTime);
                            });
                }
                // 提取并替换name字段
                closestFileOpt.ifPresent(closestFile -> {
                    String closestName = closestFile.getFileName();
                    int startIndex = closestName.indexOf("V");
                    if (closestName.contains("W")) {
                        startIndex = closestName.indexOf("W");
                    }
                    if (closestName.contains("Z")) {
                        startIndex = closestName.indexOf("Z");
                    if (startIndex == -1) startIndex = closestName.indexOf("W");
                    if (startIndex == -1) startIndex = closestName.indexOf("Z");
                    if (startIndex == -1) startIndex = closestName.indexOf("T");
                    if (startIndex == -1) {
                        return;
                    }
                    int endIndex = closestName.indexOf(".", startIndex);
                    String replacement = closestName.substring(startIndex, endIndex);
                    int currentStartIndex = currentName.indexOf("V");
                    if (currentName.contains("W")) {
                        currentStartIndex = closestName.indexOf("W");
                    if (endIndex == -1) {
                        return;
                    }
                    if (currentName.contains("Z")) {
                        currentStartIndex = closestName.indexOf("Z");
                    String replacement = closestName.substring(startIndex, endIndex);
                    int currentStartIndex = currentName.indexOf("V");
                    if (currentStartIndex == -1) currentStartIndex = currentName.indexOf("W");
                    if (currentStartIndex == -1) currentStartIndex = currentName.indexOf("Z");
                    if (currentStartIndex == -1) currentStartIndex = currentName.indexOf("T");
                    if (currentStartIndex == -1) {
                        return;
                    }
                    int currentEndIndex = currentName.indexOf(".", currentStartIndex);
                    if (currentEndIndex == -1) {
                        return;
                    }
                    String newName = currentName.substring(0, currentStartIndex)
                            + replacement
                            + currentName.substring(currentEndIndex);
@@ -633,6 +644,7 @@
        }
    }
    public void updateById(Integer id, MediaFileMarkEntity entity) {
        entity.setIsadd(1);
        UpdateWrapper<MediaFileMarkEntity> updateWrapper = new UpdateWrapper<>();
src/main/java/com/dji/sample/patches/controller/PatchesController.java
@@ -4,14 +4,12 @@
import com.dji.sample.common.model.PaginationData;
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.common.util.MinioUrlUtils;
import com.dji.sample.log.aspect.SysLogAnnotation;
import com.dji.sample.media.model.MediaFileEntity;
import com.dji.sample.media.service.impl.FileServiceImpl;
import com.dji.sample.patches.model.Param.PatchesParam;
import com.dji.sample.patches.model.entity.LotInfo;
import com.dji.sample.patches.service.GetPatchesService;
import com.dji.sample.patches.service.ShpToDataSourceService;
import com.dji.sample.patches.service.impl.ShpToDataSourceServiceImpl;
import com.dji.sample.patches.utils.DistrictCodeUtils;
import com.dji.sample.patches.utils.TimerUtil;
import com.dji.sample.territory.service.impl.TbDkjbxxServiceImpl;
@@ -127,50 +125,36 @@
        }
    }
    @PostMapping("/patchesToWayline")
    public ResponseResult patchesToWayline(@RequestBody List<LotInfo> list,
                                           @RequestParam String waylineName,
                                           @RequestParam String workspaceId,
                                           @RequestParam String PatchesId,
                                           @RequestParam String spotInFreckle,
                                           @RequestParam double lat,
                                           @RequestParam double lon,
                                           HttpServletRequest request) throws IOException {
        CustomClaim customClaim = (CustomClaim) request.getAttribute(TOKEN_CLAIM);
        String creator = customClaim.getUsername();
        MultipartFile file = timerUtil.getFile(waylineName, list,lat,lon);
        waylineFileService.importKmzFile(file, workspaceId, creator,PatchesId,spotInFreckle);
        WaylineFileEntity entity = waylineFileService.selectByName(waylineName);
        Map<String, String> infoMap = new HashMap<>();
        URL url = null;
        try {
            url = waylineFileService.getObjectUrl(workspaceId, entity.getWaylineId());
            infoMap.put("url", String.valueOf(MinioUrlUtils.getUrl(url)));
            infoMap.put("waylineId", entity.getWaylineId());
        } catch (SQLException e) {
            throw new RuntimeException(e);
        @PostMapping("/patchesToWayline")
        public ResponseResult patchesToWayline(@RequestBody List<LotInfo> lotInfos,
                                               @RequestParam String waylineName,
                                               @RequestParam String spotInFreckle,
                                               @RequestParam String workspaceId,
                                               @RequestParam String patchesId,
                                               @RequestParam double lat,
                                               @RequestParam double lon,
                                               HttpServletRequest request) throws IOException {
            CustomClaim customClaim = (CustomClaim) request.getAttribute(TOKEN_CLAIM);
            String creator = customClaim.getUsername();
            MultipartFile file = timerUtil.getFile(waylineName, lotInfos, lat, lon);
            waylineFileService.importKmzFile(file, workspaceId, creator, patchesId, spotInFreckle);
            WaylineFileEntity entity = waylineFileService.selectByName(waylineName);
            Map<String, String> infoMap = new HashMap<>();
            URL url = null;
            try {
                url = waylineFileService.getObjectUrl(workspaceId, entity.getWaylineId());
                infoMap.put("url", String.valueOf(MinioUrlUtils.getUrl(url)));
                infoMap.put("waylineId", entity.getWaylineId());
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
            return ResponseResult.success(infoMap);
        }
        return ResponseResult.success(infoMap);
    }
    @GetMapping("/useMyTask")
    public ResponseResult useMyTask() throws Exception {
        try {
//            timerUtil.myTask();
//            timerUtil.myTask2();
//            timerUtil.myTask3();
            timerUtil.mytask4();
            timerUtil.mytask5();
            timerUtil.mytask6();
            timerUtil.mytask7();
        } catch (Exception e) {
            throw new RuntimeException("db存储发送出现异常" + e);
        }
        return ResponseResult.success();
    }
        @GetMapping ("/tests")
    @GetMapping ("/tests")
    public ResponseResult use()  {
            ExecutorService executor = Executors.newSingleThreadExecutor();
            executor.execute(() -> {
src/main/java/com/dji/sample/patches/service/impl/GetPatchesServiceImpl.java
@@ -1,7 +1,6 @@
package com.dji.sample.patches.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dji.sample.common.model.Pagination;
@@ -20,7 +19,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Service