From a98ab7f009865d113b75708a69ef1a0a8e3d8d3b Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期四, 24 二月 2022 16:33:37 +0800
Subject: [PATCH] 功能完善
---
dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml | 36
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java | 91 ++
ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeDataService.java | 39
ximon-admin/src/main/java/com/sandu/ximon/admin/entity/TaskItem.java | 3
ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java | 744 ++++++++--------
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java | 1
ximon-admin/src/main/java/com/sandu/ximon/admin/service/RoleService.java | 3
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java | 20
ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java | 231 ++--
dao/src/main/java/com/sandu/ximon/dao/domain/PoleLightemitEntity.java | 144 +-
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java | 1312 ++++++++++++++--------------
ximon-admin/src/main/java/com/sandu/ximon/admin/security/test.java | 24
ximon-admin/src/main/java/com/sandu/ximon/admin/entity/Schedule.java | 12
13 files changed, 1,466 insertions(+), 1,194 deletions(-)
diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/PoleLightemitEntity.java b/dao/src/main/java/com/sandu/ximon/dao/domain/PoleLightemitEntity.java
index fc1e85a..129a6bd 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/domain/PoleLightemitEntity.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/PoleLightemitEntity.java
@@ -1,89 +1,95 @@
package com.sandu.ximon.dao.domain;
-import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
import java.io.Serializable;
+import java.time.LocalDateTime;
+import lombok.Data;
/**
* led骞垮憡灞忎富琛�
- *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2019-04-20 13:34:54
+ * @TableName pole_lightemit
*/
+@TableName(value ="pole_lightemit")
@Data
-@TableName("pole_lightemit")
public class PoleLightemitEntity implements Serializable {
- private static final long serialVersionUID = 1L;
+ /**
+ * LED ID
+ */
+ @TableId(type = IdType.AUTO)
+ private Long lightemitId;
- /**
- * LED ID
- */
- @TableId
- private Long lightemitId;
- /**
- * LED鍚嶇О
- */
- private String lightemitName;
- /**
- * LED鎺у埗鍗$紪鍙�
- */
- private String lightemitControlCode;
- /**
- * 鎵�鏄剧ず鍥剧墖鍦板潃
- */
- private String url;
- /**
- * 鏄剧ず鏃堕棿
- */
- private Integer playTime;
- /**
- * 鍔犲叆鏃堕棿锛堝瓨鍌ㄥ崟鐏暟鎹洿鏂版椂闂达級
- */
- private DateTime addTime;
- /*
- 璇锋眰鏁版嵁
- */
- private String requestBody;
- /**
- * 鎾斁璁剧疆 0锛氫娇鐢ㄦ挱鏀炬帴鍙o紱 1锛氫娇鐢▁ixunplayer鎾斁鎺ュ彛
- */
- private Integer playerSetting;
- /**
- * 鐘舵�� 0锛氱鐢� 1锛氭甯�
- */
- private Integer status;
+ /**
+ * LED鍚嶇О
+ */
+ private String lightemitName;
+
+ /**
+ * led灞忔帶鍒跺崱缂栧彿
+ */
+ private String lightemitControlCode;
+
+ /**
+ * 鎵�鏄剧ず鍥剧墖鍦板潃
+ */
+ private String url;
+
+ /**
+ * 鏄剧ず鏃堕棿
+ */
+ private Integer playTime;
+
+ /**
+ * 鍔犲叆鏃堕棿
+ */
+ private LocalDateTime addTime;
+
+ /**
+ * 璇锋眰body,鑺傜洰涓讳綋鐨勫鍣�
+ */
+ private String requestBody;
+
+ /**
+ * 鎾斁璁剧疆 0锛氫娇鐢ㄦ挱鏀炬帴鍙o紱 1锛氫娇鐢▁ixunplayer鎾斁鎺ュ彛
+ */
+ private Integer playerSetting;
+
/**
* 鐘舵�� 0锛氱鐢� 1锛氭甯�
*/
+ private Integer status;
+
+ /**
+ * 澶囨敞
+ */
private String remark;
- /**
- * 鍒涘缓鑰匢D
- */
- private Long createUserId;
- /**
- * 鍒涘缓鏃堕棿
- */
- private DateTime createTime;
- /**
- * 缁戝畾鐏潌ID
- */
- @TableField(exist = false)
- private Long streetlightId;
- /**
- * 鐏潌鍚嶇О
- */
- @TableField(exist = false)
- private String streetlightName;
- /**
- * led灞忓箷寮�鍏�
- */
- @TableField(exist = false)
- private Boolean isOpen;
+ /**
+ * 鍒涘缓鑰匢D
+ */
+ private Long createUserId;
+ /**
+ * 瀹㈡埛id
+ */
+ private Long clientId;
+
+
+ private Long userId;
+
+ /**
+ * 缁戝畾鐏潌ID
+ */
+ @TableField(exist = false)
+ private Long poleId;
+
+ /**
+ *
+ */
+ private LocalDateTime createTime;
+
+ @TableField(exist = false)
+ private static final long serialVersionUID = 1L;
}
\ No newline at end of file
diff --git a/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java b/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java
new file mode 100644
index 0000000..95580da
--- /dev/null
+++ b/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleLightemitEntityMapper.java
@@ -0,0 +1,20 @@
+package com.sandu.ximon.dao.mapper;
+
+import com.sandu.ximon.dao.domain.PoleLightemitEntity;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @Entity com.sandu.ximon.dao.domain.PoleLightemitEntity
+ */
+@Mapper
+public interface PoleLightemitEntityMapper extends BaseMapper<PoleLightemitEntity> {
+
+
+ void updateRequestBody(@Param("ledCode")String ledCode, @Param("postBody")String postBody);
+}
+
+
+
+
diff --git a/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml b/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
new file mode 100644
index 0000000..c7147d0
--- /dev/null
+++ b/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sandu.ximon.dao.mapper.PoleLightemitEntityMapper">
+
+ <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.PoleLightemitEntity">
+ <id property="lightemitId" column="lightemit_id" jdbcType="BIGINT"/>
+ <result property="lightemitName" column="lightemit_name" jdbcType="VARCHAR"/>
+ <result property="lightemitControlCode" column="lightemit_control_code" jdbcType="VARCHAR"/>
+ <result property="url" column="url" jdbcType="VARCHAR"/>
+ <result property="playTime" column="play_time" jdbcType="INTEGER"/>
+ <result property="addTime" column="add_time" jdbcType="TIMESTAMP"/>
+ <result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
+ <result property="playerSetting" column="player_setting" jdbcType="TINYINT"/>
+ <result property="status" column="status" jdbcType="TINYINT"/>
+ <result property="remark" column="remark" jdbcType="VARCHAR"/>
+ <result property="createUserId" column="create_user_id" jdbcType="BIGINT"/>
+ <result property="clientId" column="client_id" jdbcType="BIGINT"/>
+ <result property="userId" column="user_id" jdbcType="BIGINT"/>
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ lightemit_id,lightemit_name,lightemit_control_code,
+ url,play_time,add_time,
+ request_body,player_setting,status,
+ remark,create_user_id,create_time
+ </sql>
+
+ <update id="updateRequestBody">
+ UPDATE pole_lightemit
+ SET request_body = #{postBody}
+ WHERE lightemit_control_code = #{ledCode}
+ </update>
+</mapper>
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java
index 6af675c..c9e1fc6 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java
@@ -130,6 +130,5 @@
wrapper.like(LedPlayerEntity::getPlayerName,keyword);
return ResponseUtil.success(ledPlayerEntityService.list(wrapper));
}
-
}
}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
new file mode 100644
index 0000000..9fab077
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -0,0 +1,91 @@
+package com.sandu.ximon.admin.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.github.pagehelper.PageHelper;
+import com.sandu.common.domain.ResponseVO;
+import com.sandu.common.execption.BusinessException;
+import com.sandu.common.object.BaseConditionVO;
+import com.sandu.common.util.ResponseUtil;
+import com.sandu.ximon.admin.entity.ProgramPro;
+import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.service.ClientService;
+import com.sandu.ximon.admin.service.PoleLightemitService;
+import com.sandu.ximon.admin.service.XiXunPlayerService;
+import com.sandu.ximon.dao.domain.LedPlayerEntity;
+import com.sandu.ximon.dao.domain.PoleLightemitEntity;
+import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
+import com.sandu.ximon.dao.enums.AdministratorEnums;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author liuhaonan
+ * @Date 2022/2/22 13:55
+ * @Version 1.0
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/v1/xixun")
+public class XiXunController {
+
+ private final XiXunPlayerService xiXunPlayerService;
+ private final ClientService clientService;
+ private final PoleLightemitService poleLightemitService;
+
+ @PostMapping("/addProgram")
+ public ResponseVO<Object> addProgram(@RequestBody ProgramPro programPro){
+ return ResponseUtil.success(xiXunPlayerService.insert(programPro));
+ }
+
+ @PostMapping("/deleteProgram/{pid}")
+ public ResponseVO<Object> deleteProgram(@PathVariable Long pid){
+ return ResponseUtil.success(xiXunPlayerService.deleteProgram(pid));
+ }
+
+ @GetMapping("/getByPid/{pid}")
+ public ResponseVO<Object> getByPid(@PathVariable Long pid){
+ return ResponseUtil.success(xiXunPlayerService.getByPid(pid));
+ }
+ @GetMapping("/list")
+ public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
+ PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+
+ LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
+ if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
+// clientService.findClientId()
+// wrapper.eq(PoleXixunPlayerEntity::getCreateUserId,)
+ //wrapper.eq(LedPlayerEntity::get)
+ return ResponseUtil.success(xiXunPlayerService.list(wrapper)); // todo
+ }else {
+ return ResponseUtil.success(xiXunPlayerService.list(wrapper));
+ }
+ }
+
+
+ @GetMapping("/pushToXixun/{pid}")
+ public ResponseVO<Object> getByPid(@PathVariable Long pid, @RequestBody List<Long> lightemitIds ){
+ xiXunPlayerService.videoXixunPlayer(pid,lightemitIds);
+ return ResponseUtil.success("鎺ㄩ�佹垚鍔�");
+ }
+
+ @PostMapping("/saveLed")
+ public ResponseVO<Object> save(@RequestBody PoleLightemitEntity poleLightemit){
+ int count = poleLightemitService.count(new QueryWrapper<PoleLightemitEntity>().eq("lightemit_control_code", poleLightemit.getLightemitControlCode()));
+ if(count != 0){
+ throw new BusinessException("LED鎺у埗鍗$紪鍙蜂笉鑳介噸澶�");
+ }
+
+ poleLightemit.setCreateUserId(SecurityUtils.getClientId());
+
+ poleLightemitService.savePoleLightemit(poleLightemit);
+
+ return ResponseUtil.success("");
+ }
+
+}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/Schedule.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/Schedule.java
new file mode 100644
index 0000000..379bf4e
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/Schedule.java
@@ -0,0 +1,12 @@
+package com.sandu.ximon.admin.entity;
+
+import lombok.Data;
+
+/**
+ * @Author liuhaonan
+ * @Date 2022/2/21 15:27
+ * @Version 1.0
+ */
+@Data
+public class Schedule {
+}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/TaskItem.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/TaskItem.java
index a6adb99..d242b61 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/TaskItem.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/entity/TaskItem.java
@@ -3,6 +3,7 @@
import lombok.Data;
import java.io.Serializable;
+import java.util.List;
@Data
public class TaskItem implements Serializable {
@@ -11,5 +12,5 @@
private String _id; //UUID
private Program _program; //灏嗗寘瑁呭ソ鐨勮妭鐩祴鍊肩粰浠�
private int repeatTimes; //閲嶅娆℃暟
- // private List<Schedule> schedules=null; //鍙互涓轰竴涓猵rogram娣诲姞澶氫釜瀹氭椂娈�
+ private List<Schedule> schedules=null; //鍙互涓轰竴涓猵rogram娣诲姞澶氫釜瀹氭椂娈�
}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/security/test.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/security/test.java
new file mode 100644
index 0000000..d3e5e77
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/security/test.java
@@ -0,0 +1,24 @@
+package com.sandu.ximon.admin.security;
+
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+/**
+ * @Author liuhaonan
+ * @Date 2022/2/24 10:15
+ * @Version 1.0
+ */
+public class test {
+ public static void main(String[] args) {
+
+ String s="e10adc3949ba59abbe56e057f20f883e";
+ PasswordEncoder pw= new BCryptPasswordEncoder();
+ //鍔犲瘑
+ String encode=pw.encode(s);
+ System.out.println(encode);
+ //姣旇緝瀵嗙爜
+ boolean matches=pw.matches(s,encode);
+ System.out.println("==============================");
+ System.out.println(matches);
+ }
+}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeDataService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeDataService.java
index 336b0db..06fd1ed 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeDataService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeDataService.java
@@ -2,12 +2,19 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.Constant;
import com.sandu.ximon.dao.domain.IpVolumeData;
import com.sandu.ximon.dao.mapper.IpVolumeDataMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* @Author liuhaonan
@@ -26,6 +33,36 @@
} else {
return Wrappers.lambdaQuery(IpVolumeData.class);
}
-
}
+// public List<IpVolumeData> getOnlineList(Long userId) {
+// PageInfo terminalList = getTerminalList(userId, 1, 9999, "");
+// List<IpVolumeData> list = terminalList.getList();
+// List<IpVolumeData> result = new ArrayList<>();
+// for(IpVolumeData t:list){
+// if(t.getOnLineStatus() != 0) {
+// result.add(t);
+// }
+// }
+// return result;
+// }
+
+// public PageInfo getTerminalList(Long userId, Integer page, Integer limit, String key) {
+//
+// List<TerminalEntity> list = null;
+// if(roleId == Constant.SUPER_ADMIN) {
+// PageHelper.startPage(page,limit);
+// list = getTerminalList(key);
+// }else if(roleId == Constant.ADMIN) {
+// PageHelper.startPage(page,limit);
+// list = getTerminalListByCompanyId(companyId,key);
+// }else {
+// PageHelper.startPage(page,limit);
+// list = getTerminalListByUserId(userId,key);
+// }
+// PageInfo pageInfo = new PageInfo(list);
+//
+// pageInfo.setList(setTerminalStatus(list));
+//
+// return pageInfo;
+// }
}
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 3a816b4..a2e2bb6 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,343 +1,660 @@
-//package com.sandu.ximon.admin.service;
-//
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-//import com.google.gson.Gson;
-//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.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 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;
-//import org.springframework.context.ApplicationContext;
-//import org.springframework.scheduling.annotation.Async;
-//import org.springframework.stereotype.Service;
-//
-//import javax.annotation.PostConstruct;
-//import java.io.File;
-//import java.io.IOException;
-//import java.util.*;
-//
-//
-//@Service
-//@EnableCaching
-//public class PoleLightemitService extends BaseServiceImpl<PoleLightemitDao, PoleLightemitEntity> {
-//
-// @Autowired
+package com.sandu.ximon.admin.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.Gson;
+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.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;
+import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+
+@Service
+@EnableCaching
+public class PoleLightemitService extends BaseServiceImpl<PoleLightemitEntityMapper, PoleLightemitEntity> {
+
+ // @Autowired
// PoleStreetlightLightemitService poleStreetlightLightemitService;
-// LightemitUtils lightemitUtils;
-// @Autowired
-// RealtimeServerBean realtimeServerBean;
-// @Value("${server.port}")
-// private String port;
-// @Autowired
-// ApplicationContext applicationContext;
-// @Autowired
+
+ LightemitUtils lightemitUtils;
+ @Autowired
+ private RealtimeServerBean realtimeServerBean;
+ @Value("${server.port}")
+ private String port;
+ @Autowired
+ ApplicationContext applicationContext;
+ // @Autowired
// FfmpegUtils ffmpegUtils;
// @Autowired
// FileUploadPathBean fileUploadPathBean;
-// @Autowired
-// NginxConfigBean nginxConfigBean;
-// @Autowired
-// PoleLightemitDao poleLightemitDao;
-//
-// @PostConstruct
-// public void init(){
-// //閲嶆柊鑾峰彇鍗曚緥
-// lightemitUtils = applicationContext.getBean(LightemitUtils.class);
+ @Autowired
+ NginxConfigBean nginxConfigBean;
+
+ @Autowired
+ PoleLightemitEntityMapper poleLightemitDao;
+
+ @PostConstruct
+ public void init() {
+ //閲嶆柊鑾峰彇鍗曚緥
+ lightemitUtils = applicationContext.getBean(LightemitUtils.class);
+ }
+
+ /*@Override
+ public PageUtils queryPage(Map<String, Object> params, Long userId) {
+
+ String key = (String)params.get("key");
+
+ Long groupId = StringUtils.isNotBlank((String)params.get("group"))? Long.valueOf((String)params.get("group")): null;
+
+ String order = (String)params.get("order");
+
+ String column = (String)params.get("sortby");
+
+ IPage<PoleLightemitEntity> page = new Page<>();
+ //鑾峰彇瑙掕壊鍒楄〃
+ Long roleId = (sysUserRoleService.queryRoleId(userId));
+
+ if(roleId == null || roleId == 0){
+ return null;
+ }
+
+ if(roleId.longValue() == Constant.SUPER_ADMIN){
+// page = this.page(
+// new Query<PoleLightemitEntity>().getPage(params),
+// new QueryWrapper<PoleLightemitEntity>().like(StringUtils.isNotBlank(key),"lightemit_name", key));
+ if (order != null && order.equals("ASC") && column.equals("isOpen")) {
+ Map<String, Object> map = new HashMap<>();
+ Integer pg = 1;
+ Integer size = 200;
+ map.put("page",pg);
+ params.put("limit",size);
+ page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params),key,groupId,order,column);
+ ledOnlineCheck(page.getRecords());
+ page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
+ return new PageUtils(page);
+ }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
+ Map<String, Object> map = new HashMap<>();
+ Integer pg = 1;
+ Integer size = 200;
+ map.put("page",pg);
+ params.put("limit",size);
+ page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params),key,groupId,order,column);
+ ledOnlineCheck(page.getRecords());
+ page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
+ return new PageUtils(page);
+ }else {
+ page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params), key, groupId,order,column);
+ }
+
+ }else if(roleId.longValue() == Constant.ADMIN){
+ if (order != null && order.equals("ASC") && column.equals("isOpen")) {
+ Map<String, Object> map = new HashMap<>();
+ Integer pg = 1;
+ Integer size = 200;
+ map.put("page",pg);
+ params.put("limit",size);
+ page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
+ ledOnlineCheck(page.getRecords());
+ page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
+ return new PageUtils(page);
+ }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
+ Map<String, Object> map = new HashMap<>();
+ Integer pg = 1;
+ Integer size = 200;
+ map.put("page",pg);
+ params.put("limit",size);
+ page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
+ ledOnlineCheck(page.getRecords());
+ page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
+ return new PageUtils(page);
+ }else {
+ page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
+ }
+
+ }else if(roleId.longValue() == Constant.USER){
+ if (order != null && order.equals("ASC") && column.equals("isOpen")) {
+ Map<String, Object> map = new HashMap<>();
+ Integer pg = 1;
+ Integer size = 200;
+ map.put("page",pg);
+ params.put("limit",size);
+ page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
+ ledOnlineCheck(page.getRecords());
+ page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
+ return new PageUtils(page);
+ }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
+ Map<String, Object> map = new HashMap<>();
+ Integer pg = 1;
+ Integer size = 200;
+ map.put("page",pg);
+ params.put("limit",size);
+ page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
+ ledOnlineCheck(page.getRecords());
+ page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
+ return new PageUtils(page);
+ }else {
+ page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
+ }
+
+ }
+ ledOnlineCheck(page.getRecords());
+ return new PageUtils(page);
+ }
+*//*
+ @Override
+ public List<PoleLightemitEntity> getAll(Long userId) {
+ //鑾峰彇瑙掕壊鍒楄〃
+ Long roleId = (sysUserRoleService.queryRoleId(userId));
+
+ if(roleId == null || roleId == 0){
+ return null;
+ }
+ List<PoleLightemitEntity> list = null;
+ if(roleId.longValue() == Constant.SUPER_ADMIN){
+ list = poleLightemitDao.selectAll();
+ }else if(roleId.longValue() == Constant.ADMIN){
+ list = poleLightemitDao.selectAllByCompany(userId);
+ }else if(roleId.longValue() == Constant.USER){
+ list = poleLightemitDao.selectAllByUser(userId);
+ }
+ return list;
+ }
+*/
+
+/* public void ledOnlineCheck(List<PoleLightemitEntity> list) {
+
+ for(PoleLightemitEntity poleLightemitEntity : list){
+ poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true"));
+ }
+ }*/
+
+
+ public void savePoleLightemit(PoleLightemitEntity poleLightemit) {
+ boolean save = this.save(poleLightemit);
+ // 缁戝畾鐏潌
+ if(save&&poleLightemit.getPoleId()!=null){
+
+ }
+ // poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId());
+ }
+
+
+ /* public void updatePoleLightemit(PoleLightemitEntity poleLightemit) {
+ this.updateById(poleLightemit);
+ poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId());
+ }*/
+
+ /**
+ * 鏌ヨ鏉冮檺鑼冨洿鍐呯殑鎵�鏈塴ed灞忎俊鎭�
+ *
+ * @param
+ * @return
+ */
+ /* public List<PoleLightemitEntity> selectLightemitByUserId(Long userId) {
+ List<PoleLightemitEntity> list = new ArrayList<>();
+
+ Long roleId = sysUserRoleService.queryRoleId(userId);
+
+ if(roleId == null || roleId == 0){
+ return new ArrayList<>();
+ }
+ if(roleId.longValue() == Constant.SUPER_ADMIN){
+ list = this.list();
+ }else if(roleId.longValue() == Constant.ADMIN){
+ list = baseMapper.selectCompanyLightemitByUserId(userId);
+ }else if(roleId.longValue() == Constant.USER){
+ list = baseMapper.selectLightemitByUserId(userId);
+ }
+ return list;
+ }
+*/
+ /*
+ 閫氳繃灞忓箷缂栫爜鏌ヨ
+ */
+ public PoleLightemitEntity selectByLightemitControlCode(String lightemitControlCode) {
+ QueryWrapper<PoleLightemitEntity> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("lightemit_control_code", lightemitControlCode);
+ return this.getOne(queryWrapper);
+ }
+
+ /*
+ led涓婁紶鍥剧墖
+ */
+ @Async("taskExecutor")
+ public void photoUpload(String lightemitControlCode, String path, List<String> filenameList, String userName) throws IOException {
+ //鑾峰彇灞忓箷瀹�
+ String screenWidth = lightemitUtils.getScreenWidth(lightemitControlCode);
+ String screenHeight = lightemitUtils.getScreenHeight(lightemitControlCode);
+
+ //html鍦板潃
+ String filenameTemp = path + userName + "_" + lightemitControlCode + ".html";
+ File htmlFile = new File(filenameTemp);
+ if (!htmlFile.exists() || htmlFile.delete()) {
+ htmlFile.createNewFile();
+ }
+
+ //鑾峰彇body鐨刪tml
+ Map<String, Object> params = new HashMap<>();
+ params.put("imgList", filenameList);
+ params.put("screenWidth", screenWidth);
+ params.put("screenHeight", screenHeight);
+
+ String body = new HtmlTemplateUtils().renderPath("classpath:templates/lightemitTemplates/photoTemplates.html", params);
+
+ boolean flag = new FileUtil().writeToFile(body, filenameTemp);
+
+ if (flag) {
+ //娓呭睆鎿嶄綔
+ lightemitUtils.clear(lightemitControlCode);
+ //娓呴櫎鎾斁鍒楄〃
+ lightemitUtils.clearVideoPlay(lightemitControlCode);
+ //娓呴櫎鑺傜洰鍒楄〃
+ lightemitUtils.clearPlayerTask(lightemitControlCode);
+ //鎺ㄩ�佸浘鐗�
+ lightemitUtils.postHtml(lightemitControlCode, userName);
+ }
+ }
+
+ /*
+ led涓婁紶瑙嗛
+ */
+
+ @Async("taskExecutor")
+ public void videoUpload(String lightemitControlCode, String filename, String path, String userName) throws IOException {
+ //鑾峰彇灞忓箷瀹�
+ String screenWidth = lightemitUtils.getScreenWidth(lightemitControlCode);
+ String screenHeight = lightemitUtils.getScreenHeight(lightemitControlCode);
+
+ //鍙戦�佽棰戣嚦寮�鍙戞澘骞舵挱鏀�
+ lightemitUtils.postVideo(screenWidth, screenHeight, filename, lightemitControlCode);
+
+ //娓呭睆
+ lightemitUtils.clear(lightemitControlCode);
+
+ }
+
+ /**
+ * 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;
+ }
+ }
+
+ /*
+ 鍒犻櫎
+ */
+
+ /* public void deleteByIds(List<Long> lightemitIds) {
+ this.removeByIds(lightemitIds);
+ //鍒犻櫎鍏崇郴琛ㄤ腑鐨勬暟鎹�
+ poleStreetlightLightemitService.remove(
+ new UpdateWrapper<PoleStreetlightLightemitEntity>().in("lightemit_id", lightemitIds.toArray()));
+ }*/
+
+ /*
+ 鐔欒瑙嗛璁剧疆
+ */
+
+ @Async("taskExecutor")
+ public void videoXixunPlayer(String lightemitControlCode, String ip, String filename, Long filesize, Integer videoTime) {
+ //鑾峰彇灞忓箷瀹�
+ Integer screenWidth = Integer.valueOf(lightemitUtils.getScreenWidth(lightemitControlCode));
+ Integer screenHeight = Integer.valueOf(lightemitUtils.getScreenHeight(lightemitControlCode));
+ Source source = new Source();
+ Layer layer = new Layer();
+ Program pro = new Program();
+ TaskItem items = new TaskItem();
+ ProgramsTask task = new ProgramsTask();
+ Command command = new Command();
+ XixunPlayer xixun = new XixunPlayer();
+ source.set_id(UUID.randomUUID().toString());//鎵�鏈塤id閮藉彲鐢║UID闅忔満鐢熸垚
+ source.setId(filename);//璇锋眰澶存嫾鎺ヨID涓鸿璧勬簮鐨勫畬鏁翠笅杞藉湴鍧�
+ source.set_type("Video"); //璁剧疆璧勬簮绫诲瀷锛屽叾浠栬祫婧愮被鍨嬭鍙傝�儀ixunplayer鑺傜洰json璇存槑鏂囨。
+ source.setFileExt(".mp4"); //璧勬簮鍚庣紑鍚�
+ source.setHeight(screenHeight); //璧勬簮楂樺害
+ source.setWidth(screenWidth); //璧勬簮瀹藉害
+ source.setLeft(0); //璺濆乏
+ source.setMd5("dd135d5d2d44d619a542db773ab529a4");
+ source.setMime("video/mp4");
+ source.setName(filename);
+ source.setPlayTime(0); //鎾斁璧峰鏃堕棿
+ source.setSize(filesize); //璧勬簮瀛楄妭鏁帮紝瑕佺簿鍑�
+ source.setTimeSpan(videoTime); //璇ヨ祫婧愭挱鏀炬椂闀�
+ source.setTop(0); //璺濋《
+ List<Source> list = new ArrayList<Source>();
+ list.add(source);
+ layer.setSources(list);
+ pro.set_id(UUID.randomUUID().toString());
+ pro.setHeight(screenHeight); //鑺傜洰楂樺害
+ List<Layer> list1 = new ArrayList<Layer>();
+ list1.add(layer);
+ pro.setLayers(list1);
+ pro.setName("demo"); //鑺傜洰鍚嶇О
+ pro.setOthers(true);//濡傛灉涓簍rue锛屽垯璇ヨ妭鐩潵鑷涓夋柟鎺ュ彛锛屼笉鏄潵鑷垜浠嚜宸辩殑web锛屼簩娆″紑鍙戣鍔″繀璧嬪�间负true
+ pro.setTotalSize(filesize); //鎵�鏈夎祫婧愭�诲瓧鑺傛暟
+ pro.setVersion(0); //楂樼骇鑺傜洰=0锛岀畝鏄撹妭鐩�=2
+ pro.setWidth(screenWidth); //鑺傜洰瀹藉害
+ items.set_id(UUID.randomUUID().toString());
+ items.set_program(pro);
+ items.setRepeatTimes(1);
+ items.setSchedules(null);//瀹氭椂娈碉紝涓嶅仛瀹氭椂鍙负null
+ task.set_id(UUID.randomUUID().toString());
+ task.setName("杩欐槸涓�涓ず渚�");
+ List<TaskItem> list2 = new ArrayList<TaskItem>();
+ list2.add(items);
+ task.setItems(list2);
+ command.setId(UUID.randomUUID().toString());
+ //杩欓噷鏄笅鏂圭殑post鍥炶皟鍦板潃锛岄渶瑕佷慨鏀笽P鍦板潃
+ command.setNotificationURL("http://" + ip + ":" + port + "/machine-fast/serv/download/getJSON");
+ //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご
+ command.setPreDownloadURL("http://" + ip + ":" + port + "/machine-fast/serv/download/downloadFile/");
+ command.setTask(task);
+ xixun.set_id(UUID.randomUUID().toString());
+ xixun.setCommand(command);
+ xixun.setType("commandXixunPlayer"); //鍛戒护鍥哄畾绫诲瀷锛屼笉鍙洿鏀�
+ String jsondata = new Gson().toJson(xixun);
+ lightemitUtils.clear(lightemitControlCode);
+ poleLightemitDao.updateRequestBody(lightemitControlCode, jsondata);
+ lightemitUtils.post(realtimeServerBean.getCommand() + lightemitControlCode, jsondata);
+ }
+
+ /*
+ 鎺ㄩ�佸ぉ姘旀暟鎹�
+ */
+
+ //@Async("taskExecutor")
+ /* public Boolean pushWeather(String lightemitControlCode, PoleSensorEntity sensorEntity, PoleStreetlightEntity streetlightEntity) {
+ if(StringUtils.isBlank(lightemitControlCode)){
+ return Boolean.valueOf(false);
+ }
+ Integer screenHeight = Integer.parseInt(lightemitUtils.getScreenHeight(lightemitControlCode));
+ String size = String.valueOf(screenHeight/18);
+ //瀛楀箷涓讳綋鎷兼帴
+ String body =
+ "<head><style type=\"text/css\">body{background-color:#000;}</style></head>" +
+ "<p style=\"font-size:" + size + "px;line-height:17px;color:#fff\">" +
+ (streetlightEntity == null || streetlightEntity.getCity() == null? "": streetlightEntity.getCity().replace("甯�", "")) + "<br/>" +
+ "娓╁害锛�" + (sensorEntity == null || sensorEntity.getTemperature() == null? "-": sensorEntity.getTemperature()) + "鈩�<br/>" +
+ "婀垮害锛�" + (sensorEntity == null || sensorEntity.getHumidity() == null? "-": sensorEntity.getHumidity()) + "%RH<br/>" +
+ "浜害锛�" + (sensorEntity == null || sensorEntity.getBrightness() == null? "-": sensorEntity.getBrightness()) + "lux<br/>" +
+ "椋庨�燂細" + (sensorEntity == null || sensorEntity.getWindSpeed() == null? "-": sensorEntity.getWindSpeed()) + "m/s<br/>" +
+ "CO2锛�" + (sensorEntity == null || sensorEntity.getEco2() == null? "-": sensorEntity.getEco2()) + "ppm<br/>" +
+ "鐢查啗锛�" + (sensorEntity == null || sensorEntity.getEch2o() == null? "-": sensorEntity.getEch2o()) + "mg/m鲁<br/>" +
+ "TVOC锛�" + (sensorEntity == null || sensorEntity.getTvoc() == null? "-": sensorEntity.getTvoc()) + "mg/m鲁<br/>" +
+ "PM25锛�" + (sensorEntity == null || sensorEntity.getPm25() == null? "-": sensorEntity.getPm25()) + "mg/m鲁<br/>" +
+ "PM10锛�" + (sensorEntity == null || sensorEntity.getPm10() == null? "-": sensorEntity.getPm10()) + "mg/m鲁<br/>";
+
+ //缁勮璇锋眰鍙傛暟
+ SubTitleSet subTitleSet = new SubTitleSet();
+ subTitleSet.html = body;
+ subTitleSet.num = 1;
+
+ //娓呭睆鎿嶄綔
+ lightemitUtils.clear(lightemitControlCode);
+ //娓呴櫎鎾斁鍒楄〃
+ lightemitUtils.clearVideoPlay(lightemitControlCode);
+ //娓呴櫎鑺傜洰鍒楄〃
+ lightemitUtils.clearPlayerTask(lightemitControlCode);
+ try{
+ lightemitUtils.subTitleSet(subTitleSet, lightemitControlCode, false);
+ return true;
+ }catch (Exception e){
+ return false;
+ }finally {
+ //涓�鍒嗛挓鍚庢竻闄ゅ睆骞�
+ new Timer().schedule(new TimerTask() {
+ @Override
+ public void run() {
+ lightemitUtils.clear(lightemitControlCode);
+ //娓呴櫎鎾斁鍒楄〃
+ lightemitUtils.clearVideoPlay(lightemitControlCode);
+ //娓呴櫎鑺傜洰鍒楄〃
+ lightemitUtils.clearPlayerTask(lightemitControlCode);
+ //鎺ㄩ�佹渶鍚庡懡浠�
+ lightemitUtils.sendLastCommand(lightemitControlCode);
+ }
+ }, 60*1000);
+ }
+ }*/
+
+ /*
+ 鏇存柊璇锋眰鏁版嵁
+ */
+
+ public void updateRequestBody(String ledCode, String postBody) {
+ baseMapper.updateRequestBody(ledCode, postBody);
+ }
+
+ /*
+ 鏍规嵁led灞忕紪鐮佽幏鍙栫伅鏉嗘墍鏈変俊鎭�
+ */
+
+// public PoleStreetlightEntity getStreetlightByLedCode(String ledCode) {
+// return baseMapper.getStreetlightByLedCode(ledCode);
// }
-//
-// /*@Override
-// public PageUtils queryPage(Map<String, Object> params, Long userId) {
-//
-// String key = (String)params.get("key");
-//
-// Long groupId = StringUtils.isNotBlank((String)params.get("group"))? Long.valueOf((String)params.get("group")): null;
-//
-// String order = (String)params.get("order");
-//
-// String column = (String)params.get("sortby");
-//
-// IPage<PoleLightemitEntity> page = new Page<>();
-// //鑾峰彇瑙掕壊鍒楄〃
-// Long roleId = (sysUserRoleService.queryRoleId(userId));
-//
-// if(roleId == null || roleId == 0){
-// return null;
-// }
-//
-// if(roleId.longValue() == Constant.SUPER_ADMIN){
-//// page = this.page(
-//// new Query<PoleLightemitEntity>().getPage(params),
-//// new QueryWrapper<PoleLightemitEntity>().like(StringUtils.isNotBlank(key),"lightemit_name", key));
-// if (order != null && order.equals("ASC") && column.equals("isOpen")) {
-// Map<String, Object> map = new HashMap<>();
-// Integer pg = 1;
-// Integer size = 200;
-// map.put("page",pg);
-// params.put("limit",size);
-// page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params),key,groupId,order,column);
-// ledOnlineCheck(page.getRecords());
-// page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
-// return new PageUtils(page);
-// }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
-// Map<String, Object> map = new HashMap<>();
-// Integer pg = 1;
-// Integer size = 200;
-// map.put("page",pg);
-// params.put("limit",size);
-// page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params),key,groupId,order,column);
-// ledOnlineCheck(page.getRecords());
-// page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
-// return new PageUtils(page);
-// }else {
-// page = baseMapper.superAdminSelectPageVo(PageTransform.transformPage(params), key, groupId,order,column);
-// }
-//
-// }else if(roleId.longValue() == Constant.ADMIN){
-// if (order != null && order.equals("ASC") && column.equals("isOpen")) {
-// Map<String, Object> map = new HashMap<>();
-// Integer pg = 1;
-// Integer size = 200;
-// map.put("page",pg);
-// params.put("limit",size);
-// page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
-// ledOnlineCheck(page.getRecords());
-// page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
-// return new PageUtils(page);
-// }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
-// Map<String, Object> map = new HashMap<>();
-// Integer pg = 1;
-// Integer size = 200;
-// map.put("page",pg);
-// params.put("limit",size);
-// page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
-// ledOnlineCheck(page.getRecords());
-// page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
-// return new PageUtils(page);
-// }else {
-// page = baseMapper.adminSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
-// }
-//
-// }else if(roleId.longValue() == Constant.USER){
-// if (order != null && order.equals("ASC") && column.equals("isOpen")) {
-// Map<String, Object> map = new HashMap<>();
-// Integer pg = 1;
-// Integer size = 200;
-// map.put("page",pg);
-// params.put("limit",size);
-// page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
-// ledOnlineCheck(page.getRecords());
-// page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(true)).collect(Collectors.toList()));
-// return new PageUtils(page);
-// }else if (order != null && order.equals("DESC") && column.equals("isOpen")){
-// Map<String, Object> map = new HashMap<>();
-// Integer pg = 1;
-// Integer size = 200;
-// map.put("page",pg);
-// params.put("limit",size);
-// page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
-// ledOnlineCheck(page.getRecords());
-// page.setRecords(page.getRecords().stream().filter(h-> h.getIsOpen().equals(false)).collect(Collectors.toList()));
-// return new PageUtils(page);
-// }else {
-// page = baseMapper.userSelectPageVo(PageTransform.transformPage(params), userId, key, groupId,order,column);
-// }
-//
-// }
-// ledOnlineCheck(page.getRecords());
-// return new PageUtils(page);
+
+ /*
+ 鏍规嵁led灞忕紪鐮佽缃煶閲�
+ */
+
+ @Async("taskExecutor")
+ public void setVolume(String lightemitControlCode, Integer volume) {
+ lightemitUtils.setVoiume(lightemitControlCode, volume);
+ }
+
+
+// public List<PoleLightemitEntity> listOfStreetlight(String streetlightId) {
+// return baseMapper.listOfStreetlight(streetlightId);
// }
-//*//*
-// @Override
-// public List<PoleLightemitEntity> getAll(Long userId) {
-// //鑾峰彇瑙掕壊鍒楄〃
-// Long roleId = (sysUserRoleService.queryRoleId(userId));
-//
-// if(roleId == null || roleId == 0){
-// return null;
-// }
-// List<PoleLightemitEntity> list = null;
-// if(roleId.longValue() == Constant.SUPER_ADMIN){
-// list = poleLightemitDao.selectAll();
-// }else if(roleId.longValue() == Constant.ADMIN){
-// list = poleLightemitDao.selectAllByCompany(userId);
-// }else if(roleId.longValue() == Constant.USER){
-// list = poleLightemitDao.selectAllByUser(userId);
-// }
-// return list;
+
+
+// public List<PoleLightemitEntity> selectLedByStreetlightId(String streetlightId) {
+// return baseMapper.getLedByStreetlightId(streetlightId);
// }
-//*/
-//
-///* public void ledOnlineCheck(List<PoleLightemitEntity> list) {
-//
-// for(PoleLightemitEntity poleLightemitEntity : list){
-// poleLightemitEntity.setIsOpen(lightemitUtils.getIsScreenOpen(poleLightemitEntity.getLightemitControlCode()).contains("true"));
-// }
-// }*/
-//
-//
-// /* public void savePoleLightemit(PoleLightemitEntity poleLightemit) {
-// this.save(poleLightemit);
-// poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId());
-// }*/
-//
-//
-// /* public void updatePoleLightemit(PoleLightemitEntity poleLightemit) {
-// this.updateById(poleLightemit);
-// poleStreetlightLightemitService.saveStreetlightLightemit(poleLightemit.getLightemitId(),poleLightemit.getStreetlightId());
-// }*/
-//
-// /**
-// * 鏌ヨ鏉冮檺鑼冨洿鍐呯殑鎵�鏈塴ed灞忎俊鎭�
-// * @param
-// * @return
-// */
-// /* public List<PoleLightemitEntity> selectLightemitByUserId(Long userId) {
-// List<PoleLightemitEntity> list = new ArrayList<>();
-//
-// Long roleId = sysUserRoleService.queryRoleId(userId);
-//
-// if(roleId == null || roleId == 0){
-// return new ArrayList<>();
-// }
-// if(roleId.longValue() == Constant.SUPER_ADMIN){
-// list = this.list();
-// }else if(roleId.longValue() == Constant.ADMIN){
-// list = baseMapper.selectCompanyLightemitByUserId(userId);
-// }else if(roleId.longValue() == Constant.USER){
-// list = baseMapper.selectLightemitByUserId(userId);
-// }
-// return list;
-// }
-//*/
-// /*
-// 閫氳繃灞忓箷缂栫爜鏌ヨ
-// */
-//
-// public PoleLightemitEntity selectByLightemitControlCode(String lightemitControlCode) {
-// QueryWrapper<PoleLightemitEntity> queryWrapper = new QueryWrapper<>();
-// queryWrapper.eq("lightemit_control_code", lightemitControlCode);
-// return this.getOne(queryWrapper);
-// }
-//
-// /*
-// led涓婁紶鍥剧墖
-// */
-// @Async("taskExecutor")
-// public void photoUpload(String lightemitControlCode, String path, List<String> filenameList, String userName) throws IOException {
-// //鑾峰彇灞忓箷瀹�
-// String screenWidth = lightemitUtils.getScreenWidth(lightemitControlCode);
-// String screenHeight = lightemitUtils.getScreenHeight(lightemitControlCode);
-//
-// //html鍦板潃
-// String filenameTemp = path + userName + "_"+lightemitControlCode + ".html";
-// File htmlFile = new File(filenameTemp);
-// if (!htmlFile.exists() || htmlFile.delete()) {
-// htmlFile.createNewFile();
-// }
-//
-// //鑾峰彇body鐨刪tml
-// Map<String, Object> params = new HashMap<>();
-// params.put("imgList",filenameList);
-// params.put("screenWidth",screenWidth);
-// params.put("screenHeight",screenHeight);
-//
-// String body = new HtmlTemplateUtils().renderPath("classpath:templates/lightemitTemplates/photoTemplates.html", params);
-//
-// boolean flag = new FileUtil().writeToFile(body, filenameTemp);
-//
-// if(flag){
-// //娓呭睆鎿嶄綔
-// lightemitUtils.clear(lightemitControlCode);
-// //娓呴櫎鎾斁鍒楄〃
-// lightemitUtils.clearVideoPlay(lightemitControlCode);
-// //娓呴櫎鑺傜洰鍒楄〃
-// lightemitUtils.clearPlayerTask(lightemitControlCode);
-// //鎺ㄩ�佸浘鐗�
-// lightemitUtils.postHtml(lightemitControlCode,userName);
-// }
-// }
-//
-// /*
-// led涓婁紶瑙嗛
-// */
-//
-// @Async("taskExecutor")
-// public void videoUpload(String lightemitControlCode, String filename, String path, String userName) throws IOException {
-// //鑾峰彇灞忓箷瀹�
-// String screenWidth = lightemitUtils.getScreenWidth(lightemitControlCode);
-// String screenHeight = lightemitUtils.getScreenHeight(lightemitControlCode);
-//
-// //鍙戦�佽棰戣嚦寮�鍙戞澘骞舵挱鏀�
-// lightemitUtils.postVideo(screenWidth, screenHeight, filename, lightemitControlCode);
-//
-// //娓呭睆
-// lightemitUtils.clear(lightemitControlCode);
-//
-// }
-//
-// /**
-// * 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;
-// }
-// }
-//
-// /*
-// 鍒犻櫎
-// */
-//
-// /* public void deleteByIds(List<Long> lightemitIds) {
-// this.removeByIds(lightemitIds);
-// //鍒犻櫎鍏崇郴琛ㄤ腑鐨勬暟鎹�
-// poleStreetlightLightemitService.remove(
-// new UpdateWrapper<PoleStreetlightLightemitEntity>().in("lightemit_id", lightemitIds.toArray()));
-// }*/
-//
-// /*
-// 鐔欒瑙嗛璁剧疆
-// */
-//
-// @Async("taskExecutor")
-// public void videoXixunPlayer(String lightemitControlCode, String ip, String filename, Long filesize, Integer videoTime) {
-// //鑾峰彇灞忓箷瀹�
+
+ /*
+ 涓婁紶姘村钩婊氬姩鍗曡瀛楀箷
+ */
+ 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);
+ }
+ }
+ }
+
+ /*
+ 涓婁紶鍨傜洿婊氬姩鍗曡瀛楀箷
+ */
+ 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);
+ }
+ }
+ }
+ }
+
+
+ /*
+ 涓婁紶鍨傜洿婊氬姩澶氳瀛楀箷
+ */
+ 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);
+ }
+ }
+ }
+ }
+
+ // @Override
+ public void xixunplaySetting(String lightemitControlCode) {
+ //鑾峰彇灞忓箷瀹�
// Integer screenWidth = Integer.valueOf(lightemitUtils.getScreenWidth(lightemitControlCode));
// Integer screenHeight = Integer.valueOf(lightemitUtils.getScreenHeight(lightemitControlCode));
// Source source = new Source();
@@ -345,7 +662,7 @@
// Program pro = new Program();
// TaskItem items = new TaskItem();
// ProgramsTask task = new ProgramsTask();
-// Command command = new Command();
+// Command payload = new Command();
// XixunPlayer xixun = new XixunPlayer();
// source.set_id(UUID.randomUUID().toString());//鎵�鏈塤id閮藉彲鐢║UID闅忔満鐢熸垚
// source.setId(filename);//璇锋眰澶存嫾鎺ヨID涓鸿璧勬簮鐨勫畬鏁翠笅杞藉湴鍧�
@@ -361,7 +678,7 @@
// source.setSize(filesize); //璧勬簮瀛楄妭鏁帮紝瑕佺簿鍑�
// source.setTimeSpan(videoTime); //璇ヨ祫婧愭挱鏀炬椂闀�
// source.setTop(0); //璺濋《
-// List<Source> list=new ArrayList<Source>();
+// List<Source> list = new ArrayList<Source>();
// list.add(source);
// layer.setSources(list);
// pro.set_id(UUID.randomUUID().toString());
@@ -383,329 +700,18 @@
// List<TaskItem> list2=new ArrayList<TaskItem>();
// list2.add(items);
// task.setItems(list2);
-// command.setId(UUID.randomUUID().toString());
+// payload.setId(UUID.randomUUID().toString());
// //杩欓噷鏄笅鏂圭殑post鍥炶皟鍦板潃锛岄渶瑕佷慨鏀笽P鍦板潃
-// command.setNotificationURL("http://" + ip + ":" + port + "/machine-fast/serv/download/getJSON");
+// payload.setNotificationURL("http://" + ip + ":" + port + "/machine-fast/serv/download/getJSON");
// //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご
-// command.setPreDownloadURL("http://" + ip + ":" + port + "/machine-fast/serv/download/downloadFile/");
-// command.setTask(task);
+// payload.setPreDownloadURL("http://" + ip + ":" + port + "/machine-fast/serv/download/downloadFile/");
+// payload.setTask(task);
// xixun.set_id(UUID.randomUUID().toString());
-// xixun.setCommand(command);
+// xixun.setCommand(payload);
// xixun.setType("commandXixunPlayer"); //鍛戒护鍥哄畾绫诲瀷锛屼笉鍙洿鏀�
// String jsondata = new Gson().toJson(xixun);
// lightemitUtils.clear(lightemitControlCode);
// this.updateRequestBody(lightemitControlCode,jsondata);
// lightemitUtils.post(realtimeServerBean.getCommand() + lightemitControlCode,jsondata);
-// }
-//
-// /*
-// 鎺ㄩ�佸ぉ姘旀暟鎹�
-// */
-//
-// //@Async("taskExecutor")
-// /* public Boolean pushWeather(String lightemitControlCode, PoleSensorEntity sensorEntity, PoleStreetlightEntity streetlightEntity) {
-// if(StringUtils.isBlank(lightemitControlCode)){
-// return Boolean.valueOf(false);
-// }
-// Integer screenHeight = Integer.parseInt(lightemitUtils.getScreenHeight(lightemitControlCode));
-// String size = String.valueOf(screenHeight/18);
-// //瀛楀箷涓讳綋鎷兼帴
-// String body =
-// "<head><style type=\"text/css\">body{background-color:#000;}</style></head>" +
-// "<p style=\"font-size:" + size + "px;line-height:17px;color:#fff\">" +
-// (streetlightEntity == null || streetlightEntity.getCity() == null? "": streetlightEntity.getCity().replace("甯�", "")) + "<br/>" +
-// "娓╁害锛�" + (sensorEntity == null || sensorEntity.getTemperature() == null? "-": sensorEntity.getTemperature()) + "鈩�<br/>" +
-// "婀垮害锛�" + (sensorEntity == null || sensorEntity.getHumidity() == null? "-": sensorEntity.getHumidity()) + "%RH<br/>" +
-// "浜害锛�" + (sensorEntity == null || sensorEntity.getBrightness() == null? "-": sensorEntity.getBrightness()) + "lux<br/>" +
-// "椋庨�燂細" + (sensorEntity == null || sensorEntity.getWindSpeed() == null? "-": sensorEntity.getWindSpeed()) + "m/s<br/>" +
-// "CO2锛�" + (sensorEntity == null || sensorEntity.getEco2() == null? "-": sensorEntity.getEco2()) + "ppm<br/>" +
-// "鐢查啗锛�" + (sensorEntity == null || sensorEntity.getEch2o() == null? "-": sensorEntity.getEch2o()) + "mg/m鲁<br/>" +
-// "TVOC锛�" + (sensorEntity == null || sensorEntity.getTvoc() == null? "-": sensorEntity.getTvoc()) + "mg/m鲁<br/>" +
-// "PM25锛�" + (sensorEntity == null || sensorEntity.getPm25() == null? "-": sensorEntity.getPm25()) + "mg/m鲁<br/>" +
-// "PM10锛�" + (sensorEntity == null || sensorEntity.getPm10() == null? "-": sensorEntity.getPm10()) + "mg/m鲁<br/>";
-//
-// //缁勮璇锋眰鍙傛暟
-// SubTitleSet subTitleSet = new SubTitleSet();
-// subTitleSet.html = body;
-// subTitleSet.num = 1;
-//
-// //娓呭睆鎿嶄綔
-// lightemitUtils.clear(lightemitControlCode);
-// //娓呴櫎鎾斁鍒楄〃
-// lightemitUtils.clearVideoPlay(lightemitControlCode);
-// //娓呴櫎鑺傜洰鍒楄〃
-// lightemitUtils.clearPlayerTask(lightemitControlCode);
-// try{
-// lightemitUtils.subTitleSet(subTitleSet, lightemitControlCode, false);
-// return true;
-// }catch (Exception e){
-// return false;
-// }finally {
-// //涓�鍒嗛挓鍚庢竻闄ゅ睆骞�
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// lightemitUtils.clear(lightemitControlCode);
-// //娓呴櫎鎾斁鍒楄〃
-// lightemitUtils.clearVideoPlay(lightemitControlCode);
-// //娓呴櫎鑺傜洰鍒楄〃
-// lightemitUtils.clearPlayerTask(lightemitControlCode);
-// //鎺ㄩ�佹渶鍚庡懡浠�
-// lightemitUtils.sendLastCommand(lightemitControlCode);
-// }
-// }, 60*1000);
-// }
-// }*/
-//
-// /*
-// 鏇存柊璇锋眰鏁版嵁
-// */
-//
-// public void updateRequestBody(String ledCode, String postBody) {
-// baseMapper.updateRequestBody(ledCode, postBody);
-// }
-//
-// /*
-// 鏍规嵁led灞忕紪鐮佽幏鍙栫伅鏉嗘墍鏈変俊鎭�
-// */
-//
-// public PoleStreetlightEntity getStreetlightByLedCode(String ledCode) {
-// return baseMapper.getStreetlightByLedCode(ledCode);
-// }
-//
-// /*
-// 鏍规嵁led灞忕紪鐮佽缃煶閲�
-// */
-//
-// @Async("taskExecutor")
-// public void setVolume(String lightemitControlCode, Integer volume) {
-// lightemitUtils.setVoiume(lightemitControlCode, volume);
-// }
-//
-//
-// public List<PoleLightemitEntity> listOfStreetlight(String streetlightId) {
-// return baseMapper.listOfStreetlight(streetlightId);
-// }
-//
-//
-// public List<PoleLightemitEntity> selectLedByStreetlightId(String streetlightId) {
-// return baseMapper.getLedByStreetlightId(streetlightId);
-// }
-//
-// /*
-// 涓婁紶姘村钩婊氬姩鍗曡瀛楀箷
-// */
-// 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);
-// }
-// }
-// }
-//
-// /*
-// 涓婁紶鍨傜洿婊氬姩鍗曡瀛楀箷
-// */
-// 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);
-// }
-// }
-// }
-// }
-//
-//
-// /*
-// 涓婁紶鍨傜洿婊氬姩澶氳瀛楀箷
-// */
-// 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);
-// }
-// }
-// }
-// }
-//
-// @Override
-// public void xixunplaySetting(String lightemitControlCode) {
-// //鑾峰彇灞忓箷瀹�
-//// Integer screenWidth = Integer.valueOf(lightemitUtils.getScreenWidth(lightemitControlCode));
-//// Integer screenHeight = Integer.valueOf(lightemitUtils.getScreenHeight(lightemitControlCode));
-//// Source source = new Source();
-//// Layer layer = new Layer();
-//// Program pro = new Program();
-//// TaskItem items = new TaskItem();
-//// ProgramsTask task = new ProgramsTask();
-//// Command payload = new Command();
-//// XixunPlayer xixun = new XixunPlayer();
-//// source.set_id(UUID.randomUUID().toString());//鎵�鏈塤id閮藉彲鐢║UID闅忔満鐢熸垚
-//// source.setId(filename);//璇锋眰澶存嫾鎺ヨID涓鸿璧勬簮鐨勫畬鏁翠笅杞藉湴鍧�
-//// source.set_type("Video"); //璁剧疆璧勬簮绫诲瀷锛屽叾浠栬祫婧愮被鍨嬭鍙傝�儀ixunplayer鑺傜洰json璇存槑鏂囨。
-//// source.setFileExt(".mp4"); //璧勬簮鍚庣紑鍚�
-//// source.setHeight(screenHeight); //璧勬簮楂樺害
-//// source.setWidth(screenWidth); //璧勬簮瀹藉害
-//// source.setLeft(0); //璺濆乏
-//// source.setMd5("dd135d5d2d44d619a542db773ab529a4");
-//// source.setMime("video/mp4");
-//// source.setName(filename);
-//// source.setPlayTime(0); //鎾斁璧峰鏃堕棿
-//// source.setSize(filesize); //璧勬簮瀛楄妭鏁帮紝瑕佺簿鍑�
-//// source.setTimeSpan(videoTime); //璇ヨ祫婧愭挱鏀炬椂闀�
-//// source.setTop(0); //璺濋《
-//// List<Source> list = new ArrayList<Source>();
-//// list.add(source);
-//// layer.setSources(list);
-//// pro.set_id(UUID.randomUUID().toString());
-//// pro.setHeight(screenHeight); //鑺傜洰楂樺害
-//// List<Layer> list1=new ArrayList<Layer>();
-//// list1.add(layer);
-//// pro.setLayers(list1);
-//// pro.setName("demo"); //鑺傜洰鍚嶇О
-//// pro.setOthers(true);//濡傛灉涓簍rue锛屽垯璇ヨ妭鐩潵鑷涓夋柟鎺ュ彛锛屼笉鏄潵鑷垜浠嚜宸辩殑web锛屼簩娆″紑鍙戣鍔″繀璧嬪�间负true
-//// pro.setTotalSize(filesize); //鎵�鏈夎祫婧愭�诲瓧鑺傛暟
-//// pro.setVersion(0); //楂樼骇鑺傜洰=0锛岀畝鏄撹妭鐩�=2
-//// pro.setWidth(screenWidth); //鑺傜洰瀹藉害
-//// items.set_id(UUID.randomUUID().toString());
-//// items.set_program(pro);
-//// items.setRepeatTimes(1);
-//// items.setSchedules(null);//瀹氭椂娈碉紝涓嶅仛瀹氭椂鍙负null
-//// task.set_id(UUID.randomUUID().toString());
-//// task.setName("杩欐槸涓�涓ず渚�");
-//// List<TaskItem> list2=new ArrayList<TaskItem>();
-//// list2.add(items);
-//// task.setItems(list2);
-//// payload.setId(UUID.randomUUID().toString());
-//// //杩欓噷鏄笅鏂圭殑post鍥炶皟鍦板潃锛岄渶瑕佷慨鏀笽P鍦板潃
-//// payload.setNotificationURL("http://" + ip + ":" + port + "/machine-fast/serv/download/getJSON");
-//// //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご
-//// payload.setPreDownloadURL("http://" + ip + ":" + port + "/machine-fast/serv/download/downloadFile/");
-//// payload.setTask(task);
-//// xixun.set_id(UUID.randomUUID().toString());
-//// xixun.setCommand(payload);
-//// xixun.setType("commandXixunPlayer"); //鍛戒护鍥哄畾绫诲瀷锛屼笉鍙洿鏀�
-//// String jsondata = new Gson().toJson(xixun);
-//// lightemitUtils.clear(lightemitControlCode);
-//// this.updateRequestBody(lightemitControlCode,jsondata);
-//// lightemitUtils.post(realtimeServerBean.getCommand() + lightemitControlCode,jsondata);
-// }
-//}
\ No newline at end of file
+ }
+}
\ No newline at end of file
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/RoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/RoleService.java
index 8ad8b8a..4fb38f6 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/RoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/RoleService.java
@@ -81,6 +81,9 @@
@Transactional(rollbackFor = Exception.class)
public boolean addRole(RoleParam param) {
+ if(param.getMenuIdList().isEmpty()){
+ throw new BusinessException("鏉冮檺鍙傛暟寮傚父");
+ }
Role role = new Role();
role.setName(param.getName());
role.setRemark(param.getRemark());
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 c7f89fe..e4cbf16 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
@@ -1,107 +1,132 @@
-//package com.sandu.ximon.admin.service;
-//
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.google.gson.Gson;
-//import com.google.gson.GsonBuilder;
-//import com.sandu.common.service.impl.BaseServiceImpl;
-//import com.sandu.ximon.admin.config.RealtimeServerBean;
-//import com.sandu.ximon.admin.config.XiXunConfig;
-//import com.sandu.ximon.admin.entity.*;
-//import com.sandu.ximon.admin.security.SecurityUtils;
-//import com.sandu.ximon.admin.utils.JsonUtil;
-//import com.sandu.ximon.admin.utils.LightemitUtils;
-//import com.sandu.ximon.dao.domain.PoleLightemitEntity;
-//import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
-//import com.sandu.ximon.dao.mapper.PoleXixunPlayerEntityMapper;
-//import lombok.AllArgsConstructor;
-//import org.springframework.stereotype.Service;
-//
-//import java.text.SimpleDateFormat;
-//import java.util.*;
-//
-//@Service
-//@AllArgsConstructor
-//public class XiXunPlayerService extends BaseServiceImpl<PoleXixunPlayerEntityMapper, PoleXixunPlayerEntity> {
-//
-// private final PoleXixunPlayerEntityMapper poleXixunPlayerEntityMapper;
-// private final XiXunConfig config;
-// private final LightemitUtils lightemitUtils;
-// private final RealtimeServerBean realtimeServerBean;
-//
-//
-// public void insert(ProgramPro programPro, Long userId) {
-// SimpleDateFormat sdf=new SimpleDateFormat("yy-MM-dd HH:mm:ss");
-// Date date = new Date();
-//// Program program = new Program();
-//// try {
-//// program = JsonUtil.convertJsonStringToObject(json,Program.class);
-//// } catch (Exception e) {
-//// e.printStackTrace();
-//// }
-// String json = JsonUtil.jsonObj2Sting(programPro);
-// PoleXixunPlayerEntity poleXixunPlayer = new PoleXixunPlayerEntity();
-// poleXixunPlayer.setProgramCode(programPro.get_id());
-// poleXixunPlayer.setProgramName(programPro.getName());
-// poleXixunPlayer.setHeight(programPro.getHeight());
-// poleXixunPlayer.setWidth(programPro.getWidth());
-// poleXixunPlayer.setTotalSize((float) programPro.getTotalSize()/1000000+"MB");
-// poleXixunPlayer.setRequestBody(json);
-// poleXixunPlayer.setCreatTime(sdf.format(date));
-// poleXixunPlayer.setCreateUserId(SecurityUtils.getClientId());
-//
-// this.save(poleXixunPlayer);
-// }
-//
-// public void videoXixunPlayer(long programId,Long[] lightemitIds) {
-//
-// ProgramPro pro = new ProgramPro();
-// ItemPro items = new ItemPro();
-// TaskPro taskPro = new TaskPro();
-// CommandPro command = new CommandPro();
-// XixunPlayerPro xixun = new XixunPlayerPro();
-// PoleXixunPlayerEntity poleXixunPlayerEntity = new PoleXixunPlayerEntity();
-// items.set_id(UUID.randomUUID().toString());
-// QueryWrapper<PoleXixunPlayerEntity> queryWrapper = new QueryWrapper<>();
-// queryWrapper.eq("program_id",programId);
-// poleXixunPlayerEntity = this.getOne(queryWrapper);
-// String json = poleXixunPlayerEntity.getRequestBody();
+package com.sandu.ximon.admin.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.sandu.common.execption.BusinessException;
+import com.sandu.common.service.impl.BaseServiceImpl;
+import com.sandu.ximon.admin.config.RealtimeServerBean;
+import com.sandu.ximon.admin.config.XiXunConfig;
+import com.sandu.ximon.admin.entity.*;
+import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.JsonUtil;
+import com.sandu.ximon.admin.utils.LightemitUtils;
+import com.sandu.ximon.dao.domain.PoleLightemitEntity;
+import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
+import com.sandu.ximon.dao.mapper.PoleXixunPlayerEntityMapper;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+@Service
+@AllArgsConstructor
+public class XiXunPlayerService extends BaseServiceImpl<PoleXixunPlayerEntityMapper, PoleXixunPlayerEntity> {
+
+ private final PoleXixunPlayerEntityMapper poleXixunPlayerEntityMapper;
+ private final XiXunConfig config;
+ private final LightemitUtils lightemitUtils;
+ private final RealtimeServerBean realtimeServerBean;
+ private final PoleLightemitService poleLightemitService;
+
+
+ public boolean insert(ProgramPro programPro) {
+ // SimpleDateFormat sdf=new SimpleDateFormat("yy-MM-dd HH:mm:ss");
+ // Date date = new Date();
+// Program program = new Program();
// try {
-// pro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
+// program = JsonUtil.convertJsonStringToObject(json,Program.class);
// } catch (Exception e) {
// e.printStackTrace();
// }
-// items.set_program(pro);
-// items.setRepeatTimes(1);
-// items.setSchedulePros(null);//瀹氭椂娈碉紝涓嶅仛瀹氭椂鍙负null
-// taskPro.set_id(UUID.randomUUID().toString());
-// taskPro.setName(poleXixunPlayerEntity.getProgramName());
-// List<ItemPro> list2=new ArrayList<ItemPro>();
-// list2.add(items);
-// taskPro.setItems(list2);
-// command.setId(UUID.randomUUID().toString());
-// //杩欓噷鏄笅鏂圭殑post鍥炶皟鍦板潃锛岄渶瑕佷慨鏀笽P鍦板潃
-// command.setNotificationURL("http://" + config.getIp() + ":" + config.getPort() + "/machine-fast/serv/download/getJSON");
-// //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご
-// command.setPreDownloadURL("http://" + config.getIp() + ":" + config.getPort() + "/machine-fast/serv/download/downliadFileById/");
-// command.setTask(taskPro);
-// xixun.set_id(UUID.randomUUID().toString());
-// xixun.setCommand(command);
-// xixun.setType("commandXixunPlayer"); //鍛戒护鍥哄畾绫诲瀷锛屼笉鍙洿鏀�
-//
-//
-// Gson gson = new GsonBuilder().disableHtmlEscaping().create();
-//// String jsondata = JSON.toJSONString(xixun);
-// String jsondata = gson.toJson(xixun);
-//
-//// Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(Arrays.asList(lightemitIds));
-////
-//// if(poleLightemitEntities != null){
-//// for (PoleLightemitEntity entity: poleLightemitEntities) {
-//// lightemitUtils.clear(entity.getLightemitControlCode());
-//// poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
-//// lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
-//// }
-//// }
-// }
-//
-//}
+ String json = JsonUtil.jsonObj2Sting(programPro);
+ PoleXixunPlayerEntity poleXixunPlayer = new PoleXixunPlayerEntity();
+ poleXixunPlayer.setProgramCode(programPro.get_id());
+ poleXixunPlayer.setProgramName(programPro.getName());
+ poleXixunPlayer.setHeight(programPro.getHeight());
+ poleXixunPlayer.setWidth(programPro.getWidth());
+ poleXixunPlayer.setTotalSize((float) programPro.getTotalSize() / 1000000 + "MB");
+ poleXixunPlayer.setRequestBody(json);
+ // poleXixunPlayer.setCreatTime(sdf.format(date));
+ poleXixunPlayer.setCreateUserId(SecurityUtils.getClientId());
+
+ return this.save(poleXixunPlayer);
+ }
+
+ public boolean deleteProgram(Long pid) {
+ PoleXixunPlayerEntity byId = getById(pid);
+ if (byId == null) {
+ throw new BusinessException("鏈壘鍒拌鑺傜洰");
+ }
+ return removeById(pid);
+ }
+
+ public Object getByPid(Long pid) {
+ PoleXixunPlayerEntity byId = getById(pid);
+ if (byId == null) {
+ throw new BusinessException("鏈壘鍒拌鑺傜洰");
+ }
+ String json = byId.getRequestBody();
+ ProgramPro programPro = new ProgramPro();
+ try {
+ programPro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return programPro;
+ }
+
+ public void videoXixunPlayer(long programId, List<Long> lightemitIds) {
+
+ ProgramPro pro = new ProgramPro();
+ ItemPro items = new ItemPro();
+ TaskPro taskPro = new TaskPro();
+ CommandPro command = new CommandPro();
+ XixunPlayerPro xixun = new XixunPlayerPro();
+ PoleXixunPlayerEntity poleXixunPlayerEntity = new PoleXixunPlayerEntity();
+ items.set_id(UUID.randomUUID().toString());
+ QueryWrapper<PoleXixunPlayerEntity> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("program_id", programId);
+ poleXixunPlayerEntity = this.getOne(queryWrapper);
+ String json = poleXixunPlayerEntity.getRequestBody();
+ try {
+ pro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ items.set_program(pro);
+ items.setRepeatTimes(1);
+ items.setSchedulePros(null);//瀹氭椂娈碉紝涓嶅仛瀹氭椂鍙负null
+ taskPro.set_id(UUID.randomUUID().toString());
+ taskPro.setName(poleXixunPlayerEntity.getProgramName());
+ List<ItemPro> list2 = new ArrayList<>();
+ list2.add(items);
+ taskPro.setItems(list2);
+ command.setId(UUID.randomUUID().toString());
+ //杩欓噷鏄笅鏂圭殑post鍥炶皟鍦板潃锛岄渶瑕佷慨鏀笽P鍦板潃
+ command.setNotificationURL("http://" + config.getIp() + ":" + config.getPort() + "/machine-fast/serv/download/getJSON");
+ //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご
+ command.setPreDownloadURL("http://" + config.getIp() + ":" + config.getPort() + "/machine-fast/serv/download/downliadFileById/");
+ command.setTask(taskPro);
+ xixun.set_id(UUID.randomUUID().toString());
+ xixun.setCommand(command);
+ xixun.setType("commandXixunPlayer"); //鍛戒护鍥哄畾绫诲瀷锛屼笉鍙洿鏀�
+
+
+ Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+// String jsondata = JSON.toJSONString(xixun);
+ String jsondata = gson.toJson(xixun);
+
+ Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(lightemitIds);
+
+ if(poleLightemitEntities != null){
+ for (PoleLightemitEntity entity: poleLightemitEntities) {
+ lightemitUtils.clear(entity.getLightemitControlCode());
+ poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
+ lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
+ }
+ }
+ }
+
+
+}
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 0fb8c5b..1c9e8ac 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
@@ -1,308 +1,318 @@
-//package com.sandu.ximon.admin.utils;
-//
-//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.*;
-//import com.sandu.ximon.dao.domain.PoleLightemitEntity;
-//import com.squareup.okhttp.*;
-//import org.apache.commons.lang.StringEscapeUtils;
-//import org.apache.commons.lang.StringUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.ApplicationContext;
-//import org.springframework.stereotype.Component;
-//
-//import java.io.IOException;
-//
-//@Component
-//public class LightemitUtils {
-// @Autowired
-// RealtimeServerBean realtimeServerBean;
-//
-// PoleLightemitService poleLightemitService;
-// @Autowired
-// ApplicationContext applicationContext;
-// @Autowired
-// NginxConfigBean nginxConfigBean;
-// //body灏佽缂栫爜
-// private final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
-//
-// private OkHttpClient client = new OkHttpClient();
-//
-//
+package com.sandu.ximon.admin.utils;
+
+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.*;
+import com.squareup.okhttp.*;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+@Component
+public class LightemitUtils {
+ @Autowired
+ RealtimeServerBean realtimeServerBean;
+
+ @Autowired
+ PoleLightemitService poleLightemitService;
+ @Autowired
+ ApplicationContext applicationContext;
+ @Autowired
+ NginxConfigBean nginxConfigBean;
+ //body灏佽缂栫爜
+ private final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
+
+ private OkHttpClient client = new OkHttpClient();
+
+
// public void init(){
// //閲嶆柊鑾峰彇鍗曚緥
// poleLightemitService = applicationContext.getBean(PoleLightemitService.class);
// }
-// /**
-// * post璇锋眰灏佽鏂规硶
-// * @param url url
-// * @param json body
-// * @return
-// */
-// public String post(String url, String json){
-// RequestBody body = RequestBody.create(JSON, json);
-// Request request = new Request.Builder()
-// .url(url)
-// .post(body)
-// .build();
-// try {
-// Response response = client.newCall(request).execute();
-// return response.body().string();
-// } catch (IOException e) {
-// LogUtils.error(e.getMessage());
-// return "";
-// }
-// }
-//
-// /**
-// * 鑾峰彇led灞忓搴�
-// * @param ledCode led灞忕紪鍙�
-// * @return
-// */
-// public String getScreenWidth(String ledCode){
-// String postBody = new Gson().toJson(new GetScreenWidth());
-// //璇锋眰鍦板潃
-// String url = realtimeServerBean.getCommand() + ledCode;
-// //璇锋眰
-// String result = post(url,postBody);
-// if(StringUtils.isNotBlank(result)){
-// try{
-// return JSONObject.parseObject(result).get("result").toString();
-// }catch (Exception e){
-// return "64";
-// }
-// }else{
-// return "64";
-// }
-// }
-//
-// /**
-// * 鑾峰彇led灞忛珮搴�
-// * @param ledCode led灞忕紪鍙�
-// * @return
-// */
-// public String getScreenHeight(String ledCode){
-// String postBody = new Gson().toJson(new GetScreenHeight());
-// //璇锋眰鍦板潃
-// String url = realtimeServerBean.getCommand() + ledCode;
-// //璇锋眰
-// String result = post(url,postBody);
-// if(StringUtils.isNotBlank(result)){
-// try{
-// return JSONObject.parseObject(result).get("result").toString();
-// }catch (Exception e){
-// return "64";
-// }
-// }else{
-// return "64";
-// }
-// }
-//
-// /**
-// * 娓呭睆鎿嶄綔
-// * @param ledCode
-// */
-// public void clear(String ledCode){
-// String postBody = new Gson().toJson(new Clear());
-// //璇锋眰鍦板潃
-// String url = realtimeServerBean.getCommand() + ledCode;
-// //璇锋眰
-//// poleLightemitService.updateRequestBody(ledCode, "");
-// String result = post(url,postBody);
-// }
-//
-// /**
-// * html浼犺緭鑷砽ed灞�
-// * @param ledCode
-// * @param username
-// */
-// public void postHtml(String ledCode, String username){
-//
-// PostHtml postHtml = new PostHtml(realtimeServerBean.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);
-// }
-// /**
-// * 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灞�
-// * @param screenWidth
-// * @param screenHeight
-// * @param filename
-// * @param ledCode
-// */
-// public void postVideo(String screenWidth, String screenHeight, String filename, String ledCode) {
-//
-// //led寮�鍙戞澘涓嬭浇瑙嗛璇锋眰body
-// DownloadFileToLocal downloadFileToLocal = new DownloadFileToLocal();
-// downloadFileToLocal.url = realtimeServerBean.getUrl() + filename;
-// downloadFileToLocal.path += filename;
-//
-// //led寮�鍙戞澘涓嬭浇瑙嗛璇锋眰
-// this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(downloadFileToLocal));
-//
-// //led寮�鍙戞澘瑙嗛鍒楄〃璇锋眰body
-// SetPlayList setPlayList = new SetPlayList();
-// setPlayList.list[0] = "/data/data/com.xixun.xy.conn/files/local/abc/"+filename;
-//// setPlayList.pathList[0] = "";
-// try{
-// setPlayList.width = Integer.valueOf(screenWidth);
-// setPlayList.height = Integer.valueOf(screenHeight);
-// }catch (Exception e){
-// return;
-// }
-// String postBody = new Gson().toJson(setPlayList);
-// //淇濆瓨led鏁版嵁
-// poleLightemitService.updateRequestBody(ledCode, postBody);
-// //led寮�鍙戞澘瑙嗛鍒楄〃璇锋眰
-// this.post(realtimeServerBean.getCommand() + ledCode, postBody);
-// }
-//
-// /**
-// * led灞忓瓧骞曡缃�
-// * @param subTitleSet
-// * @param ledCode
-// */
-// public void subTitleSet(SubTitleSet subTitleSet, String ledCode, Boolean isSave){
-// String postBody = new Gson().toJson(subTitleSet);
-// if(isSave == true){
-// poleLightemitService.updateRequestBody(ledCode, postBody);
-// }
-// this.post(realtimeServerBean.getCommand() + ledCode, postBody);
-// }
-//
-// /**
-// * 娓呴櫎鎾斁鍒楄〃
-// * @param ledCode
-// */
-// public void clearVideoPlay(String ledCode) {
-//// poleLightemitService.updateRequestBody(ledCode, "");
-// this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new ClearVideoPlay()));
-// }
-//
-// /**
-// * 娓呴櫎鑺傜洰鍒楄〃
-// * @param ledCode
-// */
-// public void clearPlayerTask(String ledCode) {
-//// poleLightemitService.updateRequestBody(ledCode, "");
-// this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new ClearPlayerTask()));
-// }
-//
-// /**
-// * 鑾峰彇led灞忕敾闈�
-// * @param ledCode
-// */
-// public String getPicture(String ledCode) {
-// String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new GetPicture()));
-// //鑾峰彇base64鍥剧墖鏁版嵁
-// if(StringUtils.isBlank(result)){
-// return "";
-// }
-// String re;
-//
-// try{
-// re = JSONObject.parseObject(result).get("result").toString();
-// }catch (Exception e){
-// re = "0";
-// }
-//
-// if(StringUtils.isBlank(re)){
-// return "";
-// }
-// //鍘婚櫎鎹㈣绗�
-// re.replaceAll("\r|\n*","");
-// return re;
-// }
-//
-// /**
-// * 鍒ゆ柇led灞忔槸鍚﹀紑鍚�
-// * @param ledCode
-// * @return
-// */
-// public String getIsScreenOpen(String ledCode){
-// String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new IsScreenOpen()));
-// //鑾峰彇base64鍥剧墖鏁版嵁
-// if(StringUtils.isNotBlank(result)){
-// String re;
-// try{
-// re = JSONObject.parseObject(result).get("result").toString();
-// }catch (Exception e){
-// re = "false";
-// }
-// return re;
-// }else{
-// return "";
-// }
-// }
-//
-// /*
-// 鍚姩xwalk
-// */
-// /*public void startActivity(String ledCode){
-// String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new StartActivity()));
-// }*/
-//
-// /*
-// 浣跨敤xwalk鍔犺浇缃戦〉
-// */
-// /*public void callXwalkFn(String ledCode,String username){
-//
-// CallXwalkFn callXwalkFn = new CallXwalkFn();
-//
-// callXwalkFn.setArgUrl(realtimeServerBean.getUrl() + username + "_" + ledCode + ".html");
-// String postBody = new Gson().toJson(callXwalkFn);
-//
-// //璇锋眰鍦板潃
-// String url = realtimeServerBean.getCommand() + ledCode;
-// //璇锋眰
-// String result = post(url,postBody);
-// }*/
-//
-// /*
-// 鎺у埗灞忓箷寮�鍏�
-// */
-// public String setScreenOpen(String ledCode, Boolean bool) {
-// String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new setScreenOpen(bool)));
-// //鑾峰彇base64鍥剧墖鏁版嵁
-// if(StringUtils.isNotBlank(result)){
-// String re = "";
-// try{
-// re = JSONObject.parseObject(result).get("result").toString();
-// }catch (Exception e){
-// re = "false";
-// }
-// return re;
-// }else{
-// return "";
-// }
-// }
-//
+
+ /**
+ * post璇锋眰灏佽鏂规硶
+ *
+ * @param url url
+ * @param json body
+ * @return
+ */
+ public String post(String url, String json) {
+ RequestBody body = RequestBody.create(JSON, json);
+ Request request = new Request.Builder()
+ .url(url)
+ .post(body)
+ .build();
+ try {
+ Response response = client.newCall(request).execute();
+ return response.body().string();
+ } catch (IOException e) {
+ LogUtils.error(e.getMessage());
+ return "";
+ }
+ }
+
+ /**
+ * 鑾峰彇led灞忓搴�
+ *
+ * @param ledCode led灞忕紪鍙�
+ * @return
+ */
+ public String getScreenWidth(String ledCode) {
+ String postBody = new Gson().toJson(new GetScreenWidth());
+ //璇锋眰鍦板潃
+ String url = realtimeServerBean.getCommand() + ledCode;
+ //璇锋眰
+ String result = post(url, postBody);
+ if (StringUtils.isNotBlank(result)) {
+ try {
+ return JSONObject.parseObject(result).get("result").toString();
+ } catch (Exception e) {
+ return "64";
+ }
+ } else {
+ return "64";
+ }
+ }
+
+ /**
+ * 鑾峰彇led灞忛珮搴�
+ *
+ * @param ledCode led灞忕紪鍙�
+ * @return
+ */
+ public String getScreenHeight(String ledCode) {
+ String postBody = new Gson().toJson(new GetScreenHeight());
+ //璇锋眰鍦板潃
+ String url = realtimeServerBean.getCommand() + ledCode;
+ //璇锋眰
+ String result = post(url, postBody);
+ if (StringUtils.isNotBlank(result)) {
+ try {
+ return JSONObject.parseObject(result).get("result").toString();
+ } catch (Exception e) {
+ return "64";
+ }
+ } else {
+ return "64";
+ }
+ }
+
+ /**
+ * 娓呭睆鎿嶄綔
+ *
+ * @param ledCode
+ */
+ public void clear(String ledCode) {
+ String postBody = new Gson().toJson(new Clear());
+ //璇锋眰鍦板潃
+ String url = realtimeServerBean.getCommand() + ledCode;
+ //璇锋眰
+// poleLightemitService.updateRequestBody(ledCode, "");
+ String result = post(url, postBody);
+ }
+
+ /**
+ * html浼犺緭鑷砽ed灞�
+ *
+ * @param ledCode
+ * @param username
+ */
+ public void postHtml(String ledCode, String username) {
+
+ PostHtml postHtml = new PostHtml(realtimeServerBean.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);
+ }
+ /**
+ * 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灞�
+ * @param screenWidth
+ * @param screenHeight
+ * @param filename
+ * @param ledCode
+ */
+ public void postVideo(String screenWidth, String screenHeight, String filename, String ledCode) {
+
+ //led寮�鍙戞澘涓嬭浇瑙嗛璇锋眰body
+ DownloadFileToLocal downloadFileToLocal = new DownloadFileToLocal();
+ downloadFileToLocal.url = realtimeServerBean.getUrl() + filename;
+ downloadFileToLocal.path += filename;
+
+ //led寮�鍙戞澘涓嬭浇瑙嗛璇锋眰
+ this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(downloadFileToLocal));
+
+ //led寮�鍙戞澘瑙嗛鍒楄〃璇锋眰body
+ SetPlayList setPlayList = new SetPlayList();
+ setPlayList.list[0] = "/data/data/com.xixun.xy.conn/files/local/abc/"+filename;
+// setPlayList.pathList[0] = "";
+ try{
+ setPlayList.width = Integer.valueOf(screenWidth);
+ setPlayList.height = Integer.valueOf(screenHeight);
+ }catch (Exception e){
+ return;
+ }
+ String postBody = new Gson().toJson(setPlayList);
+ //淇濆瓨led鏁版嵁
+ poleLightemitService.updateRequestBody(ledCode, postBody);
+ //led寮�鍙戞澘瑙嗛鍒楄〃璇锋眰
+ this.post(realtimeServerBean.getCommand() + ledCode, postBody);
+ }
+
+ /**
+ * led灞忓瓧骞曡缃�
+ * @param subTitleSet
+ * @param ledCode
+ */
+ public void subTitleSet(SubTitleSet subTitleSet, String ledCode, Boolean isSave){
+ String postBody = new Gson().toJson(subTitleSet);
+ if(isSave == true){
+ poleLightemitService.updateRequestBody(ledCode, postBody);
+ }
+ this.post(realtimeServerBean.getCommand() + ledCode, postBody);
+ }
+
+ /**
+ * 娓呴櫎鎾斁鍒楄〃
+ *
+ * @param ledCode
+ */
+ public void clearVideoPlay(String ledCode) {
+// poleLightemitService.updateRequestBody(ledCode, "");
+ this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new ClearVideoPlay()));
+ }
+
+ /**
+ * 娓呴櫎鑺傜洰鍒楄〃
+ *
+ * @param ledCode
+ */
+ public void clearPlayerTask(String ledCode) {
+// poleLightemitService.updateRequestBody(ledCode, "");
+ this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new ClearPlayerTask()));
+ }
+
+ /**
+ * 鑾峰彇led灞忕敾闈�
+ *
+ * @param ledCode
+ */
+ public String getPicture(String ledCode) {
+ String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new GetPicture()));
+ //鑾峰彇base64鍥剧墖鏁版嵁
+ if (StringUtils.isBlank(result)) {
+ return "";
+ }
+ String re;
+
+ try {
+ re = JSONObject.parseObject(result).get("result").toString();
+ } catch (Exception e) {
+ re = "0";
+ }
+
+ if (StringUtils.isBlank(re)) {
+ return "";
+ }
+ //鍘婚櫎鎹㈣绗�
+ re.replaceAll("\r|\n*", "");
+ return re;
+ }
+
+ /**
+ * 鍒ゆ柇led灞忔槸鍚﹀紑鍚�
+ *
+ * @param ledCode
+ * @return
+ */
+ public String getIsScreenOpen(String ledCode) {
+ String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new IsScreenOpen()));
+ //鑾峰彇base64鍥剧墖鏁版嵁
+ if (StringUtils.isNotBlank(result)) {
+ String re;
+ try {
+ re = JSONObject.parseObject(result).get("result").toString();
+ } catch (Exception e) {
+ re = "false";
+ }
+ return re;
+ } else {
+ return "";
+ }
+ }
+
+ /*
+ 鍚姩xwalk
+ */
+ /*public void startActivity(String ledCode){
+ String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new StartActivity()));
+ }*/
+
+ /*
+ 浣跨敤xwalk鍔犺浇缃戦〉
+ */
+ /*public void callXwalkFn(String ledCode,String username){
+
+ CallXwalkFn callXwalkFn = new CallXwalkFn();
+
+ callXwalkFn.setArgUrl(realtimeServerBean.getUrl() + username + "_" + ledCode + ".html");
+ String postBody = new Gson().toJson(callXwalkFn);
+
+ //璇锋眰鍦板潃
+ String url = realtimeServerBean.getCommand() + ledCode;
+ //璇锋眰
+ String result = post(url,postBody);
+ }*/
+
+ /*
+ 鎺у埗灞忓箷寮�鍏�
+ */
+ public String setScreenOpen(String ledCode, Boolean bool) {
+ String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new setScreenOpen(bool)));
+ //鑾峰彇base64鍥剧墖鏁版嵁
+ if (StringUtils.isNotBlank(result)) {
+ String re = "";
+ try {
+ re = JSONObject.parseObject(result).get("result").toString();
+ } catch (Exception e) {
+ re = "false";
+ }
+ return re;
+ } else {
+ return "";
+ }
+ }
+
// //鍙戦�佹渶鏂扮殑鏁版嵁
// public void sendLastCommand(String lightemitControlCode) {
// PoleLightemitEntity poleLightemitEntity = poleLightemitService.selectByLightemitControlCode(lightemitControlCode);
@@ -311,68 +321,70 @@
// }
// this.post(realtimeServerBean.getCommand() + lightemitControlCode, poleLightemitEntity.getRequestBody());
// }
-//
-// /*
-// 璁剧疆led闊抽噺
-// */
-// public void setVoiume(String ledCode,Integer volume){
-//
-// SetVolume setVolume = new SetVolume();
-// setVolume.arg1 = volume;
-// String postBody = new Gson().toJson(setVolume);
-//
-// //璇锋眰
-// String result = post(realtimeServerBean.getCommand() + ledCode,postBody);
-// }
-//
-// /*
-// 鑾峰彇led闊抽噺
-// */
-// /*public String getVoiume(String ledCode){
-// GetVolume getVolume = new GetVolume();
-// String postBody = new Gson().toJson(getVolume);
-//
-// //璇锋眰
-// String result = post(realtimeServerBean.getCommand() + ledCode,postBody);
-// //璇锋眰
-// if(StringUtils.isNotBlank(result)){
-// try{
-// return JSONObject.parseObject(result).get("result").toString();
-// }catch (Exception e){
-// return "0";
-// }
-// }else{
-// return "0";
-// }
-// }
-//*/
-// /**
-// * 鏌ヨ瀹氭椂
-// * @param ledCode
-// * @return
-// */
-// public String getTimeSchedule(String ledCode) {
-// String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new GetTimeSchedule()));
-// //鑾峰彇瀹氭椂json鏁版嵁
-//// Map map = new Gson().fromJson(result,Map.class);
-//// Gson gson = new Gson();
-//// Task task =gson.fromJson((String)gson.fromJson(result,Map.class).get("task"),Task.class);
-//// Schedules schedules =gson.fromJson((String)gson.fromJson(result,Map.class).get("schedule"),Schedules.class);
-// if(StringUtils.isBlank(result)){
-// return "";
-// }
-// String re;
-//
-// //鍘婚櫎瀛楃涓蹭腑鐨刓
-// re = StringEscapeUtils.unescapeJavaScript(result);
-// //鍘婚櫎瀛楃涓蹭腑鐨剗"
-// re = re.replace("}\"","}");
-// //鍘婚櫎瀛楃涓蹭腑"{
-// re = re.replace("\"{","{");
-// re = re.replace("\"null\"","{}");
-// if(StringUtils.isBlank(re)){
-// return "";
-// }
-// return re;
-// }
-//}
+
+ /*
+ 璁剧疆led闊抽噺
+ */
+ public void setVoiume(String ledCode, Integer volume) {
+
+ SetVolume setVolume = new SetVolume();
+ setVolume.arg1 = volume;
+ String postBody = new Gson().toJson(setVolume);
+
+ //璇锋眰
+ String result = post(realtimeServerBean.getCommand() + ledCode, postBody);
+ }
+
+ /*
+ 鑾峰彇led闊抽噺
+ */
+ /*public String getVoiume(String ledCode){
+ GetVolume getVolume = new GetVolume();
+ String postBody = new Gson().toJson(getVolume);
+
+ //璇锋眰
+ String result = post(realtimeServerBean.getCommand() + ledCode,postBody);
+ //璇锋眰
+ if(StringUtils.isNotBlank(result)){
+ try{
+ return JSONObject.parseObject(result).get("result").toString();
+ }catch (Exception e){
+ return "0";
+ }
+ }else{
+ return "0";
+ }
+ }
+*/
+
+ /**
+ * 鏌ヨ瀹氭椂
+ *
+ * @param ledCode
+ * @return
+ */
+ public String getTimeSchedule(String ledCode) {
+ String result = this.post(realtimeServerBean.getCommand() + ledCode, new Gson().toJson(new GetTimeSchedule()));
+ //鑾峰彇瀹氭椂json鏁版嵁
+// Map map = new Gson().fromJson(result,Map.class);
+// Gson gson = new Gson();
+// Task task =gson.fromJson((String)gson.fromJson(result,Map.class).get("task"),Task.class);
+// Schedules schedules =gson.fromJson((String)gson.fromJson(result,Map.class).get("schedule"),Schedules.class);
+ if (StringUtils.isBlank(result)) {
+ return "";
+ }
+ String re;
+
+ //鍘婚櫎瀛楃涓蹭腑鐨刓
+ re = StringEscapeUtils.unescapeJavaScript(result);
+ //鍘婚櫎瀛楃涓蹭腑鐨剗"
+ re = re.replace("}\"", "}");
+ //鍘婚櫎瀛楃涓蹭腑"{
+ re = re.replace("\"{", "{");
+ re = re.replace("\"null\"", "{}");
+ if (StringUtils.isBlank(re)) {
+ return "";
+ }
+ return re;
+ }
+}
--
Gitblit v1.9.3