From ada0b243f16f12b5025253663eacfe53055f8310 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期三, 10 八月 2022 17:03:50 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java | 198 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 186 insertions(+), 12 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java
index 63dca4d..209edf0 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java
@@ -17,6 +17,7 @@
import com.sandu.ximon.admin.utils.response.VnnoxPlayerListResponse;
import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse;
import com.sandu.ximon.admin.utils.response.VnnoxResult;
+import com.sandu.ximon.admin.vo.NovaPushResultVO;
import com.sandu.ximon.dao.domain.LedPlayerEntity;
import com.sandu.ximon.dao.domain.LedPlayerInfoEntity;
import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity;
@@ -107,7 +108,12 @@
* @param screenStatus
* @return
*/
- public VnnoxResult screenStatusChange(List<LedPlayerEntity> playerList, Integer screenStatus) {
+ public Map<String, Object> screenStatusChange(List<LedPlayerEntity> playerList, Integer screenStatus) {
+ playerList.forEach(item -> {
+ if (item.getPlayerId().isEmpty() || item.getPlayerName().isEmpty() || item.getPlayerName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ });
VnnoxScreenStatusType type;
if (screenStatus.equals(0)) {
type = VnnoxScreenStatusType.CLOSE;
@@ -116,29 +122,114 @@
}
VnnoxResult vnnoxResult = vnnoxAPIUtil.screenStatus(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), type);
+
+
+ List<String> success = vnnoxResult.getSuccess();
+ List<String> fail = vnnoxResult.getFail();
+ //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+ Map<String, Object> result = new HashMap<>();
+ List<NovaPushResultVO> successList = new ArrayList<>();
+ List<NovaPushResultVO> faileList = new ArrayList<>();
+ List<String> finalSuccess = success;
+ List<String> finalFail = fail;
+ playerList.forEach(n -> {
+ if (finalSuccess.contains(n.getPlayerId())) {
+ NovaPushResultVO vo = new NovaPushResultVO();
+ vo.setName(n.getPlayerName());
+ vo.setPlayerId(n.getPlayerId());
+ successList.add(vo);
+ } else if (finalFail.contains(n.getPlayerId())) {
+ NovaPushResultVO vo = new NovaPushResultVO();
+ vo.setName(n.getPlayerName());
+ vo.setPlayerId(n.getPlayerId());
+ faileList.add(vo);
+ }
+ });
+
+ result.put("success", successList);
+ result.put("fail", faileList);
+
// 鏍规嵁灞忓箷鐘舵�佽皟鏁碦EDIS鏍囪瘑浣�
for (String playerId : vnnoxResult.getSuccess()) {
redisUtils.set(VnnoxConstant.REDIS_SCREEN_STATUS + playerId, screenStatus, VnnoxConstant.REDIS_MAX_SAVE_TIME);
}
- return vnnoxResult;
+ return result;
}
- public VnnoxResult volChange(List<LedPlayerEntity> playerList, Integer vol) {
+ public Map<String, Object> volChange(List<LedPlayerEntity> playerList, Integer vol) {
+ playerList.forEach(item -> {
+ if (item.getPlayerId().isEmpty() || item.getPlayerName().isEmpty() || item.getPlayerName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ });
VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), vol);
// 鏍规嵁闊抽噺璋冩暣REDIS鏍囪瘑浣�
for (String playerId : vnnoxResult.getSuccess()) {
redisUtils.set(VnnoxConstant.REDIS_VOL + playerId, vol, VnnoxConstant.REDIS_MAX_SAVE_TIME);
}
- return vnnoxResult;
+ List<String> success = vnnoxResult.getSuccess();
+ List<String> fail = vnnoxResult.getFail();
+ //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+ Map<String, Object> result = new HashMap<>();
+ List<NovaPushResultVO> successList = new ArrayList<>();
+ List<NovaPushResultVO> faileList = new ArrayList<>();
+ List<String> finalSuccess = success;
+ List<String> finalFail = fail;
+ playerList.forEach(n -> {
+ if (finalSuccess.contains(n.getPlayerId())) {
+ NovaPushResultVO vo = new NovaPushResultVO();
+ vo.setName(n.getPlayerName());
+ vo.setPlayerId(n.getPlayerId());
+ successList.add(vo);
+ } else if (finalFail.contains(n.getPlayerId())) {
+ NovaPushResultVO vo = new NovaPushResultVO();
+ vo.setName(n.getPlayerName());
+ vo.setPlayerId(n.getPlayerId());
+ faileList.add(vo);
+ }
+ });
+
+ result.put("success", successList);
+ result.put("fail", faileList);
+ return result;
}
- public VnnoxResult brightnessChange(List<LedPlayerEntity> playerList, Integer brightness) {
+ public Map<String, Object> brightnessChange(List<LedPlayerEntity> playerList, Integer brightness) {
+ playerList.forEach(item -> {
+ if (item.getPlayerId().isEmpty() || item.getPlayerName().isEmpty() || item.getPlayerName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ });
VnnoxResult vnnoxResult = vnnoxAPIUtil.brightnessChange(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), brightness);
// 鏍规嵁浜害璋冩暣REDIS鏍囪瘑浣�
for (String playerId : vnnoxResult.getSuccess()) {
redisUtils.set(VnnoxConstant.REDIS_BRIGHTNESS + playerId, brightness, VnnoxConstant.REDIS_MAX_SAVE_TIME);
}
- return vnnoxResult;
+ List<String> success = vnnoxResult.getSuccess();
+ List<String> fail = vnnoxResult.getFail();
+ //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+ Map<String, Object> result = new HashMap<>();
+ List<NovaPushResultVO> successList = new ArrayList<>();
+ List<NovaPushResultVO> faileList = new ArrayList<>();
+ List<String> finalSuccess = success;
+ List<String> finalFail = fail;
+ playerList.forEach(n -> {
+ if (finalSuccess.contains(n.getPlayerId())) {
+ NovaPushResultVO vo = new NovaPushResultVO();
+ vo.setName(n.getPlayerName());
+ vo.setPlayerId(n.getPlayerId());
+ successList.add(vo);
+ } else if (finalFail.contains(n.getPlayerId())) {
+ NovaPushResultVO vo = new NovaPushResultVO();
+ vo.setName(n.getPlayerName());
+ vo.setPlayerId(n.getPlayerId());
+ faileList.add(vo);
+ }
+ });
+
+ result.put("success", successList);
+ result.put("fail", faileList);
+ return result;
}
@@ -194,8 +285,37 @@
// }
//閲嶅惎
- public VnnoxResult reboot(List<String> playerList) {
- return vnnoxAPIUtil.reboot(playerList);
+ public Map<String, Object> reboot(List<NovaPushResultVO> nova) {
+ List<String> playerIds = new ArrayList<>();
+ nova.forEach(item -> {
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty() || item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ playerIds.add(item.getPlayerId());
+ });
+
+ VnnoxResult reboot = vnnoxAPIUtil.reboot(playerIds);
+
+
+ List<String> success = reboot.getSuccess();
+ List<String> fail = reboot.getFail();
+ //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+ Map<String, Object> result = new HashMap<>();
+ List<NovaPushResultVO> successList = new ArrayList<>();
+ List<NovaPushResultVO> faileList = new ArrayList<>();
+ List<String> finalSuccess = success;
+ List<String> finalFail = fail;
+ nova.forEach(n -> {
+ if (finalSuccess.contains(n.getPlayerId())) {
+ successList.add(n);
+ } else if (finalFail.contains(n.getPlayerId())) {
+ faileList.add(n);
+ }
+ });
+
+ result.put("success", successList);
+ result.put("fail", faileList);
+ return result;
}
/**
@@ -204,8 +324,35 @@
* @param
* @return
*/
- public VnnoxResult syncPlay(List<String> playerList, Integer option) {
- return vnnoxAPIUtil.syncPlay(playerList, option);
+ public Map<String, Object> syncPlay(List<NovaPushResultVO> nova, Integer option) {
+ List<String> playerIds = new ArrayList<>();
+ nova.forEach(item -> {
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty() || item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ playerIds.add(item.getPlayerId());
+ });
+ VnnoxResult vnnoxResult = vnnoxAPIUtil.syncPlay(playerIds, option);
+
+ List<String> success = vnnoxResult.getSuccess();
+ List<String> fail = vnnoxResult.getFail();
+ //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+ Map<String, Object> result = new HashMap<>();
+ List<NovaPushResultVO> successList = new ArrayList<>();
+ List<NovaPushResultVO> faileList = new ArrayList<>();
+ List<String> finalSuccess = success;
+ List<String> finalFail = fail;
+ nova.forEach(n -> {
+ if (finalSuccess.contains(n.getPlayerId())) {
+ successList.add(n);
+ } else if (finalFail.contains(n.getPlayerId())) {
+ faileList.add(n);
+ }
+ });
+
+ result.put("success", successList);
+ result.put("fail", faileList);
+ return result;
}
/**
@@ -214,8 +361,35 @@
* @param
* @return
*/
- public VnnoxResult ntpSync(List<String> playerList, boolean enable) {
- return vnnoxAPIUtil.ntpSync(playerList, enable);
+ public Map<String, Object> ntpSync(List<NovaPushResultVO> nova, boolean enable) {
+ List<String> playerIds = new ArrayList<>();
+ nova.forEach(item -> {
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty() || item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ playerIds.add(item.getPlayerId());
+ });
+ VnnoxResult vnnoxResult = vnnoxAPIUtil.ntpSync(playerIds, enable);
+
+ List<String> success = vnnoxResult.getSuccess();
+ List<String> fail = vnnoxResult.getFail();
+ //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+ Map<String, Object> result = new HashMap<>();
+ List<NovaPushResultVO> successList = new ArrayList<>();
+ List<NovaPushResultVO> faileList = new ArrayList<>();
+ List<String> finalSuccess = success;
+ List<String> finalFail = fail;
+ nova.forEach(n -> {
+ if (finalSuccess.contains(n.getPlayerId())) {
+ successList.add(n);
+ } else if (finalFail.contains(n.getPlayerId())) {
+ faileList.add(n);
+ }
+ });
+
+ result.put("success", successList);
+ result.put("fail", faileList);
+ return result;
}
--
Gitblit v1.9.3