From 9330e9b0e4e70151d36084ecb5695b818cfda2db Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期二, 19 四月 2022 16:07:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java | 73 +++++++++++++++++++++++++++++++++---
1 files changed, 66 insertions(+), 7 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 5a7ff63..f74e9f5 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
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
+import com.sandu.common.execption.BusinessException;
import com.sandu.ximon.admin.config.VnnoxConstant;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
@@ -8,6 +9,7 @@
import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse;
import com.sandu.ximon.admin.utils.response.VnnoxResult;
import com.sandu.ximon.dao.domain.LedPlayerEntity;
+import com.sandu.ximon.dao.domain.LedPlayerInfoEntity;
import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@@ -29,11 +31,11 @@
@AllArgsConstructor
public class VnnoxService {
- // @Autowired
+ // @Autowired
private VnnoxAPIUtil vnnoxAPIUtil;
- // @Autowired
+ // @Autowired
private RedisUtils redisUtils;
- // @Autowired
+ // @Autowired
private LedPlayerEntityService ledPlayerEntityService;
/**
@@ -43,7 +45,7 @@
* @return
*/
@Transactional(rollbackFor = Exception.class)
- public LedV2RegisterResultEntity validateSN(String name,String sn) throws URISyntaxException {
+ public LedV2RegisterResultEntity validateSN(String name, String sn) throws URISyntaxException {
LedV2RegisterResultEntity ledV2RegisterResultEntity = new LedV2RegisterResultEntity();
// 鍒ゆ柇鏁版嵁搴撴槸鍚﹀瓨鍦紝鑻ヤ笉瀛樺湪锛屽垽鏂槸鍚﹀凡缁忔敞鍐屽埌Vnnox鏈嶅姟鍣�
@@ -60,13 +62,13 @@
Integer limit = 100;
List<VnnoxPlayerResponse> playerList;
// 鑾峰彇Vnnox鏈嶅姟鍣ㄥ垪琛�
- VnnoxPlayerListResponse response = vnnoxAPIUtil.getPlayerList(limit, page,name);
+ VnnoxPlayerListResponse response = vnnoxAPIUtil.getPlayerList(limit, page, name);
playerList = response.getRows();
Integer total = response.getTotal() - limit;
while (total > 0) {
page = page + 1;
total = total - limit;
- response = vnnoxAPIUtil.getPlayerList(limit, page,name);
+ response = vnnoxAPIUtil.getPlayerList(limit, page, name);
playerList.addAll(response.getRows());
}
ledPlayerEntity = new LedPlayerEntity();
@@ -140,6 +142,7 @@
}
+ //鎴睆
public Map<String, String> getScreenShotUrl(Integer id) {
Map<String, String> map = new HashMap();
@@ -181,7 +184,7 @@
return map;
}
-
+ //閲嶅惎
public VnnoxResult reboot(List<LedPlayerEntity> playerList) {
return vnnoxAPIUtil.reboot(
playerList.stream().map(
@@ -190,4 +193,60 @@
);
}
+ public boolean updateDataName(Long id, String name) {
+ LedPlayerEntity byId = ledPlayerEntityService.getById(id);
+ if (byId == null) {
+ throw new BusinessException("鏈壘鍒拌璁惧");
+ }
+ LedPlayerEntity led = new LedPlayerEntity();
+ led.setId(id);
+ led.setName(name);
+ return ledPlayerEntityService.updateById(led);
+ }
+
+ /**
+ * 鑾峰彇缂撳瓨鏁版嵁
+ *
+ * @param list
+ * @return
+ */
+ public List<LedPlayerEntity> setCacheInfo(List<LedPlayerEntity> list) {
+ for (LedPlayerEntity playerEntity : list) {
+ String playerId = playerEntity.getPlayerId();
+ LedPlayerInfoEntity cache = new LedPlayerInfoEntity();
+ // 璁剧疆灞忓箷鐘舵��
+ String result = redisUtils.get(VnnoxConstant.REDIS_SCREEN_STATUS + playerId);
+ Integer screenStatus = 1;
+ if (null != result) {
+ screenStatus = Integer.parseInt(result);
+ }
+ cache.setScreenStatus(screenStatus);
+ // 璁剧疆灞忓箷闊抽噺
+ result = redisUtils.get(VnnoxConstant.REDIS_VOL + playerId);
+ Integer vol = 0;
+ if (null != result) {
+ vol = Integer.parseInt(result);
+ }
+ cache.setVol(vol);
+ // 璁剧疆灞忓箷浜害
+ result = redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId);
+ Integer brightness = 0;
+ if (null != result) {
+ brightness = Integer.parseInt(result);
+ }
+ cache.setBrightness(brightness);
+
+ // 璁剧疆缂╃暐鍥捐闂矾寰�
+ result = redisUtils.get(VnnoxConstant.REDIS_SCREEN_SHOT + playerId);
+ System.out.println(playerId + "鐨勮矾寰勭粨鏋�:-----------------------------" + result);
+ if (null != result) {
+ playerEntity.setScreenShotUrl(result);
+ } else {
+ playerEntity.setScreenShotUrl("");
+ }
+
+ playerEntity.setPlayerInfo(cache);
+ }
+ return list;
+ }
}
--
Gitblit v1.9.3