From bfce748e37a753c729e15dd233600379f504d019 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期四, 28 四月 2022 13:59:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
index 709c063..d4e8de8 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -30,6 +30,7 @@
 import com.sandu.ximon.admin.param.*;
 import com.sandu.ximon.admin.redis.LightKey;
 import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.LightemitUtils;
 import com.sandu.ximon.admin.utils.RedisUtils;
 import com.sandu.ximon.admin.utils.response.VnnoxResult;
 import com.sandu.ximon.admin.vo.PoleBindVO;
@@ -873,6 +874,12 @@
      */
     public boolean pushAirDataToXiXun(Long poleId) {
         Pole pole = getById(poleId);
+        //鍒ゆ柇褰掑睘鏉�
+        if (SecurityUtils.getClientId() != null) {
+            if (!pole.getClientId().equals(SecurityUtils.getUserId()) && !pole.getUserId().equals(SecurityUtils.getUserId())) {
+                throw new BusinessException("鏃犳潈闄愭搷浣�");
+            }
+        }
         PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
         PoleBinding xixun = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 10));
         if (pole == null) {
@@ -890,6 +897,27 @@
         return SpringContextHolder.getBean(XiXunPlayerService.class).pushWeather(xixun.getDeviceCode(), data, pole);
     }
 
+
+    /**
+     * 鍏抽棴鐔欒澶ф皵鎺ㄩ��
+     */
+    public void closeXiXunAirPush(Long poleId) {
+        Pole pole = getById(poleId);
+        if (SecurityUtils.getClientId() != null) {
+            if (!pole.getClientId().equals(SecurityUtils.getUserId()) && !pole.getUserId().equals(SecurityUtils.getUserId())) {
+                throw new BusinessException("鏃犳潈闄愭搷浣�");
+            }
+        }
+        PoleBinding air = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 3));
+        PoleBinding xixun = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getPoleId, poleId).eq(PoleBinding::getDeviceType, 10));
+        if (pole == null || air == null || xixun == null) {
+            throw new BusinessException("璁惧涓嶅瓨鍦�");
+        }
+        //鍏抽棴鎺ㄩ��
+        SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
+
+    }
+
     /**
      * 鎺ㄩ�佸ぇ姘旂洃娴嬫暟鎹埌novaLED
      */

--
Gitblit v1.9.3