rain
2024-08-14 75e6eea8cd3fac9cc888e2ffc9cdb126fab8429d
任务下发、更新、取消,优化图斑逻辑
11 files modified
1 files renamed
564 ■■■■■ changed files
src/main/java/com/dji/sample/common/model/ResponseResult.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/droneairport/controller/RegistController.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/droneairport/dao/DeviceExpanSionMapper.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/droneairport/model/Entity/DeviceExpanSionEntity.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/droneairport/service/impl/RegistServiceImpl.java 256 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/droneairport/utils/SM4Util.java 100 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/manage/model/receiver/BatteryReceiver.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/model/MediaFileEntity.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java 125 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/patches/controller/PatchesController.java 1 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/patches/utils/TimerUtil.java 58 ●●●● patch | view | raw | blame | history
src/main/java/com/dji/sample/common/model/ResponseResult.java
@@ -56,6 +56,13 @@
                .traceid(traceid)
                .build();
    }
    public static ResponseResult success(int code, String message,String traceid) {
        return ResponseResult.builder()
                .code(code)
                .message(message)
                .traceid(traceid)
                .build();
    }
    public static ResponseResult error() {
        return ResponseResult.builder()
src/main/java/com/dji/sample/droneairport/controller/RegistController.java
@@ -2,7 +2,7 @@
import com.dji.sample.common.model.CustomClaim;
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.droneairport.dao.DeviceExpanSionDao;
import com.dji.sample.droneairport.dao.DeviceExpanSionMapper;
import com.dji.sample.droneairport.model.param.ReturnTaskParam;
import com.dji.sample.droneairport.service.RegistService;
import com.dji.sample.manage.service.impl.DeviceRedisServiceImpl;
@@ -19,7 +19,7 @@
    @Autowired
    private RegistService registService;
    @Autowired
    private DeviceExpanSionDao expanSionDao;
    private DeviceExpanSionMapper expanSionDao;
    @Autowired
    private DeviceRedisServiceImpl deviceRedisService;
src/main/java/com/dji/sample/droneairport/dao/DeviceExpanSionMapper.java
File was renamed from src/main/java/com/dji/sample/droneairport/dao/DeviceExpanSionDao.java
@@ -5,5 +5,5 @@
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DeviceExpanSionDao extends BaseMapper<DeviceExpanSionEntity> {
public interface DeviceExpanSionMapper extends BaseMapper<DeviceExpanSionEntity> {
}
src/main/java/com/dji/sample/droneairport/model/Entity/DeviceExpanSionEntity.java
@@ -43,8 +43,8 @@
    @TableField("model")
    private String model;
    @TableField("device_id")
    private String deviceId;
    @TableField("device_sn")
    private String deviceSn;
    @TableField("longitude")
    private double longitude;
src/main/java/com/dji/sample/droneairport/service/impl/RegistServiceImpl.java
@@ -10,7 +10,7 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.component.redis.RedisOpsUtils;
import com.dji.sample.droneairport.dao.DeviceExpanSionDao;
import com.dji.sample.droneairport.dao.DeviceExpanSionMapper;
import com.dji.sample.droneairport.model.Entity.DeviceExpanSionEntity;
import com.dji.sample.droneairport.model.dto.*;
import com.dji.sample.droneairport.model.param.ReturnTaskParam;
@@ -46,6 +46,7 @@
import java.util.*;
import java.util.stream.Collectors;
import static com.dji.sample.droneairport.utils.TaskAllocator.assignTasks;
import static com.dji.sample.patches.utils.TimerUtil.getCurrentTimestampPlus8Hours;
@Service
@@ -55,7 +56,7 @@
    @Autowired
    private IDeviceRedisService redisService;
    @Autowired
    private DeviceExpanSionDao expanSionDao;
    private DeviceExpanSionMapper expanSionMapper;
    @Autowired
    private TaskInfoMapper taskInfoMapper;
    @Autowired
@@ -111,10 +112,10 @@
    @Override
    public String addDrone(String workspaceId) {
        try {
            DeviceExpanSionEntity airport = expanSionDao.selectOne(new LambdaQueryWrapper<DeviceExpanSionEntity>()
            DeviceExpanSionEntity airport = expanSionMapper.selectOne(new LambdaQueryWrapper<DeviceExpanSionEntity>()
                    .eq(DeviceExpanSionEntity::getWorkspaceId, workspaceId)
                    .eq(DeviceExpanSionEntity::getType, 0));
            DeviceExpanSionEntity drone = expanSionDao.selectOne(new LambdaQueryWrapper<DeviceExpanSionEntity>()
            DeviceExpanSionEntity drone = expanSionMapper.selectOne(new LambdaQueryWrapper<DeviceExpanSionEntity>()
                    .eq(DeviceExpanSionEntity::getWorkspaceId, workspaceId)
                    .eq(DeviceExpanSionEntity::getType, 1));
            AddDeviceDto dto = deviceEntityToDto(drone);
@@ -179,8 +180,6 @@
        AddTaskDto addTaskDto = jsonToDto(jsonObject);
        TaskInfo taskInfo = new TaskInfo();
        List<String> listx = convertStringToList(addTaskDto.getDeviceid());
        String sn = listx.get(0);
        String workspaceId = getWorkspaceId(sn);
        taskInfo.setId(traceid);
        taskInfo.setTaskId(taskId);
        taskInfo.setName(addTaskDto.getBizidname());
@@ -188,47 +187,54 @@
        taskInfo.setCreateUser(username);
        param.setTraceId(traceid);
        taskInfoMapper.insert(taskInfo);
        // 转换 TaskListDto 为 LotInfo
        List<LotInfo> lotInfos = new ArrayList<>();
        List<TaskListDto> tasklist = addTaskDto.getTasklist();
        for (TaskListDto taskListDto : tasklist) {
            LotInfo lotInfo = new LotInfo();
            lotInfo = convertToLotInfo(taskListDto);
            LotInfo lotInfo = convertToLotInfo(taskListDto);
            lotInfo.setTaskId(taskId);
            lotInfo.setType(0);
            lotInfo.setTaskName(addTaskDto.getBizidname());
            lotInfo.setUserName(username);
            lotInfo.setWorkspaceId(workspaceId);
            lotInfos.add(lotInfo);
            patchesMapper.insert(lotInfo);
        }
        Long time = getCurrentTimestampPlus8Hours(14);
//        获取未规划的图斑集合
        List<List<LotInfo>> lists = timerUtil.getNoPlan(workspaceId);
        List<List<LotInfo>> convertedLists = TimerUtil.convertToLists(lists);
        for (List<LotInfo> list : convertedLists) {
            String waylineName = TimerUtil.getTimeName();
            //根据获取的图斑集合获得kmz航线文件
            MultipartFile multipartFile = null;
            try {
                multipartFile = timerUtil.getFile(waylineName, list, 28.62452712442823, 115.85666327144976);
            } catch (IOException e) {
                throw new RuntimeException(e);
        // 获取机场信息
        List<Airport> airports = getAirportsBySn(listx);
        List<AirportTasks> airportTasks = assignTasks(airports, lotInfos);
        // 处理并插入图斑到数据库
        processAndInsertTasks(airportTasks);
        // 根据机场位置生成航线任务
        for (AirportTasks airportTask : airportTasks) {
            Airport airport = airportTask.getAirport();
            List<LotInfo> lotInfosForAirport = airportTask.getTasks();
            if (!lotInfosForAirport.isEmpty()) {
                String waylineName = TimerUtil.getTimeName();
                MultipartFile multipartFile = timerUtil.getFile(waylineName, lotInfosForAirport, airport.getLat(), airport.getLon());
                WaylineFileEntity waylineFile = timerUtil.backWayline(multipartFile, waylineName, airport.getWorkspaceId(), username);
                Long time = getCurrentTimestampPlus8Hours(14);
                List<List<Long>> listOfLists = new ArrayList<>();
                List<Long> sublist = new ArrayList<>();
                sublist.add(time);
                listOfLists.add(sublist);
                List<Long> lists1 = new ArrayList<>();
                lists1.add(time);
                String times = TimerUtil.convertTimestampToFormattedString(time);
                param.setWaylineId(taskId);
                timerUtil.sendPostWithParameters(waylineName, waylineFile.getWaylineId(), times, lists1, listOfLists, taskId+"~"+airport.getWorkspaceId(),airport.getDockSn());
                timerUtil.updatePatchesStatu(lotInfosForAirport);
            }
            //上传航线文件
            WaylineFileEntity waylineFile = timerUtil.backWayline(multipartFile, waylineName, workspaceId, username);
            //将为规划的图斑状态更新为已规划
            List<List<Long>> listOfLists = new ArrayList<>();
            List<Long> sublist = new ArrayList<>();
            sublist.add(time); // 添加整数值
            listOfLists.add(sublist);
            List<Long> lists1 = new ArrayList<>();
            lists1.add(time);
            String times = TimerUtil.convertTimestampToFormattedString(time);
            param.setWaylineId(taskId);
            TimerUtil.sendPostWithParameters(waylineName, waylineFile.getWaylineId(), times, lists1, listOfLists, taskId);
            timerUtil.updatePatchesStatu(list);
        }
        return param;
    }
    @Override
    public ReturnTaskParam updateTask(String base64, String Secret, String username) throws Exception {
@@ -239,57 +245,88 @@
        JSONObject jsonObject = new JSONObject(decryptedJson);
        UpdataTaskDto addTaskDto = UpjsonToDto(jsonObject);
        String taskId = addTaskDto.getTaskid();
        String Bizidname=getBizidnameByTask(taskId);
        delPatchesByTaskId(taskId);
//        delWaylineJob(taskId);
        delTaskInfo(taskId);
        delWaylineJob(taskId);
        TaskInfo taskInfo = new TaskInfo();
        List<String> listx = convertStringToList(addTaskDto.getDeviceid());
        String sn = listx.get(0);
        String workspaceId = getWorkspaceId(sn);
        taskInfo.setId(traceid);
        taskInfo.setTaskId(taskId);
        taskInfo.setName(Bizidname);
        taskInfo.setDeviceIds(addTaskDto.getDeviceid());
        taskInfo.setCreateUser(username);
        param.setTraceId(traceid);
        updateTaskInfo(traceid, taskId, addTaskDto.getDeviceid(), username);
        taskInfoMapper.insert(taskInfo);
        // 转换 TaskListDto 为 LotInfo
        List<LotInfo> lotInfos = new ArrayList<>();
        List<TaskListDto> tasklist = addTaskDto.getTasklist();
        for (TaskListDto taskListDto : tasklist) {
            LotInfo lotInfo = new LotInfo();
            lotInfo = convertToLotInfo(taskListDto);
            lotInfo.setUserName(username);
            LotInfo lotInfo = convertToLotInfo(taskListDto);
            lotInfo.setTaskId(taskId);
            lotInfo.setWorkspaceId(workspaceId);
            lotInfo.setType(0);
            lotInfo.setTaskName(Bizidname);
            lotInfo.setUserName(username);
            lotInfos.add(lotInfo);
            patchesMapper.insert(lotInfo);
        }
        Long time = getCurrentTimestampPlus8Hours(14);
//        获取未规划的图斑集合
        List<List<LotInfo>> lists = timerUtil.getNoPlan(workspaceId);
        List<List<LotInfo>> convertedLists = TimerUtil.convertToLists(lists);
        for (List<LotInfo> list : convertedLists) {
            String waylineName = TimerUtil.getTimeName();
            //根据获取的图斑集合获得kmz航线文件
            MultipartFile multipartFile = null;
            try {
                multipartFile = timerUtil.getFile(waylineName, list, 28.62452712442823, 115.85666327144976);
            } catch (IOException e) {
                throw new RuntimeException(e);
        // 获取机场信息
        List<Airport> airports = getAirportsBySn(listx);
        List<AirportTasks> airportTasks = assignTasks(airports, lotInfos);
        // 处理并插入图斑到数据库
        processAndInsertTasks(airportTasks);
        // 根据机场位置生成航线任务
        for (AirportTasks airportTask : airportTasks) {
            Airport airport = airportTask.getAirport();
            List<LotInfo> lotInfosForAirport = airportTask.getTasks();
            if (!lotInfosForAirport.isEmpty()) {
                String waylineName = TimerUtil.getTimeName();
                MultipartFile multipartFile = timerUtil.getFile(waylineName, lotInfosForAirport, airport.getLat(), airport.getLon());
                WaylineFileEntity waylineFile = timerUtil.backWayline(multipartFile, waylineName, airport.getWorkspaceId(), username);
                // 将为规划的图斑状态更新为已规划
                Long time = getCurrentTimestampPlus8Hours(14);
                List<List<Long>> listOfLists = new ArrayList<>();
                List<Long> sublist = new ArrayList<>();
                sublist.add(time);
                listOfLists.add(sublist);
                List<Long> lists1 = new ArrayList<>();
                lists1.add(time);
                String times = TimerUtil.convertTimestampToFormattedString(time);
                param.setWaylineId(taskId);
                timerUtil.sendPostWithParameters(waylineName, waylineFile.getWaylineId(), times, lists1, listOfLists, airport.getWorkspaceId()+"~"+taskId,airport.getDockSn());
                timerUtil.updatePatchesStatu(lotInfosForAirport);
            }
            //上传航线文件
            WaylineFileEntity waylineFile = timerUtil.backWayline(multipartFile, waylineName, workspaceId, username);
            updateJob(taskId, waylineFile.getWaylineId());
            param.setWaylineId(taskId);
            timerUtil.updatePatchesStatu(list);
        }
        return param;
    }
    @Override
    public ResponseResult cancelTask(String taskId) {
        LambdaUpdateWrapper<WaylineJobEntity> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(WaylineJobEntity::getJobId, taskId)
        updateWrapper.like(WaylineJobEntity::getJobId, taskId)
                .set(WaylineJobEntity::getStatus, 4);
        waylineJobMapper.update(null, updateWrapper);
        return null;
    }
    public  void processAndInsertTasks(List<AirportTasks> airportTasks) {
        for (AirportTasks airportTasksEntry : airportTasks) {
            Airport airport = airportTasksEntry.getAirport();
            List<LotInfo> tasks = airportTasksEntry.getTasks();
            // 处理每个任务
            for (LotInfo lotInfo : tasks) {
                lotInfo.setWorkspaceId(airport.getWorkspaceId()); // 设置 workspaceId
                patchesMapper.updateById(lotInfo);
            }
        }
    }
    @Override
@@ -314,6 +351,7 @@
        }
        return null;
    }
    private static final String BASE_DIR = "src/main/resources/tmp";
    /**
@@ -322,7 +360,7 @@
     * @param taskId 任务 ID
     * @return 匹配的 DB 文件路径列表
     */
    public  List<String> findDbFilesByTaskId(String taskId) {
    public List<String> findDbFilesByTaskId(String taskId) {
        List<String> dbFilePaths = new ArrayList<>();
        File baseDir = new File(BASE_DIR);
@@ -354,6 +392,9 @@
        patchesMapper.delete(new LambdaUpdateWrapper<LotInfo>().eq(LotInfo::getTaskId, taskId));
    }
    public void delTaskInfo(String taskId){
        taskInfoMapper.delete(new LambdaUpdateWrapper<TaskInfo>().eq(TaskInfo::getTaskId, taskId));
    }
    private String buildRequestBody(AddDeviceDto dto) {
        try {
            return objectMapper.writeValueAsString(dto);
@@ -368,6 +409,10 @@
        return entity.getWorkspaceId();
    }
    public String getBizidnameByTask(String taskId){
       TaskInfo taskInfo= taskInfoMapper.selectOne(new LambdaQueryWrapper<TaskInfo>().eq(TaskInfo::getTaskId, taskId));
        return taskInfo.getName();
    }
    public static String enSM2(String data, String pubKey) throws InvalidCipherTextException, IOException {
        String encrypt = Utils.encrypt(data, pubKey);
        encrypt = Utils.hexToBase64(encrypt);
@@ -378,6 +423,8 @@
        String hex = Utils.convertBase64ToHex(Base64);
        return Utils.decrypt(hex, priKey);
    }
    public static Map<String, String> createKey() throws NoSuchAlgorithmException {
@@ -397,7 +444,7 @@
                    .latitude(entity.getLatitude())
                    .radius(entity.getRadius())
                    .regioncode(entity.getRegioncode())
                    .deviceid(entity.getDeviceId())
                    .deviceid(entity.getDeviceSn())
                    .model(entity.getModel())
                    .build();
        }
@@ -416,30 +463,45 @@
        return builder.build();
    }
    public OsdSubDeviceReceiver getDroneFromCache(String sn) {
    public String getDroneFromCache(String sn) {
        String key = "osd:" + sn;
        return (OsdSubDeviceReceiver) RedisOpsUtils.get(key);
        return  RedisOpsUtils.get(key).toString();
    }
    public void delWaylineJob(String taskId) {
        waylineJobMapper.delete(new LambdaQueryWrapper<WaylineJobEntity>().like(WaylineJobEntity::getJobId, taskId));
    }
    public DroneStateDto getAirportFromCache(String deviceId) {
        OsdSubDeviceReceiver receiver = getDroneFromCache(deviceId);
        if (receiver == null) {
            throw new IllegalArgumentException("Receiver data not found for device ID: " + deviceId);
        String  receiver = getDroneFromCache(deviceId);
        double gimbalYaw =0.0;
        double gimbalPitch=0.0;
        com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(receiver);
        double latitude = jsonObject.getDoubleValue("latitude");
        double longitude = jsonObject.getDoubleValue("longitude");
        int modeCode = jsonObject.getInteger("mode_code");
        double elevation = jsonObject.getDoubleValue("elevation");
        double height = jsonObject.getDoubleValue("height");
        com.alibaba.fastjson.JSONArray payloads = jsonObject.getJSONArray("payloads");
        if (payloads != null && payloads.size() > 1) {
            com.alibaba.fastjson.JSONArray payloadArray = payloads.getJSONArray(1);
            for (int i = 0; i < payloadArray.size(); i++) {
                com.alibaba.fastjson.JSONObject payload = payloadArray.getJSONObject(i);
                 gimbalYaw = payload.getDoubleValue("gimbal_yaw");
                 gimbalPitch = payload.getDoubleValue("gimbal_pitch");
            }
        }
        com.alibaba.fastjson.JSONObject battery = jsonObject.getJSONObject("battery");
        int batteryCapacityPercent = battery.getInteger("capacity_percent");
        DroneStateDto.DroneStateDtoBuilder builder = DroneStateDto.builder();
        builder.gimbalYal(receiver.getAttitudeHead() != null ? receiver.getAttitudeHead() : 0.0)
                .gimbalPitch(receiver.getAttitudePitch() != null ? receiver.getAttitudePitch() : 0.0)
                .batteryCapacityPercent(receiver.getBattery() != null ? receiver.getBattery().getCapacityPercent() : 0)
                .height(receiver.getHeight() != null ? receiver.getHeight() : 0.0)
                .latitude(receiver.getLatitude() != null ? receiver.getLatitude() : 0.0)
                .longitude(receiver.getLongitude() != null ? receiver.getLongitude() : 0.0)
                .modeCode(receiver.getModeCode() != null ? receiver.getModeCode().getVal() : 0)
                .elevation(receiver.getElevation() != null ? receiver.getElevation() : 0.0)
                .gpsState(2);
        builder.gimbalYal(gimbalYaw)
                .gimbalPitch(gimbalPitch)
                .batteryCapacityPercent(batteryCapacityPercent)
                .height(height)
                .latitude(latitude)
                .longitude(longitude)
                .modeCode(modeCode)
                .elevation(elevation)
                .gpsState(3);
        return builder.build();
    }
@@ -523,6 +585,32 @@
    }
    public List<Airport> getAirportsBySn(List<String> snList) {
        List<Airport> airports = new ArrayList<>();
        // 查询所有设备
        List<DeviceExpanSionEntity> entities = expanSionMapper.selectList(
                new LambdaQueryWrapper<DeviceExpanSionEntity>().in(DeviceExpanSionEntity::getDeviceSn, snList)
        );
        // 使用一个Map来存储SN和经纬度的对应关系
        Map<String, DeviceExpanSionEntity> entityMap = new HashMap<>();
        for (DeviceExpanSionEntity entity : entities) {
            entityMap.put(entity.getDeviceSn(), entity);
        }
        // 遍历SN列表,创建Airport对象
        for (String sn : snList) {
            DeviceExpanSionEntity entity = entityMap.get(sn);
            if (entity != null) {
                DeviceEntity deviceEntity = deviceMapper.selectOne(new LambdaQueryWrapper<DeviceEntity>().eq(DeviceEntity::getChildSn,sn));
                Airport airport = new Airport(entity.getWorkspaceId(),deviceEntity.getDeviceSn(),entity.getLatitude(), entity.getLongitude());
                airports.add(airport);
            }
        }
        return airports;
    }
    public static List<String> convertStringToList(String input) {
        // 使用 Hutool 解析字符串
        JSONArray jsonArray = JSONUtil.parseArray(input);
@@ -547,11 +635,6 @@
        // 执行更新操作
        taskInfoMapper.update(taskInfo, updateWrapper);
    }
    public void delWaylineFile(String waylineId) {
        fileMapper.delete(new LambdaUpdateWrapper<WaylineFileEntity>().eq(WaylineFileEntity::getWaylineId, waylineId));
    }
    public void updateJob(String jobid, String waylineId) {
        LambdaUpdateWrapper<WaylineJobEntity> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(WaylineJobEntity::getJobId, jobid)
@@ -560,5 +643,4 @@
        // 调用 update 方法进行更新操作
        waylineJobMapper.update(null, updateWrapper);
    }
}
}
src/main/java/com/dji/sample/droneairport/utils/SM4Util.java
@@ -24,7 +24,7 @@
     */
    public static String generateSM4Key() {
        SecureRandom secureRandom = new SecureRandom();
        byte[] sm4Key = new byte[16]; // SM4 密钥长度为 128 位(16 字节)
        byte[] sm4Key = new byte[8]; // SM4 密钥长度为 128 位(16 字节)
        secureRandom.nextBytes(sm4Key);
        String key = bytesToHex(sm4Key);
        return key;
@@ -112,33 +112,74 @@
        // 原始明文
        String plaintext = "{\n" +
                "    \"deviceid\": [\n" +
                "        \"1581F5BMD22CK0014H2U\",\n" +
                "        \"1581F6QAD241800B6V95\"\n" +
                "    ],\n" +
                "    \"taskid\": \"b6e89a1e-5e89-4c9b-aa26-00faa4d8f568\",\n" +
                "    \"tasklist\": [\n" +
                "        {\n" +
                "            \"bsm\": \"2028107171717717107171017\",\n" +
                "            \"xzqdm\": \"310000\",\n" +
                "            \"dkbh\": \"ndbg201102U0172710711\",\n" +
                "            \"dklx\": \"ndbg2024\",\n" +
                "            \"dkmc\": \"小桥头\",\n" +
                "            \"dkmj\": 20.5,\n" +
                "            \"dkfw\": \"MULTIPOLYGON(((115.86528871951153 28.625287925196325,115.86561708513025 28.625787612007546,115.86815834948467 28.624602640426623,115.86773004650362 28.62425999804172,115.86528871951153 28.625287925196325)))\",\n" +
                "            \"bz\": null\n" +
                "        },\n" +
                "        {\n" +
                "            \"bsm\": \"202810717171777\",\n" +
                "            \"xzqdm\": \"310000\",\n" +
                "            \"dkbh\": \"ndbg201102U011\",\n" +
                "            \"dklx\": \"ndbg2024q\",\n" +
                "            \"dkmc\": \"桥头\",\n" +
                "            \"dkmj\": 27.5,\n" +
                "            \"dkfw\": \"MULTIPOLYGON(((115.8537683547021 28.626198084066036,115.85362014017156 28.625905772075246,115.85325749115422 28.625530171307133,115.8532121556319 28.625552314192735,115.85285649743213 28.625719691357663,115.8526650611681 28.62581016383709,115.85251948537035 28.62587896210428,115.8524159923293 28.625927871721817,115.85236695899066 28.625953724319036,115.85242053528945 28.626032126827145,115.85243919323472 28.626059431385023,115.85258924149208 28.626287013655055,115.85275847878526 28.62654053983997,115.85281562628226 28.62662918289837,115.8537683547021 28.626198084066036)))\",\n" +
                "            \"bz\": null\n" +
                "        }\n" +
                "    ]\n" +
                "  \"deviceid\": [\n" +
                "    \"1581F6QAD241800B6V95\",\n" +
                "    \"1581F5BMD22CK0014H2U\"\n" +
                "  ],\n" +
                "  \"bizidname\": \"南昌市西湖区图斑下发\",\n" +
                "  \"tasklist\": [\n" +
                "    {\n" +
                "      \"bsm\": \"2028107171717717107171017\",\n" +
                "      \"xzqdm\": \"310000\",\n" +
                "      \"dkbh\": \"ndbg201102U0172710711\",\n" +
                "      \"dklx\": \"ndbg2024\",\n" +
                "      \"dkmc\": \"小桥头\",\n" +
                "      \"dkmj\": 20.5,\n" +
                "      \"dkfw\": \"MULTIPOLYGON(((115.86528871951153 28.625287925196325,115.86561708513025 28.625787612007546,115.86815834948467 28.624602640426623,115.86773004650362 28.62425999804172,115.86528871951153 28.625287925196325)))\",\n" +
                "      \"bz\": null\n" +
                "    },\n" +
                "    {\n" +
                "      \"bsm\": \"207\",\n" +
                "      \"xzqdm\": \"31000\",\n" +
                "      \"dkbh\": \"n1\",\n" +
                "      \"dklx\": \"n4\",\n" +
                "      \"dkmc\": \"小桥\",\n" +
                "      \"dkmj\": 20.5,\n" +
                "      \"dkfw\": \"MULTIPOLYGON(((115.86262525992014 28.634623244731678,115.86214341906647 28.63383445340825,115.86164016306374 28.63418423417594,115.86204348170406 28.63485524217979,115.86262525992014 28.634623244731678)))\",\n" +
                "      \"bz\": null\n" +
                "    },\n" +
                "    {\n" +
                "      \"bsm\": \"20281071717177177\",\n" +
                "      \"xzqdm\": \"31000\",\n" +
                "      \"dkbh\": \"ndbg20110210711\",\n" +
                "      \"dklx\": \"ndbg2774\",\n" +
                "      \"dkmc\": \"桥头\",\n" +
                "      \"dkmj\": 20.574,\n" +
                "      \"dkfw\": \"MULTIPOLYGON(((115.86528871951153 28.625287925196325,115.86561708513025 28.625787612007546,115.86815834948467 28.624602640426623,115.86773004650362 28.62425999804172,115.86528871951153 28.625287925196325)))\",\n" +
                "      \"bz\": null\n" +
                "    },\n" +
                "    {\n" +
                "      \"bsm\": \"177177\",\n" +
                "      \"xzqdm\": \"3\",\n" +
                "      \"dkbh\": \"n1\",\n" +
                "      \"dklx\": \"ndbg2774\",\n" +
                "      \"dkmc\": \"大桥头\",\n" +
                "      \"dkmj\": 20.54,\n" +
                "      \"dkfw\": \"MULTIPOLYGON(((115.84891670917342 28.62884019080562,115.84861068074487 28.628310237250474,115.84801105657137 28.628543424429186,115.84836943314201 28.629060290948733,115.84891670917342 28.62884019080562)))\",\n" +
                "      \"bz\": null\n" +
                "    },\n" +
                "    {\n" +
                "      \"bsm\": \"177177\",\n" +
                "      \"xzqdm\": \"3\",\n" +
                "      \"dkbh\": \"n1\",\n" +
                "      \"dklx\": \"ndbg2774\",\n" +
                "      \"dkmc\": \"大桥头\",\n" +
                "      \"dkmj\": 20.54,\n" +
                "      \"dkfw\": \"MULTIPOLYGON(((115.85261028414699 28.628065910491646,115.85234952636368 28.627469892700983,115.85043542990357 28.628240439727712,115.85050295853954 28.62842805760428,115.85071376127738 28.628739229859185,115.85080329411801 28.628869938164858,115.85261028414699 28.628065910491646)))\",\n" +
                "      \"bz\": null\n" +
                "    }\n" +
                ",\n" +
                "    {\n" +
                "      \"bsm\": \"177177\",\n" +
                "      \"xzqdm\": \"3\",\n" +
                "      \"dkbh\": \"n1\",\n" +
                "      \"dklx\": \"ndbg2774\",\n" +
                "      \"dkmc\": \"大桥头\",\n" +
                "      \"dkmj\": 20.54,\n" +
                "      \"dkfw\": \"MULTIPOLYGON(((115.85063001998248 28.61939504315339,115.85047227189142 28.619025124342414,115.8490255596 28.6190394011085,115.8491588094162 28.61949625762165,115.84966325514971 28.61989600707048,115.84993419451101 28.620007388652688,115.85063001998248 28.61939504315339)))\",\n" +
                "      \"bz\": null\n" +
                "    }\n" +
                "  ]\n" +
                "}\n";
        String secert =encrypt(key,plaintext.getBytes());
//        System.out.println(secert);
@@ -148,7 +189,8 @@
        byte[] text=decrypt(key,ming);
//        System.out.println(new String(text, StandardCharsets.UTF_8));
        System.out.println(encrypt("jsimjrby3wqb7dbq",plaintext));
//        System.out.println("封装"+decrypt("jsimjrby3wqb7dbq","9LFnVDdqleTOFcBJT7TSxs788zPH8PicodLb5634SsixHrKNX+ZAgwODPZxvWFNQ"));
//        System.out.println(generateSM4Key());
//        System.out.println("封装"+decrypt("8a217699714b0fc0","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"));
        String encryptedBase64 = encrypt(key, plaintext.getBytes(StandardCharsets.UTF_8));
//        System.out.println("Encrypted (Base64): " + encryptedBase64);
//        System.out.println(generateSM4Key());
src/main/java/com/dji/sample/manage/model/receiver/BatteryReceiver.java
@@ -1,5 +1,6 @@
package com.dji.sample.manage.model.receiver;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
@@ -13,6 +14,7 @@
 */
@Data
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class BatteryReceiver {
    private List<BatteryStateReceiver> batteries;
src/main/java/com/dji/sample/media/model/MediaFileEntity.java
@@ -85,5 +85,8 @@
    @TableField(value = "drone_data", typeHandler = FastjsonTypeHandler.class)
    private Object droneData;
    @TableField("isadd")
    private Integer isadd;
}
src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
@@ -117,84 +117,79 @@
    }
    @Override
    public Integer saveFile(String workspaceId, FileUploadDTO file) {
    public Integer saveFile(String workspaceId, FileUploadDTO file) throws ImageProcessingException, IOException {
        MediaFileEntity fileEntity = this.fileUploadConvertToEntity(file);
        fileEntity.setWorkspaceId(workspaceId);
        fileEntity.setIsadd(0);
        fileEntity.setFileId(UUID.randomUUID().toString());
        String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey();
        File downloadedFile = TbFjServiceImpl.downloadFile(url);
        Object data = ImgUtil.getInfo(downloadedFile);
        fileEntity.setDroneData(data);
        return mapper.insert(fileEntity);
    }
    public void saveFiles(String workspaceId, FileUploadDTO file) {
        // 更新文件状态
        updateStatue(file.getName());
        // 使用 CompletableFuture 异步执行
        CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
            try {
                // 下载文件
                boolean endsWithMp4 = file.getObjectKey().endsWith(".mp4");
                if (endsWithMp4) {
                    // 处理视频文件
                    MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file);
                    zipEntity.setWorkspaceId(workspaceId);
                    zipEntity.setFileId(UUID.randomUUID().toString());
                    zipMapper.insert(zipEntity);
                    // 处理视频文件的其他逻辑(如果有)
                } else {
                    // 处理图片文件
                    String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey();
                    File downloadedFile = TbFjServiceImpl.downloadFile(url);
                    File nailFile = new File(ImgZipUtil.compressImage(downloadedFile, 50).toURI());
                    MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity(file);
                    Object data = ImgUtil.getInfo(downloadedFile);
                    nailEntity.setIsadd(0);
                    nailEntity.setIsOriginal(false);
                    nailEntity.setDronedata(data);
                    nailEntity.setWorkspaceId(workspaceId);
                    nailEntity.setFileName("nail" + file.getName());
                    nailEntity.setObjectKey("/nail" + file.getPath() + "/" + file.getName());
                    nailEntity.setFilePath("nail" + file.getPath());
                    String nailName = nailEntity.getObjectKey();
                    nailEntity.setFileId(UUID.randomUUID().toString());
                    // 上传图片文件
//                    uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", file.getObjectKey(), downloadedFile, "image/jpeg");
                    uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), nailName, nailFile, "image/jpeg");
//                    uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", nailName, nailFile, "image/jpeg");
                    nailMapper.insert(nailEntity);
                    // 处理压缩后的图片文件(如果有)
                    File zipFile = new File(ImgZipUtil.compressImageAndGetFile(downloadedFile, 0.5f).toURI());
                    MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file);
                    zipEntity.setIsOriginal(false);
                    zipEntity.setWorkspaceId(workspaceId);
                    zipEntity.setFileName("zip" + file.getName());
                    zipEntity.setObjectKey("/zip" + file.getPath() + "/" + file.getName());
                    zipEntity.setFilePath("zip" + file.getPath());
                    String zipName = zipEntity.getObjectKey();
                    zipEntity.setFileId(UUID.randomUUID().toString());
                    // 上传压缩文件
                    uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), zipName, zipFile, "image/jpeg");
//                    uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", zipName, zipFile, "image/jpeg");
                    zipMapper.insert(zipEntity);
                }
            } catch (IOException | ImageProcessingException e) {
                // 处理异常
                e.printStackTrace();
            }
        });
        // 等待异步任务完成
        try {
            future.get();
        } catch (InterruptedException | ExecutionException e) {
            Thread.currentThread().interrupt();
            // 处理异步任务的中断和异常
            // 下载文件
            boolean endsWithMp4 = file.getObjectKey().endsWith(".mp4");
            if (endsWithMp4) {
                // 处理视频文件
//            MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file);
//            zipEntity.setWorkspaceId(workspaceId);
//            zipEntity.setFileId(UUID.randomUUID().toString());
//            zipMapper.insert(zipEntity);
                // 处理视频文件的其他逻辑(如果有)
            } else {
                // 处理图片文件
                String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey();
                File downloadedFile = TbFjServiceImpl.downloadFile(url);
                File nailFile = new File(ImgZipUtil.compressImage(downloadedFile, 50).toURI());
                MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity(file);
                Object data = ImgUtil.getInfo(downloadedFile);
                nailEntity.setIsadd(0);
                nailEntity.setIsOriginal(false);
                nailEntity.setDronedata(data);
                nailEntity.setWorkspaceId(workspaceId);
                nailEntity.setFileName("nail" + file.getName());
                nailEntity.setObjectKey("/nail" + file.getPath() + "/" + file.getName());
                nailEntity.setFilePath("nail" + file.getPath());
                String nailName = nailEntity.getObjectKey();
                nailEntity.setFileId(UUID.randomUUID().toString());
                // 上传图片文件
//            uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", file.getObjectKey(), downloadedFile, "image/jpeg");
                uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), nailName, nailFile, "image/jpeg");
//            uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", nailName, nailFile, "image/jpeg");
                nailMapper.insert(nailEntity);
                // 处理压缩后的图片文件(如果有)
//            File zipFile = new File(ImgZipUtil.compressImageAndGetFile(downloadedFile, 0.5f).toURI());
//            MediaFileZipEntity zipEntity = this.fileUploadConvertToZipEntity(file);
//            zipEntity.setIsOriginal(false);
//            zipEntity.setWorkspaceId(workspaceId);
//            zipEntity.setFileName("zip" + file.getName());
//            zipEntity.setObjectKey("/zip" + file.getPath() + "/" + file.getName());
//            zipEntity.setFilePath("zip" + file.getPath());
//            String zipName = zipEntity.getObjectKey();
//            zipEntity.setFileId(UUID.randomUUID().toString());
                // 上传压缩文件
//            uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), zipName, zipFile, "image/jpeg");
//            uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", zipName, zipFile, "image/jpeg");
//            zipMapper.insert(zipEntity);
            }
        } catch (IOException | ImageProcessingException e) {
            // 处理异常
            e.printStackTrace();
        }
    }
    public void updateStatue(String filename) {
        if (filename.contains("~")) {
            String name = TimerUtil.getDkbh(filename);
src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java
@@ -227,7 +227,7 @@
        String objectKey = callback.getFile().getObjectKey();
        callback.getFile().setPath(objectKey.substring(objectKey.indexOf("/") + 1, objectKey.lastIndexOf("/")));
        int count =fileService.saveFile(job.getWorkspaceId(), callback.getFile());
        fileService.saveFiles(job.getWorkspaceId(), callback.getFile());
//        fileService.saveFiles(job.getWorkspaceId(), callback.getFile());
//        fileService.saveZipFile(job.getWorkspaceId(),callback.getFile());
        return count > 0;
    }
src/main/java/com/dji/sample/patches/controller/PatchesController.java
@@ -74,6 +74,7 @@
                                                        @RequestParam(name = "dkmj", required = false) Double dkmj,
                                                        @RequestParam(name = "isPush",required = false) Integer isPush
                                                        ) {
        fileService.getNoaddFile();
        //调用service分页查询
        PatchesParam param = PatchesParam.builder()
                .page(page)
src/main/java/com/dji/sample/patches/utils/TimerUtil.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dji.sample.common.model.CustomClaim;
import com.dji.sample.manage.dao.IDeviceMapper;
import com.dji.sample.manage.model.entity.DeviceEntity;
import com.dji.sample.media.dao.IFileMapper;
import com.dji.sample.media.model.MediaFileEntity;
import com.dji.sample.patches.config.pojo.PatchesConfigPojo;
@@ -78,7 +80,8 @@
    private TerritoryConfigPojo territoryConfigPojo;
    @Autowired
    private IWaylineJobBreakPointService jobBreakPointService;
    @Autowired
    private IDeviceMapper deviceMapper;
    /**
     * 定时器,将没有规划的图斑生成航线,并将航线飞完后的成果数据进行保存推送
     *
@@ -525,13 +528,13 @@
        return Files.readAllBytes(path);
    }
    public static void sendPostWithParameters(String name, String fileId, String time, List<Long> taskDays, List<List<Long>> taskPeriods, String jobId) throws IOException {
    public  void sendPostWithParameters(String name, String fileId, String time, List<Long> taskDays, List<List<Long>> taskPeriods, String jobId,String docksn) throws IOException {
        try {
            RestTemplate restTemplate = new RestTemplate();
            // 构建请求体
            String jsonBody = buildRequestBody(name, fileId, time, taskDays, taskPeriods, jobId);
            String jsonBody = buildRequestBody(name, fileId, time, taskDays, taskPeriods, jobId,docksn);
            String workspaceId =getWorkspaceIdByDocksn(docksn);
            // 设置请求头
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_JSON);
@@ -546,49 +549,19 @@
            // 发送请求
            ResponseEntity<String> response = restTemplate.exchange(
//                    "https://wrj.shuixiongit.com/drone-api/wayline/api/v1/workspaces/4a574db8-4ad3-48f7-9f16-3edbcd8056e1/flight-tasks",
                    "http://localhost:6789/wayline/api/v1/workspaces/4a574db8-4ad3-48f7-9f16-3edbcd8056e1/flight-tasks",
                    "http://localhost:6789/wayline/api/v1/workspaces/"+workspaceId+"/flight-tasks",
                    HttpMethod.POST,
                    requestEntity,
                    String.class);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
            System.out.println(response);
        } catch (Exception e) {
            throw new IllegalArgumentException("Request failed: " + e.getMessage());
        }
    }
    public String getWorkspaceIdByDocksn(String docksn){
      DeviceEntity entity=  deviceMapper.selectOne(new LambdaQueryWrapper<DeviceEntity>().eq(DeviceEntity::getDeviceSn,docksn));
      return entity.getWorkspaceId();
    }
    public static void sendPostWithParameters(String name, String fileId, String time, List<Long> taskDays, List<List<Long>> taskPeriods) throws IOException {
        try {
            RestTemplate restTemplate = new RestTemplate();
@@ -652,7 +625,7 @@
                + "}", name, fileId, select_execute_time, taskDays, taskPeriods);
    }
    private static String buildRequestBody(String name, String fileId, String select_execute_time, List<Long> taskDays, List<List<Long>> taskPeriods, String jobid) {
    private static String buildRequestBody(String name, String fileId, String select_execute_time, List<Long> taskDays, List<List<Long>> taskPeriods, String jobid, String dockSn) {
        // 将 List 和 String 类型的参数格式化为 JSON 字符串
        String taskDaysJson = taskDays != null ? taskDays.toString() : "[]";
        String taskPeriodsJson = taskPeriods != null ? taskPeriods.toString() : "[]";
@@ -661,7 +634,7 @@
        return String.format("{"
                + "\"name\":\"%s\","
                + "\"file_id\":\"%s\","
                + "\"dock_sn\":\"4TADKCM0010016\","
                + "\"dock_sn\":\"%s\","
                + "\"task_type\":1,"
                + "\"select_execute_time\":\"%s\","
                + "\"rth_altitude\":100,"
@@ -679,9 +652,10 @@
                + "\"task_periods\":%s,"
                + "\"wayline_type\":0,"
                + "\"job_id\":\"%s\""
                + "}", name, fileId, select_execute_time, taskDaysJson, taskPeriodsJson, jobid);
                + "}", name, fileId, dockSn, select_execute_time, taskDaysJson, taskPeriodsJson, jobid);
    }
    /**
     * 将上传的db保存一份到本地
     *