From c8faa15c88cff7b5d75afcb6469c5b1b7e1a670f Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期四, 18 八月 2022 17:31:59 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java | 90 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 78 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 209edf0..a4e905d 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
@@ -110,7 +110,10 @@
*/
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) {
+ if (item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) {
throw new BusinessException("playerId鎴杙layerName涓虹┖");
}
});
@@ -135,12 +138,12 @@
playerList.forEach(n -> {
if (finalSuccess.contains(n.getPlayerId())) {
NovaPushResultVO vo = new NovaPushResultVO();
- vo.setName(n.getPlayerName());
+ vo.setName(n.getName());
vo.setPlayerId(n.getPlayerId());
successList.add(vo);
} else if (finalFail.contains(n.getPlayerId())) {
NovaPushResultVO vo = new NovaPushResultVO();
- vo.setName(n.getPlayerName());
+ vo.setName(n.getName());
vo.setPlayerId(n.getPlayerId());
faileList.add(vo);
}
@@ -158,7 +161,10 @@
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) {
+ if (item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) {
throw new BusinessException("playerId鎴杙layerName涓虹┖");
}
});
@@ -178,12 +184,12 @@
playerList.forEach(n -> {
if (finalSuccess.contains(n.getPlayerId())) {
NovaPushResultVO vo = new NovaPushResultVO();
- vo.setName(n.getPlayerName());
+ vo.setName(n.getName());
vo.setPlayerId(n.getPlayerId());
successList.add(vo);
} else if (finalFail.contains(n.getPlayerId())) {
NovaPushResultVO vo = new NovaPushResultVO();
- vo.setName(n.getPlayerName());
+ vo.setName(n.getName());
vo.setPlayerId(n.getPlayerId());
faileList.add(vo);
}
@@ -196,7 +202,10 @@
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) {
+ if (item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) {
throw new BusinessException("playerId鎴杙layerName涓虹┖");
}
});
@@ -216,12 +225,12 @@
playerList.forEach(n -> {
if (finalSuccess.contains(n.getPlayerId())) {
NovaPushResultVO vo = new NovaPushResultVO();
- vo.setName(n.getPlayerName());
+ vo.setName(n.getName());
vo.setPlayerId(n.getPlayerId());
successList.add(vo);
} else if (finalFail.contains(n.getPlayerId())) {
NovaPushResultVO vo = new NovaPushResultVO();
- vo.setName(n.getPlayerName());
+ vo.setName(n.getName());
vo.setPlayerId(n.getPlayerId());
faileList.add(vo);
}
@@ -275,6 +284,54 @@
return map;
}
+
+ // 鎵归噺鎴睆
+ public Map<String, String> getScreenShotUrl(List<String> playerIds) {
+ Map<String, String> map = new HashMap();
+
+ playerIds.forEach(
+ playId->{
+ try {
+ redisUtils.delete(VnnoxConstant.REDIS_SCREEN_SHOT + playId);
+ } catch (Exception e) {
+
+ }
+ }
+ );
+
+ VnnoxResult vnnoxResult = vnnoxAPIUtil.screenShot(playerIds);
+
+ if (null == vnnoxResult) {
+ map.put("code", "500");
+ map.put("msg", "璁惧宸蹭笅绾�");
+ return map;
+ }
+
+ if (vnnoxResult.getSuccess().size() == 0) {
+ map.put("code", "500");
+ map.put("msg", "鑾峰彇缂╃暐鍥惧け璐�!");
+ return map;
+ }
+ String url = null;
+ Integer checkCount = 0;
+ while (checkCount < 10) {
+ url = redisUtils.get(VnnoxConstant.REDIS_SCREEN_SHOT + playerIds.get(0));
+ if (null != url) {
+ break;
+ }
+ try {
+ Thread.sleep(2000);
+ checkCount = checkCount + 1;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ map.put("url", url);
+ map.put("code", "200");
+ return map;
+ }
+
+
// //閲嶅惎
// public VnnoxResult reboot(List<LedPlayerEntity> playerList) {
// return vnnoxAPIUtil.reboot(
@@ -288,7 +345,10 @@
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) {
+ if (item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) {
throw new BusinessException("playerId鎴杙layerName涓虹┖");
}
playerIds.add(item.getPlayerId());
@@ -327,7 +387,10 @@
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) {
+ if (item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) {
throw new BusinessException("playerId鎴杙layerName涓虹┖");
}
playerIds.add(item.getPlayerId());
@@ -364,7 +427,10 @@
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) {
+ if (item.getName() == null || item.getPlayerId() == null) {
+ throw new BusinessException("playerId鎴杙layerName涓虹┖");
+ }
+ if (item.getPlayerId().isEmpty() || item.getName().isEmpty()) {
throw new BusinessException("playerId鎴杙layerName涓虹┖");
}
playerIds.add(item.getPlayerId());
--
Gitblit v1.9.3