From 77edfb324184d304ae7763aae3ab609f2b495da4 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 22 七月 2022 17:31:47 +0800
Subject: [PATCH] fix

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
index 7e7e050..b8e32a6 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
@@ -159,6 +159,13 @@
         if (deviceCode == null) {
             throw new BusinessException("璁惧缂栧彿涓嶈兘涓虹┖");
         }
+        if (SecurityUtils.getClientId() != null) {
+            //鏌ョ伅鏉嗗綊灞炲叧绯�
+            boolean belong = isBelong(deviceCode, null);
+            if (!belong) {
+                throw new BusinessException("璇ョ伅鏉嗕笉灞炰簬鎮紝鏃犳硶瑙g粦锛�");
+            }
+        }
         //鐩存帴鍒犻櫎璁惧涓嶉渶瑕佺伅鏉咺D
         PoleBinding one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode));
 
@@ -179,12 +186,9 @@
      *
      * @param deviceCode 璁惧缂栧彿
      * @param type       璁惧绫诲瀷
-     * @return 宸茬粦瀹氳繑鍥瀟rue锛屾湭缁戝畾杩斿洖false
+     * @return 灞炰簬璇ョ敤鎴疯繑鍥瀟rue锛屼笉鏄繑鍥瀎alse
      */
     public boolean isBelong(String deviceCode, String type) {
-        if (type.isEmpty() || deviceCode.isEmpty()) {
-            throw new BusinessException("璁惧缂栧彿鎴栫被鍨嬩笉鑳戒负绌�");
-        }
         Long userId = SecurityUtils.getClientId();
         Pole binding = baseMapper.getPoleByBinding(type, deviceCode, userId);
         if (binding != null) {

--
Gitblit v1.9.3