From 981055073317b3b07534d5ac504a4e470e87f3d8 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期三, 30 三月 2022 11:04:22 +0800
Subject: [PATCH] 摄像头
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java | 76 ++++++++++++++++++++++++++++++++++---
1 files changed, 69 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..c861d80 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,6 +1,9 @@
package com.sandu.ximon.admin.service;
+import com.sandu.common.execption.BusinessException;
+import com.sandu.common.log.Log;
import com.sandu.ximon.admin.config.VnnoxConstant;
+import com.sandu.ximon.admin.utils.LogUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
import com.sandu.ximon.admin.utils.request.VnnoxScreenStatusType;
@@ -8,6 +11,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 +33,11 @@
@AllArgsConstructor
public class VnnoxService {
- // @Autowired
+ // @Autowired
private VnnoxAPIUtil vnnoxAPIUtil;
- // @Autowired
+ // @Autowired
private RedisUtils redisUtils;
- // @Autowired
+ // @Autowired
private LedPlayerEntityService ledPlayerEntityService;
/**
@@ -43,7 +47,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 +64,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 +144,7 @@
}
+ //鎴睆
public Map<String, String> getScreenShotUrl(Integer id) {
Map<String, String> map = new HashMap();
@@ -181,7 +186,7 @@
return map;
}
-
+ //閲嶅惎
public VnnoxResult reboot(List<LedPlayerEntity> playerList) {
return vnnoxAPIUtil.reboot(
playerList.stream().map(
@@ -190,4 +195,61 @@
);
}
+ 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