1.整理文件管理文件路径。
2.新增航线信息接口业务。
3.优化KMZ文件接口业务逻辑。
4.pom文件修改。
5.增加业务工具类。
6.增加部分业务注解。
7.增加修改无人机状态方法。
7 files added
23 files modified
2 files renamed
853 ■■■■■ changed files
ard-admin/src/main/java/com/ard/web/controller/route/ArdRouteFileController.java 4 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/route/ArdRouteFolderController.java 4 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/route/ArdRouteInformationController.java 111 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/route/UavRouteController.java 23 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/resources/application-prod.yml 10 ●●●●● patch | view | raw | blame | history
ard-route/pom.xml 9 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/domain/UavRouteReq.java 20 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteFile.java 2 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteFolder.java 6 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInformation.java 37 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/mapper/ArdRouteFileMapper.java 7 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/mapper/ArdRouteFolderMapper.java 2 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/mapper/ArdRouteInformationMapper.java 63 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/IArdRouteFileService.java 2 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/IArdRouteFolderService.java 2 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/IArdRouteInformationService.java 63 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/UavRouteService.java 4 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteFileServiceImpl.java 4 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteFolderServiceImpl.java 11 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInformationServiceImpl.java 93 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/service/impl/UavRouteServiceImpl.java 127 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java 21 ●●●●● patch | view | raw | blame | history
ard-route/src/main/java/com/ard/route/util/ToolUtils.java 43 ●●●●● patch | view | raw | blame | history
ard-route/src/main/resources/mapper/ArdRouteFileMapper.xml 16 ●●●●● patch | view | raw | blame | history
ard-route/src/main/resources/mapper/ArdRouteFolderMapper.xml 18 ●●●●● patch | view | raw | blame | history
ard-route/src/main/resources/mapper/ArdRouteInformationMapper.xml 98 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/component/netty/TyTcpClientManager.java 19 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/mapper/ArdDroneInfoMapper.java 10 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/mapper/ArdServerInfoMapper.java 1 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/IArdDroneInfoService.java 5 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/impl/ArdDroneInfoServiceImpl.java 10 ●●●●● patch | view | raw | blame | history
ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml 8 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/route/ArdRouteFileController.java
@@ -21,7 +21,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ard.route.domain.ArdRouteFile;
import com.ard.route.domain.route.ArdRouteFile;
import com.ard.route.service.IArdRouteFileService;
/**
@@ -32,7 +32,7 @@
 */
@Api(tags = "文件")
@RestController
@RequestMapping("/file")
@RequestMapping("/route/file")
public class ArdRouteFileController extends BaseController {
    @Autowired
ard-admin/src/main/java/com/ard/web/controller/route/ArdRouteFolderController.java
@@ -22,7 +22,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ard.route.domain.ArdRouteFolder;
import com.ard.route.domain.route.ArdRouteFolder;
import com.ard.route.service.IArdRouteFolderService;
/**
@@ -33,7 +33,7 @@
 */
@Api(tags = "文件夹")
@RestController
@RequestMapping("/folder")
@RequestMapping("/route/folder")
public class ArdRouteFolderController extends BaseController {
    @Autowired
ard-admin/src/main/java/com/ard/web/controller/route/ArdRouteInformationController.java
New file
@@ -0,0 +1,111 @@
package com.ard.web.controller.route;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ard.common.utils.poi.ExcelUtil;
import com.ard.route.domain.route.ArdRouteInformation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ard.common.annotation.Log;
import com.ard.common.core.controller.BaseController;
import com.ard.common.core.domain.AjaxResult;
import com.ard.common.enums.BusinessType;
import com.ard.route.service.IArdRouteInformationService;
import com.ard.common.core.page.TableDataInfo;
/**
 * 航线(kmz)Controller
 *
 * @author xia
 * @date 2025-10-23
 */
@Api(tags = "航线信息接口")
@RestController
@RequestMapping("/route/information")
public class ArdRouteInformationController extends BaseController {
    @Autowired
    private IArdRouteInformationService ardRouteInformationService;
    /**
     * 查询航线(kmz)列表
     */
    @ApiOperation("查询航线(kmz)列表")
    @PreAuthorize("@ss.hasPermi('route:information:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArdRouteInformation ardRouteInformation) {
        startPage();
        List<ArdRouteInformation> list = ardRouteInformationService.selectArdRouteInformationList(ardRouteInformation);
        return getDataTable(list);
    }
    /**
     * 导出航线(kmz)列表
     */
    @ApiOperation("导出航线(kmz)列表")
    @PreAuthorize("@ss.hasPermi('route:information:export')")
    @Log(title = "航线(kmz)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArdRouteInformation ardRouteInformation) {
        List<ArdRouteInformation> list = ardRouteInformationService.selectArdRouteInformationList(ardRouteInformation);
        ExcelUtil<ArdRouteInformation> util = new ExcelUtil<ArdRouteInformation>(ArdRouteInformation.class);
        util.exportExcel(response, list, "航线(kmz)数据");
    }
    /**
     * 获取航线(kmz)详细信息
     */
    @ApiOperation("获取航线(kmz)详细信息")
    @PreAuthorize("@ss.hasPermi('route:information:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(ardRouteInformationService.selectArdRouteInformationById(id));
    }
    /**
     * 新增航线(kmz)
     */
    @ApiOperation("新增航线(kmz)")
    @PreAuthorize("@ss.hasPermi('route:information:add')")
    @Log(title = "航线(kmz)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArdRouteInformation ardRouteInformation) {
        ardRouteInformation.setCreateBy(getUsername());
        return toAjax(ardRouteInformationService.insertArdRouteInformation(ardRouteInformation));
    }
    /**
     * 修改航线(kmz)
     */
    @ApiOperation("修改航线(kmz)")
    @PreAuthorize("@ss.hasPermi('route:information:edit')")
    @Log(title = "航线(kmz)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArdRouteInformation ardRouteInformation) {
        ardRouteInformation.setUpdateBy(getUsername());
        return toAjax(ardRouteInformationService.updateArdRouteInformation(ardRouteInformation));
    }
    /**
     * 删除航线(kmz)
     */
    @ApiOperation("删除航线(kmz)")
    @PreAuthorize("@ss.hasPermi('route:information:remove')")
    @Log(title = "航线(kmz)", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(ardRouteInformationService.deleteArdRouteInformationByIds(ids));
    }
}
ard-admin/src/main/java/com/ard/web/controller/route/UavRouteController.java
@@ -1,18 +1,19 @@
package com.ard.web.controller.route;
import com.ard.common.core.domain.AjaxResult;
import com.ard.route.domain.UavRouteReq;
import com.ard.route.service.UavRouteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static com.ard.common.core.domain.AjaxResult.success;
@Api(tags = "KMZ文件接口")
@RequestMapping("/kmz")
@RequestMapping("/route/kmz")
@RestController
public class UavRouteController {
@@ -23,18 +24,20 @@
     * 编辑kmz文件
     */
    @ApiOperation("编辑kmz文件")
    @PreAuthorize("@ss.hasPermi('route:kmz:updateKmz')")
    @PostMapping("/updateKmz")
    public void updateKmz(@RequestBody UavRouteReq uavRouteReq) {
        routeService.updateKmz(uavRouteReq);
    public AjaxResult updateKmz(@RequestBody UavRouteReq uavRouteReq) {
        return success(routeService.updateKmz(uavRouteReq));
    }
    /**
     * 生成kmz文件
     */
    @ApiOperation("生成kmz文件")
    @PostMapping("/buildKmz")
    public void buildKmz(@RequestBody UavRouteReq uavRouteReq){
        routeService.buildKmz(uavRouteReq);
    @PreAuthorize("@ss.hasPermi('route:kmz:buildKmz')")
    @PostMapping("/buildKmz/{fileName}")
    public AjaxResult buildKmz(@RequestBody UavRouteReq uavRouteReq,@PathVariable("fileName") String fileName){
        return success(routeService.buildKmz(uavRouteReq,fileName));
    }
}
ard-admin/src/main/resources/application-prod.yml
@@ -79,3 +79,13 @@
  expire: 3600
  region: us-east-1
  object-dir-prefix: wayline
# 是否是本地测试环境 true / false
isLocal: false
# 本地KMZ上传的路径
kmz:
  path: KmzFile/kmz/
MinioKmz:
  path: kmz
ard-route/pom.xml
@@ -42,6 +42,15 @@
            <artifactId>swagger-annotations</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.3.33</version>
        </dependency>
        <dependency>
            <groupId>com.ard</groupId>
            <artifactId>ard-oss</artifactId>
        </dependency>
    </dependencies>
ard-route/src/main/java/com/ard/route/domain/UavRouteReq.java
@@ -14,6 +14,10 @@
    /**
     * 航线类型
     * waypoint:航点飞行
     * mapping2d:建图航拍
     * mapping3d:倾斜摄影
     * mappingStrip:航带飞行
     */
    private String templateType;
@@ -39,16 +43,29 @@
    /**
     * 负载图片存储类型
     * wide:存储广角镜头照片
     * zoom:存储变焦镜头照片
     * ir:存储红外镜头照片
     * narrow_band: 存储窄带镜头拍摄照片
     * visable:可见光照片
     * * 注:存储多个镜头照片,格式
     */
    private String imageFormat;
    /**
     * 航线结束动作
     * goHome:飞行器完成航线任务后,退出航线模式并返航。noAction:飞行器完成航线任务后,退出航线模式。
     * autoLand:飞行器完成航线任务后,退出航线模式并原地降落。
     * gotoFirstWaypoint:飞行器完成航线任务后,立即飞向航线起始点,到达后退出航线模式。
     * * 注:以上动作执行过程,若飞行器退出了航线模式且进入失控状态,则会优先执行失控动作。
     */
    private String finishAction;
    /**
     * 失控动作
     * goBack:返航。飞行器从失控位置飞向起飞点
     * landing:降落。飞行器从失控位置原地降落
     * hover:悬停。飞行器从失控位置悬停
     */
    private String exitOnRcLostAction;
@@ -59,6 +76,7 @@
    /**
     * 全局航线飞行速度
     * 1 - 15
     */
    private Double autoFlightSpeed;
@@ -74,6 +92,8 @@
    /**
     * 云台俯仰角控制模式
     * manual:手动控制。飞行器从一个航点飞向下一个航点的过程中,支持用户手动控制云台的俯仰角度。若无用户控制,则保持飞离航点时的云台俯仰角度。
     * usePointSetting:依照每个航点设置。飞行器从一个航点飞向下一个航点的过程中,云台俯仰角均匀过渡至下一个航点的俯仰角。
     */
    private String gimbalPitchMode;
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteFile.java
File was renamed from ard-route/src/main/java/com/ard/route/domain/ArdRouteFile.java
@@ -1,4 +1,4 @@
package com.ard.route.domain;
package com.ard.route.domain.route;
import java.util.Date;
import java.util.List;
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteFolder.java
File was renamed from ard-route/src/main/java/com/ard/route/domain/ArdRouteFolder.java
@@ -1,4 +1,4 @@
package com.ard.route.domain;
package com.ard.route.domain.route;
import java.util.List;
@@ -24,6 +24,10 @@
    @Excel(name = "文件夹名称")
    private String fileName;
    /** 序列号 */
    @Excel(name = "序列号")
    private Integer serialNumber;
    private List<ArdRouteFile> ardRouteFileLs;
}
ard-route/src/main/java/com/ard/route/domain/route/ArdRouteInformation.java
New file
@@ -0,0 +1,37 @@
package com.ard.route.domain.route;
import com.ard.common.annotation.Excel;
import com.ard.common.core.domain.BaseEntity;
import lombok.Data;
/**
 * 航线(kmz)对象 ard_route_information
 *
 * @author xia
 * @date 2025-10-23
 */
@Data
public class ArdRouteInformation extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /** ID */
    private String id;
    /** 文件名称 */
    @Excel(name = "文件名称")
    private String fileName;
    /** 新文件名称 */
    @Excel(name = "新文件名称")
    private String fileNameNew;
    /** 文件路径 */
    @Excel(name = "文件路径")
    private String upPath;
    /** 文件大小 */
    @Excel(name = "文件大小")
    private Double upFileSize;
}
ard-route/src/main/java/com/ard/route/mapper/ArdRouteFileMapper.java
@@ -1,7 +1,7 @@
package com.ard.route.mapper;
import java.util.List;
import com.ard.route.domain.ArdRouteFile;
import com.ard.route.domain.route.ArdRouteFile;
/**
 * 文件Mapper接口
@@ -62,8 +62,9 @@
    /**
     * 根据所属文件夹ID,删除文件
     *
     * @param folderId 所属文件夹ID
     * @param folderIds 所属文件夹ID
     * @return 结果
     */
    public int deleteArdRouteFileByFolderId(String folderId);
    public int deleteRouteFileByFolderIds(String[] folderIds);
}
ard-route/src/main/java/com/ard/route/mapper/ArdRouteFolderMapper.java
@@ -1,7 +1,7 @@
package com.ard.route.mapper;
import java.util.List;
import com.ard.route.domain.ArdRouteFolder;
import com.ard.route.domain.route.ArdRouteFolder;
/**
 * 文件夹Mapper接口
ard-route/src/main/java/com/ard/route/mapper/ArdRouteInformationMapper.java
New file
@@ -0,0 +1,63 @@
package com.ard.route.mapper;
import com.ard.route.domain.route.ArdRouteInformation;
import java.util.List;
/**
 * 航线(kmz)Mapper接口
 *
 * @author xia
 * @date 2025-10-23
 */
public interface ArdRouteInformationMapper {
    /**
     * 查询航线(kmz)
     *
     * @param id 航线(kmz)主键
     * @return 航线(kmz)
     */
    public ArdRouteInformation selectArdRouteInformationById(String id);
    /**
     * 查询航线(kmz)列表
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 航线(kmz)集合
     */
    public List<ArdRouteInformation> selectArdRouteInformationList(ArdRouteInformation ardRouteInformation);
    /**
     * 新增航线(kmz)
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 结果
     */
    public int insertArdRouteInformation(ArdRouteInformation ardRouteInformation);
    /**
     * 修改航线(kmz)
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 结果
     */
    public int updateArdRouteInformation(ArdRouteInformation ardRouteInformation);
    /**
     * 删除航线(kmz)
     *
     * @param id 航线(kmz)主键
     * @return 结果
     */
    public int deleteArdRouteInformationById(String id);
    /**
     * 批量删除航线(kmz)
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteArdRouteInformationByIds(String[] ids);
}
ard-route/src/main/java/com/ard/route/service/IArdRouteFileService.java
@@ -1,7 +1,7 @@
package com.ard.route.service;
import java.util.List;
import com.ard.route.domain.ArdRouteFile;
import com.ard.route.domain.route.ArdRouteFile;
/**
 * 文件Service接口
ard-route/src/main/java/com/ard/route/service/IArdRouteFolderService.java
@@ -3,7 +3,7 @@
import java.util.List;
import java.util.Map;
import com.ard.route.domain.ArdRouteFolder;
import com.ard.route.domain.route.ArdRouteFolder;
/**
 * 文件夹Service接口
ard-route/src/main/java/com/ard/route/service/IArdRouteInformationService.java
New file
@@ -0,0 +1,63 @@
package com.ard.route.service;
import com.ard.route.domain.route.ArdRouteInformation;
import java.util.List;
/**
 * 航线(kmz)Service接口
 *
 * @author xia
 * @date 2025-10-23
 */
public interface IArdRouteInformationService {
    /**
     * 查询航线(kmz)
     *
     * @param id 航线(kmz)主键
     * @return 航线(kmz)
     */
    public ArdRouteInformation selectArdRouteInformationById(String id);
    /**
     * 查询航线(kmz)列表
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 航线(kmz)集合
     */
    public List<ArdRouteInformation> selectArdRouteInformationList(ArdRouteInformation ardRouteInformation);
    /**
     * 新增航线(kmz)
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 结果
     */
    public int insertArdRouteInformation(ArdRouteInformation ardRouteInformation);
    /**
     * 修改航线(kmz)
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 结果
     */
    public int updateArdRouteInformation(ArdRouteInformation ardRouteInformation);
    /**
     * 批量删除航线(kmz)
     *
     * @param ids 需要删除的航线(kmz)主键集合
     * @return 结果
     */
    public int deleteArdRouteInformationByIds(String[] ids);
    /**
     * 删除航线(kmz)信息
     *
     * @param id 航线(kmz)主键
     * @return 结果
     */
    public int deleteArdRouteInformationById(String id);
}
ard-route/src/main/java/com/ard/route/service/UavRouteService.java
@@ -7,11 +7,11 @@
    /**
     * 编辑kmz文件
     */
    void updateKmz(UavRouteReq uavRouteReq);
    public String updateKmz(UavRouteReq uavRouteReq);
    /**
     * 生成kmz文件(带航点)
     */
    void buildKmz(UavRouteReq uavRouteReq);
    public String buildKmz(UavRouteReq uavRouteReq, String fileName);
}
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteFileServiceImpl.java
@@ -1,16 +1,14 @@
package com.ard.route.service.impl;
import java.util.List;
import java.util.UUID;
import com.ard.common.annotation.DataScope;
import com.ard.common.utils.DateUtils;
import com.ard.common.utils.SecurityUtils;
import com.ard.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ard.route.mapper.ArdRouteFileMapper;
import com.ard.route.domain.ArdRouteFile;
import com.ard.route.domain.route.ArdRouteFile;
import com.ard.route.service.IArdRouteFileService;
/**
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteFolderServiceImpl.java
@@ -6,14 +6,13 @@
import com.ard.common.annotation.DataScope;
import com.ard.common.utils.DateUtils;
import com.ard.common.utils.SecurityUtils;
import com.ard.common.utils.uuid.IdUtils;
import com.ard.route.domain.ArdRouteFile;
import com.ard.route.domain.route.ArdRouteFile;
import com.ard.route.mapper.ArdRouteFileMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ard.route.mapper.ArdRouteFolderMapper;
import com.ard.route.domain.ArdRouteFolder;
import com.ard.route.domain.route.ArdRouteFolder;
import com.ard.route.service.IArdRouteFolderService;
import org.springframework.transaction.annotation.Transactional;
@@ -105,12 +104,8 @@
    @Transactional(rollbackFor = Exception.class)
    public Map<String, Integer> deleteArdRouteFolderByIds(String[] ids) {
        Map<String, Integer> result = new HashMap<>();
        int fileAdd = 0;
        // 删除文件夹的同时也删除文件夹下的所有文件
        for (String folderId : ids) {
            ardRouteFileMapper.deleteArdRouteFileByFolderId(folderId);
            fileAdd ++;
        }
        int fileAdd = ardRouteFileMapper.deleteRouteFileByFolderIds(ids);
        result.put("file", fileAdd);
        int folderCount = ardRouteFolderMapper.deleteArdRouteFolderByIds(ids);
        result.put("folder", folderCount);
ard-route/src/main/java/com/ard/route/service/impl/ArdRouteInformationServiceImpl.java
New file
@@ -0,0 +1,93 @@
package com.ard.route.service.impl;
import java.util.List;
import com.ard.common.utils.DateUtils;
import com.ard.common.utils.uuid.IdUtils;
import com.ard.route.domain.route.ArdRouteInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ard.route.mapper.ArdRouteInformationMapper;
import com.ard.route.service.IArdRouteInformationService;
/**
 * 航线(kmz)Service业务层处理
 *
 * @author xia
 * @date 2025-10-23
 */
@Service
public class ArdRouteInformationServiceImpl implements IArdRouteInformationService {
    @Autowired
    private ArdRouteInformationMapper ardRouteInformationMapper;
    /**
     * 查询航线(kmz)
     *
     * @param id 航线(kmz)主键
     * @return 航线(kmz)
     */
    @Override
    public ArdRouteInformation selectArdRouteInformationById(String id) {
        return ardRouteInformationMapper.selectArdRouteInformationById(id);
    }
    /**
     * 查询航线(kmz)列表
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 航线(kmz)
     */
    @Override
    public List<ArdRouteInformation> selectArdRouteInformationList(ArdRouteInformation ardRouteInformation) {
        return ardRouteInformationMapper.selectArdRouteInformationList(ardRouteInformation);
    }
    /**
     * 新增航线(kmz)
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 结果
     */
    @Override
    public int insertArdRouteInformation(ArdRouteInformation ardRouteInformation) {
        ardRouteInformation.setId(IdUtils.simpleUUID());
        ardRouteInformation.setCreateTime(DateUtils.getNowDate());
        return ardRouteInformationMapper.insertArdRouteInformation(ardRouteInformation);
    }
    /**
     * 修改航线(kmz)
     *
     * @param ardRouteInformation 航线(kmz)
     * @return 结果
     */
    @Override
    public int updateArdRouteInformation(ArdRouteInformation ardRouteInformation) {
        ardRouteInformation.setUpdateTime(DateUtils.getNowDate());
        return ardRouteInformationMapper.updateArdRouteInformation(ardRouteInformation);
    }
    /**
     * 批量删除航线(kmz)
     *
     * @param ids 需要删除的航线(kmz)主键
     * @return 结果
     */
    @Override
    public int deleteArdRouteInformationByIds(String[] ids) {
        return ardRouteInformationMapper.deleteArdRouteInformationByIds(ids);
    }
    /**
     * 删除航线(kmz)信息
     *
     * @param id 航线(kmz)主键
     * @return 结果
     */
    @Override
    public int deleteArdRouteInformationById(String id) {
        return ardRouteInformationMapper.deleteArdRouteInformationById(id);
    }
}
ard-route/src/main/java/com/ard/route/service/impl/UavRouteServiceImpl.java
@@ -3,26 +3,43 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import com.ard.common.utils.SecurityUtils;
import com.ard.oss.service.impl.OssServiceContext;
import com.ard.route.constant.FileTypeConstants;
import com.ard.route.domain.RoutePointReq;
import com.ard.route.domain.UavRouteReq;
import com.ard.route.domain.WaypointHeadingReq;
import com.ard.route.domain.WaypointTurnReq;
import com.ard.route.domain.kml.*;
import com.ard.route.domain.route.ArdRouteInformation;
import com.ard.route.enums.kml.ExitOnRCLostEnums;
import com.ard.route.service.IArdRouteInformationService;
import com.ard.route.util.RouteFileUtils;
import com.ard.route.service.UavRouteService;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveInputStream;
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.zip.ZipOutputStream;
import static com.ard.route.util.RouteFileUtils.*;
import static com.ard.route.util.ToolUtils.getFileNameWithoutExtension;
/**
 * Author:songjian
@@ -31,8 +48,28 @@
@Service
public class UavRouteServiceImpl implements UavRouteService {
    @Value("${isLocal}")
    private Boolean isLocal;
    @Value("${kmz.path}")
    private String localFilePath;
    @Value("${MinioKmz.path}")
    private String kmzPath;
    @Resource
    private OssServiceContext ossService;
    @Resource
    private IArdRouteInformationService ardRouteInformationService;
    /**
     * XML 头部
     */
    private static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    @Override
    public void updateKmz(UavRouteReq uavRouteReq) {
    public String updateKmz(UavRouteReq uavRouteReq) {
        // TODO 替换本地文件路径!!!
        File file = FileUtil.file("/Users/songjian/Project/IdeaProjects/dj-uav/file/kmz/航线kmz文件.kmz");
        try (ArchiveInputStream archiveInputStream = new ZipArchiveInputStream(FileUtil.getInputStream(file))) {
@@ -51,9 +88,10 @@
                    this.handleRouteUpdate(wpmlInfo, uavRouteReq, FileTypeConstants.WPML, kmlParams);
                }
            }
            RouteFileUtils.buildKmz("更新航线kmz文件", kmlInfo, wpmlInfo);
            return RouteFileUtils.buildKmz("更新航线kmz文件", kmlInfo, wpmlInfo, kmzPath);
        } catch (Exception e) {
            e.printStackTrace();
            return "更新航线kmz文件失败";
        }
    }
@@ -99,10 +137,91 @@
    }
    @Override
    public void buildKmz(UavRouteReq uavRouteReq) {
    public String buildKmz(UavRouteReq uavRouteReq, String fileName) {
        KmlParams kmlParams = new KmlParams();
        BeanUtils.copyProperties(uavRouteReq, kmlParams);
        kmlParams.setRoutePointList(BeanUtil.copyToList(uavRouteReq.getRoutePointList(), RoutePointInfo.class));
        RouteFileUtils.buildKmz("航线kmz文件AAAAAA", kmlParams);
        return buildKmz(fileName, kmlParams);
    }
    /**
     * 生成航线 KMZ 文件
     *
     * @param fileName  文件名
     * @param kmlParams 参数对象
     * @return 本地文件路径
     */
    public String buildKmz(String fileName, KmlParams kmlParams) {
        KmlInfo kmlInfo = buildKml(kmlParams);
        KmlInfo wpmlInfo = buildWpml(kmlParams);
        return buildKmz(fileName, kmlInfo, wpmlInfo);
    }
    /**
     * 生成航线 KMZ 文件
     *
     * @param fileName 文件名
     * @param kmlInfo  kml 文件信息
     * @param wpmlInfo wpml 文件信息
     * @return 本地文件路径
     */
    public String buildKmz(String fileName, KmlInfo kmlInfo, KmlInfo wpmlInfo) {
        XStream xStream = new XStream(new DomDriver());
        xStream.processAnnotations(KmlInfo.class);
        xStream.addImplicitCollection(KmlActionGroup.class, "action");
        String kml = XML_HEADER + xStream.toXML(kmlInfo);
        String wpml = XML_HEADER + xStream.toXML(wpmlInfo);
        // 判断本地生成kmz文件
        if (isLocal) {
            try (FileOutputStream fileOutputStream = new FileOutputStream(localFilePath + fileName + ".kmz");
                 ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) {
                zipOutputStream.setLevel(0); // 0 表示不压缩,存储方式
                // 创建KMZ文件内容
                buildZipFile("wpmz/template.kml", zipOutputStream, kml);
                buildZipFile("wpmz/waylines.wpml", zipOutputStream, wpml);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return localFilePath + fileName + ".kmz";
        }else {
            try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
                 ZipOutputStream zipOutputStream = new ZipOutputStream(baos)) {
                zipOutputStream.setLevel(0);
                // 创建KMZ文件内容
                buildZipFile("wpmz/template.kml", zipOutputStream, kml);
                buildZipFile("wpmz/waylines.wpml", zipOutputStream, wpml);
                zipOutputStream.finish();
                zipOutputStream.flush();
                // 获取文件大小
                Double fileSize = (double) baos.size(); // 字节数
                // 创建MultipartFile对象
                MultipartFile multipartFile = new MockMultipartFile(
                        fileName + ".kmz",
                        fileName + ".kmz",
                        "application/vnd.google-earth.kmz",
                        new ByteArrayInputStream(baos.toByteArray())
                );
                String kmzFilePath = ossService.upload(kmzPath,multipartFile);
                // KMZ信息管理
                ArdRouteInformation ardRouteInformation = new ArdRouteInformation();
                ardRouteInformation.setFileName(fileName);
                ardRouteInformation.setFileNameNew(getFileNameWithoutExtension(kmzFilePath));
                ardRouteInformation.setUpPath(kmzFilePath);
                ardRouteInformation.setUpFileSize(fileSize);
                ardRouteInformation.setCreateBy(SecurityUtils.getUsername());
                ardRouteInformationService.insertArdRouteInformation(ardRouteInformation);
                return kmzFilePath;
            } catch (Exception e) {
                throw new RuntimeException("KMZ文件生成或上传失败", e);
            }
        }
    }
}
ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java
@@ -58,24 +58,11 @@
     * 生成航线 KMZ 文件
     *
     * @param fileName  文件名
     * @param kmlParams 参数对象
     * @return 本地文件路径
     */
    public static String buildKmz(String fileName, KmlParams kmlParams) {
        KmlInfo kmlInfo = buildKml(kmlParams);
        KmlInfo wpmlInfo = buildWpml(kmlParams);
        return buildKmz(fileName, kmlInfo, wpmlInfo);
    }
    /**
     * 生成航线 KMZ 文件
     *
     * @param fileName 文件名
     * @param kmlInfo  kml 文件信息
     * @param wpmlInfo wpml 文件信息
     * @return 本地文件路径
     */
    public static String buildKmz(String fileName, KmlInfo kmlInfo, KmlInfo wpmlInfo) {
    public static String buildKmz(String fileName, KmlInfo kmlInfo, KmlInfo wpmlInfo, String kmzFilePath) {
        XStream xStream = new XStream(new DomDriver());
        xStream.processAnnotations(KmlInfo.class);
        xStream.addImplicitCollection(KmlActionGroup.class, "action");
@@ -83,7 +70,7 @@
        String kml = XML_HEADER + xStream.toXML(kmlInfo);
        String wpml = XML_HEADER + xStream.toXML(wpmlInfo);
        try (FileOutputStream fileOutputStream = new FileOutputStream(LOCAL_KMZ_FILE_PATH + fileName + ".kmz");
        try (FileOutputStream fileOutputStream = new FileOutputStream(kmzFilePath + fileName + ".kmz");
             ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) {
            zipOutputStream.setLevel(0); // 0 表示不压缩,存储方式
@@ -96,10 +83,10 @@
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return LOCAL_KMZ_FILE_PATH + fileName + ".kmz";
        return kmzFilePath + fileName + ".kmz";
    }
    private static void buildZipFile(String name, ZipOutputStream zipOutputStream, String content) throws IOException {
    public static void buildZipFile(String name, ZipOutputStream zipOutputStream, String content) throws IOException {
        ZipEntry kmlEntry = new ZipEntry(name);
        zipOutputStream.putNextEntry(kmlEntry);
        // 将内容写入 ZIP 条目
ard-route/src/main/java/com/ard/route/util/ToolUtils.java
New file
@@ -0,0 +1,43 @@
package com.ard.route.util;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
 * 工具类
 */
public class ToolUtils {
    /**
     * 生成KMZ文件名称规则
     */
    public static String buildKmzFileName() {
        // 获取当前日期时间
        LocalDateTime now = LocalDateTime.now();
        return "测试KMZ文件" + "_" + now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
    }
    /**
     * 根据路径截取文件名
     */
    public static String getFileNameWithoutExtension(String filePath) {
        if (filePath == null || filePath.trim().isEmpty()) {
            return "";
        }
        // 规范化路径,处理正斜杠和反斜杠
        String normalizedPath = filePath.replace('\\', '/');
        // 获取文件名(含扩展名)
        String fileNameWithExt = normalizedPath.substring(normalizedPath.lastIndexOf('/') + 1);
        // 去除扩展名
        int lastDotIndex = fileNameWithExt.lastIndexOf('.');
        if (lastDotIndex > 0) {
            return fileNameWithExt.substring(0, lastDotIndex);
        }
        return fileNameWithExt;
    }
}
ard-route/src/main/resources/mapper/ArdRouteFileMapper.xml
@@ -39,6 +39,10 @@
            <if test="fileType != null  and fileType != ''"> and file_type = #{fileType}</if>
            <if test="fileSize != null "> and file_size = #{fileSize}</if>
            <if test="filePath != null  and filePath != ''"> and file_path = #{filePath}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateBy != null  and updateBy != ''"> and update_by = #{updateBy}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
        </where>
    </select>
    
@@ -95,14 +99,18 @@
        delete from ard_route_file where id = #{id}
    </delete>
    <delete id="deleteArdRouteFileByFolderId" parameterType="String">
        delete from ard_route_file where folder_id = #{folderId}
    </delete>
    <delete id="deleteArdRouteFileByIds" parameterType="String">
        delete from ard_route_file where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="deleteRouteFileByFolderIds" parameterType="String">
        delete from ard_route_file where folder_id in
        <foreach item="folderId" collection="array" open="(" separator="," close=")">
            #{folderId}
        </foreach>
    </delete>
</mapper>
ard-route/src/main/resources/mapper/ArdRouteFolderMapper.xml
@@ -7,19 +7,28 @@
    <resultMap type="ArdRouteFolder" id="ArdRouteFolderResult">
        <result property="id"    column="id"    />
        <result property="fileName"    column="file_name"    />
        <result property="serialNumber"    column="serial_number"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <!-- 关联 ArdRouteFile 对象 -->
        <association property="ardRouteFile"
                     javaType="com.ard.route.domain.route.ArdRouteFile"
                     column="folder_id"
                     autoMapping="true"
                     select="selectArdRouteFile">
        </association>
    </resultMap>
    <select id="selectArdRouteFile" resultType="com.ard.route.domain.ArdRouteFile">
    <select id="selectArdRouteFile" resultType="com.ard.route.domain.route.ArdRouteFile">
        select * from ard_route_file where id = #{folderId}
    </select>
    <sql id="selectArdRouteFolderVo">
        select id,
               file_name,
               serial_number,
               create_by,
               create_time,
               update_by,
@@ -31,6 +40,10 @@
        <include refid="selectArdRouteFolderVo"/>
        <where>  
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
            <if test="createdTime != null "> and created_time = #{createdTime}</if>
            <if test="updatedBy != null  and updatedBy != ''"> and updated_by = #{updatedBy}</if>
            <if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
        </where>
    </select>
    
@@ -44,6 +57,7 @@
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="fileName != null">file_name,</if>
            <if test="serialNumber != null">serial_number,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
@@ -52,6 +66,7 @@
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="serialNumber != null">#{serialNumber},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
@@ -63,6 +78,7 @@
        update ard_route_folder
        <trim prefix="SET" suffixOverrides=",">
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="serialNumber != null">serial_number = #{serialNumber},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
ard-route/src/main/resources/mapper/ArdRouteInformationMapper.xml
New file
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ard.route.mapper.ArdRouteInformationMapper">
    <resultMap type="ArdRouteInformation" id="ArdRouteInformationResult">
        <result property="id"    column="id"    />
        <result property="fileName"    column="file_name"    />
        <result property="fileNameNew"    column="file_name_new"    />
        <result property="upPath"    column="up_path"    />
        <result property="upFileSize"    column="up_file_size"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
    <sql id="selectArdRouteInformationVo">
        select id,
               file_name,
               file_name_new,
               up_path,
               up_file_size,
               create_by,
               create_time,
               update_by,
               update_time
        from ard_route_information
    </sql>
    <select id="selectArdRouteInformationList" parameterType="ArdRouteInformation" resultMap="ArdRouteInformationResult">
        <include refid="selectArdRouteInformationVo"/>
        <where>
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="upPath != null  and upPath != ''"> and up_path = #{upPath}</if>
            <if test="upFileSize != null "> and up_file_size = #{upFileSize}</if>
        </where>
    </select>
    <select id="selectArdRouteInformationById" parameterType="String" resultMap="ArdRouteInformationResult">
        <include refid="selectArdRouteInformationVo"/>
        where id = #{id}
    </select>
    <insert id="insertArdRouteInformation" parameterType="ArdRouteInformation">
        insert into ard_route_information
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="fileName != null">file_name,</if>
            <if test="fileNameNew != null">file_name_new,</if>
            <if test="upPath != null">up_path,</if>
            <if test="upFileSize != null">up_file_size,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="fileNameNew != null">#{fileNameNew},</if>
            <if test="upPath != null">#{upPath},</if>
            <if test="upFileSize != null">#{upFileSize},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
    <update id="updateArdRouteInformation" parameterType="ArdRouteInformation">
        update ard_route_information
        <trim prefix="SET" suffixOverrides=",">
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="fileNameNew != null">file_name_new = #{fileNameNew},</if>
            <if test="upPath != null">up_path = #{upPath},</if>
            <if test="upFileSize != null">up_file_size = #{upFileSize},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteArdRouteInformationById" parameterType="String">
        delete from ard_route_information where id = #{id}
    </delete>
    <delete id="deleteArdRouteInformationByIds" parameterType="String">
        delete from ard_route_information where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
ard-work/src/main/java/com/ard/work/component/netty/TyTcpClientManager.java
@@ -6,6 +6,7 @@
import com.ard.work.component.netty.handler.MessageProtocolEncoder;
import com.ard.work.component.netty.cache.TyTcpServerCache;
import com.ard.work.domain.entity.ArdServerInfo;
import com.ard.work.service.IArdDroneInfoService;
import com.ard.work.service.IArdServerInfoService;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.*;
@@ -32,6 +33,9 @@
    @Resource
    private IArdServerInfoService ardServerService; // ← 从数据库读取边缘服务器配置
    @Resource
    private IArdDroneInfoService ardDroneService;
    @Resource
    private ClientHandler clientHandler;
@@ -76,8 +80,8 @@
                Channel channel = f.channel();
                channel.attr(AttributeKey.valueOf("serverId")).set(serverId);
                TyTcpServerCache.putTcpServerCache(serverId, true);
                // 断开服务器,修改状态为: 0 - 在线
                ardServerService.updateServerStatus(serverId, "1");
                // 修改状态为: 1 - 在线
                updateServerAndDroneStatus(serverId, "1");
                // 成功后再加入 channels
                TyTcpServerCache.putChannel(serverId, channel);
@@ -86,7 +90,7 @@
                log.warn("❌ 服务器 [{}] 连接失败", serverId);
                TyTcpServerCache.putTcpServerCache(serverId, false);
                // 断开服务器,修改状态为: 0 - 离线
                ardServerService.updateServerStatus(serverId, "0");
                updateServerAndDroneStatus(serverId, "0");
            }
        });
    }
@@ -100,12 +104,19 @@
            channel.close();
            log.info("断开服务器 [{}] 连接", serverId);
            // 断开服务器,修改状态为: 0 - 离线
            ardServerService.updateServerStatus(serverId, "0");
            updateServerAndDroneStatus(serverId, "0");
            TyTcpServerCache.removeChannel(serverId);
        }
        TyTcpServerCache.removeTcpServerCache(serverId);
    }
    /**
     * 同步修改服务和无人机状态
     */
    private void updateServerAndDroneStatus(String serverId, String status) {
        ardServerService.updateServerStatus(serverId, status);
        ardDroneService.updateDroneStatus(serverId, status);
    }
    /**
     * 启动时从数据库加载所有边缘服务器并建立 TCP 连接
ard-work/src/main/java/com/ard/work/mapper/ArdDroneInfoMapper.java
@@ -1,6 +1,7 @@
package com.ard.work.mapper;
import com.ard.work.domain.entity.ArdDroneInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -75,4 +76,13 @@
     */
    int insertArdDroneLs(List<ArdDroneInfo> ardDroneInfo);
    /**
     * 修改无人机状态
     *
     * @param serverId 服务器管理主键
     * @param onLine 状态
     * @return 结果
     */
    int updateDroneStatus(@Param("serverId") String serverId, @Param("onLine") String onLine);
}
ard-work/src/main/java/com/ard/work/mapper/ArdServerInfoMapper.java
@@ -64,6 +64,7 @@
     * 修改服务器状态
     *
     * @param id 服务器管理主键
     * @param status 状态
     * @return 结果
     */
    public int updateServerStatus(@Param("id") String id, @Param("status") String status);
ard-work/src/main/java/com/ard/work/service/IArdDroneInfoService.java
@@ -79,4 +79,9 @@
     */
    public int insertArdDroneLs(String[] boxSn,Long deptId);
    /**
     * 修改无人机状态
     */
    public int updateDroneStatus(String serverId,String status);
}
ard-work/src/main/java/com/ard/work/service/impl/ArdDroneInfoServiceImpl.java
@@ -38,8 +38,6 @@
    @Resource
    private AuthorizeService authorizeService;
    UtilMethod utilMethod = new UtilMethod();
    /**
     * 查询无人机盒子
     *
@@ -153,6 +151,14 @@
    }
    /**
     * 修改无人机状态
     */
    @Override
    public int updateDroneStatus(String serverId, String status) {
        return ArdDroneInfoMapper.updateDroneStatus(serverId, status);
    }
    /**
     * 获取已存在的无人机信息
     */
    private List<ArdDroneInfo> getExistingDrones(String[] boxSn) {
ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml
@@ -196,4 +196,12 @@
        </foreach>
    </insert>
    <update id="updateDroneStatus">
        update ard_drone_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="onLine != null">on_line = #{onLine},</if>
        </trim>
        where server_id = #{serverId}
    </update>
</mapper>