From 4e91adbb41c89688fe5b0ef03807cfe748a7d59d Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期四, 26 五月 2022 17:17:02 +0800
Subject: [PATCH] 角色

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
index c71c961..7b30ecd 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
@@ -75,7 +75,9 @@
                             sourcePro -> {
                                 long fileId = Long.parseLong(sourcePro.getId());
                                 LedSFile file = xiXunFileService.getById(fileId);
-                                sourcePro.setUrl(file.getFileUrl());
+                                String fileUrl = file.getFileUrl();
+                                String[] split = fileUrl.split("/");
+                                sourcePro.setId(split[split.length - 1]);
                                 sourcePro.setMd5(file.getMd5());
                             }
                     );
@@ -166,7 +168,9 @@
      * @param programId
      * @param lightemitIds
      */
-    public void videoXixunPlayer(long programId, List<Long> lightemitIds) {
+    public List<Map> videoXixunPlayer(long programId, List<Long> lightemitIds) {
+        //璁板綍鎿嶄綔缁撴灉
+        List<Map> mapList = new ArrayList<>();
 
         ProgramPro pro = new ProgramPro();
         ItemPro items = new ItemPro();
@@ -199,7 +203,7 @@
 //        //杩欓噷鏄笅鏂圭殑post鍥炶皟鍦板潃锛岄渶瑕佷慨鏀笽P鍦板潃
         command.setNotificationURL("");
         //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご
-        command.setPreDownloadURL("");
+        command.setPreDownloadURL("https://ximonsmart.oss-cn-shanghai.aliyuncs.com/");
         command.setTask(taskPro);
         xixun.set_id(UUID.randomUUID().toString());
         xixun.setCommand(command);
@@ -213,11 +217,29 @@
         Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(lightemitIds);
 
         if (poleLightemitEntities != null) {
+            Map map;
             for (PoleLightemitEntity entity : poleLightemitEntities) {
-                lightemitUtils.clear(entity.getLightemitControlCode());
-                poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
-                String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
-                LogUtils.error("缁撴灉:" + post);
+                map = new LinkedHashMap();
+                String clearResult = lightemitUtils.clear(entity.getLightemitControlCode());
+                if (clearResult.contains("does not exist")) {
+                    map.put("LightemitId", entity.getLightemitId());
+                    map.put("Result", "澶辫触");
+                    mapList.add(map);
+                } else {
+                    poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
+                    String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
+                    //{"_type":"success","_id":"ce8dc3ff-dc88-43b7-8f55-60abd8700f1a","timestamp":1653555160535}
+                    if (post.startsWith("{") && post.endsWith("}") && post.contains("_type\":\"success")) {
+                        map.put("LightemitId", entity.getLightemitId());
+                        map.put("Result", "鎴愬姛");
+                        mapList.add(map);
+                    } else {
+                        map.put("LightemitId", entity.getLightemitId());
+                        map.put("Result", "澶辫触");
+                        mapList.add(map);
+                    }
+                    LogUtils.error("缁撴灉:" + post);
+                }
             }
         }
 
@@ -237,6 +259,8 @@
         /**
          * 鐔欐睕鑺傜洰鎺ㄩ�佹棩蹇楄褰曠粨鏉�
          */
+
+        return mapList;
     }
 
 

--
Gitblit v1.9.3