From 03328152832ecc95572f75c03bd21934162d42d0 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期一, 19 九月 2022 15:20:28 +0800
Subject: [PATCH] changes

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java |  107 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 87 insertions(+), 20 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..5a1dfec 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
@@ -4,10 +4,6 @@
 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.security.SecurityUtils;
 import com.sandu.ximon.admin.utils.*;
@@ -16,6 +12,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.NovaAStateInfoVO;
 import com.sandu.ximon.admin.vo.NovaPushResultVO;
 import com.sandu.ximon.admin.vo.NovaScreenShorUrlVO;
 import com.sandu.ximon.admin.vo.NovaWeatherVO;
@@ -508,8 +505,7 @@
         List<String> temp = new ArrayList<>();
         for (LedPlayerEntity item : ledList) {
             String playerId = item.getPlayerId();
-            if (redisUtils.get(VnnoxConstant.REDIS_VOL + playerId) == null
-                    || redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId) == null) {
+            if (redisUtils.get(VnnoxConstant.REDIS_VOL + playerId) == null || redisUtils.get(VnnoxConstant.REDIS_BRIGHTNESS + playerId) == null) {
                 temp.add(item.getPlayerId());
             }
         }
@@ -609,19 +605,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 +638,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 +653,75 @@
 
     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":
+                    if ("CLOSE".equals(screenPowerStatus)) {
+                        novaAStateInfoVO.setScreenPowerStatus("0");
+                    } else {
+                        novaAStateInfoVO.setScreenPowerStatus("1");
+                    }
+                    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);
+                }
+        );
+
+    }
 }

--
Gitblit v1.9.3