Browse Source

fix:
删除用户后导致app卡死不能使用

18339543638 1 year ago
parent
commit
85ff5fe9a4

+ 7 - 0
djkla

@@ -0,0 +1,7 @@
+  captcha
+* dev
+  lifang
+  local-master
+  local-slave
+  master
+  nb-pc-rabbitmq

+ 2 - 2
nb-admin/src/main/java/com/nb/admin/AdminApplication.java

@@ -4,7 +4,7 @@ import com.nb.common.config.properties.DruidProperties;
 import com.nb.common.config.web.RequestCheckProperties;
 import org.mybatis.spring.annotation.MapperScan;
 import org.redisson.spring.starter.RedissonAutoConfiguration;
-import org.springframework.amqp.rabbit.annotation.EnableRabbit;
+//import org.springframework.amqp.rabbit.annotation.EnableRabbit;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
@@ -37,7 +37,7 @@ exclude = {RedisAutoConfiguration.class,RedissonAutoConfiguration.class})
 @EnableScheduling
 @EnableAsync
 @EnableCaching
-@EnableRabbit
+//@EnableRabbit
 @MapperScan({"com.nb.**.mapper"})
 @EnableConfigurationProperties({RequestCheckProperties.class, DruidProperties.class})
 @ServletComponentScan(basePackages = "com.nb.common.config")

+ 5 - 5
nb-admin/src/main/resources/application-dev.yml

@@ -100,11 +100,11 @@ spring:
         max-active: 16
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
-  rabbitmq:
-    password: guest
-    host: 192.168.100.32
-    port: 5672
-    username: guest
+#  rabbitmq:
+#    password: guest
+#    host: 192.168.100.32
+#    port: 5672
+#    username: guest
 request:
   check:
     enable: false

+ 1 - 1
nb-admin/src/main/resources/application.yml

@@ -108,4 +108,4 @@ management:
         include: heapdump,metrics
 hospital:
   code: 123
-  name: 测试医院
+  name: 中央监护管理系统

+ 3 - 0
nb-admin/src/main/resources/db/migration/V1_init_20230802.sql

@@ -638,6 +638,8 @@ CREATE TABLE `bus_hospital`  (
                                UNIQUE INDEX `code`(`code`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '医院-医院信息表' ROW_FORMAT = Dynamic;
 
+INSERT INTO `nbnetpump`.`bus_hospital`(`tenant_id`, `area_code`, `address`, `name`, `telephone`, `strategy`, `email`, `coordinate`, `script_version`, `draft_script`, `script_online`, `script`, `device_count`, `update_config`, `code`, `create_time`, `create_by`, `update_time`, `update_by`, `is_delete`, `remark`) VALUES ('1', NULL, NULL, '中央监护管理系统', NULL, 0, NULL, '{\"lat\":\"114.658855\",\"lon\":\"35.135106\"}', NULL, NULL, 0, NULL, NULL, NULL, '123', '2024-01-24 15:15:21.371', '1', '2024-01-24 15:15:22.068', '1', 0, '系统级医院,不可删除、修改');
+
 -- ----------------------------
 -- Table structure for bus_hospital_config
 -- ----------------------------
@@ -886,6 +888,7 @@ CREATE TABLE `im_room`  (
                           `doctor_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '医生id',
                           `sponsor_type` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '发起人类型 0、看护人发起 1、医生发起',
                           `total_count` int(11) NOT NULL COMMENT '聊天室总消息数 ',
+                          `doctor_top` tinyint(1) NULL DEFAULT NULL COMMENT '医生聊天室置顶',
                           `monitor_finished` tinyint(1) NULL DEFAULT NULL COMMENT '是否监控结束',
                           `monitor_finished_time` datetime(3) NULL DEFAULT NULL COMMENT '监控结束时间',
                           `bind_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绑定id',

+ 4 - 4
nb-service/iot-service/pom.xml

@@ -28,9 +28,9 @@
             <version>1.0</version>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-amqp</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.springframework.boot</groupId>-->
+            <!--<artifactId>spring-boot-starter-amqp</artifactId>-->
+        <!--</dependency>-->
     </dependencies>
 </project>

+ 2 - 2
nb-service/iot-service/src/main/java/com/nb/aliyun/controller/IotController.java

@@ -45,11 +45,11 @@ public class IotController {
     private final IDeviceClient deviceService;
     private final ExecutorService executorService=new DefaultEventLoopGroup();
     /**
-     * 分配菜单
+     * 数据保存
      */
     @PostMapping("/data/save")
     @SaIgnore
-    public R assignMenu(@Validated @RequestBody BusDeviceRunningEntity source) {
+    public R assignMenu(@RequestBody BusDeviceRunningEntity source) {
         if(StrUtil.isBlank(source.getDeviceId())){
             throw new CustomException("[deviceId]设备id不能为空");
         }

+ 22 - 22
nb-service/iot-service/src/main/java/com/nb/aliyun/service/distribute/MasterDistributeQueueConfig.java

@@ -1,22 +1,22 @@
-package com.nb.aliyun.service.distribute;
-
-import com.nb.aliyun.service.AliIotConstant;
-import lombok.AllArgsConstructor;
-import org.springframework.amqp.core.DirectExchange;
-import org.springframework.context.annotation.Bean;
-import org.springframework.stereotype.Component;
-
-/**
- * @ClassName : RabbitMqChannelConfig
- * @Description :
- * @Author : LF
- * @Date: 2023年07月31日
- */
-//@Component
-@AllArgsConstructor
-public class MasterDistributeQueueConfig {
-    @Bean
-    DirectExchange distributeExchange() {
-        return new DirectExchange(AliIotConstant.Exchange,true,false);
-    }
-}
+//package com.nb.aliyun.service.distribute;
+//
+//import com.nb.aliyun.service.AliIotConstant;
+//import lombok.AllArgsConstructor;
+//import org.springframework.amqp.core.DirectExchange;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * @ClassName : RabbitMqChannelConfig
+// * @Description :
+// * @Author : LF
+// * @Date: 2023年07月31日
+// */
+////@Component
+//@AllArgsConstructor
+//public class MasterDistributeQueueConfig {
+//    @Bean
+//    DirectExchange distributeExchange() {
+//        return new DirectExchange(AliIotConstant.Exchange,true,false);
+//    }
+//}

+ 35 - 35
nb-service/iot-service/src/main/java/com/nb/aliyun/service/distribute/SlaveDistributeMsgListener.java

@@ -1,35 +1,35 @@
-package com.nb.aliyun.service.distribute;
-
-import cn.hutool.json.JSONUtil;
-import com.nb.aliyun.service.bean.AliIotMessagePojo;
-import com.nb.aliyun.service.process.DeviceMsgHandler;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.rabbit.annotation.RabbitHandler;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.stereotype.Component;
-
-/**
- * @ClassName : MasterMsgListener
- * @Description : 接受来自分发器的消息
- * @Author : LF
- * @Date: 2023年08月01日
- */
-@Slf4j
-@Component
-@AutoConfigureAfter(SlaveDistributeQueueConfig.class)
-public class SlaveDistributeMsgListener {
-    private final DeviceMsgHandler deviceMsgHandler;
-
-    public SlaveDistributeMsgListener(DeviceMsgHandler deviceMsgHandler) {
-        this.deviceMsgHandler = deviceMsgHandler;
-    }
-
-    @RabbitHandler
-    @RabbitListener(queues = "${hospital.code}")
-    public void handleMsg(AliIotMessagePojo  msg){
-        log.info("[分发器消息]:{}",JSONUtil.toJsonStr(msg));
-        deviceMsgHandler.handleMessage(msg,false);
-    }
-}
+//package com.nb.aliyun.service.distribute;
+//
+//import cn.hutool.json.JSONUtil;
+//import com.nb.aliyun.service.bean.AliIotMessagePojo;
+//import com.nb.aliyun.service.process.DeviceMsgHandler;
+//import lombok.AllArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+//import org.springframework.amqp.rabbit.annotation.RabbitListener;
+//import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * @ClassName : MasterMsgListener
+// * @Description : 接受来自分发器的消息
+// * @Author : LF
+// * @Date: 2023年08月01日
+// */
+////@Slf4j
+////@Component
+////@AutoConfigureAfter(SlaveDistributeQueueConfig.class)
+//public class SlaveDistributeMsgListener {
+//    private final DeviceMsgHandler deviceMsgHandler;
+//
+//    public SlaveDistributeMsgListener(DeviceMsgHandler deviceMsgHandler) {
+//        this.deviceMsgHandler = deviceMsgHandler;
+//    }
+//
+////    @RabbitHandler
+////    @RabbitListener(queues = "${hospital.code}")
+////    public void handleMsg(AliIotMessagePojo  msg){
+////        log.info("[分发器消息]:{}",JSONUtil.toJsonStr(msg));
+////        deviceMsgHandler.handleMessage(msg,false);
+////    }
+//}

+ 39 - 39
nb-service/iot-service/src/main/java/com/nb/aliyun/service/distribute/SlaveDistributeQueueConfig.java

@@ -1,39 +1,39 @@
-package com.nb.aliyun.service.distribute;
-
-import com.nb.aliyun.service.AliIotConstant;
-import com.nb.web.api.HospitalProperties;
-import lombok.AllArgsConstructor;
-import org.springframework.amqp.core.Binding;
-import org.springframework.amqp.core.BindingBuilder;
-import org.springframework.amqp.core.DirectExchange;
-import org.springframework.amqp.core.Queue;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.stereotype.Component;
-
-/**
- * @ClassName : RabbitMqChannelConfig
- * @Description :
- * @Author : LF
- * @Date: 2023年07月31日
- */
-@Component
-@AllArgsConstructor
-@EnableConfigurationProperties(HospitalProperties.class)
-public class SlaveDistributeQueueConfig {
-    private final HospitalProperties hospitalProperties;
-    @Bean
-    public Queue distributeQueue() {
-        return new Queue(hospitalProperties.getCode(),true,true,true);
-    }
-
-    @Bean
-    DirectExchange distributeExchange() {
-        return new DirectExchange(AliIotConstant.Exchange,true,false);
-    }
-
-    @Bean
-    Binding bindingDirect() {
-        return BindingBuilder.bind(distributeQueue()).to(distributeExchange()).with(hospitalProperties.getCode());
-    }
-}
+//package com.nb.aliyun.service.distribute;
+//
+//import com.nb.aliyun.service.AliIotConstant;
+//import com.nb.web.api.HospitalProperties;
+//import lombok.AllArgsConstructor;
+//import org.springframework.amqp.core.Binding;
+//import org.springframework.amqp.core.BindingBuilder;
+//import org.springframework.amqp.core.DirectExchange;
+//import org.springframework.amqp.core.Queue;
+//import org.springframework.boot.context.properties.EnableConfigurationProperties;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * @ClassName : RabbitMqChannelConfig
+// * @Description :
+// * @Author : LF
+// * @Date: 2023年07月31日
+// */
+//@Component
+//@AllArgsConstructor
+//@EnableConfigurationProperties(HospitalProperties.class)
+//public class SlaveDistributeQueueConfig {
+//    private final HospitalProperties hospitalProperties;
+//    @Bean
+//    public Queue distributeQueue() {
+//        return new Queue(hospitalProperties.getCode(),true,true,true);
+//    }
+//
+//    @Bean
+//    DirectExchange distributeExchange() {
+//        return new DirectExchange(AliIotConstant.Exchange,true,false);
+//    }
+//
+//    @Bean
+//    Binding bindingDirect() {
+//        return BindingBuilder.bind(distributeQueue()).to(distributeExchange()).with(hospitalProperties.getCode());
+//    }
+//}

+ 3 - 3
nb-service/iot-service/src/main/java/com/nb/aliyun/service/process/DeviceMsgHandler.java

@@ -13,7 +13,7 @@ import com.nb.web.api.feign.IHospitalClient;
 import com.nb.web.api.feign.result.HospitalResult;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.rabbit.core.RabbitTemplate;
+//import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 import java.util.List;
@@ -29,7 +29,7 @@ import java.util.List;
 @Slf4j
 public class DeviceMsgHandler {
 
-    private final RabbitTemplate rabbitTemplate;
+//    private final RabbitTemplate rabbitTemplate;
 
     private final IDeviceClient deviceService;
 
@@ -71,7 +71,7 @@ public class DeviceMsgHandler {
             return;
         }
         HospitalResult hospital = hospitalClient.findById(tenantId);
-        rabbitTemplate.convertAndSend(AliIotConstant.Exchange,hospital.getCode(),msg);
+//        rabbitTemplate.convertAndSend(AliIotConstant.Exchange,hospital.getCode(),msg);
     }
 
     private void doProcessMessage(AliIotMessagePojo msg,String tenantId){

+ 2 - 2
nb-service/web-service/src/main/java/com/nb/web/service/bus/job/DeviceFlowStatsJob.java

@@ -27,9 +27,9 @@ import java.util.stream.Collectors;
  * @Description 设备流量统计
  * @createTime 2022年07月28日 17:16:00
  */
-@Component
+//@Component
 @AllArgsConstructor
-@ConditionalOnBean(EnterpriseWeChatNotify.class)
+//@ConditionalOnBean(EnterpriseWeChatNotify.class)
 public class DeviceFlowStatsJob {
     private final LocalBusHospitalLogService hospitalLogService;
     private final EnterpriseWeChatNotify enterpriseWeChatNotify;

+ 14 - 14
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusHospitalService.java

@@ -226,20 +226,20 @@ public class LocalBusHospitalService extends BaseService<BusHospitalMapper, BusH
 
 
     private void saveDefaultHospital(){
-        BusHospitalEntity hospital = new BusHospitalEntity();
-        hospital.setId("1");
-        hospital.setName(StrUtil.isNotBlank(hospitalProperties.getName())?hospitalProperties.getName():"驼人医疗器械有限公司");
-        hospital.setCode(hospitalProperties.getCode());
-        hospital.setRemark("系统级医院,不可删除、修改");
-        GeoPoint geoPoint = new GeoPoint();
-        geoPoint.setLon("35.135106");
-        geoPoint.setLat("114.658855");
-        hospital.setCoordinate(geoPoint);
-        try {
-            this.save(hospital);
-        }catch (Exception e){
-
-        }
+//        BusHospitalEntity hospital = new BusHospitalEntity();
+//        hospital.setId("1");
+//        hospital.setName(StrUtil.isNotBlank(hospitalProperties.getName())?hospitalProperties.getName():"驼人医疗器械有限公司");
+//        hospital.setCode(hospitalProperties.getCode());
+//        hospital.setRemark("系统级医院,不可删除、修改");
+//        GeoPoint geoPoint = new GeoPoint();
+//        geoPoint.setLon("35.135106");
+//        geoPoint.setLat("114.658855");
+//        hospital.setCoordinate(geoPoint);
+//        try {
+//            this.save(hospital);
+//        }catch (Exception e){
+//
+//        }
     }