From 588e035b53b5d415fbacd21086b99a9b72c714f2 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 06 三月 2026 10:03:41 +0800
Subject: [PATCH] 更改头部

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java |   36 +++++-------------------------------
 1 files changed, 5 insertions(+), 31 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
index e8b905c..c30157f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
@@ -118,32 +118,7 @@
         if(device.getDoorNameObj()!=null && Constants.equalsInteger(device.getType(),Constants.DEVICE_TYPE.duanluqi)){
             device.setDoorName(JSONObject.toJSONString(device.getDoorNameObj()));
         }
-        Device model = deviceMapper.selectById(device.getId());
-        if(model ==null){
-            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
-        }
-        if(Constants.equalsInteger(model.getType(),Constants.DEVICE_TYPE.duanluqi)){
-            //濡傛灉鏄柗璺櫒
-            if( Constants.equalsInteger(model.getIsUsed(),Constants.ZERO)
-                    && StringUtils.equals(device.getDoorName(),model.getDoorName())){
-                //濡傛灉閰嶇疆鍙傛暟鍙戠敓浜嗗彉鍖�,璁剧疆鐘舵�佹湭鍚敤
-                device.setIsUsed(Constants.ONE);
-                try {
-                    MqttClient mqttClient = MqttClientCache.clientMapCache.get("device"+device.getId());
-                    if(mqttClient !=null){
-                        if(mqttClient.isConnected()){
-                            mqttClient.disconnect();
-                        }
-                        mqttClient.close();
-                        MqttClientCache.clientMapCache.remove("device"+device.getId());
-                    }
-                }catch (Exception e){
-                    log.error("==============绔彛mqtt閾炬帴澶辫触锛�"+model.getName()+e.getMessage());
-                }
-            }
-        }
         deviceMapper.updateById(device);
-
     }
 
     @Override
@@ -374,12 +349,11 @@
             //濡傛灉绯荤粺涓嶇敤浜嗭紝绔彛mqtt杩炴帴
             try {
                 mqttClient = mqttBizService.unsubscribe(mqttClient,config  ,topics);
-                if(mqttClient !=null){
-                    if(mqttClient.isConnected()){
-                        mqttClient.disconnect();
-                    }
-                    mqttClient.close();
-                    MqttClientCache.clientMapCache.remove("device"+param.getId());
+                if(mqttClient ==null){
+                    throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"寤虹珛杩炴帴澶辫触锛�");
+                }
+                if(mqttClient.isConnected()){
+                    mqttClient.disconnect();
                 }
             }catch (Exception e){
                 log.error("==============绔彛mqtt閾炬帴澶辫触锛�"+model.getName()+e.getMessage());

--
Gitblit v1.9.3