Przeglądaj źródła

Merge branch 'dev' of http://192.168.1.43:3000/v2/zd-parents into dev

chaiyunlong 3 lat temu
rodzic
commit
2ec6b6b4f6
44 zmienionych plików z 585 dodań i 275 usunięć
  1. 6 1
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/RemoteFireDeviceService.java
  2. 7 0
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/feign/fallback/RemoteFireDeviceFallbackFactory.java
  3. 2 1
      zd-api/zd-algorithm-api/src/main/resources/META-INF/spring.factories
  4. 5 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/constant/RiskPlanConstants.java
  5. 21 0
      zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/vo/HardwareCVO.java
  6. 1 0
      zd-auth/pom.xml
  7. 12 0
      zd-common/common-core/pom.xml
  8. 200 0
      zd-common/common-core/src/main/java/com/zd/common/core/mybatisplus/MybatisPlusGenerator.java
  9. 6 0
      zd-common/common-core/src/main/resources/code-generator.properties
  10. 1 0
      zd-gateway/pom.xml
  11. 1 0
      zd-modules/zd-airbottle/pom.xml
  12. BIN
      zd-modules/zd-algorithm/libs/onvif-java-1.0.2.jar
  13. 21 23
      zd-modules/zd-algorithm/pom.xml
  14. 2 2
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/AlgorithmApplication.java
  15. 23 0
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/alarm/CodeGenerator.java
  16. 38 12
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/controller/FireDeviceController.java
  17. 12 6
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/utils/FireDeviceStatusTask.java
  18. 7 7
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java
  19. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/mqtt/CommonSend.java
  20. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/utils/HttpUtils.java
  21. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/gb28181/event/online/OnlineEventListener.java
  22. 1 32
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  23. 0 12
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
  24. 0 5
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/media/zlm/ZLMRESTfulUtils.java
  25. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
  26. 74 86
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/mqtt/MqttConfig.java
  27. 5 0
      zd-modules/zd-base/pom.xml
  28. 1 1
      zd-modules/zd-base/src/main/java/com/zd/base/job/config/ScheduleConfig.java
  29. 24 0
      zd-modules/zd-base/src/main/java/com/zd/base/job/task/FireDeviceTask.java
  30. 1 0
      zd-modules/zd-bottle-parent/zd-bottle/pom.xml
  31. 1 0
      zd-modules/zd-chemical/pom.xml
  32. 1 0
      zd-modules/zd-exam/pom.xml
  33. 1 0
      zd-modules/zd-modules-laboratory/pom.xml
  34. 6 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabRiskPlanController.java
  35. 0 4
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/enums/BigViewDataType.java
  36. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/impl/SubMessageSendManager.java
  37. 16 6
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalDescServiceImpl.java
  38. 65 59
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java
  39. 10 9
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectManagerService.java
  40. 4 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabWarnPushMessageServiceImpl.java
  41. 1 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml
  42. 1 1
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalDescMapper.xml
  43. 1 0
      zd-modules/zd-modules-system/pom.xml
  44. 1 0
      zd-visual/zd-monitor/pom.xml

+ 6 - 1
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/RemoteFireDeviceService.java

@@ -1,7 +1,9 @@
 package com.zd.algorithm.api.fire;
 package com.zd.algorithm.api.fire;
 
 
+import com.zd.algorithm.api.fire.feign.fallback.RemoteFireDeviceFallbackFactory;
 import com.zd.algorithm.api.speaker.feign.fallback.RemoteSpeakFallbackFactory;
 import com.zd.algorithm.api.speaker.feign.fallback.RemoteSpeakFallbackFactory;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.constant.ApplicationConstants;
+import com.zd.model.domain.AjaxResult;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
  * 一键灭火远程调用
  * 一键灭火远程调用
  * @author xxf
  * @author xxf
  */
  */
-@FeignClient(contextId = "remoteFireDeviceService",value = ApplicationConstants.ALGORITHM_SERVICE,fallbackFactory = RemoteSpeakFallbackFactory.class)
+@FeignClient(contextId = "remoteFireDeviceService",value = ApplicationConstants.ALGORITHM_SERVICE,fallbackFactory = RemoteFireDeviceFallbackFactory.class)
 public interface RemoteFireDeviceService {
 public interface RemoteFireDeviceService {
 
 
     @GetMapping(value = "/firedevice/addFireLog")
     @GetMapping(value = "/firedevice/addFireLog")
@@ -21,4 +23,7 @@ public interface RemoteFireDeviceService {
 
 
     @GetMapping(value = "/firedevice/getDeviceByCode")
     @GetMapping(value = "/firedevice/getDeviceByCode")
     public R getDeviceByCode(@RequestParam(value = "deviceCode", required = true) String deviceCode);
     public R getDeviceByCode(@RequestParam(value = "deviceCode", required = true) String deviceCode);
+
+    @GetMapping(value = "/firedeviceTask/deviceStatus")
+    public AjaxResult getFireDeviceStatus();
 }
 }

+ 7 - 0
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/feign/fallback/RemoteFireDeviceFallbackFactory.java

@@ -1,6 +1,7 @@
 package com.zd.algorithm.api.fire.feign.fallback;
 package com.zd.algorithm.api.fire.feign.fallback;
 
 
 import com.zd.algorithm.api.fire.RemoteFireDeviceService;
 import com.zd.algorithm.api.fire.RemoteFireDeviceService;
+import com.zd.model.domain.AjaxResult;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
@@ -30,6 +31,12 @@ public class RemoteFireDeviceFallbackFactory implements FallbackFactory<RemoteFi
                 log.info("根据采集器编码查询灭火设备信息失败:" + cause.getMessage());
                 log.info("根据采集器编码查询灭火设备信息失败:" + cause.getMessage());
                 return R.fail("根据采集器编码查询灭火设备信息失败:"+ cause.getMessage());
                 return R.fail("根据采集器编码查询灭火设备信息失败:"+ cause.getMessage());
             }
             }
+
+            @Override
+            public AjaxResult getFireDeviceStatus() {
+                log.info("一键灭火设备状态请求失败:" + cause.getMessage());
+                return AjaxResult.error("一键灭火设备状态请求失败:" + cause.getMessage());
+            }
         };
         };
 
 
     }
     }

+ 2 - 1
zd-api/zd-algorithm-api/src/main/resources/META-INF/spring.factories

@@ -5,5 +5,6 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
   com.zd.algorithm.api.forward.feign.fallback.RemoteForwardFallbackFactory,\
   com.zd.algorithm.api.forward.feign.fallback.RemoteForwardFallbackFactory,\
   com.zd.algorithm.api.rfid.feign.fallback.RemoteRfidFallbackFactory,\
   com.zd.algorithm.api.rfid.feign.fallback.RemoteRfidFallbackFactory,\
   com.zd.algorithm.api.smartlock.feign.fallback.RemoteSmartlockFallbackFactory,\
   com.zd.algorithm.api.smartlock.feign.fallback.RemoteSmartlockFallbackFactory,\
-  com.zd.algorithm.api.speaker.feign.fallback.RemoteSpeakFallbackFactory
+  com.zd.algorithm.api.speaker.feign.fallback.RemoteSpeakFallbackFactory,\
+  com.zd.algorithm.api.fire.feign.fallback.RemoteFireDeviceFallbackFactory
 
 

+ 5 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/constant/RiskPlanConstants.java

@@ -28,4 +28,9 @@ public interface RiskPlanConstants {
      */
      */
     String SMOKE_FUN_NUM = "yangan";
     String SMOKE_FUN_NUM = "yangan";
 
 
+    /**
+     * 消息推送公司名称
+     */
+    String LAB_SAFETY_MANAGEMENT_SYSTEM = "【实验室安全系统】";
+
 }
 }

+ 21 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/vo/HardwareCVO.java

@@ -35,6 +35,11 @@ public class HardwareCVO extends BaseHardware {
     @Deprecated
     @Deprecated
     List<FunctionStatus> functionStatusList;
     List<FunctionStatus> functionStatusList;
 
 
+    @ApiModelProperty(value = "一体机类型")
+    private Integer pcType;
+
+    @ApiModelProperty(value = "是否灭火主机")
+    private Integer isPcfire;
     /**
     /**
      * 设备类型
      * 设备类型
      *
      *
@@ -77,4 +82,20 @@ public class HardwareCVO extends BaseHardware {
     public void setHardwareTypeEnum(HardwareTypeEnum hardwareTypeEnum) {
     public void setHardwareTypeEnum(HardwareTypeEnum hardwareTypeEnum) {
         this.hardwareTypeEnum = hardwareTypeEnum;
         this.hardwareTypeEnum = hardwareTypeEnum;
     }
     }
+
+    public Integer getPcType() {
+        return pcType;
+    }
+
+    public void setPcType(Integer pcType) {
+        this.pcType = pcType;
+    }
+
+    public Integer getIsPcfire() {
+        return isPcfire;
+    }
+
+    public void setIsPcfire(Integer isPcfire) {
+        this.isPcfire = isPcfire;
+    }
 }
 }

+ 1 - 0
zd-auth/pom.xml

@@ -75,6 +75,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

+ 12 - 0
zd-common/common-core/pom.xml

@@ -62,6 +62,18 @@
             <groupId>com.belerweb</groupId>
             <groupId>com.belerweb</groupId>
             <artifactId>pinyin4j</artifactId>
             <artifactId>pinyin4j</artifactId>
         </dependency>
         </dependency>
+
+        <!-- mybatis-plus -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.31</version>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
 </project>
 </project>

+ 200 - 0
zd-common/common-core/src/main/java/com/zd/common/core/mybatisplus/MybatisPlusGenerator.java

@@ -0,0 +1,200 @@
+package com.zd.common.core.mybatisplus;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.generator.FastAutoGenerator;
+import com.baomidou.mybatisplus.generator.IFill;
+import com.baomidou.mybatisplus.generator.config.ConstVal;
+import com.baomidou.mybatisplus.generator.config.OutputFile;
+import com.baomidou.mybatisplus.generator.config.TemplateType;
+import com.baomidou.mybatisplus.generator.config.rules.DateType;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+import com.baomidou.mybatisplus.generator.fill.Column;
+import com.zd.common.core.utils.StringUtils;
+
+import java.net.URL;
+import java.util.*;
+
+
+/**
+ * <p>代码生成</p>
+ *
+ * @author linft
+ * @version 1.0
+ * @date 11/25/2022
+ */
+public class MybatisPlusGenerator {
+
+    /**
+     * 代码生成
+     * @param tables
+     * @param tablePrefix
+     * @param addr
+     */
+    public static void generator(String[] tables, String tablePrefix, URL addr) {
+        ResourceBundle bundle = ResourceBundle.getBundle("code-generator");
+        //数据信息
+        String url = bundle.getString("mysql-url");
+        String username = bundle.getString("mysql-user");
+        String password = bundle.getString("mysql-pwd");
+
+        //输出目录
+        List<String> list = getCurrentModuleDir(addr);
+
+        /*策略配置*/
+        /*Controller 策略*/
+        String controllerSuperClass = "";
+
+        //过滤字段前缀
+        String fieldPrefix = "";
+
+        /**
+         * 主键生成模式;
+         *  IdType.AUTO -- 自增
+         *  IdType.ASSIGN_ID -- 雪花算法
+         *  IdType.ASSIGN_UUID -- uuid
+         */
+        IdType idType = IdType.ASSIGN_ID;
+
+        /**
+         * 添加忽略字段
+         */
+        String[] ignoreColumns = {};
+        System.out.println("====================>>> start generator code......");
+        // 生成器
+        FastAutoGenerator.create(url, username, password)
+                // 全局配置
+                .globalConfig(builder -> builder
+                        .disableOpenDir()// 禁止打开输出目录
+                        .outputDir(list.get(0))
+                        .author(bundle.getString("author"))
+                        .dateType(DateType.TIME_PACK)
+                        //.commentDate("yyyy-MM-dd HH:mm:ss")
+                        .enableSwagger()// 开启 swagger 模式
+                        .build())
+                // 包配置
+                .packageConfig(builder -> builder
+                        .parent(list.get(2))
+                        //.controller(controllerPackageName)
+                        .service("service")
+                        .serviceImpl("service.impl")
+                        .mapper("mapper")
+                        .xml("mapper")
+                        .entity("entity")
+                        // 设置mapperXml生成路
+                        .pathInfo(pathInfo(list))
+                        .build())
+                // 模板配置
+                .templateConfig(builder -> builder
+                        .disable(disableTemplateType)
+                        .build()
+                )
+
+                // 策略配置
+                .strategyConfig(builder -> builder
+                        .addInclude(tables)
+                        .addTablePrefix(tablePrefix)
+                        .addFieldPrefix(fieldPrefix)
+
+                        // Controller 策略
+                        .controllerBuilder()
+                        .fileOverride()
+                        .superClass(controllerSuperClass)
+                        .enableRestStyle()
+                        .formatFileName("%sController")
+
+                        // Service 策略
+                        .serviceBuilder()
+                        // 覆盖已生成文件
+                        .fileOverride()
+                        // 设置 service 接口父类
+                        .superServiceClass(ConstVal.SUPER_SERVICE_CLASS)
+                        // 设置 service 实现类父类
+                        .superServiceImplClass(ConstVal.SUPER_SERVICE_IMPL_CLASS)
+                        .formatServiceFileName("%sService")
+                        .formatServiceImplFileName("%sServiceImpl")
+
+                        // mapper策略
+                        .mapperBuilder()
+                        .fileOverride()
+                        // mapper接口的父类
+                        .superClass(ConstVal.SUPER_MAPPER_CLASS)
+                        .enableMapperAnnotation()
+                        .enableBaseResultMap()
+                        .enableBaseColumnList()
+                        .formatMapperFileName("%sMapper")
+                        .formatXmlFileName("%sMapper")
+
+                        // entity 策略
+                        .entityBuilder()
+                        .fileOverride()
+                        .enableLombok()
+                        //.enableTableFieldAnnotation()
+                        .enableActiveRecord()
+                     //.logicDeleteColumnName(logicDeleteColumnName)
+                     //.logicDeletePropertyName(logicDeletePropertyName)
+                        .addIgnoreColumns(ignoreColumns)
+                        .addTableFills(fillColumns)
+                        .formatFileName("%s")
+                        .idType(idType)
+                        .build())
+                .templateEngine(new FreemarkerTemplateEngine())
+                .execute();
+        System.out.println("====================>>> generator code done  <<<======================");
+    }
+
+    /**
+     * 获取当前模块的路劲
+     * @return
+     */
+    public static List<String> getCurrentModuleDir(URL url) {
+        if (url == null || StringUtils.isEmpty(url.getPath())) {
+            throw new RuntimeException("The empty url!");
+        }
+        List<String> list = new ArrayList<>();
+        String path = url.getPath();
+        if (!StringUtils.isEmpty(path)) {
+            String[] arr = path.substring(1,path.length()-1).split("/target/classes/");
+            list.add(arr[0]+"/src/main/java");
+            list.add(arr[0]+"/src/main/resources");
+            //packages
+            String packages = arr[1].replace("/",".");
+            list.add(packages);
+        }
+        return list;
+    }
+    /**
+     * 各文件的输出路径
+     *
+     * @return pathInfo
+     */
+    public static Map<OutputFile, String> pathInfo(List<String> list) {
+        //存放各文件的包路径
+        Map<OutputFile, String> pathInfo = new HashMap<>(6);
+        pathInfo.put(OutputFile.xml, list.get(1) + "/mapper");
+        return pathInfo;
+    }
+
+    /*模板配置*/
+    /**
+     * 禁用模板 本项目配置不生成 Service ServiceImpl Controller
+     */
+    static TemplateType[] disableTemplateType = {
+            //TemplateType.ENTITY,
+            //TemplateType.MAPPER,
+            //TemplateType.XML,
+            //TemplateType.SERVICE,
+            //TemplateType.SERVICEIMPL,
+            TemplateType.CONTROLLER
+    };
+
+    /**
+     * 自动填充的字段和时机
+     */
+    static List<IFill> fillColumns = new ArrayList<IFill>() {{
+        add(new Column("create_time", FieldFill.INSERT));
+        add(new Column("create_by", FieldFill.INSERT));
+        add(new Column("update_time", FieldFill.UPDATE));
+        add(new Column("update_by", FieldFill.UPDATE));
+    }};
+}

+ 6 - 0
zd-common/common-core/src/main/resources/code-generator.properties

@@ -0,0 +1,6 @@
+##数据库信息
+mysql-url=jdbc:mysql://192.168.1.43:13306/cloud_data_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai
+mysql-user=root
+mysql-pwd=root123456
+#作者
+author=

+ 1 - 0
zd-gateway/pom.xml

@@ -104,6 +104,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

+ 1 - 0
zd-modules/zd-airbottle/pom.xml

@@ -93,6 +93,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

BIN
zd-modules/zd-algorithm/libs/onvif-java-1.0.2.jar


+ 21 - 23
zd-modules/zd-algorithm/pom.xml

@@ -55,8 +55,28 @@
         <dependency>
         <dependency>
             <groupId>com.squareup.okhttp3</groupId>
             <groupId>com.squareup.okhttp3</groupId>
             <artifactId>okhttp</artifactId>
             <artifactId>okhttp</artifactId>
-            <version>3.10.0</version>
+            <version>4.9.0</version>
         </dependency>
         </dependency>
+
+        <!-- okhttp-digest -->
+        <dependency>
+            <groupId>io.github.rburgst</groupId>
+            <artifactId>okhttp-digest</artifactId>
+            <version>2.5</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.squareup.okhttp3</groupId>
+                    <artifactId>okhttp</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sf.kxml</groupId>
+            <artifactId>kxml2</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+
         <!-- mybatis plus -->
         <!-- mybatis plus -->
         <dependency>
         <dependency>
             <groupId>com.baomidou</groupId>
             <groupId>com.baomidou</groupId>
@@ -148,67 +168,45 @@
         <dependency>
         <dependency>
             <groupId>com.zd.swagger</groupId>
             <groupId>com.zd.swagger</groupId>
             <artifactId>common-swagger</artifactId>
             <artifactId>common-swagger</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.base</groupId>
             <groupId>com.zd.base</groupId>
             <artifactId>zd-base-api</artifactId>
             <artifactId>zd-base-api</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.chemical</groupId>
             <groupId>com.zd.chemical</groupId>
             <artifactId>zd-chemical-api</artifactId>
             <artifactId>zd-chemical-api</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.airbottle</groupId>
             <groupId>com.zd.airbottle</groupId>
             <artifactId>zd-airbottle-api</artifactId>
             <artifactId>zd-airbottle-api</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.laboratory</groupId>
             <groupId>com.zd.laboratory</groupId>
             <artifactId>zd-laboratory-api</artifactId>
             <artifactId>zd-laboratory-api</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.algorithm</groupId>
             <groupId>com.zd.algorithm</groupId>
             <artifactId>zd-algorithm-api</artifactId>
             <artifactId>zd-algorithm-api</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.core</groupId>
             <groupId>com.zd.core</groupId>
             <artifactId>common-core</artifactId>
             <artifactId>common-core</artifactId>
-            <version>3.1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.zd.mqtt</groupId>
-            <artifactId>common-mqtt</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
             <groupId>com.zd.system</groupId>
             <groupId>com.zd.system</groupId>
             <artifactId>zd-system-api</artifactId>
             <artifactId>zd-system-api</artifactId>
-            <version>3.1.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.zd.auth</groupId>
             <groupId>com.zd.auth</groupId>
             <artifactId>zd-auth-api</artifactId>
             <artifactId>zd-auth-api</artifactId>
-            <version>3.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>be.teletask</groupId>
-            <artifactId>onvif-java</artifactId>
-            <version>1.0.2</version>
-            <scope>system</scope>
-            <systemPath>${project.basedir}/libs/onvif-java-1.0.2.jar</systemPath>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
 
 

+ 2 - 2
zd-modules/zd-algorithm/src/main/java/com/zd/alg/AlgorithmApplication.java

@@ -6,7 +6,6 @@ import com.zd.alg.forward.properties.FireProperties;
 import com.zd.common.core.annotation.EnableCustomConfig;
 import com.zd.common.core.annotation.EnableCustomConfig;
 import com.zd.common.core.annotation.EnableZdFeignClients;
 import com.zd.common.core.annotation.EnableZdFeignClients;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.common.core.launch.ZdStartApplication;
-import com.zd.common.mqtt.model.MqttProperties;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.BaseConstants;
 import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.annotation.MapperScan;
@@ -14,6 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 
 /**
 /**
@@ -23,7 +23,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @EnableCustomConfig
 @EnableCustomConfig
 @EnableZdFeignClients
 @EnableZdFeignClients
 @SpringBootApplication(scanBasePackages = BaseConstants.BASE_PACKAGE)
 @SpringBootApplication(scanBasePackages = BaseConstants.BASE_PACKAGE)
-@EnableConfigurationProperties({MqttProperties.class, AlgorithmYml.class, FireProperties.class})
+@EnableConfigurationProperties({AlgorithmYml.class, FireProperties.class})
 @MapperScan(value = {"com.zd.**.mapper"})
 @MapperScan(value = {"com.zd.**.mapper"})
 @EnableScheduling
 @EnableScheduling
 public class AlgorithmApplication {
 public class AlgorithmApplication {

+ 23 - 0
zd-modules/zd-algorithm/src/main/java/com/zd/alg/alarm/CodeGenerator.java

@@ -0,0 +1,23 @@
+package com.zd.alg.alarm;
+
+import com.zd.common.core.mybatisplus.MybatisPlusGenerator;
+
+import java.net.URL;
+
+/**
+ * <p>类注释说明</p>
+ *
+ * @author linft
+ * @version 1.0
+ * @date 12/30/2022
+ */
+public class CodeGenerator {
+
+    public static void main(String[] args) {
+        String[] tables = {"vmp_log","vmp_role"};
+        //若要去掉前缀,需写添加,若无需去除,不用填写
+        String tablePrefix = "vmp_";
+        URL url = CodeGenerator.class.getResource("");
+        MybatisPlusGenerator.generator(tables, tablePrefix, url);
+    }
+}

+ 38 - 12
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/controller/FireDeviceController.java

@@ -42,7 +42,6 @@ import java.util.concurrent.TimeUnit;
  * @Description:
  * @Description:
  */
  */
 @RestController
 @RestController
-@Component
 @RequestMapping("/firedevice")
 @RequestMapping("/firedevice")
 public class FireDeviceController extends BaseController {
 public class FireDeviceController extends BaseController {
 
 
@@ -125,6 +124,7 @@ public class FireDeviceController extends BaseController {
         HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
         HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
         vo.setSubjectId(subjectId);
         vo.setSubjectId(subjectId);
         List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
         List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
+        logger.info("是否配置灭火设备:"+list.size());
         if (list.size() == 0) {
         if (list.size() == 0) {
             map.put("smoke", smoke);
             map.put("smoke", smoke);
             map.put("temperature", temperature);
             map.put("temperature", temperature);
@@ -135,8 +135,10 @@ public class FireDeviceController extends BaseController {
             isexist = true;
             isexist = true;
             //获取灭火主机最后一次响应时间,判断响应是否超时
             //获取灭火主机最后一次响应时间,判断响应是否超时
             Long timeJson = redisService.getCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME+list.get(0).getDeviceCode());
             Long timeJson = redisService.getCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME+list.get(0).getDeviceCode());
+            logger.info("灭火主机最后一次响应时间:"+timeJson);
             if (StringUtils.isNotNull(timeJson)) {
             if (StringUtils.isNotNull(timeJson)) {
                 Long timeDiff = (System.currentTimeMillis() - timeJson) / 1000;
                 Long timeDiff = (System.currentTimeMillis() - timeJson) / 1000;
+                logger.info("灭火主机最后一次响应时间差值:"+timeDiff+" 超时响应时间:"+onlineTime);
                 //时间差 在设置时间内
                 //时间差 在设置时间内
                 if (timeDiff < onlineTime) {
                 if (timeDiff < onlineTime) {
                     online = true;
                     online = true;
@@ -149,9 +151,9 @@ public class FireDeviceController extends BaseController {
             JSONObject strJson = redisService.getCacheObject(list.get(0).getDeviceCode());
             JSONObject strJson = redisService.getCacheObject(list.get(0).getDeviceCode());
             if (StringUtils.isNotNull(strJson)) {
             if (StringUtils.isNotNull(strJson)) {
                 Integer fireNumber = (Integer) strJson.get("fireNumber");
                 Integer fireNumber = (Integer) strJson.get("fireNumber");
-                if (fireNumber == 1) {
-                    temperature = true;
-                } else if (fireNumber == 2) {
+                if (fireNumber > 0) {
+                    smoke = true;
+                } else if (fireNumber >3) {
                     smoke = true;
                     smoke = true;
                     temperature = true;
                     temperature = true;
                 }
                 }
@@ -163,8 +165,10 @@ public class FireDeviceController extends BaseController {
             //手动灭火和当前时差
             //手动灭火和当前时差
             Long outfireTime = redisService.getCacheObject(ARTIFICIAL_OUT_FILE+list.get(0).getDeviceCode());
             Long outfireTime = redisService.getCacheObject(ARTIFICIAL_OUT_FILE+list.get(0).getDeviceCode());
             if(StringUtils.isNotNull(outfireTime)){
             if(StringUtils.isNotNull(outfireTime)){
+                Long fireTimeVal=fireTime;
+                fireTimeVal = fireTimeVal+list.get(0).getDeviceCountDown();
                 timeDifference =    System.currentTimeMillis()-outfireTime;
                 timeDifference =    System.currentTimeMillis()-outfireTime;
-                timeDifference = timeDifference/1000;
+                timeDifference = fireTimeVal - (timeDifference/1000);
             }
             }
             //查询该实验室是否存在火焰摄像头报警
             //查询该实验室是否存在火焰摄像头报警
             JSONObject fireJson = redisService.getCacheObject(CacheDevice.FIRE_CAMERA_KEY.getRedisKey()+subjectId);
             JSONObject fireJson = redisService.getCacheObject(CacheDevice.FIRE_CAMERA_KEY.getRedisKey()+subjectId);
@@ -224,9 +228,9 @@ public class FireDeviceController extends BaseController {
         JSONObject strJson = redisService.getCacheObject(deviceCode);
         JSONObject strJson = redisService.getCacheObject(deviceCode);
         if (StringUtils.isNotNull(strJson)) {
         if (StringUtils.isNotNull(strJson)) {
             Integer fireNumber = (Integer) strJson.get("fireNumber");
             Integer fireNumber = (Integer) strJson.get("fireNumber");
-            if (fireNumber == 1) {
-                temperature = true;
-            } else if (fireNumber == 2) {
+            if (fireNumber >0) {
+                smoke = true;
+            } else if (fireNumber >3) {
                 smoke = true;
                 smoke = true;
                 temperature = true;
                 temperature = true;
             }
             }
@@ -271,6 +275,7 @@ public class FireDeviceController extends BaseController {
      */
      */
     @GetMapping(value = "/outfireapp")
     @GetMapping(value = "/outfireapp")
     public ResultData outFire(Long subjectId,String deviceCode) throws InterruptedException {
     public ResultData outFire(Long subjectId,String deviceCode) throws InterruptedException {
+        Long fireTimeVal=fireTime;
         logger.info("=========小程序端开始一键灭火=======");
         logger.info("=========小程序端开始一键灭火=======");
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         //设备是否在线
         //设备是否在线
@@ -284,10 +289,19 @@ public class FireDeviceController extends BaseController {
                 online = true;
                 online = true;
             }
             }
         }
         }
+
+        //查询实验室是否配置灭火设备
+        HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
+        vo.setSubjectId(subjectId);
+        List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
+        if(list.get(0).getDeviceCountDown()!=null){
+            fireTimeVal= fireTimeVal+list.get(0).getDeviceCountDown();
+        }
+
         //int waitTime = 5;//倒计时等待时间(秒)
         //int waitTime = 5;//倒计时等待时间(秒)
         map.put("online", online);
         map.put("online", online);
         map.put("waitTime", countDown);
         map.put("waitTime", countDown);
-        map.put("direTime", fireTime);
+        map.put("direTime", fireTimeVal);
         new Thread(()->startTT(subjectId,deviceCode,countDown)).start();
         new Thread(()->startTT(subjectId,deviceCode,countDown)).start();
         return ResultData.success(map);
         return ResultData.success(map);
     }
     }
@@ -321,7 +335,9 @@ public class FireDeviceController extends BaseController {
      * @throws InterruptedException
      * @throws InterruptedException
      */
      */
     @GetMapping(value = "/outfirepc")
     @GetMapping(value = "/outfirepc")
-    public ResultData outFirePc(Long subjectId,String deviceCode) throws InterruptedException {
+    public ResultData outFirePc(Long subjectId,String deviceCode) {
+        logger.info("=========PC端开始一键灭火=======");
+        Long fireTimeVal=fireTime;
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         //设备是否在线
         //设备是否在线
         boolean online=false;
         boolean online=false;
@@ -334,10 +350,20 @@ public class FireDeviceController extends BaseController {
                 online = true;
                 online = true;
             }
             }
         }
         }
+
+        //查询实验室是否配置灭火设备
+        HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
+        vo.setSubjectId(subjectId);
+        List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
+        logger.info("灭火固定时间fireTime:"+fireTime+" ,数据库配置时间:"+list.get(0).getDeviceCountDown());
+        if(list.get(0).getDeviceCountDown()!=null){
+            fireTimeVal= fireTimeVal+list.get(0).getDeviceCountDown();
+        }
+
         //int waitTime = 5;//倒计时等待时间(秒)
         //int waitTime = 5;//倒计时等待时间(秒)
         map.put("online", online);
         map.put("online", online);
         map.put("waitTime", countDown);
         map.put("waitTime", countDown);
-        map.put("direTime", fireTime);
+        map.put("direTime", fireTimeVal);
         new Thread(()->startTT(subjectId,deviceCode,countDown)).start();
         new Thread(()->startTT(subjectId,deviceCode,countDown)).start();
         return ResultData.success(map);
         return ResultData.success(map);
     }
     }
@@ -498,7 +524,7 @@ public class FireDeviceController extends BaseController {
             logger.info("关闭继电器,执行结果:" + o);
             logger.info("关闭继电器,执行结果:" + o);
         }
         }
         map.put("msg", msg);
         map.put("msg", msg);
-        map.put("flg", true);
+        map.put("flg", flg);
         return map;
         return map;
     }
     }
 
 

+ 12 - 6
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/utils/FireDeviceStatusTask.java

@@ -13,11 +13,15 @@ import com.zd.laboratory.api.feign.RemoteLaboratoryService;
 import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.CacheDevice;
 import com.zd.model.constant.CacheDevice;
 import com.zd.model.constant.MqttConstants;
 import com.zd.model.constant.MqttConstants;
+import com.zd.model.domain.ResultData;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
@@ -27,8 +31,8 @@ import java.util.concurrent.TimeUnit;
  * @Date: 2022/11/25/14:58
  * @Date: 2022/11/25/14:58
  * @Description:
  * @Description:
  */
  */
-@Component
-
+@RestController
+@RequestMapping("/firedeviceTask")
 public class FireDeviceStatusTask {
 public class FireDeviceStatusTask {
 
 
     Logger logger = LoggerFactory.getLogger(FireDeviceStatusTask.class);
     Logger logger = LoggerFactory.getLogger(FireDeviceStatusTask.class);
@@ -46,8 +50,9 @@ public class FireDeviceStatusTask {
     /**
     /**
      * 定时更新灭火装置状态
      * 定时更新灭火装置状态
      */
      */
-    @Scheduled(cron = "0/20 * * * * ?")
-    public void getFireDeviceStatus() {
+    //@Scheduled(cron = "0/20 * * * * ?")
+    @RequestMapping("/deviceStatus")
+    public ResultData getFireDeviceStatus() {
         try {
         try {
             //redis取值
             //redis取值
             List<HardwareFireDeviceVO> list = JSON.parseArray(redisService.getCacheObject(CacheConstants.FIRE_DEVICE_LIST) + "", HardwareFireDeviceVO.class);
             List<HardwareFireDeviceVO> list = JSON.parseArray(redisService.getCacheObject(CacheConstants.FIRE_DEVICE_LIST) + "", HardwareFireDeviceVO.class);
@@ -67,8 +72,8 @@ public class FireDeviceStatusTask {
                     byte[] activeCodeByte = ReUtil.hexStringToByteArray(activeCode);
                     byte[] activeCodeByte = ReUtil.hexStringToByteArray(activeCode);
                     mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE + vo.getDeviceCode(), activeCodeByte);
                     mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE + vo.getDeviceCode(), activeCodeByte);
                     //兼容指令无反应问题
                     //兼容指令无反应问题
-                    /*Thread.sleep(500);
-                    mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE + vo.getDeviceCode(), activeCodeByte);*/
+                    Thread.sleep(500);
+                    mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE + vo.getDeviceCode(), activeCodeByte);
                     logger.info("集合数量:" + list.size() + ",mqtt消息推送, 灭火装置状态请求,实验室id:" + vo.getSubjectId() + ",采集器编号:" + vo.getDeviceCode() + ",继电器编号" + vo.getRelayCode());
                     logger.info("集合数量:" + list.size() + ",mqtt消息推送, 灭火装置状态请求,实验室id:" + vo.getSubjectId() + ",采集器编号:" + vo.getDeviceCode() + ",继电器编号" + vo.getRelayCode());
 
 
 
 
@@ -102,5 +107,6 @@ public class FireDeviceStatusTask {
         } catch (Exception e) {
         } catch (Exception e) {
             logger.info("一键灭火定时任务异常" + e);
             logger.info("一键灭火定时任务异常" + e);
         }
         }
+        return ResultData.success();
     }
     }
 }
 }

+ 7 - 7
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java

@@ -11,6 +11,7 @@ import com.zd.alg.forward.serivce.mqtt.CommonSend;
 import com.zd.alg.forward.utils.Base64DecodedMultipartFile;
 import com.zd.alg.forward.utils.Base64DecodedMultipartFile;
 import com.zd.alg.forward.utils.FileUploadUtils;
 import com.zd.alg.forward.utils.FileUploadUtils;
 import com.zd.alg.forward.utils.HttpUtils;
 import com.zd.alg.forward.utils.HttpUtils;
+import com.zd.alg.mqtt.entiy.MessageBody;
 import com.zd.algorithm.api.alarm.entity.AlarmEntrty;
 import com.zd.algorithm.api.alarm.entity.AlarmEntrty;
 import com.zd.algorithm.api.alarm.entity.Routes;
 import com.zd.algorithm.api.alarm.entity.Routes;
 import com.zd.algorithm.api.alarm.entity.SendTypes;
 import com.zd.algorithm.api.alarm.entity.SendTypes;
@@ -20,7 +21,6 @@ import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.ServletUtils;
 import com.zd.common.core.utils.ServletUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.utils.StringUtils;
-import com.zd.common.mqtt.model.MessageBody;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
 import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
@@ -129,23 +129,23 @@ public class CheckService {
                 AlgorithmYml.CheckValid checkValid = algorithmYml.getCheckValid(Integer.valueOf(code));
                 AlgorithmYml.CheckValid checkValid = algorithmYml.getCheckValid(Integer.valueOf(code));
                 MultiValueMap<String, Object> params = getStringObjectMultiValueMap(checkValid, String.valueOf(id));
                 MultiValueMap<String, Object> params = getStringObjectMultiValueMap(checkValid, String.valueOf(id));
                 HttpEntity<MultiValueMap<String, Object>> files = getHttpEntityMap(toFile, params);
                 HttpEntity<MultiValueMap<String, Object>> files = getHttpEntityMap(toFile, params);
-                logger.info("===============4=================");
+                //logger.info("===============4=================");
                 ImgPostResponse<AnalysisReturnData> send = HttpUtils.sendV5(restTemplateLocal, files, algorithmYml);
                 ImgPostResponse<AnalysisReturnData> send = HttpUtils.sendV5(restTemplateLocal, files, algorithmYml);
                 if (send == null || send.getStatus_code() != 1000) {
                 if (send == null || send.getStatus_code() != 1000) {
                     assert send != null;
                     assert send != null;
-                    logger.error("==================4.1==================="+send.getStatus_code()+"==========="+send.getMessage());
+                    //logger.error("==================4.1==================="+send.getStatus_code()+"==========="+send.getMessage());
                     return R.fail("算法服务错误,请重试!");
                     return R.fail("算法服务错误,请重试!");
                 }
                 }
-                logger.info("===============5=================");
+                //logger.info("===============5=================");
                 R algorithm = saveAlgorithmV5(send, checkValid);
                 R algorithm = saveAlgorithmV5(send, checkValid);
                 if (algorithm.getCode() != 200) {
                 if (algorithm.getCode() != 200) {
-                    logger.error("==============="+algorithm.getCode()+"=================");
+                    //logger.error("==============="+algorithm.getCode()+"=================");
                     return algorithm;
                     return algorithm;
                 }
                 }
-                logger.info("===============6=================");
+                //logger.info("===============6=================");
                 AnalysisReturnData data = send.getData();
                 AnalysisReturnData data = send.getData();
                 Map<String, Object> result = (Map<String, Object>) data.getResult();
                 Map<String, Object> result = (Map<String, Object>) data.getResult();
-                logger.info("=========================7==============="+result.toString());
+                //logger.info("=========================7==============="+result.toString());
                 Map<String, Object> algorithmData = (Map<String, Object>) result.get("algorithm_data");
                 Map<String, Object> algorithmData = (Map<String, Object>) result.get("algorithm_data");
                 Map<String, Object> modelResult = (Map<String, Object>) result.get("model_data");
                 Map<String, Object> modelResult = (Map<String, Object>) result.get("model_data");
                 List<Map<String, Object>> objects = (List<Map<String, Object>>) modelResult.get("objects");
                 List<Map<String, Object>> objects = (List<Map<String, Object>>) modelResult.get("objects");

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/mqtt/CommonSend.java

@@ -1,7 +1,7 @@
 package com.zd.alg.forward.serivce.mqtt;
 package com.zd.alg.forward.serivce.mqtt;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.zd.common.mqtt.model.MessageBody;
+import com.zd.alg.mqtt.entiy.MessageBody;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/utils/HttpUtils.java

@@ -56,7 +56,7 @@ public class HttpUtils {
         String[] filename = originalFilename.split("\\.");
         String[] filename = originalFilename.split("\\.");
         File toFile = File.createTempFile(filename[0], "." + filename[1]);
         File toFile = File.createTempFile(filename[0], "." + filename[1]);
         file.transferTo(toFile);
         file.transferTo(toFile);
-        log.info("================>{}",toFile.getAbsoluteFile());
+        //log.info("================>{}",toFile.getAbsoluteFile());
         //toFile.deleteOnExit();//在jvm 退出时删除
         //toFile.deleteOnExit();//在jvm 退出时删除
         return toFile;
         return toFile;
     }
     }

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/gb28181/event/online/OnlineEventListener.java

@@ -77,7 +77,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> {
 		}
 		}
 
 
 		device.setOnline(1);
 		device.setOnline(1);
-		logger.info("***************************处理时间监听,监听上线******************************");
+		//logger.info("***************************处理时间监听,监听上线******************************");
 		// 处理上线监听
 		// 处理上线监听
 		storager.updateDevice(device);
 		storager.updateDevice(device);
 		remoteLaboratoryService.sends(device.getDeviceId(), HardwareOperate.ONLINE);
 		remoteLaboratoryService.sends(device.getDeviceId(), HardwareOperate.ONLINE);

+ 1 - 32
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@@ -342,8 +342,7 @@ public class SIPCommander implements ISIPCommander {
 		try {
 		try {
 			if (device == null) return;
 			if (device == null) return;
 			String streamMode = device.getStreamMode().toUpperCase();
 			String streamMode = device.getStreamMode().toUpperCase();
-
-			logger.info("{} 分配的ZLM为: {} [{}:{}]", streamId, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
+			//logger.info("{} 分配的ZLM为: {} [{}:{}]", streamId, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
 			// 添加订阅
 			// 添加订阅
 			JSONObject subscribeKey = new JSONObject();
 			JSONObject subscribeKey = new JSONObject();
 			subscribeKey.put("app", "rtp");
 			subscribeKey.put("app", "rtp");
@@ -418,7 +417,6 @@ public class SIPCommander implements ISIPCommander {
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
 
 
 			Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrcInfo.getSsrc(), callIdHeader);
 			Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrcInfo.getSsrc(), callIdHeader);
-
 			String finalStreamId = streamId;
 			String finalStreamId = streamId;
 			transmitRequest(device, request, (e -> {
 			transmitRequest(device, request, (e -> {
 				streamSession.remove(device.getDeviceId(), channelId);
 				streamSession.remove(device.getDeviceId(), channelId);
@@ -428,8 +426,6 @@ public class SIPCommander implements ISIPCommander {
 				streamSession.put(device.getDeviceId(), channelId ,ssrcInfo.getSsrc(), finalStreamId, mediaServerItem.getId(),e.getClientTransaction());
 				streamSession.put(device.getDeviceId(), channelId ,ssrcInfo.getSsrc(), finalStreamId, mediaServerItem.getId(),e.getClientTransaction());
 				streamSession.put(device.getDeviceId(), channelId , e.getDialog());
 				streamSession.put(device.getDeviceId(), channelId , e.getDialog());
 			});
 			});
-
-
 		} catch ( SipException | ParseException | InvalidArgumentException e) {
 		} catch ( SipException | ParseException | InvalidArgumentException e) {
 			e.printStackTrace();
 			e.printStackTrace();
 		}
 		}
@@ -447,9 +443,7 @@ public class SIPCommander implements ISIPCommander {
 	public void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, String startTime, String endTime, ZLMHttpHookSubscribe.Event event
 	public void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, String startTime, String endTime, ZLMHttpHookSubscribe.Event event
 			, SipSubscribe.Event errorEvent) {
 			, SipSubscribe.Event errorEvent) {
 		try {
 		try {
-
 			logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStreamId(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
 			logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStreamId(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
-
 			// 添加订阅
 			// 添加订阅
 			JSONObject subscribeKey = new JSONObject();
 			JSONObject subscribeKey = new JSONObject();
 			subscribeKey.put("app", "rtp");
 			subscribeKey.put("app", "rtp");
@@ -473,10 +467,7 @@ public class SIPCommander implements ISIPCommander {
 	        content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
 	        content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
 					+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
 					+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
 
 
-
-
 			String streamMode = device.getStreamMode().toUpperCase();
 			String streamMode = device.getStreamMode().toUpperCase();
-
 			if (userSetup.isSeniorSdp()) {
 			if (userSetup.isSeniorSdp()) {
 				if("TCP-PASSIVE".equals(streamMode)) {
 				if("TCP-PASSIVE".equals(streamMode)) {
 					content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
 					content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
@@ -522,14 +513,10 @@ public class SIPCommander implements ISIPCommander {
 					content.append("a=connection:new\r\n");
 					content.append("a=connection:new\r\n");
 				}
 				}
 			}
 			}
-
 	        content.append("y=" + ssrcInfo.getSsrc() + "\r\n");//ssrc
 	        content.append("y=" + ssrcInfo.getSsrc() + "\r\n");//ssrc
-
 			String tm = Long.toString(System.currentTimeMillis());
 			String tm = Long.toString(System.currentTimeMillis());
-
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
-
 	        Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader);
 	        Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader);
 
 
 	        transmitRequest(device, request, errorEvent, okEvent -> {
 	        transmitRequest(device, request, errorEvent, okEvent -> {
@@ -579,11 +566,7 @@ public class SIPCommander implements ISIPCommander {
 	        content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n");
 	        content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n");
 	        content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
 	        content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
 					+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
 					+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
-
-
-
 			String streamMode = device.getStreamMode().toUpperCase();
 			String streamMode = device.getStreamMode().toUpperCase();
-
 			if (userSetup.isSeniorSdp()) {
 			if (userSetup.isSeniorSdp()) {
 				if("TCP-PASSIVE".equals(streamMode)) {
 				if("TCP-PASSIVE".equals(streamMode)) {
 					content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
 					content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
@@ -637,9 +620,7 @@ public class SIPCommander implements ISIPCommander {
 
 
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
-
 	        Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader);
 	        Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader);
-
 	        ClientTransaction transaction = transmitRequest(device, request, errorEvent);
 	        ClientTransaction transaction = transmitRequest(device, request, errorEvent);
 	        streamSession.put(device.getDeviceId(), channelId, ssrcInfo.getSsrc(), ssrcInfo.getStreamId(), mediaServerItem.getId(), transaction);
 	        streamSession.put(device.getDeviceId(), channelId, ssrcInfo.getSsrc(), ssrcInfo.getStreamId(), mediaServerItem.getId(), transaction);
 
 
@@ -775,12 +756,9 @@ public class SIPCommander implements ISIPCommander {
 			broadcastXml.append("<SourceID>" + sipConfig.getId() + "</SourceID>\r\n");
 			broadcastXml.append("<SourceID>" + sipConfig.getId() + "</SourceID>\r\n");
 			broadcastXml.append("<TargetID>" + device.getDeviceId() + "</TargetID>\r\n");
 			broadcastXml.append("<TargetID>" + device.getDeviceId() + "</TargetID>\r\n");
 			broadcastXml.append("</Notify>\r\n");
 			broadcastXml.append("</Notify>\r\n");
-
 			String tm = Long.toString(System.currentTimeMillis());
 			String tm = Long.toString(System.currentTimeMillis());
-
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
-
 			Request request = headerProvider.createMessageRequest(device, broadcastXml.toString(), "z9hG4bK-ViaBcst-" + tm, "FromBcst" + tm, null, callIdHeader);
 			Request request = headerProvider.createMessageRequest(device, broadcastXml.toString(), "z9hG4bK-ViaBcst-" + tm, "FromBcst" + tm, null, callIdHeader);
 			transmitRequest(device, request, errorEvent);
 			transmitRequest(device, request, errorEvent);
 		} catch (SipException | ParseException | InvalidArgumentException e) {
 		} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -811,12 +789,9 @@ public class SIPCommander implements ISIPCommander {
 			}
 			}
 			cmdXml.append("<RecordCmd>" + recordCmdStr + "</RecordCmd>\r\n");
 			cmdXml.append("<RecordCmd>" + recordCmdStr + "</RecordCmd>\r\n");
 			cmdXml.append("</Control>\r\n");
 			cmdXml.append("</Control>\r\n");
-
 			String tm = Long.toString(System.currentTimeMillis());
 			String tm = Long.toString(System.currentTimeMillis());
-
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
-
 			Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromRecord" + tm, null, callIdHeader);
 			Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromRecord" + tm, null, callIdHeader);
 			transmitRequest(device, request, errorEvent);
 			transmitRequest(device, request, errorEvent);
 			return true;
 			return true;
@@ -842,12 +817,9 @@ public class SIPCommander implements ISIPCommander {
 			cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
 			cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
 			cmdXml.append("<TeleBoot>Boot</TeleBoot>\r\n");
 			cmdXml.append("<TeleBoot>Boot</TeleBoot>\r\n");
 			cmdXml.append("</Control>\r\n");
 			cmdXml.append("</Control>\r\n");
-
 			String tm = Long.toString(System.currentTimeMillis());
 			String tm = Long.toString(System.currentTimeMillis());
-
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
-
 			Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromBoot" + tm, null, callIdHeader);
 			Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromBoot" + tm, null, callIdHeader);
 			transmitRequest(device, request);
 			transmitRequest(device, request);
 			return true;
 			return true;
@@ -874,12 +846,9 @@ public class SIPCommander implements ISIPCommander {
 			cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
 			cmdXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
 			cmdXml.append("<GuardCmd>" + guardCmdStr + "</GuardCmd>\r\n");
 			cmdXml.append("<GuardCmd>" + guardCmdStr + "</GuardCmd>\r\n");
 			cmdXml.append("</Control>\r\n");
 			cmdXml.append("</Control>\r\n");
-
 			String tm = Long.toString(System.currentTimeMillis());
 			String tm = Long.toString(System.currentTimeMillis());
-
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 			CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
 					: udpSipProvider.getNewCallId();
 					: udpSipProvider.getNewCallId();
-
 			Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromGuard" + tm, null, callIdHeader);
 			Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromGuard" + tm, null, callIdHeader);
 			transmitRequest(device, request, errorEvent);
 			transmitRequest(device, request, errorEvent);
 			return true;
 			return true;

+ 0 - 12
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java

@@ -29,21 +29,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
 
 
     private final Logger logger = LoggerFactory.getLogger(SIPCommanderFroPlatform.class);
     private final Logger logger = LoggerFactory.getLogger(SIPCommanderFroPlatform.class);
 
 
-    // @Autowired
-    // private SipConfig sipConfig;
-
-    // @Autowired
-    // private SIPRequestHeaderProvider headerProvider;
-
     @Autowired
     @Autowired
     private SIPRequestHeaderPlarformProvider headerProviderPlarformProvider;
     private SIPRequestHeaderPlarformProvider headerProviderPlarformProvider;
 
 
-    // @Autowired
-    // private VideoStreamSessionManager streamSession;
-
-    // @Autowired
-    // private IVideoManagerStorager storager;
-
     @Autowired
     @Autowired
     private IRedisCatchStorage redisCatchStorage;
     private IRedisCatchStorage redisCatchStorage;
 
 

+ 0 - 5
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/media/zlm/ZLMRESTfulUtils.java

@@ -39,9 +39,7 @@ public class ZLMRESTfulUtils {
                 }
                 }
             }
             }
         }
         }
-
         FormBody body = builder.build();
         FormBody body = builder.build();
-
         Request request = new Request.Builder()
         Request request = new Request.Builder()
                 .post(body)
                 .post(body)
                 .url(url)
                 .url(url)
@@ -83,9 +81,6 @@ public class ZLMRESTfulUtils {
                     }
                     }
                 });
                 });
             }
             }
-
-
-
         return responseJSON;
         return responseJSON;
     }
     }
 
 

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@@ -118,7 +118,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
 			device.setCreateTime(now);
 			device.setCreateTime(now);
 			return deviceMapper.add(device) > 0;
 			return deviceMapper.add(device) > 0;
 		}else {
 		}else {
-			logger.info("*****************************更新设备状态***************************");
+			//logger.info("*****************************更新设备状态***************************");
 			return deviceMapper.update(device) > 0;
 			return deviceMapper.update(device) > 0;
 		}
 		}
 
 

+ 74 - 86
zd-modules/zd-algorithm/src/main/java/com/zd/alg/mqtt/MqttConfig.java

@@ -1,13 +1,14 @@
 package com.zd.alg.mqtt;
 package com.zd.alg.mqtt;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.zd.alg.fire.service.IFireDeviceLogService;
-import com.zd.alg.fire.utils.FireDeviceStatusTask;
-import com.zd.alg.fire.utils.FireLaborUtil;
-import com.zd.common.core.redis.RedisService;
-import com.zd.model.constant.CacheConstants;
-import com.zd.model.constant.MqttConstants;
+import com.zd.alg.alarm.service.IAlarmLogService;
+import com.zd.alg.alarm.utils.AlarmUtil;
+import com.zd.algorithm.api.alarm.entity.AlarmEntrty;
+import com.zd.algorithm.api.alarm.entity.AlarmLog;
+import com.zd.algorithm.api.alarm.entity.Routes;
+import com.zd.algorithm.api.alarm.entity.SendTypes;
+import com.zd.common.core.utils.DateUtils;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
 import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
@@ -25,10 +26,15 @@ import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannel
 import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler;
 import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler;
 import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
 import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
 import org.springframework.integration.mqtt.support.MqttHeaders;
 import org.springframework.integration.mqtt.support.MqttHeaders;
-import org.springframework.messaging.*;
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.MessageHandler;
+import org.springframework.messaging.MessagingException;
 
 
-import javax.annotation.Resource;
-import java.util.concurrent.TimeUnit;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 
 /**
 /**
  * mqtt配置
  * mqtt配置
@@ -37,21 +43,16 @@ import java.util.concurrent.TimeUnit;
  */
  */
 @Configuration
 @Configuration
 public class MqttConfig {
 public class MqttConfig {
-    static Logger logger = LoggerFactory.getLogger(MqttConfig.class);
-
-    @Resource
-    private RedisService redisService;
 
 
-    @Resource
-    private MqttSend mqttSend;
+    @Autowired
+    private AlarmUtil alarmUtil;
+    @Autowired
+    private IAlarmLogService alarmLogService;
 
 
-    @Resource
-    private IFireDeviceLogService deviceLogService;
+    static Logger logger = LoggerFactory.getLogger(MqttConfig.class);
 
 
     private static final byte[] WILL_DATA;
     private static final byte[] WILL_DATA;
 
 
-    private static String WILL_TOPIC = "alert";
-
     static {
     static {
         WILL_DATA = "offline".getBytes();
         WILL_DATA = "offline".getBytes();
     }
     }
@@ -82,10 +83,10 @@ public class MqttConfig {
     @Value("${mqtt.consumer.maxInflight}")
     @Value("${mqtt.consumer.maxInflight}")
     private Integer maxInflight;
     private Integer maxInflight;
 
 
+    private MqttPahoMessageDrivenChannelAdapter adapter;
+
     /**
     /**
      * 连接mqtt配置
      * 连接mqtt配置
-     *
-     * @return
      */
      */
     @Bean
     @Bean
     public MqttConnectOptions mqttConnectOptions() {
     public MqttConnectOptions mqttConnectOptions() {
@@ -93,17 +94,16 @@ public class MqttConfig {
         // false,服务器会保留客户端的连接记录
         // false,服务器会保留客户端的连接记录
         // true,表示每次连接到服务器都以新的身份连接
         // true,表示每次连接到服务器都以新的身份连接
         options.setCleanSession(false);
         options.setCleanSession(false);
-        options.setAutomaticReconnect(true);
         options.setUserName(username);
         options.setUserName(username);
         options.setPassword(password.toCharArray());
         options.setPassword(password.toCharArray());
-        options.setMaxInflight(maxInflight);
+//        options.setMaxInflight(maxInflight);
         options.setServerURIs(StringUtils.split(url, ","));
         options.setServerURIs(StringUtils.split(url, ","));
         //超时时间 单位为秒
         //超时时间 单位为秒
-        options.setConnectionTimeout(60);
+        options.setConnectionTimeout(10);
         //会话心跳时间 单位: s, 间隔时间:1.5*20秒向客户端发送心跳判断客户端是否在线
         //会话心跳时间 单位: s, 间隔时间:1.5*20秒向客户端发送心跳判断客户端是否在线
         options.setKeepAliveInterval(60);
         options.setKeepAliveInterval(60);
         //设置“遗嘱”消息的话题,若客户端与服务器之间的连接意外中断,服务器将发布客户端的“遗嘱”消息。
         //设置“遗嘱”消息的话题,若客户端与服务器之间的连接意外中断,服务器将发布客户端的“遗嘱”消息。
-        options.setWill(WILL_TOPIC, WILL_DATA, 2, false);
+//        options.setWill("willTopic", WILL_DATA, 2, false);
         return options;
         return options;
     }
     }
 
 
@@ -128,15 +128,11 @@ public class MqttConfig {
 
 
     /**
     /**
      * 发送者消息处理
      * 发送者消息处理
-     *
-     * @return
      */
      */
     @Bean
     @Bean
     @ServiceActivator(inputChannel = MQTT_OUTBOUND_CHANNEL)
     @ServiceActivator(inputChannel = MQTT_OUTBOUND_CHANNEL)
     public MessageHandler mqttOutbound() {
     public MessageHandler mqttOutbound() {
-        MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler(
-                producerClientId,
-                mqttClientFactory());
+        MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler(producerClientId, mqttClientFactory());
         messageHandler.setAsync(true);
         messageHandler.setAsync(true);
         messageHandler.setDefaultTopic(defaultTopic);
         messageHandler.setDefaultTopic(defaultTopic);
         return messageHandler;
         return messageHandler;
@@ -144,13 +140,11 @@ public class MqttConfig {
 
 
     /**
     /**
      * 消息订阅
      * 消息订阅
-     *
-     * @return
      */
      */
     @Bean
     @Bean
     public MessageProducer inbound() {
     public MessageProducer inbound() {
         // 可同时消费(订阅)多个Topic
         // 可同时消费(订阅)多个Topic
-        MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(consumerClientId, mqttClientFactory(), StringUtils.split(defaultTopic, ","));
+        adapter = new MqttPahoMessageDrivenChannelAdapter(consumerClientId, mqttClientFactory(), StringUtils.split(defaultTopic, ","));
         adapter.setCompletionTimeout(5000);
         adapter.setCompletionTimeout(5000);
         adapter.setConverter(new DefaultPahoMessageConverter());
         adapter.setConverter(new DefaultPahoMessageConverter());
         adapter.setQos(2);
         adapter.setQos(2);
@@ -162,8 +156,6 @@ public class MqttConfig {
 
 
     /**
     /**
      * 消费者消息通道
      * 消费者消息通道
-     *
-     * @return
      */
      */
     @Bean(name = MQTT_INBOUND_CHANNEL)
     @Bean(name = MQTT_INBOUND_CHANNEL)
     public MessageChannel mqttInboundChannel() {
     public MessageChannel mqttInboundChannel() {
@@ -173,61 +165,57 @@ public class MqttConfig {
     /**
     /**
      * 消费者消息处理
      * 消费者消息处理
      * 设备心跳
      * 设备心跳
-     *
-     * @return
      */
      */
-    //@Bean
-    //@ServiceActivator(inputChannel = MQTT_INBOUND_CHANNEL)
+    @Bean
+    @ServiceActivator(inputChannel = MQTT_INBOUND_CHANNEL)
     public MessageHandler mqttInbound() {
     public MessageHandler mqttInbound() {
+        return new MessageHandler() {
+            @Override
+            public void handleMessage(Message<?> message) throws MessagingException {
+                logger.info("预警消息接收内容: message={}", message);
+                String receivedTopic = (String) message.getHeaders().get(MqttHeaders.RECEIVED_TOPIC);
+                String msg = (String) message.getPayload();
+                try {
+                    String type = SendTypes.All + "";
+                    Map<String, Object> map = JSON.parseObject(msg, Map.class);
+                    map = JSON.parseObject(map.get("data") + "", Map.class);
+                    String text = (String) map.get("text");
+                    List<String> list = JSON.parseArray(map.get("to") + "", String.class);
+                    if (CollectionUtils.isEmpty(list)) {
+                        logger.error("接收告警消息手机号为空!");
+                        return;
+                    }
 
 
-        return message -> {
-            logger.info("=========>>> [消息头] - [{}]", message.getHeaders()+",[消息内容]: " + message.getPayload());
-            MessageHeaders messageHeaders = message.getHeaders();
-            String receivedTopic = (String) messageHeaders.get(MqttHeaders.TOPIC);
-            String messageStr = message.getPayload().toString();
-            /*if (receivedTopic.startsWith(MqttConstants.TOPIC_FIRE_DEVICE_RECEIVE)) {
-                logger.info("灭火设备消息消费,receivedTopic:" + receivedTopic + " messageStr:" + messageStr);
-                receivedTopic = receivedTopic.substring(receivedTopic.lastIndexOf("/") + 1, receivedTopic.length());
-                //根据状态指令获取主机状态
-                JSONObject jsonObject = FireLaborUtil.getFireStatus(messageStr);
-                Integer fireNumber = Integer.valueOf(jsonObject.get("fireNumber").toString());
-                //灭火主机发生预警
-                if (fireNumber > 0) {
-                    logger.info("灭火设备传感器异常,通知预案,状态:" + jsonObject.toJSONString());
-                    //发现灭火设备异常,发送消息通知
-                    mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE_WARN+receivedTopic,jsonObject.toJSONString());
-                    //自动灭火
-                    if (fireNumber == 2) {
-                        //redis中是否已存在日志已添加标识
-                        String isExist = redisService.getCacheObject(CacheConstants.FIRE_LOG_IS_EXIST);
-                        if(StringUtils.isEmpty(isExist)){
-                            //自动灭火日志添加
-                            String str = deviceLogService.insertFireAutomatic(receivedTopic);
-                            //redis存值,灭火日志已经添加标识
-                            redisService.setCacheObject(CacheConstants.FIRE_LOG_IS_EXIST, str, 60L, TimeUnit.MINUTES);
-                            logger.info("自动灭火日志添加执行结果," + str);
+                    Set<String> set = new HashSet<>(list);
+                    String[] to = new String[set.size()];
+                    set.toArray(to);
+                    String dataType = (String) map.get("type");
+                    if (map.get("type") != null && ((SendTypes.All + "").equals(dataType) || (SendTypes.Call + "").equals(dataType) || (SendTypes.SMS + "").equals(dataType))) {
+                        type = dataType;
+                    }
+
+                    AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, to, type, text);
+                    map = alarmUtil.sendPost(alarmEntrty);
+                    String data = (String) map.get("Reply");
+                    if ("OK".equals(data)) {
+                        String[] phones = alarmEntrty.getTo();
+                        for (String phone : phones) {
+                            AlarmLog alarmLog = new AlarmLog();
+                            alarmLog.setRemark("预案ID/实验室ID: " + receivedTopic.replace(defaultTopic, ""));
+                            alarmLog.setIsBack(0);
+                            alarmLog.setStatus("失败");
+                            alarmLog.setPhone(phone);
+                            alarmLog.setNotice(alarmEntrty.getText());
+                            alarmLog.setCreateTime(DateUtils.getNowDate());
+                            alarmLogService.insertAlarmLog(alarmLog);
                         }
                         }
+                    } else {
+                        logger.error("报警电话推送错误:" + JSON.toJSONString(map));
                     }
                     }
+                } catch (Exception e) {
+                    logger.error("报警处理数据异常:{}", e);
                 }
                 }
-                //redis存值 采集器编号:主机状态json
-                redisService.setCacheObject(receivedTopic, jsonObject, 1L, TimeUnit.MINUTES);
-                //redis存值 灭火主机响应时间
-                redisService.setCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME, System.currentTimeMillis(), 1L, TimeUnit.MINUTES);
-            }*/
-        };
-    }
-
-    public static String byte2Hex(byte[] bytes) {
-        StringBuilder builder = new StringBuilder();
-        String temp;
-        for (byte aByte : bytes) {
-            temp = Integer.toHexString(aByte & 0xFF);
-            if (temp.length() == 1) {
-                //1得到一位的进行补0操作
-                builder.append("0");
             }
             }
-            builder.append(temp);
-        }
-        return builder.toString();
+        };
     }
     }
-}
+}

+ 5 - 0
zd-modules/zd-base/pom.xml

@@ -122,6 +122,10 @@
             <artifactId>minio</artifactId>
             <artifactId>minio</artifactId>
             <version>${minio.version}</version>
             <version>${minio.version}</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.zd.algorithm</groupId>
+            <artifactId>zd-algorithm-api</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>
@@ -130,6 +134,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <configuration>
                 <configuration>
                     <includeSystemScope>true</includeSystemScope>
                     <includeSystemScope>true</includeSystemScope>
                 </configuration>
                 </configuration>

+ 1 - 1
zd-modules/zd-base/src/main/java/com/zd/base/job/config/ScheduleConfig.java

@@ -25,7 +25,7 @@ public class ScheduleConfig {
         prop.put("org.quartz.scheduler.instanceId", "AUTO");
         prop.put("org.quartz.scheduler.instanceId", "AUTO");
         // 线程池配置
         // 线程池配置
         prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
         prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
-        prop.put("org.quartz.threadPool.threadCount", "20");
+        prop.put("org.quartz.threadPool.threadCount", "30");
         prop.put("org.quartz.threadPool.threadPriority", "5");
         prop.put("org.quartz.threadPool.threadPriority", "5");
         // JobStore配置
         // JobStore配置
         prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
         prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");

+ 24 - 0
zd-modules/zd-base/src/main/java/com/zd/base/job/task/FireDeviceTask.java

@@ -0,0 +1,24 @@
+package com.zd.base.job.task;
+
+import com.zd.algorithm.api.fire.RemoteFireDeviceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: xxf
+ * @Date: 2022/12/28/14:46
+ * @Description:
+ */
+@Component("fireTask")
+public class FireDeviceTask {
+
+    @Autowired
+    private RemoteFireDeviceService remoteFireDeviceService;
+
+    /**
+     * 定时器定时查询灭火主机状态
+     */
+    public void getFireDeviceStatus() {
+        remoteFireDeviceService.getFireDeviceStatus();
+    }
+}

+ 1 - 0
zd-modules/zd-bottle-parent/zd-bottle/pom.xml

@@ -102,6 +102,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

+ 1 - 0
zd-modules/zd-chemical/pom.xml

@@ -131,6 +131,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <configuration>
                 <configuration>
                     <includeSystemScope>true</includeSystemScope>
                     <includeSystemScope>true</includeSystemScope>
                 </configuration>
                 </configuration>

+ 1 - 0
zd-modules/zd-exam/pom.xml

@@ -105,6 +105,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

+ 1 - 0
zd-modules/zd-modules-laboratory/pom.xml

@@ -106,6 +106,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

+ 6 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabRiskPlanController.java

@@ -1,5 +1,7 @@
 package com.zd.laboratory.controller;
 package com.zd.laboratory.controller;
 
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.TimeInterval;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -356,6 +358,8 @@ public class LabRiskPlanController extends BaseController {
     @PostMapping("/closeRiskPlan")
     @PostMapping("/closeRiskPlan")
     public ResultData closeRiskPlan(@RequestBody LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup) {
     public ResultData closeRiskPlan(@RequestBody LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup) {
         try {
         try {
+            TimeInterval timer = DateUtil.timer();
+            logger.info("开始进入手动关闭预案");
             LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
             LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
             labRiskPlanAbnormalLog.setGroupId(labRiskPlanAbnormalGroup.getId());
             labRiskPlanAbnormalLog.setGroupId(labRiskPlanAbnormalGroup.getId());
             List<LabRiskPlanAbnormalLog> logList = labRiskPlanAbnormalLogService.selectLabRiskPlanAbnormalLogOrderByList(labRiskPlanAbnormalLog);
             List<LabRiskPlanAbnormalLog> logList = labRiskPlanAbnormalLogService.selectLabRiskPlanAbnormalLogOrderByList(labRiskPlanAbnormalLog);
@@ -369,6 +373,8 @@ public class LabRiskPlanController extends BaseController {
                 //关闭预案
                 //关闭预案
                 labRiskPlanService.closeRiskPlan(subFunction);
                 labRiskPlanService.closeRiskPlan(subFunction);
             });
             });
+            long interval = timer.interval();
+            logger.info("开始执行花费时间={}",interval);
             return ResultData.success(1);
             return ResultData.success(1);
         }catch (Exception e){
         }catch (Exception e){
             e.printStackTrace();
             e.printStackTrace();

+ 0 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/enums/BigViewDataType.java

@@ -44,8 +44,4 @@ public enum BigViewDataType {
      * 结束疏散
      * 结束疏散
      */
      */
     FLOOR_OVER_EXITLINE;
     FLOOR_OVER_EXITLINE;
-
-
-
-
 }
 }

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/impl/SubMessageSendManager.java

@@ -209,8 +209,8 @@ public class SubMessageSendManager {
         subFunction.setFunctionStatuses(newFunctionStatuses);
         subFunction.setFunctionStatuses(newFunctionStatuses);
         //todo 到这里结束
         //todo 到这里结束
 
 
-        String json = JSONObject.toJSONString(subFunction);
-        logger.error("@@@@@@@@" + json);
+        //String json = JSONObject.toJSONString(subFunction);
+        //logger.error("@@@@@@@@" + json);
         //发送事件
         //发送事件
         //本来使用mqtt接收,因为mqtt 每个客户端接受到都会处理,
         //本来使用mqtt接收,因为mqtt 每个客户端接受到都会处理,
         List<LabMessageEvent> labMessageEvents = mqttConfig.getLabMessMap().get(MqttConstants.TOPIC_LAB_FUNCTION_DATA);
         List<LabMessageEvent> labMessageEvents = mqttConfig.getLabMessMap().get(MqttConstants.TOPIC_LAB_FUNCTION_DATA);

+ 16 - 6
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalDescServiceImpl.java

@@ -102,11 +102,21 @@ public class LabRiskPlanAbnormalDescServiceImpl implements ILabRiskPlanAbnormalD
 
 
     @Override
     @Override
     public int updateLabRiskPlanAbnormalDesc(long groupId, String handledPerson, String recordVideo) {
     public int updateLabRiskPlanAbnormalDesc(long groupId, String handledPerson, String recordVideo) {
-        LabRiskPlanAbnormalDesc desc = new LabRiskPlanAbnormalDesc();
-        desc.setGroupId(groupId);
-        desc.setHandledPerson(handledPerson);
-        desc.setRecordVideo(recordVideo);
-        desc.setUpdateTime(new Date());
-        return labRiskPlanAbnormalDescMapper.updateByGroupId(desc);
+        LabRiskPlanAbnormalDesc query = new LabRiskPlanAbnormalDesc();
+        query.setGroupId(groupId);
+        List<LabRiskPlanAbnormalDesc> list = labRiskPlanAbnormalDescMapper.selectByList(query);
+        if (list != null && list.size() > 0) {
+            LabRiskPlanAbnormalDesc desc = list.get(0);
+            long start = desc.getStartDate().getTime();
+            Date now = new Date();
+            desc.setEndDate(now);
+            long rd = ((now.getTime() - start) / 1000);
+            desc.setRiskDuration(rd);
+            desc.setHandledPerson(handledPerson);
+            desc.setRecordVideo(recordVideo);
+            desc.setUpdateTime(new Date());
+            return labRiskPlanAbnormalDescMapper.updateByGroupId(desc);
+        }
+        return 0;
     }
     }
 }
 }

+ 65 - 59
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -1,5 +1,7 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.TimeInterval;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONObject;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
@@ -17,6 +19,7 @@ import com.zd.common.core.security.TokenService;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.utils.StringUtils;
+import com.zd.laboratory.api.constant.RiskPlanConstants;
 import com.zd.laboratory.api.entity.FunctionStatus;
 import com.zd.laboratory.api.entity.FunctionStatus;
 import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.entity.SensorFunctionStatus;
 import com.zd.laboratory.api.entity.SensorFunctionStatus;
@@ -1071,8 +1074,8 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             });
             });
             //有效预案延长一分钟
             //有效预案延长一分钟
 //            if(redisService.getCacheObject("subjectByYa"+subFunction.getSubId())==null){
 //            if(redisService.getCacheObject("subjectByYa"+subFunction.getSubId())==null){
-            redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 10L, TimeUnit.SECONDS);
-//            redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 2L, TimeUnit.MINUTES);
+//            redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 10L, TimeUnit.SECONDS);
+            redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 2L, TimeUnit.MINUTES);
             log.info("@@@@@@@@@@@@@@@@@@@@预案延长3分钟@@@@@@@@@@@@@@@@@@@@");
             log.info("@@@@@@@@@@@@@@@@@@@@预案延长3分钟@@@@@@@@@@@@@@@@@@@@");
 //            }
 //            }
             Map<SenseType, List<SensorFunctionStatus>> sensorFunctionStatusListMap = hardwareFunctionStatusConfig.getSensorFunctionStatusListMap();
             Map<SenseType, List<SensorFunctionStatus>> sensorFunctionStatusListMap = hardwareFunctionStatusConfig.getSensorFunctionStatusListMap();
@@ -1085,7 +1088,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                     String funNum1 = sensorFunctionStatusListMap.get(SenseType.getByCode(rps.getSensorType())).get(0).getFunNum();
                     String funNum1 = sensorFunctionStatusListMap.get(SenseType.getByCode(rps.getSensorType())).get(0).getFunNum();
                     if (funNum1.equals(sensorFunc.getFunNum())) {
                     if (funNum1.equals(sensorFunc.getFunNum())) {
                         getJsonStr(riskPlanJson, sensorFunc);
                         getJsonStr(riskPlanJson, sensorFunc);
-                        labRiskPlanLevel.setTopName(labRiskPlanLevel.getTopName() + " " + sensorFunc.getDescribe());
+                        labRiskPlanLevel.setTopName(labRiskPlanLevel.getTopName() + "-" + sensorFunc.getDescribe()+":"+sensorFunc.getVal());
                         sb.append(sensorFunc.getDescribe()).append("、");
                         sb.append(sensorFunc.getDescribe()).append("、");
                     }
                     }
                 }
                 }
@@ -1115,8 +1118,9 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
 
 
                 //向一体机推送语音播报
                 //向一体机推送语音播报
                 log.error("向一体机推送语音播报开始=======================================================");
                 log.error("向一体机推送语音播报开始=======================================================");
+                String str = StringUtils.isBlank(labRiskPlanLevel.getVoicebroadcast()) ? "" : labRiskPlanLevel.getVoicebroadcast();
                 try {
                 try {
-                    messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, labRiskPlanLevel.getTopName() + "" + labRiskPlanLevel.getVoicebroadcast());
+                    messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
                 } catch (Exception e) {
                 } catch (Exception e) {
                     log.error("向一体机推送语音播报异常:" + e);
                     log.error("向一体机推送语音播报异常:" + e);
                 }
                 }
@@ -1127,7 +1131,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 log.error("向一体机传感器预警结束=======================================================");
                 log.error("向一体机传感器预警结束=======================================================");
                 //向一体机发送预警消息展示
                 //向一体机发送预警消息展示
                 log.error("向一体机发送预警消息展示开始=======================================================");
                 log.error("向一体机发送预警消息展示开始=======================================================");
-                insertMachineContent(subFunction.getSubId(), labRiskPlanLevel.getTopName() + "" + labRiskPlanLevel.getVoicebroadcast());
+                insertMachineContent(subFunction.getSubId(), RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
                 log.error("向一体机发送预警消息展示结束=======================================================");
                 log.error("向一体机发送预警消息展示结束=======================================================");
 
 
                 //首页消息通知
                 //首页消息通知
@@ -1180,20 +1184,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 } catch (Exception e) {
                 } catch (Exception e) {
                     log.error("开启喇叭失败!!!!!:" + e);
                     log.error("开启喇叭失败!!!!!:" + e);
                 }
                 }
-
-//                // TODO: 2022/3/26  目前只有c111外的响
-//                List<PlayVo> playVoList = new ArrayList<>();
-//                PlayVo playVo = new PlayVo();
-//                playVo.setSn("ls20://0201BFB9D686");
-//                playVo.setPort(18884);
-//                ParamVo paramVo=new ParamVo();
-//                playVo.setParams(paramVo);
-//                playVoList.add(playVo);
-//                if(radioStr.length()>0){
-//                    remoteSpeakService.textParseUrlAppIps(radioStr.toString(),playVoList);
-//                    log.info("喇叭播放完成!");
-//                }
-
                 //首页预案流程通知
                 //首页预案流程通知
                 messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
                 messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
                 //首页预案组通知
                 //首页预案组通知
@@ -1204,22 +1194,24 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                     redisService.setCacheObject("subjectByExit" + subFunction.getSubId(), subFunction.getSubId(), 30L, TimeUnit.SECONDS);
                     redisService.setCacheObject("subjectByExit" + subFunction.getSubId(), subFunction.getSubId(), 30L, TimeUnit.SECONDS);
                     messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
                     messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
                 }
                 }
+                //远程调用结束录制视频接口
                 try {
                 try {
                     LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
                     LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
-                    if (labHardware != null) {
-                        //开始录制视频
-    //                    remoteCameraService.startRecord("192.168.1.64");
-//                        remoteCameraService.startRecord(labHardware.getIpAddress());
+                    if (labHardware == null) {
+                        log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
+                    }
+                    //开始录制视频
+                    log.info("远程调用开始录制视频ip地址={}",labHardware.getIpAddress());
+                    R r = remoteCameraService.startRecord(labHardware.getIpAddress());
+                    log.info("开始录制视频返回结果打印={}", JSON.toJSONString(r));
+                    if (r.getCode() != HttpStatus.SUCCESS){
+                        log.info("开始录制视频失败!");
                     }
                     }
                 } catch (Exception e) {
                 } catch (Exception e) {
-                    throw new RuntimeException(e);
+                    log.error("远程调用开始录制视频接口失败!{}",e);
                 }
                 }
-
-                R r = remoteCameraService.startRecord("192.168.1.64");
-                log.info("摄像头信息={}", JSON.toJSONString(r));
                 //向前端发送mqtt预案触发提示
                 //向前端发送mqtt预案触发提示
                 messageSendService.riskPlanTriggerNotice();
                 messageSendService.riskPlanTriggerNotice();
-
             }
             }
 
 
         } else {
         } else {
@@ -1298,22 +1290,28 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 // todo 操作人和视频结束时候的 url
                 // todo 操作人和视频结束时候的 url
 
 
                 //关闭视频录像
                 //关闭视频录像
-                LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
-                if (labHardware != null){
-                    //开始录制视频
-//                    remoteCameraService.startRecord("192.168.1.14");
-                    R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
-                    if (r.getCode() == HttpStatus.SUCCESS) {
-
+                String recordVideo = "";
+                try {
+                    LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
+                    if (labHardware != null) {
+                        //开始录制视频
+                        log.info("远程调用关闭视频ip地址={}",labHardware.getIpAddress());
+                        R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
+                        log.info("录制视频结束返回结果打印={}", JSON.toJSONString(r));
+                        if (r.getCode() == HttpStatus.SUCCESS){
+                            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(r.getData()));
+                            recordVideo = jsonObject.getString("msg");
+                        }else {
+                            log.info("结束录制视频失败!");
+                        }
+                    }else {
+                        log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
                     }
                     }
+                } catch (Exception e) {
+                    log.error("远程调用结束录制视频接口失败!{}",e);
                 }
                 }
-
-                R r = remoteCameraService.stopRecord("192.168.1.64");
-                log.info("摄像头信息2={}", JSON.toJSONString(r));
-
-                //TODO 更新风险概要  recordVideo - 视频记录存放地址
-                String handlePerson = null;
-                String recordVideo = "";
+                //更新风险概要  recordVideo - 视频记录存放地址
+                String handlePerson = tokenService.getLoginUser().getNickName();
                 labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
                 labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
                 log.info("groupId = {}",groupList.get(0).getId());
                 log.info("groupId = {}",groupList.get(0).getId());
                 writerEnterRiskPlan(groupList.get(0).getId(),2);
                 writerEnterRiskPlan(groupList.get(0).getId(),2);
@@ -1338,6 +1336,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
 
 
     @Override
     @Override
     public int closeRiskPlan(SubFunction<SensorFunctionStatus> subFunction) {
     public int closeRiskPlan(SubFunction<SensorFunctionStatus> subFunction) {
+        TimeInterval timer = DateUtil.timer();
         //将风险预案写入归属组级表里面
         //将风险预案写入归属组级表里面
         LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup = new LabRiskPlanAbnormalGroup();
         LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup = new LabRiskPlanAbnormalGroup();
         labRiskPlanAbnormalGroup.setSubjectId(subFunction.getSubId());
         labRiskPlanAbnormalGroup.setSubjectId(subFunction.getSubId());
@@ -1413,10 +1412,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             newGroupOP.setStatus(0L);
             newGroupOP.setStatus(0L);
             newGroupOP.setUpdateTime(new Date());
             newGroupOP.setUpdateTime(new Date());
             labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(newGroupOP);
             labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(newGroupOP);
-            //TODO 更新风险概要
-            String handlePerson = null;
-            String recordVideo = "";
-            labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
             //插入预案结束日志
             //插入预案结束日志
             insertPlanAbnormalLogByOver(groupVo, allRiskPlanJson, subFunction);
             insertPlanAbnormalLogByOver(groupVo, allRiskPlanJson, subFunction);
             //向一体机传感器预警
             //向一体机传感器预警
@@ -1427,21 +1422,31 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
             messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
             //首页预案是否同步疏散线路
             //首页预案是否同步疏散线路
             messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
             messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
-            //关闭视频录像
-            LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
-            if (labHardware != null){
+            //远程调用结束录制视频接口
+            String recordVideo = "";
+            try {
+                LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
+                if (labHardware == null) {
+                    log.info("手动关闭火焰预案-未查询到实验室关联摄像头信息!请检查ip是否为空!");
+                }
                 //开始录制视频
                 //开始录制视频
-//                    remoteCameraService.startRecord("192.168.1.14");
-                R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
-                if (r.getCode() == HttpStatus.SUCCESS) {
-
+                log.info("手动关闭火焰预案-远程调用结束录制视频ip地址={}",labHardware.getIpAddress());
+                R r = remoteCameraService.startRecord(labHardware.getIpAddress());
+                log.info("手动关闭火焰预案-结束录制视频返回结果打印={}", JSON.toJSONString(r));
+                if (r.getCode() == HttpStatus.SUCCESS){
+                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(r.getData()));
+                    recordVideo = jsonObject.getString("msg");
+                }else {
+                    log.info("手动关闭火焰预案-结束录制视频失败!");
                 }
                 }
+            } catch (Exception e) {
+                log.error("手动关闭火焰预案-远程调用结束录制视频接口失败!{}",e);
             }
             }
-            R r = remoteCameraService.stopRecord("192.168.1.64");
-            if (r.getCode()== HttpStatus.SUCCESS){
-
-            }
-            log.info("assddd");
+            //更新风险概要
+            String handlePerson = tokenService.getLoginUser().getNickName();
+            labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
+            long interval = timer.interval();
+            log.info("执行花费时间={}",interval);
         }
         }
         return 0;
         return 0;
     }
     }
@@ -1608,7 +1613,8 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         //这里给消息记录表插入数据(给一体机设备发送语音通知)
         //这里给消息记录表插入数据(给一体机设备发送语音通知)
         LabWarnPushMessage labWarnPushMessage = new LabWarnPushMessage();
         LabWarnPushMessage labWarnPushMessage = new LabWarnPushMessage();
         labWarnPushMessage.setRiskGroup(groupId);
         labWarnPushMessage.setRiskGroup(groupId);
-        labWarnPushMessage.setContext(labRiskPlanLevel.getTopName() + "" + labRiskPlanLevel.getInformation());
+        String string = StringUtils.isBlank(labRiskPlanLevel.getInformation()) ? "" : labRiskPlanLevel.getInformation();
+        labWarnPushMessage.setContext(RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + string);
         labWarnPushMessage.setPushType(WarnMessageTypeEnum.voice);
         labWarnPushMessage.setPushType(WarnMessageTypeEnum.voice);
         labWarnPushMessage.setWarnId(labRiskPlanLevel.getRiskPlanId());
         labWarnPushMessage.setWarnId(labRiskPlanLevel.getRiskPlanId());
         labWarnPushMessage.setSubId(subjectId);
         labWarnPushMessage.setSubId(subjectId);

+ 10 - 9
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectManagerService.java

@@ -777,19 +777,12 @@ public class LabSubjectManagerService {
 
 
         Long subId = labSensors.get(0).getSubjectId();
         Long subId = labSensors.get(0).getSubjectId();
 
 
-        /*JSONObject jsonObject = redisService.getCacheObject(CacheConstants.SENSOR_DATA_KEY + subId);
-        if (null == jsonObject) {
-            return getSensorFunctionOldStatuses(labSensors, isInitVal);
-        } else {
-            return getSensorFunctionNewStatuses(labSensors);
-        }*/
-
         List<SensorFunctionStatus> list = getSensorFunctionOldStatuses(labSensors, isInitVal);
         List<SensorFunctionStatus> list = getSensorFunctionOldStatuses(labSensors, isInitVal);
         JSONObject jsonObject = redisService.getCacheObject(CacheConstants.SENSOR_DATA_KEY + subId);
         JSONObject jsonObject = redisService.getCacheObject(CacheConstants.SENSOR_DATA_KEY + subId);
-        logger.info("传感器合并:云盒设备:"+ JSONUtil.toJsonStr(list));
+        //logger.info("传感器合并:云盒设备:"+ JSONUtil.toJsonStr(list));
         if(jsonObject != null){
         if(jsonObject != null){
             list = getSensorFunctionNewStatusesTwo(list, subId);
             list = getSensorFunctionNewStatusesTwo(list, subId);
-            logger.info("传感器合并:采集器设备:"+ JSONUtil.toJsonStr(list));
+            //logger.info("传感器合并:采集器设备:"+ JSONUtil.toJsonStr(list));
         }
         }
         return list;
         return list;
     }
     }
@@ -1345,8 +1338,16 @@ public class LabSubjectManagerService {
         hardware.setSubId(a.getSubjectId());
         hardware.setSubId(a.getSubjectId());
         hardware.setState(a.getOperate() == null ? HardwareOperate.OFFLINE : a.getOperate());
         hardware.setState(a.getOperate() == null ? HardwareOperate.OFFLINE : a.getOperate());
         hardware.setHardwareNUM(a.getHardwareNum());
         hardware.setHardwareNUM(a.getHardwareNum());
+        hardware.setIsPcfire(a.getIsPcfire());
         //默认不在线
         //默认不在线
         hardware.setSwitchEnums(ControlEntity.SwitchEnums.NO_ONLINE);
         hardware.setSwitchEnums(ControlEntity.SwitchEnums.NO_ONLINE);
+        //通风设备
+        if(a.getType().equals(HardwareTypeEnum.AI_VENTILATION)){
+            hardware.setPcType(a.getPcType());
+        }
+        if(a.getType().equals(HardwareTypeEnum.SWITCH)){
+            hardware.setIsPcfire(a.getIsPcfire());
+        }
         //初始化开关状态 (开关类型)
         //初始化开关状态 (开关类型)
         if (a.getHardwareType() == 2) {
         if (a.getHardwareType() == 2) {
             Integer code=redisService.getCacheObject(CacheConstants.RELAY_STATUS_KEY+a.getId());
             Integer code=redisService.getCacheObject(CacheConstants.RELAY_STATUS_KEY+a.getId());

+ 4 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabWarnPushMessageServiceImpl.java

@@ -1,6 +1,8 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
+import com.zd.common.core.utils.StringUtils;
+import com.zd.laboratory.api.constant.RiskPlanConstants;
 import com.zd.laboratory.domain.LabRiskPlanLevel;
 import com.zd.laboratory.domain.LabRiskPlanLevel;
 import com.zd.laboratory.domain.LabWarnPushMessage;
 import com.zd.laboratory.domain.LabWarnPushMessage;
 import com.zd.laboratory.domain.vo.LabWarnPushMessageVO;
 import com.zd.laboratory.domain.vo.LabWarnPushMessageVO;
@@ -72,7 +74,8 @@ public class LabWarnPushMessageServiceImpl implements ILabWarnPushMessageService
             try {
             try {
                 LabWarnPushMessage labWarnPushMessage = new LabWarnPushMessage();
                 LabWarnPushMessage labWarnPushMessage = new LabWarnPushMessage();
                 labWarnPushMessage.setRiskGroup(groupId);
                 labWarnPushMessage.setRiskGroup(groupId);
-                labWarnPushMessage.setContext(labRiskPlanLevel.getTopName()+""+labRiskPlanLevel.getMessage());
+                String str= StringUtils.isBlank(labRiskPlanLevel.getMessage()) ? "" : labRiskPlanLevel.getMessage();
+                labWarnPushMessage.setContext(RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
                 labWarnPushMessage.setPushType(WarnMessageTypeEnum.SMS);
                 labWarnPushMessage.setPushType(WarnMessageTypeEnum.SMS);
                 labWarnPushMessage.setWarnId(labRiskPlanLevel.getRiskPlanId());
                 labWarnPushMessage.setWarnId(labRiskPlanLevel.getRiskPlanId());
                 labWarnPushMessage.setSubId(subId);
                 labWarnPushMessage.setSubId(subId);

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml

@@ -9,7 +9,7 @@
         <result property="name" column="name"/>
         <result property="name" column="name"/>
         <result property="factory" column="factory"/>
         <result property="factory" column="factory"/>
         <result property="type" column="type" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
         <result property="type" column="type" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
-        <result property="pcType" column="pcType"/>
+        <result property="pcType" column="pc_type"/>
         <result property="macAdd" column="mac_add"/>
         <result property="macAdd" column="mac_add"/>
         <result property="subjectId" column="subject_id"/>
         <result property="subjectId" column="subject_id"/>
         <result property="deptId" column="dept_id"/>
         <result property="deptId" column="dept_id"/>

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalDescMapper.xml

@@ -109,7 +109,7 @@
     <select id="selectByList" parameterType="com.zd.laboratory.domain.LabRiskPlanAbnormalDesc" resultMap="BaseResult">
     <select id="selectByList" parameterType="com.zd.laboratory.domain.LabRiskPlanAbnormalDesc" resultMap="BaseResult">
         <include refid="selectBaseColumn"/>
         <include refid="selectBaseColumn"/>
         <where>
         <where>
-            <if test="groupId != null and groupId != 0">AND group_id =#{groupId}</if>
+            <if test="groupId != null and groupId != 0">AND group_id = #{groupId}</if>
             <if test="riskReason != null and riskReason != ''">AND risk_reason = #{riskReason}</if>
             <if test="riskReason != null and riskReason != ''">AND risk_reason = #{riskReason}</if>
             <if test="riskLevel != null">AND risk_level = #{riskLevel}</if>
             <if test="riskLevel != null">AND risk_level = #{riskLevel}</if>
             <if test="startDate != null">AND start_date = #{startDate}</if>
             <if test="startDate != null">AND start_date = #{startDate}</if>

+ 1 - 0
zd-modules/zd-modules-system/pom.xml

@@ -63,6 +63,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>

+ 1 - 0
zd-visual/zd-monitor/pom.xml

@@ -68,6 +68,7 @@
             <plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <goals>
                         <goals>