From dda268997ca8f8a364f7c19b45d7a43a50a98efe Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 25 十月 2022 18:00:11 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java | 144 ++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 120 insertions(+), 24 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 c845b76..efeefdf 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,14 +1,12 @@
package com.sandu.ximon.admin.service;
import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSON;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.config.VnnoxConstant;
-import com.sandu.ximon.admin.dto.nova.AirDataProgram;
-import com.sandu.ximon.admin.dto.nova.PlayerLayout;
-import com.sandu.ximon.admin.dto.nova.PlayerPage;
-import com.sandu.ximon.admin.dto.nova.PlayerWidget;
import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame;
+import com.sandu.ximon.admin.redis.DeviceRedisKey;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.*;
import com.sandu.ximon.admin.utils.request.VnnoxScreenStatusType;
@@ -16,9 +14,7 @@
import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse;
import com.sandu.ximon.admin.utils.response.VnnoxResult;
import com.sandu.ximon.admin.utils.response.VnnoxResultResponse;
-import com.sandu.ximon.admin.vo.NovaPushResultVO;
-import com.sandu.ximon.admin.vo.NovaScreenShorUrlVO;
-import com.sandu.ximon.admin.vo.NovaWeatherVO;
+import com.sandu.ximon.admin.vo.*;
import com.sandu.ximon.dao.domain.LedPlayerEntity;
import com.sandu.ximon.dao.domain.LedPlayerInfoEntity;
import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity;
@@ -509,7 +505,8 @@
for (LedPlayerEntity item : ledList) {
String playerId = item.getPlayerId();
if (redisUtils.get(VnnoxConstant.REDIS_VOL + playerId) == null
- || redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId) == null) {
+ || redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId) == null
+ || redisUtils.get(VnnoxConstant.REDIS_SCREEN_STATUS + playerId) == null) {
temp.add(item.getPlayerId());
}
}
@@ -526,9 +523,9 @@
for (LedPlayerEntity playerEntity : list) {
String playerId = playerEntity.getPlayerId();
LedPlayerInfoEntity cache = new LedPlayerInfoEntity();
- // 璁剧疆灞忓箷鐘舵��
+ // 璁剧疆灞忓箷鐘舵�� 鏇存柊鐘舵�佷箣鍚庤繕鎷夸笉鍒版暟鎹鏄庤澶囨湁闂鎴栦笉鍦ㄧ嚎 璁剧疆榛樿涓洪粦灞�
String result = redisUtils.get(VnnoxConstant.REDIS_SCREEN_STATUS + playerId);
- Integer screenStatus = 1;
+ Integer screenStatus = 0;
if (null != result) {
screenStatus = Integer.parseInt(result);
}
@@ -609,19 +606,17 @@
List<NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO> lines = new ArrayList<>();
- list.forEach(
- txt -> {
- List<NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO.TextAttributesDTO> textAttributes = new ArrayList<>();
+ list.forEach(txt -> {
+ List<NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO.TextAttributesDTO> textAttributes = new ArrayList<>();
- NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO linesDTO = new NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO();
- NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO.TextAttributesDTO textAttributesDTO = new NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO.TextAttributesDTO();
- textAttributesDTO.setContent(txt);
- textAttributes.add(textAttributesDTO);
- System.out.println(txt + "鏂囨湰鍐呭");
- linesDTO.setTextAttributes(textAttributes);
- lines.add(linesDTO);
- }
- );
+ NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO linesDTO = new NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO();
+ NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO.TextAttributesDTO textAttributesDTO = new NovaWeatherVO.PageDTO.WidgetsDTO.LinesDTO.TextAttributesDTO();
+ textAttributesDTO.setContent(txt);
+ textAttributes.add(textAttributesDTO);
+ System.out.println(txt + "鏂囨湰鍐呭");
+ linesDTO.setTextAttributes(textAttributes);
+ lines.add(linesDTO);
+ });
NovaWeatherVO.PageDTO.WidgetsDTO widgetsDTO = new NovaWeatherVO.PageDTO.WidgetsDTO();
NovaWeatherVO.PageDTO.WidgetsDTO.ScrollAttributeDTO scrollAttribute = new NovaWeatherVO.PageDTO.WidgetsDTO.ScrollAttributeDTO();
@@ -644,7 +639,12 @@
* 鏇存柊璇虹摝灞忓箷鍒嗚鲸鐜�
*/
public void saveInfo() {
- List<LedPlayerEntity> list = vnnoxAPIUtil.saveCurrentInfo(ledPlayerEntityService.list());
+ List<LedPlayerEntity> all = ledPlayerEntityService.list();
+ List<List<LedPlayerEntity>> split = CollectionUtil.split(all, 100);
+ List<LedPlayerEntity> list = new ArrayList<>();
+ for (List<LedPlayerEntity> ledList : split) {
+ list.addAll(vnnoxAPIUtil.saveCurrentInfo(ledList));
+ }
boolean b = SpringContextHolder.getBean(LedPlayerEntityService.class).updateBatchById(list);
if (b) {
LogUtils.error("鏇存柊璇虹摝灞忓箷鍒嗚鲸鐜囨垚鍔�");
@@ -654,7 +654,103 @@
public void asyncStatus(List<String> playerIds) {
VnnoxResultResponse vnnoxResultResponse = vnnoxAPIUtil.asyncStatus(playerIds);
-
}
+ /**
+ * 鑾峰彇璇虹摝灞忓箷淇℃伅
+ *
+ * @param stateValue
+ * @param playIdList
+ * @return
+ */
+ public List<NovaAStateInfoVO> getInfo(String stateValue, List<String> playIdList) {
+ List<NovaAStateInfoVO> list = new ArrayList<>();
+ NovaAStateInfoVO novaAStateInfoVO;
+ for (String playId : playIdList) {
+ String volumeValue = RedisUtils.getBean().get(VnnoxConstant.REDIS_VOL + playId);
+ String brightnessValue = RedisUtils.getBean().get(VnnoxConstant.REDIS_BRIGHTNESS + playId);
+ String videoSourceValue = RedisUtils.getBean().get(VnnoxConstant.VIDEO_SOURCE_VALUE + playId);
+ String timezoneValue = RedisUtils.getBean().get(VnnoxConstant.TIME_VALUE_TIMEZONE + playId);
+ String timeValue = RedisUtils.getBean().get(VnnoxConstant.TIME_VALUE_TIME + playId);
+ String screenPowerStatus = RedisUtils.getBean().get(VnnoxConstant.REDIS_SCREEN_STATUS + playId);
+ String syncPlayStatus = RedisUtils.getBean().get(VnnoxConstant.SYNC_PLAY_STATUS + playId);
+ novaAStateInfoVO = new NovaAStateInfoVO();
+ novaAStateInfoVO.setPlayerId(playId);
+ switch (stateValue) {
+ case "all":
+ novaAStateInfoVO.setVolumeValue(volumeValue);
+ novaAStateInfoVO.setBrightnessValue(brightnessValue);
+ novaAStateInfoVO.setVideoSourceValue(videoSourceValue);
+ novaAStateInfoVO.setTimezoneValue(timezoneValue);
+ novaAStateInfoVO.setTimeValue(timeValue);
+ novaAStateInfoVO.setScreenPowerStatus(screenPowerStatus);
+ novaAStateInfoVO.setSyncPlayStatus(syncPlayStatus);
+ break;
+ case "volumeValue":
+ novaAStateInfoVO.setVolumeValue(volumeValue);
+ break;
+ case "brightnessValue":
+ novaAStateInfoVO.setBrightnessValue(brightnessValue);
+ break;
+ case "videoSourceValue":
+ novaAStateInfoVO.setVideoSourceValue(videoSourceValue);
+ break;
+ case "timeValue":
+ novaAStateInfoVO.setTimezoneValue(timezoneValue);
+ novaAStateInfoVO.setTimeValue(timeValue);
+ break;
+ case "screenPowerStatus":
+ novaAStateInfoVO.setScreenPowerStatus(screenPowerStatus);
+ break;
+ case "syncPlayStatus":
+ novaAStateInfoVO.setSyncPlayStatus(syncPlayStatus);
+ break;
+ default:
+ }
+ list.add(novaAStateInfoVO);
+ }
+ return list;
+ }
+
+ public void getAsyncStatus(List<String> playerIdList, String stateValue) {
+ List<List<String>> split = CollectionUtil.split(playerIdList, 100);
+ split.forEach(
+ playerIds -> {
+ vnnoxAPIUtil.getAsyncStatus(playerIdList, stateValue);
+ }
+ );
+ }
+
+
+ /**
+ * 鍚慠edis涓瓨鍏ヨ澶囩姸鎬�
+ */
+ public void setCacheData() {
+
+ List<List<LedPlayerEntity>> split = CollectionUtil.split(ledPlayerEntityService.list(), 100);
+ List<LedPlayerEntity> ledList = new ArrayList<>();
+ split.forEach(
+ list -> {
+ List<LedPlayerEntity> ledPlayerEntities = vnnoxAPIUtil.syncCurrentInfo(list);
+ ledList.addAll(ledPlayerEntities);
+ }
+ );
+
+ ledList.forEach(
+ device -> {
+ RedisDeviceStatus deviceStatus = new RedisDeviceStatus();
+ deviceStatus.setDeviceId(device.getPlayerId());
+ if (device.getOnlineStatus() == 0) {
+ deviceStatus.setStatus(1);
+ } else if (device.getOnlineStatus() == 1) {
+ deviceStatus.setStatus(0);
+ } else {
+ deviceStatus.setStatus(1);
+ }
+ redisUtils.set(DeviceRedisKey.NOVA + device.getPlayerId(), JSON.toJSONString(deviceStatus));
+// redisUtils.delete(DeviceRedisKey.IP_BROADCAST + device.getId());
+ }
+ );
+
+ }
}
--
Gitblit v1.9.3