From 93c4a7420a87b7d7e2bbeeef8e6ccff0a8909a9d Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 06 五月 2022 11:42:06 +0800
Subject: [PATCH] Changes

---
 /dev/null                                                                         |   15 ---
 ximon-admin/src/main/java/com/sandu/ximon/admin/config/ServerConfig.java          |   37 -------
 ximon-admin/src/main/resources/application.yml                                    |    9 -
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java |  209 -----------------------------------------
 sandu-common/pom.xml                                                              |    4 
 ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java         |   22 ----
 6 files changed, 8 insertions(+), 288 deletions(-)

diff --git a/sandu-common/pom.xml b/sandu-common/pom.xml
index 86e180d..f62b80d 100644
--- a/sandu-common/pom.xml
+++ b/sandu-common/pom.xml
@@ -126,5 +126,9 @@
             <artifactId>cos_api</artifactId>
             <version>5.6.55</version>
         </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+        </dependency>
     </dependencies>
 </project>
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/config/NginxConfigBean.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/config/NginxConfigBean.java
deleted file mode 100644
index 7d10894..0000000
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/config/NginxConfigBean.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.sandu.ximon.admin.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-@Data
-@Component
-@ConfigurationProperties(prefix = "nginx-config")
-public class NginxConfigBean {
-
-    private String filePath;
-
-    private String url;
-}
\ No newline at end of file
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/config/ServerConfig.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/config/ServerConfig.java
index ff05e1c..0ae5dc7 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/config/ServerConfig.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/config/ServerConfig.java
@@ -1,53 +1,20 @@
 package com.sandu.ximon.admin.config;
 
-import com.sandu.ximon.admin.utils.LogUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
 
 @Component
 public class ServerConfig {
 
     @Value("${server-conf.ip}")
     public String SIP;
-    @Value("${nginx.port}")
-    public String nginxPort;
-    @Value("${nginx.cameraSaveUrl}")
-    public String saveUrl;
-//    @Value("${broadcast.file-save-url}")
-//    private String fileSaveUrl;
 
 
     private static String ServerIP;
-    private static String NginxPort;
-    private static String CameraSaveUrl;
-    private static String BroadcastFileSaveUrl;
-    private static boolean O2OServer;
 
-    public static String getNginxCameraSaveUrl() {
-        return CameraSaveUrl;
-    }
 
-    @PostConstruct
-    private void loadIP(){
-        ServerIP = SIP;
-        NginxPort = nginxPort;
-        CameraSaveUrl = saveUrl;
-       // BroadcastFileSaveUrl = fileSaveUrl;
-        LogUtils.print("Server IP 锛�" +SIP);
-        LogUtils.print("NignX Port 锛�" +nginxPort);
-        LogUtils.print("Camera Save Url 锛�" +CameraSaveUrl);
-        LogUtils.print("Broadcast File Save Url 锛�" +BroadcastFileSaveUrl);
-    }
-
-    public static String getServerIP(){
+    public static String getServerIP() {
         return ServerIP;
     }
-    public static String getNignxPort(){
-        return NginxPort;
-    }
-    public static String getBroadcastFileSaveUrl(){
-        return BroadcastFileSaveUrl;
-    }
+
 }
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
index 316afaf..fdae699 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
@@ -1,25 +1,18 @@
 package com.sandu.ximon.admin.service;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.github.pagehelper.PageHelper;
 import com.google.gson.Gson;
 import com.sandu.common.execption.BusinessException;
-import com.sandu.common.object.BaseConditionVO;
 import com.sandu.common.service.impl.BaseServiceImpl;
-import com.sandu.ximon.admin.config.NginxConfigBean;
 import com.sandu.ximon.admin.config.RealtimeServerBean;
 import com.sandu.ximon.admin.entity.*;
 import com.sandu.ximon.admin.param.PoleBindingParam;
 import com.sandu.ximon.admin.security.SecurityUtils;
-import com.sandu.ximon.admin.utils.Constant;
 import com.sandu.ximon.admin.utils.FileUtil;
 import com.sandu.ximon.admin.utils.HtmlTemplateUtils;
 import com.sandu.ximon.admin.utils.LightemitUtils;
-import com.sandu.ximon.admin.utils.request.SubTitleSet;
 import com.sandu.ximon.dao.domain.PoleLightemitEntity;
 import com.sandu.ximon.dao.mapper.PoleLightemitEntityMapper;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.EnableCaching;
@@ -49,8 +42,6 @@
     private String port;
     @Autowired
     ApplicationContext applicationContext;
-    @Autowired
-    NginxConfigBean nginxConfigBean;
 
     @Autowired
     PoleLightemitEntityMapper poleLightemitDao;
@@ -247,40 +238,6 @@
 
     }
 
-    /**
-     * LED涓婁紶鍗曡瀛楀箷
-     */
-    @Async("taskExecutor")
-    public Boolean subTitleSet(SubTitleSetEntity subTitleSetEntity, String path, String userName) {
-        if (subTitleSetEntity == null) {
-            return false;
-        }
-        if (subTitleSetEntity.getDirection().equals(Constant.LEFT) || subTitleSetEntity.getDirection().equals(Constant.RIGHT)) {
-            //瀛楀箷妯悜婊氬姩
-            this.BuildHorizonSingSubTitleText(subTitleSetEntity);
-        } else if (subTitleSetEntity.getDirection().equals(Constant.UP) || subTitleSetEntity.getDirection().equals(Constant.DOWN)) {
-            //瀛楀箷绾靛悜婊氬姩
-            try {
-                this.BuildVerticalSingSubTitleText(subTitleSetEntity, path, userName);
-            } catch (IOException e) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * LED涓婁紶澶氳瀛楀箷
-     */
-    @Async("taskExecutor")
-    public Boolean subMultiTitleSet(SubTitleSetEntity subTitleSetEntity, String path, String userName) {
-        try {
-            this.BuildVerticalMultiSubTitleText(subTitleSetEntity, path, userName);
-            return true;
-        } catch (IOException e) {
-            return false;
-        }
-    }
 
     @Async("taskExecutor")
     public void videoXixunPlayer(String lightemitControlCode, String ip, String filename, Long filesize, Integer videoTime) {
@@ -385,7 +342,7 @@
     }
 
     /**
-     * 鏍规嵁led灞忕紪鐮佽缃煶閲�
+     * 鏍规嵁led灞忕紪鐮佽缃寒搴�
      *
      * @param lightemitControlCode
      * @param brightness
@@ -395,168 +352,4 @@
         lightemitUtils.setBrightness(lightemitControlCode, brightness);
     }
 
-    /**
-     * 涓婁紶姘村钩婊氬姩鍗曡瀛楀箷
-     *
-     * @param subTitleSetEntity
-     */
-    private void BuildHorizonSingSubTitleText(SubTitleSetEntity subTitleSetEntity) {
-        //鎷艰LED灞忓箷璁剧疆璇锋眰body
-        SubTitleSet subTitleSet = new SubTitleSet();
-        subTitleSet.num = subTitleSetEntity.getNum() != null ? subTitleSetEntity.getNum() : subTitleSet.num;
-        subTitleSet.interval = subTitleSetEntity.getInterval() != null ? subTitleSetEntity.getInterval() : subTitleSet.interval;
-        subTitleSet.step = subTitleSetEntity.getStep() != null ? subTitleSetEntity.getStep() : subTitleSet.step;
-        subTitleSet.direction = subTitleSetEntity.getDirection() != null ? subTitleSetEntity.getDirection() : subTitleSet.direction;
-        subTitleSet.align = subTitleSetEntity.getAlign() != null ? subTitleSetEntity.getAlign() : subTitleSet.align;
-        //鎷兼帴html 鑳屾櫙榛樿鏄捐壊涓虹櫧鑹�
-        subTitleSet.html = "<head><style type=\"text/css\">body{background-color:" +
-                (subTitleSetEntity.getColor() != null && StringUtils.isNotBlank(subTitleSetEntity.getColor()) ? subTitleSetEntity.getColor() : "#000000") +
-                "}</style></head><i style=\"color:" +
-                (subTitleSetEntity.getFontColor() != null && StringUtils.isNotBlank(subTitleSetEntity.getFontColor()) ? subTitleSetEntity.getFontColor() : "#ffffff")
-                + "; font-size: " +
-                (subTitleSetEntity.getFontSize() != null && StringUtils.isNotBlank(subTitleSetEntity.getFontSize()) ? subTitleSetEntity.getFontSize() : "1")
-                + "em\">" + subTitleSetEntity.getContent() + "</i>";
-
-        //鑾峰彇鎵�鏈塴ed鏁版嵁
-        Collection poleLightemitControllers = this.listByIds(Arrays.asList(subTitleSetEntity.getId()));
-        if (!poleLightemitControllers.isEmpty()) {
-            Iterator iterator = poleLightemitControllers.iterator();
-            while (iterator.hasNext()) {
-                PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
-                //娓呭睆鎿嶄綔
-                lightemitUtils.clear(poleLightemitEntity.getLightemitControlCode());
-                //娓呴櫎鎾斁鍒楄〃
-                lightemitUtils.clearVideoPlay(poleLightemitEntity.getLightemitControlCode());
-                //娓呴櫎鑺傜洰鍒楄〃
-                lightemitUtils.clearPlayerTask(poleLightemitEntity.getLightemitControlCode());
-                //鍙戦�佸瓧骞曡缃姹�
-                lightemitUtils.subTitleSet(subTitleSet, poleLightemitEntity.getLightemitControlCode(), true);
-            }
-        }
-    }
-
-    /**
-     * 涓婁紶鍨傜洿婊氬姩鍗曡瀛楀箷
-     *
-     * @param subTitleSetEntity
-     * @param path
-     * @param userName
-     * @throws IOException
-     */
-    private void BuildVerticalSingSubTitleText(SubTitleSetEntity subTitleSetEntity, String path, String userName) throws IOException {
-        //html鍦板潃
-        //鑾峰彇鎵�鏈塴ed鏁版嵁
-        Collection poleLightemitControllers = this.listByIds(Arrays.asList(subTitleSetEntity.getId()));
-        if (!poleLightemitControllers.isEmpty()) {
-            Iterator iterator = poleLightemitControllers.iterator();
-            while (iterator.hasNext()) {
-                PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
-
-                String lightemitControlCode = poleLightemitEntity.getLightemitControlCode();
-
-                //鑾峰彇灞忓箷瀹�
-                Integer screenWidth = Integer.valueOf(lightemitUtils.getScreenWidth(lightemitControlCode));
-                Integer screenHeight = Integer.valueOf(lightemitUtils.getScreenHeight(lightemitControlCode));
-
-                String filenameTemp = path + userName + "_" + lightemitControlCode + ".html";
-                File htmlFile = new File(filenameTemp);
-                if (!htmlFile.exists() || htmlFile.delete()) {
-                    htmlFile.createNewFile();
-                }
-
-                //鑻ュ悜涓嬫粴鍔紝鏂囧瓧椤哄簭鐩稿弽
-                if (Constant.DOWN.equals(subTitleSetEntity.getDirection())) {
-                    subTitleSetEntity.setContent(StringUtils.reverse(subTitleSetEntity.getContent()));
-                }
-
-                Map<String, Object> params = new HashMap<>();
-                params.put("direction", subTitleSetEntity.getDirection());
-                params.put("screenWidth", screenWidth);
-                params.put("screenHeight", screenHeight);
-                params.put("fontSize", subTitleSetEntity.getFontSize() != null && StringUtils.isNotBlank(subTitleSetEntity.getFontSize()) ? subTitleSetEntity.getFontSize() : "1");
-                params.put("align", subTitleSetEntity.getAlign());
-                params.put("fontColor", subTitleSetEntity.getFontColor() != null && StringUtils.isNotBlank(subTitleSetEntity.getFontColor()) ? subTitleSetEntity.getFontColor() : "#ffffff");
-                params.put("backgroundColor", subTitleSetEntity.getColor() != null && StringUtils.isNotBlank(subTitleSetEntity.getColor()) ? subTitleSetEntity.getColor() : "#000000");
-                params.put("interval", subTitleSetEntity.getInterval() != null ? subTitleSetEntity.getInterval() : 50);
-                params.put("step", subTitleSetEntity.getStep() != null ? subTitleSetEntity.getStep() : 1);
-                params.put("num", subTitleSetEntity.getNum() != null ? subTitleSetEntity.getNum() : -1);
-                params.put("contentArray", subTitleSetEntity.getContent().toCharArray());
-
-                String body = new HtmlTemplateUtils().renderPath("classpath:templates/lightemitTemplates/buildVerticalSingSubTitleTemplates.html", params);
-
-                boolean flag = new FileUtil().writeToFile(body, filenameTemp);
-
-                if (flag) {
-                    //娓呭睆鎿嶄綔
-                    lightemitUtils.clear(lightemitControlCode);
-                    //娓呴櫎鎾斁鍒楄〃
-                    lightemitUtils.clearVideoPlay(lightemitControlCode);
-                    //娓呴櫎鑺傜洰鍒楄〃
-                    lightemitUtils.clearPlayerTask(lightemitControlCode);
-                    //鎺ㄩ��
-                    lightemitUtils.postHtmlUseNginx(lightemitControlCode, userName);
-                }
-            }
-        }
-    }
-
-    /**
-     * 涓婁紶鍨傜洿婊氬姩澶氳瀛楀箷
-     *
-     * @param subTitleSetEntity
-     * @param path
-     * @param userName
-     * @throws IOException
-     */
-    private void BuildVerticalMultiSubTitleText(SubTitleSetEntity subTitleSetEntity, String path, String userName) throws IOException {
-        //html鍦板潃
-        //鑾峰彇鎵�鏈塴ed鏁版嵁
-        Collection poleLightemitControllers = this.listByIds(Arrays.asList(subTitleSetEntity.getId()));
-        if (!poleLightemitControllers.isEmpty()) {
-            Iterator iterator = poleLightemitControllers.iterator();
-            while (iterator.hasNext()) {
-                PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
-
-                String lightemitControlCode = poleLightemitEntity.getLightemitControlCode();
-
-                //鑾峰彇灞忓箷瀹�
-                Integer screenWidth = Integer.valueOf(lightemitUtils.getScreenWidth(lightemitControlCode));
-                Integer screenHeight = Integer.valueOf(lightemitUtils.getScreenHeight(lightemitControlCode));
-
-                String filenameTemp = path + userName + "_" + lightemitControlCode + ".html";
-                File htmlFile = new File(filenameTemp);
-                if (!htmlFile.exists() || htmlFile.delete()) {
-                    htmlFile.createNewFile();
-                }
-
-                Map<String, Object> params = new HashMap<>();
-                params.put("direction", subTitleSetEntity.getDirection());
-                params.put("screenWidth", screenWidth);
-                params.put("screenHeight", screenHeight);
-                params.put("fontSize", subTitleSetEntity.getFontSize() != null && StringUtils.isNotBlank(subTitleSetEntity.getFontSize()) ? subTitleSetEntity.getFontSize() : "1");
-                params.put("align", subTitleSetEntity.getAlign());
-                params.put("fontColor", subTitleSetEntity.getFontColor() != null && StringUtils.isNotBlank(subTitleSetEntity.getFontColor()) ? subTitleSetEntity.getFontColor() : "#ffffff");
-                params.put("backgroundColor", subTitleSetEntity.getColor() != null && StringUtils.isNotBlank(subTitleSetEntity.getColor()) ? subTitleSetEntity.getColor() : "#000000");
-                params.put("interval", subTitleSetEntity.getInterval() != null ? subTitleSetEntity.getInterval() : 50);
-                params.put("step", subTitleSetEntity.getStep() != null ? subTitleSetEntity.getStep() : 1);
-                params.put("num", subTitleSetEntity.getNum() != null ? subTitleSetEntity.getNum() : -1);
-                params.put("contentArray", subTitleSetEntity.getContent().split("\n"));
-
-                String body = new HtmlTemplateUtils().renderPath("classpath:templates/lightemitTemplates/buildVerticalSingSubTitleTemplates.html", params);
-
-                boolean flag = new FileUtil().writeToFile(body, filenameTemp);
-
-                if (flag) {
-                    //娓呭睆鎿嶄綔
-                    lightemitUtils.clear(lightemitControlCode);
-                    //娓呴櫎鎾斁鍒楄〃
-                    lightemitUtils.clearVideoPlay(lightemitControlCode);
-                    //娓呴櫎鑺傜洰鍒楄〃
-                    lightemitUtils.clearPlayerTask(lightemitControlCode);
-                    //鎺ㄩ��
-                    lightemitUtils.postHtmlUseNginx(lightemitControlCode, userName);
-                }
-            }
-        }
-    }
 }
\ No newline at end of file
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
index 8d20209..a43f36d 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
@@ -2,7 +2,6 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
-import com.sandu.ximon.admin.config.NginxConfigBean;
 import com.sandu.ximon.admin.config.RealtimeServerBean;
 import com.sandu.ximon.admin.service.PoleLightemitService;
 import com.sandu.ximon.admin.utils.request.*;
@@ -29,8 +28,6 @@
     PoleLightemitService poleLightemitService;
     @Autowired
     ApplicationContext applicationContext;
-    @Autowired
-    NginxConfigBean nginxConfigBean;
     //body灏佽缂栫爜
     private final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
 
@@ -144,24 +141,6 @@
         String result = post(url, postBody);
     }
 
-    /**
-     * html浼犺緭鑷砽ed灞�, 閫氳繃url鑾峰彇html
-     *
-     * @param ledCode
-     * @param username
-     */
-    public void postHtmlUseNginx(String ledCode, String username) {
-
-        PostHtml postHtml = new PostHtml(nginxConfigBean.getUrl() + username + "_" + ledCode + ".html");
-        String postBody = new Gson().toJson(postHtml);
-
-        //璇锋眰鍦板潃
-        String url = realtimeServerBean.getCommand() + ledCode;
-        //淇濆瓨led鏁版嵁
-        poleLightemitService.updateRequestBody(ledCode, postBody);
-        //璇锋眰
-        String result = post(url, postBody);
-    }
 
     /**
      * 瑙嗛浼犺緭鑷砽ed灞�
@@ -234,6 +213,7 @@
 
     /**
      * 鍙戦�佹渶鏂扮殑鏁版嵁
+     *
      * @param lightemitControlCode
      */
     public void sendLastCommand(String lightemitControlCode) {
diff --git a/ximon-admin/src/main/resources/application.yml b/ximon-admin/src/main/resources/application.yml
index 1e99880..3a751a3 100644
--- a/ximon-admin/src/main/resources/application.yml
+++ b/ximon-admin/src/main/resources/application.yml
@@ -36,15 +36,6 @@
   command: http://112.74.63.130:20018/command/
   url: http://112.74.63.130:20018/
 
-# nginx鐩稿叧鍦板潃
-nginx:
-  port: 443
-  cameraSaveUrl: D:/NginX/nginx-1.15.9/data/file/cameraPresetPoint
-nginx-config:
-  filePath: D:\NginX\nginx-1.15.9\data\file\
-  url: http://47.106.172.9:443/download/
-  apkUrl: http://47.106.172.9:443/apk/
-  lcdUrl: http://47.106.172.9:443/download/lcd/
 
 server-conf:
   ip: 47.106.172.9 # 47.106.172.9/101.132.131.91

--
Gitblit v1.9.3