1.修改备注。
2.修改服务器管理ID名称。
3.增加批量新增无人机盒子接口。
4.增加公共方法类。
1 files added
10 files modified
351 ■■■■■ changed files
ard-admin/src/main/java/com/ard/web/controller/system/AuthorizationController.java 34 ●●●●● patch | view | raw | blame | history
ard-system/src/main/java/com/ard/system/authorize/service/AuthorizeService.java 41 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/domain/entity/ArdDroneInfo.java 2 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/domain/receiver/BoxInfoReceiver.java 2 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/mapper/ArdDroneInfoMapper.java 20 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/IArdDroneInfoService.java 9 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/ITyService.java 3 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/impl/ArdDroneInfoServiceImpl.java 29 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java 128 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/util/UtilMethod.java 35 ●●●●● patch | view | raw | blame | history
ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml 48 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/java/com/ard/web/controller/system/AuthorizationController.java
@@ -18,27 +18,39 @@
    @Resource
    AuthorizeService authorizeService;
    //生成临时授权只有一天
    /**
     * 生成临时授权只有一天
     */
    @PostMapping("/makeTempLicense")
    public JSONObject makeTempLicense() {
        JSONObject jsonObject = authorizeService.makeTempLicense();
        return jsonObject;
    }
    //获取机器码
    /**
     * 获取机器码
     */
    @ApiOperation("获取机器码")
    @PostMapping("/getMachineCode")
    public JSONObject getMachineCode() {
        JSONObject jsonObject = authorizeService.getMachineCode();
        return jsonObject;
    }
    //上传授权文件
    /**
     * 上传授权文件
     */
    @ApiOperation("上传授权文件")
    @PostMapping(value = "/uploadLicenseFile")
    public JSONObject uploadLicense(@RequestPart MultipartFile file) {
        JSONObject jsonObject = authorizeService.uploadLicense(file);
        return  jsonObject;
    }
    //验证授权文件是否到期
    /**
     * 验证授权文件是否到期
     */
    @ApiOperation("验证授权文件是否到期")
    @PostMapping(value = "/verifyAuthorization")
    public JSONObject verifyAuthorization() {
@@ -46,7 +58,9 @@
        return data;
    }
    //授权信息
    /**
     * 授权信息
     */
    @ApiOperation("授权信息")
    @GetMapping(value = "/getAuthorizationInfo")
    public JSONObject getAuthorizationInfo() {
@@ -54,16 +68,22 @@
        return data;
    }
    //加密
    /**
     * 加密
     */
    @PostMapping(value = "/getLicense")
    public String getLicense(@RequestBody String data) {
        String EncryptedStr = authorizeService.encryption(data);
        return EncryptedStr;
    }
    //解密
    /**
     * 解密
     */
    @PostMapping(value = "/parsLicense")
    public String parsLicense(@RequestBody String data) {
        String DecryptStr = authorizeService.decryption(data);
        return DecryptStr;
    }
}
ard-system/src/main/java/com/ard/system/authorize/service/AuthorizeService.java
@@ -5,12 +5,39 @@
public interface AuthorizeService {
    JSONObject verifyAuthorization();//验证本地授权
    JSONObject getAuthorizationInfo();//获取授权信息
    JSONObject makeTempLicense();//制作临时授权
    JSONObject getMachineCode();//获取机器码
    JSONObject uploadLicense(MultipartFile file);//上传授权文件
    /**
     * 验证本地授权
     */
    JSONObject verifyAuthorization();
    String encryption(String data);//加密
    String decryption(String data);//解密
    /**
     * 获取授权信息
     */
    JSONObject getAuthorizationInfo();
    /**
     * 制作临时授权
     */
    JSONObject makeTempLicense();
    /**
     * 获取机器码
     */
    JSONObject getMachineCode();
    /**
     * 上传授权文件
     */
    JSONObject uploadLicense(MultipartFile file);
    /**
     * 加密
     */
    String encryption(String data);
    /**
     * 解密
     */
    String decryption(String data);
}
ard-work/src/main/java/com/ard/work/domain/entity/ArdDroneInfo.java
@@ -68,7 +68,7 @@
    /** 服务器管理ID */
    @Excel(name = "服务器管理ID")
    private String serverInfoId;
    private String serverId;
    /**
     * 服务器实体对象
ard-work/src/main/java/com/ard/work/domain/receiver/BoxInfoReceiver.java
@@ -61,7 +61,7 @@
    /**
     * 服务器实体对象ID
     */
    private String serverInfoId;
    private String serverId;
    /**
     * 服务器实体对象
ard-work/src/main/java/com/ard/work/mapper/ArdDroneInfoMapper.java
@@ -30,26 +30,26 @@
    /**
     * 查询无人机盒子列表
     *
     * @param ArdDroneInfo 无人机盒子
     * @param ardDroneInfo 无人机盒子
     * @return 无人机盒子集合
     */
    List<ArdDroneInfo> selectArdDroneList(ArdDroneInfo ArdDroneInfo);
    List<ArdDroneInfo> selectArdDroneList(ArdDroneInfo ardDroneInfo);
    /**
     * 新增无人机盒子
     *
     * @param ArdDroneInfo 无人机盒子
     * @param ardDroneInfo 无人机盒子
     * @return 结果
     */
    int insertArdDrone(ArdDroneInfo ArdDroneInfo);
    int insertArdDrone(ArdDroneInfo ardDroneInfo);
    /**
     * 修改无人机盒子
     *
     * @param ArdDroneInfo 无人机盒子
     * @param ardDroneInfo 无人机盒子
     * @return 结果
     */
    int updateArdDrone(ArdDroneInfo ArdDroneInfo);
    int updateArdDrone(ArdDroneInfo ardDroneInfo);
    /**
     * 删除无人机盒子
@@ -67,4 +67,12 @@
     */
    int deleteArdDroneByIds(String[] ids);
    /**
     * 批量新增无人机盒子
     *
     * @param ardDroneInfo 无人机盒子
     * @return 结果
     */
    int insertArdDroneLs(List<ArdDroneInfo> ardDroneInfo);
}
ard-work/src/main/java/com/ard/work/service/IArdDroneInfoService.java
@@ -69,4 +69,13 @@
     * @return 结果
     */
    public int deleteArdDroneById(String id);
    /**
     * 批量新增无人机盒子
     *
     * @param ids 无人机盒子主键集合
     * @return 结果
     */
    public int insertArdDroneLs(String[] ids);
}
ard-work/src/main/java/com/ard/work/service/ITyService.java
@@ -281,8 +281,7 @@
    void processReplyMessage(String key, BaseCmd tyMessage);
    /**
     * 根据boxSn获取六合盒子列表
     * @return List<BoxInfoReceiver>
     * 根据[服务器id]获取六合盒子列表
     */
    List<BoxInfoReceiver> getBoxSnToList(String id);
ard-work/src/main/java/com/ard/work/service/impl/ArdDroneInfoServiceImpl.java
@@ -1,16 +1,20 @@
package com.ard.work.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.ard.common.utils.DateUtils;
import com.ard.common.utils.uuid.IdUtils;
import com.ard.system.authorize.service.AuthorizeService;
import com.ard.work.domain.entity.ArdDroneInfo;
import com.ard.work.domain.receiver.BoxInfoReceiver;
import com.ard.work.mapper.ArdDroneInfoMapper;
import com.ard.work.service.IArdDroneInfoService;
import com.ard.work.service.ITyService;
import com.ard.work.util.UtilMethod;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -30,6 +34,8 @@
    @Resource
    private ITyService tyService;
    UtilMethod utilMethod = new UtilMethod();
    /**
     * 查询无人机盒子
@@ -112,6 +118,29 @@
    }
    /**
     * 批量新增无人机盒子
     *
     * @param ids 无人机盒子主键集合
     * @return 结果
     */
    @Override
    public int insertArdDroneLs(String[] ids) {
        // 获取无人机盒子信息
        List<ArdDroneInfo> drone = new ArrayList<>();
        for (String id : ids) {
            ArdDroneInfo ardDrone = ArdDroneInfoMapper.selectArdDroneById(id);
            drone.add(ardDrone);
        }
        // 检验数量droneNum是否合规。
        utilMethod.authorizationVerification(drone.size());
        // 插入
        if (!drone.isEmpty()) {
            return ArdDroneInfoMapper.insertArdDroneLs(drone);
        }
        return 0;
    }
    /**
     * 同步盒子属性
     *
     * @return 结果
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
@@ -56,10 +56,7 @@
import javax.annotation.Resource;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -110,7 +107,7 @@
    @Override
    public BoxStreamUrlReceiver getBoxLiveUrl(String boxSn) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSn);
        TyHttpCommonReceiver<BoxStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(ardDroneInfo.getServerInfoId(),boxSn);
        TyHttpCommonReceiver<BoxStreamUrlReceiver> boxLiveUrl = tyClient.getBoxLiveUrl(ardDroneInfo.getServerId(),boxSn);
        return boxLiveUrl.getContent();
    }
@@ -122,7 +119,7 @@
    @Override
    public List<BoxHistoryReceiver> getBoxHistory(BoxHistoryDTO boxHistoryDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxHistoryDTO.getBoxSn());
        TyHttpCommonReceiver<List<BoxHistoryReceiver>> boxHistory = tyClient.getBoxHistory(ardDroneInfo.getServerInfoId(),
        TyHttpCommonReceiver<List<BoxHistoryReceiver>> boxHistory = tyClient.getBoxHistory(ardDroneInfo.getServerId(),
                boxHistoryDTO);
        return boxHistory.getContent();
    }
@@ -135,7 +132,7 @@
    @Override
    public List<BoxPhotosReceiver> getBoxPhotos(BoxPhotosDTO boxPhotosDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxPhotosDTO.getBoxSn());
        TyHttpCommonReceiver<List<BoxPhotosReceiver>> boxPhotos = tyClient.getBoxPhotos(ardDroneInfo.getServerInfoId(),boxPhotosDTO);
        TyHttpCommonReceiver<List<BoxPhotosReceiver>> boxPhotos = tyClient.getBoxPhotos(ardDroneInfo.getServerId(),boxPhotosDTO);
        return boxPhotos.getContent();
    }
@@ -145,7 +142,7 @@
    @Override
    public Boolean updateBoxSettings(BoxSettingsDTO boxSettingsDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(boxSettingsDTO.getBoxSn());
        TyHttpCommonReceiver<?> result = tyClient.updateBoxSettings(ardDroneInfo.getServerInfoId(),boxSettingsDTO);
        TyHttpCommonReceiver<?> result = tyClient.updateBoxSettings(ardDroneInfo.getServerId(),boxSettingsDTO);
        return result.getState() == 1;
    }
@@ -156,7 +153,7 @@
    public Boolean updateReturnHeight(ReturnHeightSettingDTO returnHeightSettingDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(returnHeightSettingDTO.getBoxSn());
        ReturnHeightSettingCmd returnHeightSettingCmd = new ReturnHeightSettingCmd(returnHeightSettingDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), returnHeightSettingCmd);
        this.sendMessage(ardDroneInfo.getServerId(), returnHeightSettingCmd);
        return true;
    }
@@ -167,7 +164,7 @@
    public Boolean updateReturnPoint(ReturnPointSettingDTO returnPointSettingDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(returnPointSettingDTO.getBoxSn());
        ReturnPointSettingCmd returnPointSettingCmd = new ReturnPointSettingCmd(returnPointSettingDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), returnPointSettingCmd);
        this.sendMessage(ardDroneInfo.getServerId(), returnPointSettingCmd);
        return true;
    }
@@ -178,7 +175,7 @@
    public Boolean updateVideoStream(VideoStreamSettingDTO videoStreamSettingDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(videoStreamSettingDTO.getBoxSn());
        VideoStreamSettingCmd videoStreamSettingCmd = new VideoStreamSettingCmd(videoStreamSettingDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), videoStreamSettingCmd);
        this.sendMessage(ardDroneInfo.getServerId(), videoStreamSettingCmd);
        return true;
    }
@@ -205,7 +202,7 @@
    public Boolean angleControl(AngleControlDTO angleControlDto) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(angleControlDto.getBoxSn());
        AngleControlCmd controlAngleCommand = new AngleControlCmd(angleControlDto);
        this.sendMessage(ardDroneInfo.getServerInfoId(), controlAngleCommand);
        this.sendMessage(ardDroneInfo.getServerId(), controlAngleCommand);
        return true;
    }
@@ -217,7 +214,7 @@
    public Boolean absAngleControl(AbsAngleControlDTO absAngleControlDto) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(absAngleControlDto.getBoxSn());
        AbsAngleControlCmd absAngleControlCommand = new AbsAngleControlCmd(absAngleControlDto);
        this.sendMessage(ardDroneInfo.getServerInfoId(), absAngleControlCommand);
        this.sendMessage(ardDroneInfo.getServerId(), absAngleControlCommand);
        return true;
    }
@@ -229,7 +226,7 @@
    public Boolean speedControl(SpeedControlDTO speedControlDto) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(speedControlDto.getBoxSn());
        SpeedControlCmd speedControlCommand = new SpeedControlCmd(speedControlDto);
        this.sendMessage(ardDroneInfo.getServerInfoId(), speedControlCommand);
        this.sendMessage(ardDroneInfo.getServerId(), speedControlCommand);
        return true;
    }
@@ -240,7 +237,7 @@
    public Boolean updateCameraMode(CameraModeDTO cameraModeDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(cameraModeDTO.getBoxSn());
        CameraModeCmd cameraModeCommand = new CameraModeCmd(cameraModeDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), cameraModeCommand);
        this.sendMessage(ardDroneInfo.getServerId(), cameraModeCommand);
        return true;
    }
@@ -255,7 +252,7 @@
        photoReturnToggle(PhotoReturnToggleDTO.builder().boxSn(capturePicDto.getBoxSn()).actionParam((byte) 0x01).build());
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(capturePicDto.getBoxSn());
        CapturePicCmd capturePicCommand = new CapturePicCmd(capturePicDto);
        this.sendMessage(ardDroneInfo.getServerInfoId(), capturePicCommand);
        this.sendMessage(ardDroneInfo.getServerId(), capturePicCommand);
        return true;
    }
@@ -272,7 +269,7 @@
            baseCmd = new RecordStopCmd(recordDto);
        }
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(recordDto.getBoxSn());
        this.sendMessage(ardDroneInfo.getServerInfoId(), baseCmd);
        this.sendMessage(ardDroneInfo.getServerId(), baseCmd);
        return true;
    }
@@ -284,7 +281,7 @@
    public Boolean zoom(ZoomDTO zoomDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(zoomDTO.getBoxSn());
        ZoomCmd zoomCommand = new ZoomCmd(zoomDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), zoomCommand);
        this.sendMessage(ardDroneInfo.getServerId(), zoomCommand);
        return true;
    }
@@ -296,7 +293,7 @@
    public Boolean zoomToLevel(ZoomToLevelDTO zoomToLevelDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(zoomToLevelDTO.getBoxSn());
        ZoomToLevelCmd zoomToLevelCommand = new ZoomToLevelCmd(zoomToLevelDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), zoomToLevelCommand);
        this.sendMessage(ardDroneInfo.getServerId(), zoomToLevelCommand);
        return true;
    }
@@ -307,7 +304,7 @@
    public Boolean switchCamera(SwitchCameraDTO switchCameraDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(switchCameraDTO.getBoxSn());
        SwitchCameraCmd switchCameraCmd = new SwitchCameraCmd(switchCameraDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), switchCameraCmd);
        this.sendMessage(ardDroneInfo.getServerId(), switchCameraCmd);
        return true;
    }
@@ -318,7 +315,7 @@
    public Boolean switchSource(SwitchSourceDTO switchSourceDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(switchSourceDTO.getBoxSn());
        SwitchSourceCmd switchSourceCmd = new SwitchSourceCmd(switchSourceDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), switchSourceCmd);
        this.sendMessage(ardDroneInfo.getServerId(), switchSourceCmd);
        return true;
    }
@@ -329,7 +326,7 @@
    public Boolean photoReturnToggle(PhotoReturnToggleDTO photoReturnToggleDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(photoReturnToggleDTO.getBoxSn());
        PhotoReturnToggleCmd photoReturnToggleCmd = new PhotoReturnToggleCmd(photoReturnToggleDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), photoReturnToggleCmd);
        this.sendMessage(ardDroneInfo.getServerId(), photoReturnToggleCmd);
        return true;
    }
@@ -340,7 +337,7 @@
    public Boolean switchUavControl(SwitchUavControlDTO switchUavControlDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(switchUavControlDTO.getBoxSn());
        SwitchUavControlCmd switchUavControlCmd = new SwitchUavControlCmd(switchUavControlDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), switchUavControlCmd);
        this.sendMessage(ardDroneInfo.getServerId(), switchUavControlCmd);
        return true;
    }
@@ -352,7 +349,7 @@
    public Boolean takeOff(TakeOffDTO takeOffDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(takeOffDTO.getBoxSn());
        TakeOffCmd takeOffCmd = new TakeOffCmd(takeOffDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), takeOffCmd);
        this.sendMessage(ardDroneInfo.getServerId(), takeOffCmd);
        return true;
    }
@@ -364,7 +361,7 @@
    public Boolean returnHome(ReturnHomeDTO returnHomeDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(returnHomeDTO.getBoxSn());
        ReturnHomeCmd returnHomeCmd = new ReturnHomeCmd(returnHomeDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), returnHomeCmd);
        this.sendMessage(ardDroneInfo.getServerId(), returnHomeCmd);
        return true;
    }
@@ -376,7 +373,7 @@
    public Boolean returnHomeCancel(ReturnHomeCancelDTO returnHomeCancelDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(returnHomeCancelDTO.getBoxSn());
        ReturnHomeCancelCmd returnHomeCancelCmd = new ReturnHomeCancelCmd(returnHomeCancelDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), returnHomeCancelCmd);
        this.sendMessage(ardDroneInfo.getServerId(), returnHomeCancelCmd);
        return true;
    }
@@ -388,7 +385,7 @@
    public Boolean land(LandDTO landDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(landDTO.getBoxSn());
        LandCmd landCmd = new LandCmd(landDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), landCmd);
        this.sendMessage(ardDroneInfo.getServerId(), landCmd);
        return true;
    }
@@ -400,7 +397,7 @@
    public Boolean landCancel(LandCancelDTO landCancelDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(landCancelDTO.getBoxSn());
        LandCancelCmd landCancelCmd = new LandCancelCmd(landCancelDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), landCancelCmd);
        this.sendMessage(ardDroneInfo.getServerId(), landCancelCmd);
        return true;
    }
@@ -412,7 +409,7 @@
    public Boolean landForced(LandForcedDTO landForcedDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(landForcedDTO.getBoxSn());
        LandForcedCmd landForcedCmd = new LandForcedCmd(landForcedDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), landForcedCmd);
        this.sendMessage(ardDroneInfo.getServerId(), landForcedCmd);
        return true;
    }
@@ -425,7 +422,7 @@
    public Boolean flyControl(FlyControlDTO flyControlDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(flyControlDTO.getBoxSn());
        FlyControlCmd flyControlCmd = new FlyControlCmd(flyControlDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), flyControlCmd);
        this.sendMessage(ardDroneInfo.getServerId(), flyControlCmd);
        return true;
    }
@@ -438,7 +435,7 @@
    public Boolean flyPointControl(FlyPointControlDTO flyPointControlDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(flyPointControlDTO.getBoxSn());
        FlyPointControlCmd flyPointControlCmd = new FlyPointControlCmd(flyPointControlDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), flyPointControlCmd);
        this.sendMessage(ardDroneInfo.getServerId(), flyPointControlCmd);
        return true;
    }
@@ -450,7 +447,7 @@
    public Boolean flyPointControlCancel(FlyPointControlCancelDTO flyPointControlCancelDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(flyPointControlCancelDTO.getBoxSn());
        FlyPointControlCancelCmd flyPointControlCancelCmd = new FlyPointControlCancelCmd(flyPointControlCancelDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), flyPointControlCancelCmd);
        this.sendMessage(ardDroneInfo.getServerId(), flyPointControlCancelCmd);
        return true;
    }
@@ -462,7 +459,7 @@
    public Boolean emeragencyBrake(EmeragencyBrakeDTO emeragencyBrakeDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(emeragencyBrakeDTO.getBoxSn());
        EmergencyBrakeCmd emergencyBrakeCmd = new EmergencyBrakeCmd(emeragencyBrakeDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), emergencyBrakeCmd);
        this.sendMessage(ardDroneInfo.getServerId(), emergencyBrakeCmd);
        return true;
    }
@@ -497,7 +494,7 @@
    public void speakModeSwitch(SpeakModeSwitchDTO speakModeSwitchDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(speakModeSwitchDTO.getBoxSn());
        SpeakModeSwitchCmd speakModeSwitchCmd = new SpeakModeSwitchCmd(speakModeSwitchDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), speakModeSwitchCmd);
        this.sendMessage(ardDroneInfo.getServerId(), speakModeSwitchCmd);
    }
    /**
@@ -507,7 +504,7 @@
    public void textSpeak(TextSpeakDTO textSpeakDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(textSpeakDTO.getBoxSn());
        TextSpeakCmd textSpeakCmd = new TextSpeakCmd(textSpeakDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), textSpeakCmd);
        this.sendMessage(ardDroneInfo.getServerId(), textSpeakCmd);
    }
    /**
@@ -517,7 +514,7 @@
    public void realSpeak(RealSpeakDTO realSpeakDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(realSpeakDTO.getBoxSn());
        RealSpeakCmd realSpeakCmd = new RealSpeakCmd(realSpeakDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), realSpeakCmd);
        this.sendMessage(ardDroneInfo.getServerId(), realSpeakCmd);
    }
    /**
@@ -527,7 +524,7 @@
    public void recordSpeak(RecordSpeakDTO recordSpeakDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(recordSpeakDTO.getBoxSn());
        RecordSpeakCmd recordSpeakCmd = new RecordSpeakCmd(recordSpeakDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), recordSpeakCmd);
        this.sendMessage(ardDroneInfo.getServerId(), recordSpeakCmd);
    }
    /**
@@ -537,7 +534,7 @@
    public void volumeSetting(VolumeSettingDTO volumeSettingDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(volumeSettingDTO.getBoxSn());
        VolumeSettingCmd volumeSettingCmd = new VolumeSettingCmd(volumeSettingDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), volumeSettingCmd);
        this.sendMessage(ardDroneInfo.getServerId(), volumeSettingCmd);
    }
    /**
@@ -547,7 +544,7 @@
    public void loopSetting(LoopSettingDTO loopSettingDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(loopSettingDTO.getBoxSn());
        LoopSettingCmd loopSettingCmd = new LoopSettingCmd(loopSettingDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), loopSettingCmd);
        this.sendMessage(ardDroneInfo.getServerId(), loopSettingCmd);
    }
    /**
@@ -557,7 +554,7 @@
    public void stopSpeak(StopSpeakDTO stopSpeakDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(stopSpeakDTO.getBoxSn());
        StopSpeakCmd stopSpeakCmd = new StopSpeakCmd(stopSpeakDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), stopSpeakCmd);
        this.sendMessage(ardDroneInfo.getServerId(), stopSpeakCmd);
    }
    /**
@@ -568,7 +565,7 @@
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(wayLineUploadDTO.getBoxSn());
        wayLineUploadDTO.setWayLineData(this.CreatePlanLineData());//设置航线数据
        WayLineUploadCmd wayLineUploadCmd = new WayLineUploadCmd(wayLineUploadDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), wayLineUploadCmd);
        this.sendMessage(ardDroneInfo.getServerId(), wayLineUploadCmd);
    }
    //创建航线
@@ -613,7 +610,7 @@
    public void wayLineBegin(WayLineBeginDTO wayLineBeginDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(wayLineBeginDTO.getBoxSn());
        WayLineBeginCmd wayLineBeginCmd = new WayLineBeginCmd(wayLineBeginDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), wayLineBeginCmd);
        this.sendMessage(ardDroneInfo.getServerId(), wayLineBeginCmd);
    }
    /**
@@ -624,7 +621,7 @@
    public void wayLinePause(WayLinePauseDTO wayLinePauseDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(wayLinePauseDTO.getBoxSn());
        WayLinePauseCmd wayLinePauseCmd = new WayLinePauseCmd(wayLinePauseDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), wayLinePauseCmd);
        this.sendMessage(ardDroneInfo.getServerId(), wayLinePauseCmd);
    }
    /**
@@ -635,7 +632,7 @@
    public void wayLineResume(WayLineResumeDTO wayLineResumeDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(wayLineResumeDTO.getBoxSn());
        WayLineResumeCmd wayLineResumeCmd = new WayLineResumeCmd(wayLineResumeDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), wayLineResumeCmd);
        this.sendMessage(ardDroneInfo.getServerId(), wayLineResumeCmd);
    }
    /**
@@ -646,7 +643,7 @@
    public void wayLineEnd(WayLineEndDTO wayLineEndDTO) {
        ArdDroneInfo ardDroneInfo = ardDroneService.selectArdDroneByboxSn(wayLineEndDTO.getBoxSn());
        WayLineEndCmd wayLineEndCmd = new WayLineEndCmd(wayLineEndDTO);
        this.sendMessage(ardDroneInfo.getServerInfoId(), wayLineEndCmd);
        this.sendMessage(ardDroneInfo.getServerId(), wayLineEndCmd);
    }
    /**
@@ -834,25 +831,49 @@
    }
    /**
     * 根据boxSn获取六合盒子列表
     * @return List<BoxInfoReceiver>
     * 根据[服务器id]获取六合盒子列表
     */
    @Override
    public List<BoxInfoReceiver> getBoxSnToList(String id) {
        List<BoxInfoReceiver> lisbox = new ArrayList<>();
        try {
            lisbox = tyClient.getBoxList(id).getContent();
            return lisbox;
            List<BoxInfoReceiver> remoteBoxList = tyClient.getBoxList(id).getContent();
            List<ArdDroneInfo> existingDrones = getDroneLs(id);
            return existingDrones.isEmpty() ? remoteBoxList : filterBoxInfoReceivers(remoteBoxList, existingDrones);
        } catch (Exception e) {
            log.error("获取云盒列表失败: {}", id, e);
            return lisbox;
            log.error("获取云盒列表失败, 服务器id: {}", id, e);
            return Collections.emptyList(); // 返回不可变空列表,更安全
        }
    }
    /**
     * 根据[服务器id]查询无人机盒子列表
     */
    private List<ArdDroneInfo> getDroneLs(String serverId) {
        ArdDroneInfo query = new ArdDroneInfo();
        query.setServerId(serverId);
        return ardDroneService.selectArdDroneList(query);
    }
    /**
     * 过滤掉在ardDroneInfos中已存在的boxSn
     */
    public List<BoxInfoReceiver> filterBoxInfoReceivers(
            List<BoxInfoReceiver> boxInfoReceivers,
            List<ArdDroneInfo> ardDroneInfos) {
        Set<String> existingBoxSns = ardDroneInfos.stream()
                .map(ArdDroneInfo::getBoxSn)
                .filter(Objects::nonNull)
                .collect(Collectors.toSet());
        return boxInfoReceivers.stream()
                .filter(box -> box.getBoxSn() != null && !existingBoxSns.contains(box.getBoxSn()))
                .collect(Collectors.toList());
    }
    private List<BoxInfoReceiver> getBoxList(List<ArdServerInfo> ls) {
        return ls.stream()
                .flatMap(ardServerInfo -> {
                    try {
                        List<BoxInfoReceiver> boxes = tyClient.getBoxList(ardServerInfo.getId()).getContent();
                        return Optional.ofNullable(boxes).orElse(Collections.emptyList()).stream();
@@ -877,7 +898,6 @@
                errorCode,
                ErrorCodeEnum.getDescByCode(errorCode));
    }
    /**
     * 发送消息
ard-work/src/main/java/com/ard/work/util/UtilMethod.java
New file
@@ -0,0 +1,35 @@
package com.ard.work.util;
import com.alibaba.fastjson2.JSONObject;
import com.ard.system.authorize.service.AuthorizeService;
import javax.annotation.Resource;
/**
 * @author: 共方法类
 * @date: 2025/3/4
 * @description:
 */
public class UtilMethod {
    @Resource
    private AuthorizeService authorizeService;
    /**
     * 根据授权数量,验证授权信息是否合规
     */
    public void authorizationVerification(int ls){
        JSONObject data = authorizeService.getAuthorizationInfo();
        if ("normal".equals(data.get("Type"))){
            int droneNum = (int) data.get("droneNum");
            if (ls > droneNum){
                throw new RuntimeException("添加无人机数量超过当前授权数量!!!");
            }
        }else if ("expired".equals(data.get("Type"))){
            throw new RuntimeException("授权文件过期!!!");
        }else if ("mismatch".equals(data.get("Type"))){
            throw new RuntimeException("授权文件不匹配!!!");
        }
    }
}
ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml
@@ -21,18 +21,18 @@
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="serverInfoId"    column="server_info_id"    />
        <result property="serverId"    column="server_id"    />
        <!-- 关联 ArdServerInfo 对象 -->
        <association property="ardServerInfo"
                     javaType="com.ard.work.domain.entity.ArdServerInfo"
                     column="server_info_id"
                     column="server_id"
                     autoMapping="true"
                     select="selectArdServerInfo">
        </association>
    </resultMap>
    <select id="selectArdServerInfo" resultType="com.ard.work.domain.entity.ArdServerInfo">
        select * from ard_server_info where id = #{serverInfoId}
        select * from ard_server_info where id = #{serverId}
    </select>
    <sql id="selectArdDroneVo">
@@ -45,7 +45,7 @@
            video_server,
            video_port,
            last_task_id,
            server_info_id,
            server_id,
            user_id,
            dept_id
        from ard_drone_info
@@ -144,4 +144,44 @@
            #{id}
        </foreach>
    </delete>
    <insert id="insertArdDroneLs">
        insert into ard_drone_info(
            id,
            box_sn,
            box_name,
            box_version,
            start_time,
            on_line,
            video_server,
            video_port,
            last_task_id,
            server_id,
            user_id,
            dept_id,
            create_by,
            create_time,
            update_by,
            update_time,
            remark
        ) values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.id},
            #{item.boxSn}),
            #{item.boxName}),
            #{item.boxVersion}),
            #{item.startTime}),
            #{item.videoServer}),
            #{item.videoPort}),
            #{item.lastTaskId}),
            #{item.userId}),
            #{item.deptId}),
            #{item.createBy}),
            #{item.createTime}),
            #{item.updateBy}),
            #{item.updateTime}),
            #{item.remark})
        </foreach>
    </insert>
</mapper>