From 56062b177a71cf781f8e480c0ec6f5e8394e7a8e Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Thu, 16 Oct 2025 14:51:29 +0800
Subject: [PATCH] 1.修改服务器状态接口优化。 2.无人机盒子对象增加盒子别名字段。 3.动态修改服务状态。
---
ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java | 128 ++++++++++++++++++++++++------------------
1 files changed, 74 insertions(+), 54 deletions(-)
diff --git a/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java b/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
index 2ec580b..af0f6ca 100644
--- a/ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
+++ b/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));
}
-
/**
* 发送消息
--
Gitblit v1.9.3