From 97a90aef9561782d60546c7a2a98cb75b2fc34f4 Mon Sep 17 00:00:00 2001
From: LHN <31457034@qq.com>
Date: 星期四, 20 十月 2022 12:01:29 +0800
Subject: [PATCH] changes

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java |  169 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 84 insertions(+), 85 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
index 8e258bb..1eeb4e2 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PlayPlanNvService.java
@@ -435,91 +435,90 @@
                 && !Objects.equals(ledProgram.getUserId(), SecurityUtils.getUserId())) {
             throw new BusinessException("璇蜂笉瑕佹搷浣滃叾浠栦汉鐨勮妭鐩�");
         }
-        return null;
-//        String pages = ledProgram.getPages();
-//
-//
-//        List<String> success = new ArrayList<>();
-//        List<String> fail = new ArrayList<>();
-//        //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
-//        Map<String, Object> result = new HashMap<>();
-//        List<NovaPushResultVO> successList = new ArrayList<>();
-//        List<NovaPushResultVO> faileList = new ArrayList<>();
-//
-//
-//        List<List<String>> split = CollectionUtil.split(nova.stream().map(NovaPushResultVO::getPlayerId).collect(Collectors.toList()), 100);
-//
-//        for (List<String> playerIds : split) {
-//            PlayerProgram program = new PlayerProgram();
-//            List<PlayerPage> programDtos = JSON.parseArray(pages, PlayerPage.class);
-//            programDtos.forEach(
-//                    programDto -> {
-//                        programDto.getWidgets().forEach(
-//                                widget -> {
-//                                    if (PlayerWidgetType.PICTURE.equals(widget.getType()) || PlayerWidgetType.VIDEO.equals(widget.getType())) {
-//                                        String url = widget.getUrl();
-//                                        LEDProgramFile one = fileService.getOne(Wrappers.lambdaQuery(LEDProgramFile.class).eq(LEDProgramFile::getFileUrl, url));
-//                                        if (one == null) {
-//                                            throw new BusinessException("鑺傜洰鏂囦欢宸插け鏁�");
-//                                        }
-//                                        widget.setMd5(one.getMd5());
-//                                        widget.setSize(Long.parseLong(one.getSize()));
-//                                    }
-//                                }
-//                        );
-//                    }
-//            );
-//            program.setPlayerIds(playerIds);
-//            //鑾峰彇鑺傜洰瀹炰綋
-//            program.setPages(programDtos);
-//
-//            program.setNoticeUrl(VnnoxConstant.NOTIFY_URL);
-//            VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.pushProgram(program);
-//
-//            if (vnnoxResultResponse == null || vnnoxResultResponse.getData() == null) {
-//                throw new BusinessException("鎺ㄩ�佸け璐�");
-//            }
-//
-//
-//            if (vnnoxResultResponse.getData() != null) {
-//                success = vnnoxResultResponse.getData().getSuccess();
-//                fail = vnnoxResultResponse.getData().getFail();
-//            }
-//
-//            List<String> finalSuccess = success;
-//            List<String> finalFail = fail;
-//            nova.forEach(n -> {
-//                if (finalSuccess.contains(n.getPlayerId())) {
-//                    successList.add(n);
-//                } else if (finalFail.contains(n.getPlayerId())) {
-//                    faileList.add(n);
-//                }
-//            });
-//        }
-//
-//        result.put("success", successList);
-//        result.put("fail", faileList);
-//
-//        /**
-//         * 璇虹摝鎺ㄩ�佽妭鐩棩蹇楄褰曞紑濮�
-//         */
-//        List<LedPlayerEntity> list = SpringContextHolder.getBean(LedPlayerEntityService.class)
-//                .list(Wrappers.lambdaQuery(LedPlayerEntity.class).in(LedPlayerEntity::getId, nova.stream().map(NovaPushResultVO::getPlayerId).toArray()));
-//        List<String> listCode = new ArrayList<>();
-//        for (LedPlayerEntity temp : list) {
-//            listCode.add(temp.getSn());
-//        }
-//
-//        String content = "{鑺傜洰ID锛�" + pid
-//                + "锛� 鑺傜洰鍚嶇О锛�" + ledProgram.getName()
-//                + "}," + " 鎺ㄩ�佺粨鏋滐細" + result
-//                + " }";
-//        StoreOperationRecordsUtils.storeOperationData(listCode, null, "璇虹摝鎺ㄩ�佽妭鐩�", content);
-//        /**
-//         * 璇虹摝鎺ㄩ�佽妭鐩棩蹇楄褰曠粨鏉�
-//         */
-//
-//        return result;
+        String pages = ledProgram.getPages();
+
+
+        List<String> success = new ArrayList<>();
+        List<String> fail = new ArrayList<>();
+        //鎷兼帴鎴愬姛澶辫触鐨勭粨鏋�
+        Map<String, Object> result = new HashMap<>();
+        List<NovaPushResultVO> successList = new ArrayList<>();
+        List<NovaPushResultVO> faileList = new ArrayList<>();
+
+
+        List<List<String>> split = CollectionUtil.split(nova.stream().map(NovaPushResultVO::getPlayerId).collect(Collectors.toList()), 100);
+
+        for (List<String> playerIds : split) {
+            PlayerProgram program = new PlayerProgram();
+            List<PlayerPage> programDtos = JSON.parseArray(pages, PlayerPage.class);
+            programDtos.forEach(
+                    programDto -> {
+                        programDto.getWidgets().forEach(
+                                widget -> {
+                                    if (PlayerWidgetType.PICTURE.equals(widget.getType()) || PlayerWidgetType.VIDEO.equals(widget.getType())) {
+                                        String url = widget.getUrl();
+                                        LEDProgramFile one = fileService.getOne(Wrappers.lambdaQuery(LEDProgramFile.class).eq(LEDProgramFile::getFileUrl, url));
+                                        if (one == null) {
+                                            throw new BusinessException("鑺傜洰鏂囦欢宸插け鏁�");
+                                        }
+                                        widget.setMd5(one.getMd5());
+                                        widget.setSize(Long.parseLong(one.getSize()));
+                                    }
+                                }
+                        );
+                    }
+            );
+            program.setPlayerIds(playerIds);
+            //鑾峰彇鑺傜洰瀹炰綋
+            program.setPages(programDtos);
+
+            program.setNoticeUrl(VnnoxConstant.NOTIFY_URL);
+            VnnoxResultResponse vnnoxResultResponse = vnnoxProgramAPIUtil.pushProgram(program);
+
+            if (vnnoxResultResponse == null || vnnoxResultResponse.getData() == null) {
+                throw new BusinessException("鎺ㄩ�佸け璐�");
+            }
+
+
+            if (vnnoxResultResponse.getData() != null) {
+                success = vnnoxResultResponse.getData().getSuccess();
+                fail = vnnoxResultResponse.getData().getFail();
+            }
+
+            List<String> finalSuccess = success;
+            List<String> finalFail = fail;
+            nova.forEach(n -> {
+                if (finalSuccess.contains(n.getPlayerId())) {
+                    successList.add(n);
+                } else if (finalFail.contains(n.getPlayerId())) {
+                    faileList.add(n);
+                }
+            });
+        }
+
+        result.put("success", successList);
+        result.put("fail", faileList);
+
+        /**
+         * 璇虹摝鎺ㄩ�佽妭鐩棩蹇楄褰曞紑濮�
+         */
+        List<LedPlayerEntity> list = SpringContextHolder.getBean(LedPlayerEntityService.class)
+                .list(Wrappers.lambdaQuery(LedPlayerEntity.class).in(LedPlayerEntity::getId, nova.stream().map(NovaPushResultVO::getPlayerId).toArray()));
+        List<String> listCode = new ArrayList<>();
+        for (LedPlayerEntity temp : list) {
+            listCode.add(temp.getSn());
+        }
+
+        String content = "{鑺傜洰ID锛�" + pid
+                + "锛� 鑺傜洰鍚嶇О锛�" + ledProgram.getName()
+                + "}," + " 鎺ㄩ�佺粨鏋滐細" + result
+                + " }";
+        StoreOperationRecordsUtils.storeOperationData(listCode, null, "璇虹摝鎺ㄩ�佽妭鐩�", content);
+        /**
+         * 璇虹摝鎺ㄩ�佽妭鐩棩蹇楄褰曠粨鏉�
+         */
+
+        return result;
     }
 
 

--
Gitblit v1.9.3