From 93c4a7420a87b7d7e2bbeeef8e6ccff0a8909a9d Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 06 五月 2022 11:42:06 +0800
Subject: [PATCH] Changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java | 209 ----------------------------------------------------
1 files changed, 1 insertions(+), 208 deletions(-)
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
--
Gitblit v1.9.3