From dda268997ca8f8a364f7c19b45d7a43a50a98efe Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 25 十月 2022 18:00:11 +0800
Subject: [PATCH] changes

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java |  523 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 416 insertions(+), 107 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
index c7f89fe..102a414 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,416 @@
-//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();
-//        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<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);
-////            }
-////        }
-//    }
-//
-//}
+package com.sandu.ximon.admin.service;
+
+import cn.hutool.json.JSONUtil;
+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.github.pagehelper.PageHelper;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.sandu.common.execption.BusinessException;
+import com.sandu.common.object.BaseConditionVO;
+import com.sandu.common.service.impl.BaseServiceImpl;
+import com.sandu.ximon.admin.config.RealtimeServerBean;
+import com.sandu.ximon.admin.entity.*;
+import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame;
+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.admin.utils.LogUtils;
+import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
+import com.sandu.ximon.admin.utils.request.SubTitleSet;
+import com.sandu.ximon.dao.domain.LedSFile;
+import com.sandu.ximon.dao.domain.Pole;
+import com.sandu.ximon.dao.domain.PoleLightemitEntity;
+import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
+import com.sandu.ximon.dao.enums.OrderByEnums;
+import com.sandu.ximon.dao.mapper.PoleXixunPlayerEntityMapper;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * 鐔欒鑺傜洰
+ */
+@Service
+@AllArgsConstructor
+public class XiXunPlayerService extends BaseServiceImpl<PoleXixunPlayerEntityMapper, PoleXixunPlayerEntity> {
+
+    private final LightemitUtils lightemitUtils;
+    private final RealtimeServerBean realtimeServerBean;
+    private final PoleLightemitService poleLightemitService;
+    private final ClientService clientService;
+    private final LedSFileService xiXunFileService;
+
+    //鐔欒鑺傜洰鍒楄〃
+    public LambdaQueryWrapper<PoleXixunPlayerEntity> XixunPlayerList(String keyword) {
+        if (SecurityUtils.getClientId() == null) {
+            if (keyword != null && keyword.isEmpty()) {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class);
+            } else {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
+            }
+
+        } else {
+            if (keyword != null && keyword.isEmpty()) {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).eq(PoleXixunPlayerEntity::getCreateUserId, SecurityUtils.getUserId())
+                        .or(w -> {
+                            w.eq(PoleXixunPlayerEntity::getClientId, SecurityUtils.getClientId());
+                        });
+            } else {
+                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).eq(PoleXixunPlayerEntity::getCreateUserId, SecurityUtils.getUserId())
+                        .or(w -> {
+                            w.eq(PoleXixunPlayerEntity::getClientId, SecurityUtils.getClientId());
+                        }).like(PoleXixunPlayerEntity::getProgramName, keyword);
+            }
+        }
+    }
+
+    public List<PoleXixunPlayerEntity> listProgram(BaseConditionVO baseConditionVO, Integer order, Integer seq, String keyword) {
+        LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = XixunPlayerList(keyword);
+        //鎺掑簭瀛楁
+        String orderByResult = "program_id";
+        //姝e簭銆佸�掑彊
+        String orderBySeq = OrderByEnums.ASC.getCode();
+        if (order != null) {
+            switch (order) {
+                case 1:
+                    orderByResult = OrderByEnums.LED_S_PROGRAM_CREATE_TIME.getCode();
+                    break;
+                default:
+            }
+        }
+        if (seq != null) {
+            switch (seq) {
+                case 1:
+                    orderBySeq = " ASC";
+                    break;
+                case 2:
+                    orderBySeq = " DESC";
+                    break;
+                default:
+                    break;
+            }
+        }
+        //鎺掑簭鏂瑰紡
+        String orderBy = orderByResult + " " + orderBySeq;
+        if (baseConditionVO != null) {
+            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
+        }
+        return list(wrapper);
+    }
+
+    public boolean insert(ProgramPro programPro) {
+        Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+        String json = gson.toJson(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.setScreenShot(programPro.getScreenShot());
+        if (SecurityUtils.getClientId() != null) {
+            poleXixunPlayer.setCreateUserId(SecurityUtils.getUserId());
+            if (clientService.findClientId()) {
+                poleXixunPlayer.setClientId(clientService.getClientId());
+            }
+        }
+        boolean save = this.save(poleXixunPlayer);
+        /**
+         * 鐔欐睕鑺傜洰鏂板鏃ュ織璁板綍寮�濮�
+         */
+        String content = "{鑺傜洰id锛�" + poleXixunPlayer.getProgramId()
+                + "锛� 鑺傜洰鍚嶇О锛�" + poleXixunPlayer.getProgramName()
+                + "锛� 鑺傜洰鍐呭锛�" + json
+                + " }";
+        StoreOperationRecordsUtils.storeOperationData(null, null, "鐔欐睕鑺傜洰娣诲姞", content);
+        /**
+         * 鐔欐睕鑺傜洰鏂板鏃ュ織璁板綍缁撴潫
+         */
+        return save;
+    }
+
+    /**
+     * 缂栬緫
+     *
+     * @param programPro
+     * @return
+     */
+    public boolean update(ProgramPro programPro) {
+        Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+        String json = gson.toJson(programPro);
+//        String jsondata = 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.setScreenShot(programPro.getScreenShot());
+        if (SecurityUtils.getClientId() != null) {
+            poleXixunPlayer.setCreateUserId(SecurityUtils.getUserId());
+            if (clientService.findClientId()) {
+                poleXixunPlayer.setClientId(clientService.getClientId());
+            }
+        }
+        poleXixunPlayer.setProgramId(programPro.getProgramId());
+        boolean updateResult = updateById(poleXixunPlayer);
+        /**
+         * 鐔欐睕鑺傜洰鏂板鏃ュ織璁板綍寮�濮�
+         */
+        String content = "{鑺傜洰id锛�" + poleXixunPlayer.getProgramId()
+                + "锛� 鑺傜洰鍚嶇О锛�" + poleXixunPlayer.getProgramName()
+                + "锛� 鑺傜洰鍐呭锛�" + json
+                + " }";
+        StoreOperationRecordsUtils.storeOperationData(null, null, "鐔欐睕鑺傜洰缂栬緫", content);
+        /**
+         * 鐔欐睕鑺傜洰鏂板鏃ュ織璁板綍缁撴潫
+         */
+        return updateResult;
+    }
+
+    public boolean deleteProgram(Long pid) {
+        PoleXixunPlayerEntity byId = getById(pid);
+        if (byId == null) {
+            throw new BusinessException("鏈壘鍒拌鑺傜洰");
+        }
+        /**
+         * 鐔欐睕鑺傜洰鍒犻櫎鏃ュ織璁板綍寮�濮�
+         */
+        String content = "{鍒犻櫎鐨勮妭鐩甶d锛�" + byId.getProgramId()
+                + "锛� 鍒犻櫎鐨勮妭鐩悕绉帮細" + byId.getProgramName()
+                + " }";
+        StoreOperationRecordsUtils.storeOperationData(null, null, "鐔欐睕鑺傜洰鍒犻櫎", content);
+        /**
+         * 鐔欐睕鑺傜洰鍒犻櫎鏃ュ織璁板綍缁撴潫
+         */
+        return removeById(pid);
+    }
+
+    public Object getByPid(Long pid) {
+        PoleXixunPlayerEntity byId = getById(pid);
+        List<Long> fileIds = new ArrayList<>();
+        List<LedSFile> file = new ArrayList<>();
+        if (byId == null) {
+            throw new BusinessException("鏈壘鍒拌鑺傜洰");
+        }
+        String json = byId.getRequestBody();
+        ProgramPro programPro = new ProgramPro();
+        try {
+            Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+//            programPro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
+            programPro = gson.fromJson(json, ProgramPro.class);
+            programPro.setProgramId(pid);
+            programPro.setScreenShot(byId.getScreenShot());
+            programPro.getLayers().forEach(
+                    layerPro -> {
+                        layerPro.getSources().forEach(
+                                sourcePro -> {
+                                    long fileId = Long.parseLong(sourcePro.getId());
+                                    file.add(xiXunFileService.getById(fileId));
+                                }
+                        );
+                    }
+            );
+            programPro.setFileList(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return programPro;
+    }
+
+
+    /**
+     * 鎺ㄩ�佽妭鐩�
+     *
+     * @param programId
+     * @param lightemitIds
+     */
+    public List<Map> videoXixunPlayer(long programId, List<Long> lightemitIds) {
+        //璁板綍鎿嶄綔缁撴灉
+        List<Map> mapList = new ArrayList<>();
+
+
+        ItemPro items = new ItemPro();
+        TaskPro taskPro = new TaskPro();
+        CommandPro command = new CommandPro();
+        XixunPlayerPro xixun = new XixunPlayerPro();
+
+        PoleXixunPlayerEntity poleXixunPlayerEntity;
+        items.set_id(UUID.randomUUID().toString());
+        QueryWrapper<PoleXixunPlayerEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("program_id", programId);
+        poleXixunPlayerEntity = this.getOne(queryWrapper);
+        if (poleXixunPlayerEntity == null) {
+            throw new BusinessException("鑺傜洰鏁版嵁寮傚父锛�");
+        }
+
+        String json = poleXixunPlayerEntity.getRequestBody();
+        if (StringUtils.isEmpty(json)) {
+            throw new BusinessException("鑺傜洰鏁版嵁寮傚父锛�");
+        }
+
+        ProgramPro pro;
+        try {
+            pro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
+            pro.getLayers().forEach(layerPro -> {
+                layerPro.getSources().forEach(sourcePro -> {
+                    long fileId = Long.parseLong(sourcePro.getId());
+                    LedSFile file = xiXunFileService.getById(fileId);
+                    if (file != null) {
+                        String fileUrl = file.getFileUrl();
+                        String[] split = fileUrl.split("/");
+                        sourcePro.setId(split[split.length - 1]);
+                        sourcePro.setMd5(file.getMd5());
+                    }
+                });
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new BusinessException("鑺傜洰鏁版嵁寮傚父锛�");
+        }
+        items.set_program(pro);
+        items.setRepeatTimes(1);
+        //瀹氭椂娈碉紝涓嶅仛瀹氭椂鍙负null
+        items.setSchedulePros(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("");
+        //璧勬簮涓嬭浇閾炬帴鐨勮姹傚ご锛岄樋閲屼簯鍥剧墖涓嬭浇鍦板潃澶�
+        command.setPreDownloadURL("https://ximonsmart.oss-cn-shanghai.aliyuncs.com/");
+        command.setTask(taskPro);
+
+        xixun.set_id(UUID.randomUUID().toString());
+        xixun.setCommand(command);
+        //鍛戒护鍥哄畾绫诲瀷锛屼笉鍙洿鏀�
+        xixun.setType("commandXixunPlayer");
+
+
+        Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+        String jsondata = gson.toJson(xixun);
+        System.out.println("鎺ㄩ�佸唴瀹�" + JSONUtil.toJsonStr(jsondata));
+
+
+        Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(lightemitIds);
+
+        if (poleLightemitEntities != null) {
+            Map map;
+            for (PoleLightemitEntity entity : poleLightemitEntities) {
+                map = new LinkedHashMap();
+                String clearResult = lightemitUtils.clear(entity.getLightemitControlCode());
+                if (clearResult.contains("does not exist")) {
+                    map.put("LightemitId", entity.getLightemitId());
+                    map.put("Result", "澶辫触");
+                    mapList.add(map);
+                } else {
+                    poleLightemitService.updateRequestBody(entity.getLightemitControlCode(), jsondata);
+                    String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), jsondata);
+                    //{"_type":"success","_id":"ce8dc3ff-dc88-43b7-8f55-60abd8700f1a","timestamp":1653555160535}
+                    if (post.startsWith("{") && post.endsWith("}") && post.contains("_type\":\"success")) {
+                        map.put("LightemitId", entity.getLightemitId());
+                        map.put("Result", "鎴愬姛");
+                        mapList.add(map);
+                    } else {
+                        map.put("LightemitId", entity.getLightemitId());
+                        map.put("Result", "澶辫触");
+                        mapList.add(map);
+                    }
+                    LogUtils.error("缁撴灉:" + post);
+                }
+            }
+        }
+
+
+        /**
+         * 鐔欐睕鑺傜洰鎺ㄩ�佹棩蹇楄褰曞紑濮�
+         */
+        List<String> listCode = new ArrayList<>();
+        for (PoleLightemitEntity bean : poleLightemitEntities) {
+            listCode.add(bean.getLightemitControlCode());
+        }
+        String content = "{鑺傜洰id锛�" + programId
+                + "锛� 鑺傜洰鍚嶇О锛�" + poleXixunPlayerEntity.getProgramName()
+                + "锛� 鑺傜洰鍐呭锛�" + json
+                + " }";
+        StoreOperationRecordsUtils.storeOperationData(listCode, null, "鐔欐睕鑺傜洰鎺ㄩ��", content);
+        /**
+         * 鐔欐睕鑺傜洰鎺ㄩ�佹棩蹇楄褰曠粨鏉�
+         */
+
+        return mapList;
+    }
+
+
+    /**
+     * 鎺ㄩ�佸ぇ姘旀暟鎹埌鐔欒LED
+     */
+    @Async("taskExecutor")
+    public Boolean pushWeather(String lightemitControlCode, A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage sensorEntity, Pole 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.getLightIntensity() == null ? "-" : sensorEntity.getLightIntensity()) + "lux<br/>" +
+                        "椋庨�燂細" + (sensorEntity == null || sensorEntity.getWindSpeed() == null ? "-" : sensorEntity.getWindSpeed()) + "m/s<br/>" +
+                        "CO2锛�" + (sensorEntity == null || sensorEntity.getCo2() == null ? "-" : sensorEntity.getCo2()) + "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);
+        }
+    }
+
+}

--
Gitblit v1.9.3