瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/impl/SubMessageSendManager.java
chaiyunlong 3 年之前
父節點
當前提交
50ba1abc0a
共有 100 個文件被更改,包括 1335 次插入2049 次删除
  1. 13 70
      pom.xml
  2. 1 0
      zd-api/pom.xml
  3. 3 3
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/alarm/entity/AlarmEntrty.java
  4. 22 0
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/alarm/entity/AlarmLog.java
  5. 17 0
      zd-api/zd-auth-api/pom.xml
  6. 20 0
      zd-api/zd-auth-api/src/main/java/com/zd/auth/feign/RemoteAuthService.java
  7. 25 0
      zd-api/zd-auth-api/src/main/java/com/zd/auth/feign/factory/RemoteAuthFallback.java
  8. 0 0
      zd-api/zd-auth-api/src/main/java/com/zd/auth/form/LoginBody.java
  9. 0 0
      zd-api/zd-auth-api/src/main/java/com/zd/auth/form/RegisterBody.java
  10. 9 0
      zd-auth/pom.xml
  11. 0 10
      zd-common/common-core/pom.xml
  12. 1 1
      zd-common/common-core/src/main/java/com/zd/common/core/launch/StartEventListener.java
  13. 4 5
      zd-common/common-core/src/main/java/com/zd/common/core/security/TokenServiceImpl.java
  14. 4 0
      zd-common/common-swagger/src/main/java/com/zd/common/swagger/config/AppListener.java
  15. 2 11
      zd-gateway/pom.xml
  16. 0 2
      zd-gateway/src/main/java/com/zd/gateway/ZdGatewayApplication.java
  17. 0 10
      zd-gateway/src/main/resources/banner.txt
  18. 0 185
      zd-model/src/main/java/com/zd/model/constant/Constants.java
  19. 80 0
      zd-model/src/main/java/com/zd/model/constant/MqttConstants.java
  20. 75 75
      zd-model/src/main/java/com/zd/model/enums/CodeToValueEnumTypeHandler.java
  21. 0 1
      zd-modules/pom.xml
  22. 2 3
      zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/QpSupplierServiceImpl.java
  23. 0 10
      zd-modules/zd-airbottle/src/main/resources/banner.txt
  24. 2 1
      zd-modules/zd-airbottle/src/main/resources/bootstrap.yml
  25. 4 0
      zd-modules/zd-algorithm/pom.xml
  26. 11 9
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/AlgorithmApplication.java
  27. 8 11
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/controller/FaceManagerApi.java
  28. 6 30
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/handle/FaceEngineFactory.java
  29. 4 13
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/service/FaceService.java
  30. 15 15
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/config/AlgorithmYml.java
  31. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/controller/SignInCheckController.java
  32. 9 11
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java
  33. 14 15
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/LoginService.java
  34. 6 11
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/SendSginAccessLogService.java
  35. 20 20
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/conf/MediaConfig.java
  36. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/conf/UserSetup.java
  37. 0 4
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
  38. 0 7
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
  39. 0 9
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/platform/PlatformController.java
  40. 10 18
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlApplyApprovalController.java
  41. 27 38
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlOpendoorApplyController.java
  42. 5 5
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlSubjectRelationController.java
  43. 1 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlUserRelationController.java
  44. 3 5
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SmartlockController.java
  45. 99 107
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlApplyApprovalServiceImpl.java
  46. 65 64
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlOpendoorApplyServiceImpl.java
  47. 17 24
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlSubjectRelationServiceImpl.java
  48. 9 16
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlUserRelationServiceImpl.java
  49. 13 12
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/utils/SmartlockUtil.java
  50. 7 7
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/speaker/domain/RemoteAddress.java
  51. 7 4
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/speaker/service/impl/SpeakerServiceImpl.java
  52. 9 146
      zd-modules/zd-algorithm/src/main/resources/bootstrap.yml
  53. 2 1
      zd-modules/zd-algorithm/src/main/resources/mapper/smartlock/SlApplyApprovalMapper.xml
  54. 15 8
      zd-modules/zd-algorithm/src/main/resources/mapper/smartlock/SlOpendoorApplyMapper.xml
  55. 2 3
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/ExamApi.java
  56. 2 3
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LabApi.java
  57. 2 3
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LabManageController.java
  58. 2 3
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LaboratoryApi.java
  59. 2 2
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/MessageContentApi.java
  60. 2 2
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/SysUserApi.java
  61. 1 1
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LabPhotoInspection.java
  62. 2 2
      zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/PhotoVo.java
  63. 1 0
      zd-modules/zd-base/src/main/java/com/zd/base/message/service/impl/WechatMsgSendServiceImpl.java
  64. 6 2
      zd-modules/zd-base/src/main/resources/bootstrap.yml
  65. 2 3
      zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/ZdBottleApplication.java
  66. 19 2
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/domain/vo/HxpAlarmRecordVo.java
  67. 6 2
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/mapper/HxpAlarmRecordMapper.java
  68. 64 12
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpAlarmRecordServiceImpl.java
  69. 7 4
      zd-modules/zd-chemical/src/main/resources/bootstrap.yml
  70. 33 20
      zd-modules/zd-chemical/src/main/resources/mapper/chemical/HxpAlarmRecordMapper.xml
  71. 7 4
      zd-modules/zd-exam/src/main/resources/bootstrap.yml
  72. 0 97
      zd-modules/zd-modules-app/pom.xml
  73. 0 25
      zd-modules/zd-modules-app/src/main/java/com/zd/app/ZdAppApplication.java
  74. 0 4
      zd-modules/zd-modules-app/src/main/resources/bootstrap.yml
  75. 0 74
      zd-modules/zd-modules-app/src/main/resources/logback.xml
  76. 0 182
      zd-modules/zd-modules-app/wait-for-it.sh
  77. 41 41
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/AlarmController.java
  78. 3 3
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHardwareController.java
  79. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHazardBookController.java
  80. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabMoldController.java
  81. 5 5
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabRotationChartController.java
  82. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubMangerController.java
  83. 11 11
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubjectController.java
  84. 0 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubjectDengerRelationController.java
  85. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/SensorLabMessageEvent.java
  86. 64 64
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/AlarmLogMapper.java
  87. 34 33
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/config/MqttConfig.java
  88. 0 86
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/constants/MqttConstants.java
  89. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/hxp/HxpLockService.java
  90. 23 19
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/impl/SubMessageSendManager.java
  91. 0 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/test/MqttTest.java
  92. 92 92
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/AlarmLogServiceImpl.java
  93. 67 67
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckMachineMsgServiceImpl.java
  94. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckRecordReleaseServiceImpl.java
  95. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckRecordServiceImpl.java
  96. 2 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabContentMachineMsgServiceImpl.java
  97. 103 104
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabGradeManageRecordServiceImpl.java
  98. 46 53
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabMessageContentServiceImpl.java
  99. 2 3
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabNotifyplanServiceImpl.java
  100. 0 0
      zd-modules/zd-modules-laboratory/src/main/resources/bootstrap.yml

+ 13 - 70
pom.xml

@@ -110,6 +110,13 @@
                 <version>${tobato.version}</version>
                 <version>${tobato.version}</version>
             </dependency>
             </dependency>
 
 
+            <!-- 动态数据源 -->
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+                <version>${dynamic-ds.version}</version>
+            </dependency>
+
             <!-- Mybatis 依赖配置 -->
             <!-- Mybatis 依赖配置 -->
             <dependency>
             <dependency>
                 <groupId>org.mybatis.spring.boot</groupId>
                 <groupId>org.mybatis.spring.boot</groupId>
@@ -198,74 +205,6 @@
                 <version>${common-pool.version}</version>
                 <version>${common-pool.version}</version>
             </dependency>
             </dependency>
 
 
-            <!-- 核心模块 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-core</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 接口模块 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-swagger</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 安全模块 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-security</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 权限范围 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-datascope</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 项目整合之后这个包要处理掉 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-api-system</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 多数据源 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-datasource</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 日志记录 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-log</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!-- 缓存服务 -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-redis</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <!--      返回值包装      -->
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-resultdata</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>com.zd</groupId>
-                <artifactId>zd-common-mqtt</artifactId>
-                <version>${zd.version}</version>
-            </dependency>
             <dependency>
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-starter-test</artifactId>
                 <artifactId>spring-boot-starter-test</artifactId>
@@ -316,12 +255,10 @@
                 <version>${zd.version}</version>
                 <version>${zd.version}</version>
             </dependency>
             </dependency>
 
 
-
             <dependency>
             <dependency>
                 <groupId>com.zd.swagger</groupId>
                 <groupId>com.zd.swagger</groupId>
                 <artifactId>common-swagger</artifactId>
                 <artifactId>common-swagger</artifactId>
                 <version>${zd.version}</version>
                 <version>${zd.version}</version>
-                <scope>compile</scope>
             </dependency>
             </dependency>
 
 
             <dependency>
             <dependency>
@@ -331,6 +268,12 @@
             </dependency>
             </dependency>
 
 
             <dependency>
             <dependency>
+                <groupId>com.zd.auth</groupId>
+                <artifactId>zd-auth-api</artifactId>
+                <version>${zd.version}</version>
+            </dependency>
+
+            <dependency>
                 <groupId>com.zd.system</groupId>
                 <groupId>com.zd.system</groupId>
                 <artifactId>zd-system-api</artifactId>
                 <artifactId>zd-system-api</artifactId>
                 <version>${zd.version}</version>
                 <version>${zd.version}</version>

+ 1 - 0
zd-api/pom.xml

@@ -19,6 +19,7 @@
         <module>zd-chemical-api</module>
         <module>zd-chemical-api</module>
         <module>zd-algorithm-api</module>
         <module>zd-algorithm-api</module>
         <module>zd-airbottle-api</module>
         <module>zd-airbottle-api</module>
+        <module>zd-auth-api</module>
     </modules>
     </modules>
 
 
     <dependencies>
     <dependencies>

+ 3 - 3
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/alarm/entity/AlarmEntrty.java

@@ -1,10 +1,10 @@
 package com.zd.algorithm.api.alarm.entity;
 package com.zd.algorithm.api.alarm.entity;
 
 
 import cn.hutool.json.JSONUtil;
 import cn.hutool.json.JSONUtil;
-import com.zd.model.constant.Constants;
-
+import com.zd.model.constant.BaseConstants;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.NotNull;
 
 
+
 public class AlarmEntrty {
 public class AlarmEntrty {
 
 
     private Routes route;
     private Routes route;
@@ -25,7 +25,7 @@ public class AlarmEntrty {
     /**
     /**
      * 编码方式 默认UTF-8
      * 编码方式 默认UTF-8
      */
      */
-    private String Encoding = Constants.UTF8;
+    private String Encoding = BaseConstants.UTF8;
 
 
     /**
     /**
      * 邮件主题
      * 邮件主题

+ 22 - 0
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/alarm/entity/AlarmLog.java

@@ -6,6 +6,8 @@ import com.zd.model.entity.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
+import java.util.Date;
+
 /**
 /**
  * 电话报警推送日志对象 alarm_log
  * 电话报警推送日志对象 alarm_log
  *
  *
@@ -52,6 +54,10 @@ public class AlarmLog extends BaseEntity {
     @ApiModelProperty(value = "是否回写")
     @ApiModelProperty(value = "是否回写")
     private Integer isBack;
     private Integer isBack;
 
 
+    private Date startTime;
+
+    private Date endTime;
+
     public void setId(Long id) {
     public void setId(Long id) {
         this.id = id;
         this.id = id;
     }
     }
@@ -104,4 +110,20 @@ public class AlarmLog extends BaseEntity {
     public String toString() {
     public String toString() {
         return JSONUtil.toJsonStr(this);
         return JSONUtil.toJsonStr(this);
     }
     }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
 }
 }

+ 17 - 0
zd-api/zd-auth-api/pom.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>zd-api</artifactId>
+        <groupId>com.zd</groupId>
+        <version>3.1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.zd.auth</groupId>
+    <artifactId>zd-auth-api</artifactId>
+    <packaging>jar</packaging>
+    <description>auth接口依赖</description>
+
+</project>

+ 20 - 0
zd-api/zd-auth-api/src/main/java/com/zd/auth/feign/RemoteAuthService.java

@@ -0,0 +1,20 @@
+package com.zd.auth.feign;
+
+import com.zd.auth.feign.factory.RemoteAuthFallback;
+import com.zd.auth.form.LoginBody;
+import com.zd.model.constant.ApplicationConstants;
+import com.zd.model.domain.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient(contextId = "remoteAuthService", value = ApplicationConstants.AUTH_SERVICE, fallbackFactory = RemoteAuthFallback.class)
+public interface RemoteAuthService {
+
+    /**
+     * 一体机登录
+     * 小程序登录也在用
+     */
+    @PostMapping("/one/login")
+    R<?> oneLogin(@RequestBody LoginBody form);
+}

+ 25 - 0
zd-api/zd-auth-api/src/main/java/com/zd/auth/feign/factory/RemoteAuthFallback.java

@@ -0,0 +1,25 @@
+package com.zd.auth.feign.factory;
+
+import com.zd.auth.feign.RemoteAuthService;
+import com.zd.auth.form.LoginBody;
+import com.zd.model.domain.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * 用户服务降级处理
+ *
+ * @author zd
+ */
+@Component
+public class RemoteAuthFallback implements FallbackFactory<RemoteAuthService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteAuthFallback.class);
+
+    @Override
+    public RemoteAuthService create(Throwable throwable) {
+        log.error("授权登录服务调用失败:{}", throwable.getMessage());
+        return form -> R.fail("授权服务调用失败:"+throwable.getMessage());
+    }
+}

zd-auth/src/main/java/com/zd/auth/form/LoginBody.java → zd-api/zd-auth-api/src/main/java/com/zd/auth/form/LoginBody.java


zd-auth/src/main/java/com/zd/auth/form/RegisterBody.java → zd-api/zd-auth-api/src/main/java/com/zd/auth/form/RegisterBody.java


+ 9 - 0
zd-auth/pom.xml

@@ -64,6 +64,15 @@
                 </exclusion>
                 </exclusion>
             </exclusions>
             </exclusions>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.zd.auth</groupId>
+            <artifactId>zd-auth-api</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.zd.swagger</groupId>
+            <artifactId>common-swagger</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

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

@@ -37,18 +37,9 @@
             <artifactId>jedis</artifactId>
             <artifactId>jedis</artifactId>
         </dependency>
         </dependency>
 
 
-        <!-- Druid -->
-        <!--<dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>druid-spring-boot-starter</artifactId>
-            <version>${druid.version}</version>
-        </dependency>-->
-
         <dependency>
         <dependency>
             <groupId>com.baomidou</groupId>
             <groupId>com.baomidou</groupId>
             <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
             <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-            <version>3.5.2</version>
-            <scope>compile</scope>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
@@ -59,7 +50,6 @@
         <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>
 
 
         <!-- excel工具 -->
         <!-- excel工具 -->

+ 1 - 1
zd-common/common-core/src/main/java/com/zd/common/core/launch/StartEventListener.java

@@ -25,6 +25,6 @@ public class StartEventListener {
         String appName = environment.getProperty("spring.application.name").toUpperCase();
         String appName = environment.getProperty("spring.application.name").toUpperCase();
         int localPort = event.getWebServer().getPort();
         int localPort = event.getWebServer().getPort();
         String profile = StringUtils.arrayToCommaDelimitedString(environment.getActiveProfiles());
         String profile = StringUtils.arrayToCommaDelimitedString(environment.getActiveProfiles());
-        log.info("============ [{}]---服务启动完成,当前使用的端口:[{}],环境变量:[{}] ============", new Object[]{appName, localPort, profile});
+        log.info("============ [{}]---服务启动完成,当前使用的端口:[{}],环境变量:[{}] ============", appName, localPort, profile);
     }
     }
 }
 }

+ 4 - 5
zd-common/common-core/src/main/java/com/zd/common/core/security/TokenServiceImpl.java

@@ -8,6 +8,7 @@ import com.zd.model.entity.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
@@ -37,7 +38,7 @@ public class TokenServiceImpl implements TokenService {
     @Override
     @Override
     public Map<String, Object> createToken(LoginUser loginUser) {
     public Map<String, Object> createToken(LoginUser loginUser) {
         Map<String, Object> map = createCommonToken(loginUser, EXPIRE_TIME);
         Map<String, Object> map = createCommonToken(loginUser, EXPIRE_TIME);
-        redisTemplate.opsForValue().set(ACCESS_TOKEN + map.get("access_token"), loginUser,EXPIRE_TIME, TimeUnit.SECONDS);
+        redisTemplate.opsForValue().set(ACCESS_TOKEN + map.get("access_token"), loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
         //redisService.setCacheObject(ACCESS_TOKEN + map.get("access_token"), loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
         //redisService.setCacheObject(ACCESS_TOKEN + map.get("access_token"), loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
         return map;
         return map;
     }
     }
@@ -72,10 +73,8 @@ public class TokenServiceImpl implements TokenService {
         map.put("expires_in", expiresIn);
         map.put("expires_in", expiresIn);
         map.put("type", loginUser.getSysUser().getUserType());
         map.put("type", loginUser.getSysUser().getUserType());
         map.put("nickName", loginUser.getSysUser().getNickName());
         map.put("nickName", loginUser.getSysUser().getNickName());
-        if (SpringUtils.getActiveProfile().equals("dev")) {
-            map.put("user_id", loginUser.getUserid());
-            map.put("username", loginUser.getUsername());
-        }
+        map.put("user_id", loginUser.getUserid());
+        map.put("username", loginUser.getUsername());
         return map;
         return map;
     }
     }
 
 

+ 4 - 0
zd-common/common-swagger/src/main/java/com/zd/common/swagger/config/AppListener.java

@@ -4,6 +4,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.context.event.ApplicationStartedEvent;
 import org.springframework.boot.context.event.ApplicationStartedEvent;
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.ApplicationListener;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
 import org.springframework.core.env.Environment;
 import org.springframework.core.env.Environment;
 
 
 import java.net.InetAddress;
 import java.net.InetAddress;
@@ -14,6 +16,8 @@ import java.net.UnknownHostException;
  * @Date: 2021/09/30/10:13
  * @Date: 2021/09/30/10:13
  * @Description:
  * @Description:
  */
  */
+@Configuration
+@Order(-108)
 public class AppListener implements ApplicationListener<ApplicationStartedEvent> {
 public class AppListener implements ApplicationListener<ApplicationStartedEvent> {
     static Logger logger= LoggerFactory.getLogger(AppListener.class);
     static Logger logger= LoggerFactory.getLogger(AppListener.class);
     @Override
     @Override

+ 2 - 11
zd-gateway/pom.xml

@@ -86,11 +86,11 @@
         </dependency>
         </dependency>
 
 
         <!-- Swagger -->
         <!-- Swagger -->
-        <dependency>
+        <!--<dependency>
             <groupId>io.springfox</groupId>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger-ui</artifactId>
             <artifactId>springfox-swagger-ui</artifactId>
             <version>${swagger.fox.version}</version>
             <version>${swagger.fox.version}</version>
-        </dependency>
+        </dependency>-->
 
 
         <dependency>
         <dependency>
             <groupId>com.github.xiaoymin</groupId>
             <groupId>com.github.xiaoymin</groupId>
@@ -119,15 +119,6 @@
                     </execution>
                     </execution>
                 </executions>
                 </executions>
             </plugin>
             </plugin>
-            <!-- 打包时跳过test插件,不运行test测试用例 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>${maven-surefire-plugin.version}</version>
-                <configuration>
-                    <skipTests>true</skipTests>
-                </configuration>
-            </plugin>
         </plugins>
         </plugins>
     </build>
     </build>
 </project>
 </project>

+ 0 - 2
zd-gateway/src/main/java/com/zd/gateway/ZdGatewayApplication.java

@@ -25,8 +25,6 @@ public class ZdGatewayApplication {
 
 
     public static void main(String[] args) {
     public static void main(String[] args) {
         ConfigurableApplicationContext run = ZdStartApplication.run(ApplicationConstants.GATEWAY_SERVICE, ZdGatewayApplication.class, args);
         ConfigurableApplicationContext run = ZdStartApplication.run(ApplicationConstants.GATEWAY_SERVICE, ZdGatewayApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  网关启动成功   ლ(´ڡ`ლ)゙");
-
         Environment env = run.getEnvironment();
         Environment env = run.getEnvironment();
         try {
         try {
             logger.info("\n----------------------------------------------------------\n\t" +
             logger.info("\n----------------------------------------------------------\n\t" +

+ 0 - 10
zd-gateway/src/main/resources/banner.txt

@@ -1,10 +0,0 @@
-Spring Boot Version: ${spring-boot.version}
-Spring Application Name: ${spring.application.name}
-                            _                        _                                 
-                           (_)                      | |                                
- _ __  _   _   ___   _   _  _  ______   __ _   __ _ | |_   ___ __      __  __ _  _   _ 
-| '__|| | | | / _ \ | | | || ||______| / _` | / _` || __| / _ \\ \ /\ / / / _` || | | |
-| |   | |_| || (_) || |_| || |        | (_| || (_| || |_ |  __/ \ V  V / | (_| || |_| |
-|_|    \__,_| \___/  \__, ||_|         \__, | \__,_| \__| \___|  \_/\_/   \__,_| \__, |
-                      __/ |             __/ |                                     __/ |
-                     |___/             |___/                                     |___/ 

+ 0 - 185
zd-model/src/main/java/com/zd/model/constant/Constants.java

@@ -1,185 +0,0 @@
-package com.zd.model.constant;
-
-/**
- * 通用常量信息
- *
- * @author zd
- */
-public class Constants {
-    /**
-     * UTF-8 字符集
-     */
-    public static final String UTF8 = "UTF-8";
-
-    /**
-     * GBK 字符集
-     */
-    public static final String GBK = "GBK";
-
-    /**
-     * RMI 远程方法调用
-     */
-    public static final String LOOKUP_RMI = "rmi://";
-
-    /**
-     * LDAP 远程方法调用
-     */
-    public static final String LOOKUP_LDAP = "ldap://";
-
-    /**
-     * http请求
-     */
-    public static final String HTTP = "http://";
-
-    /**
-     * https请求
-     */
-    public static final String HTTPS = "https://";
-
-    /**
-     * 成功标记
-     */
-    public static final Integer SUCCESS = 200;
-
-    /**
-     * 失败标记
-     */
-    public static final Integer FAIL = 500;
-
-    /**
-     * 登录成功
-     */
-    public static final String LOGIN_SUCCESS = "Success";
-
-    /**
-     * 注销
-     */
-    public static final String LOGOUT = "Logout";
-
-    /**
-     * 注册
-     */
-    public static final String REGISTER = "Register";
-
-    /**
-     * 登录失败
-     */
-    public static final String LOGIN_FAIL = "Error";
-
-    /**
-     * 当前记录起始索引
-     */
-    public static final String PAGE_NUM = "pageNum";
-
-    /**
-     * 每页显示记录数
-     */
-    public static final String PAGE_SIZE = "pageSize";
-
-    /**
-     * 排序列
-     */
-    public static final String ORDER_BY_COLUMN = "orderByColumn";
-
-    /**
-     * 排序的方向 "desc" 或者 "asc".
-     */
-    public static final String IS_ASC = "isAsc";
-
-    /**
-     * 验证码 redis key
-     */
-    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
-
-    /**
-     * 签到验证码 redis key
-     */
-    public static final String SINGIN_CAPTCHA_CODE_KEY = "captcha_signin_codes:";
-
-    /**
-     * 签到记录ID
-     */
-    public static final String SINGIN_id_KEY = "signin_id:";
-
-    public static final long SINGIN_OUT_TIME = 120;
-    /**
-     * 检查跳过
-     */
-    public static final String SINGIN_CHECK_JUMP_KEY = "signin_check_jump:";
-
-    /**
-     * 验证码有效期(分钟)
-     */
-    public static final long CAPTCHA_EXPIRATION = 2;
-
-    /**
-     * 令牌有效期(分钟)
-     */
-    public static final long TOKEN_EXPIRE = 720;
-
-    /**
-     * 参数管理 cache key
-     */
-    public static final String SYS_CONFIG_KEY = "sys_config:";
-
-    /**
-     * 字典管理 cache key
-     */
-    public static final String SYS_DICT_KEY = "sys_dict:";
-
-
-    /**
-     * 字典管理 cache key
-     */
-    public static final String WRAN_KEY = "wran_key:";
-
-    /**
-     * 资源映射路径 前缀
-     */
-    public static final String RESOURCE_PREFIX = "/profile";
-
-    /**
-     * 删除状态标记
-     */
-    public static final String DEL = "2";
-
-    /**
-     * baskPackage
-     */
-    public static final String BASE_PACKAGE = "com.zd";
-    /**
-     * 正常状态标记
-     */
-    public static final String NORMAL = "0";
-    /**
-     * MAP集合的初始化大小
-     */
-    public static final Integer MAP_INIT_SIZE = 16;
-
-
-    /**
-     * 密码类型
-     */
-    public static final String GRANT_TYPE_PASSWORD = "password";
-
-    /**
-     * 手机号类型
-     */
-    public static final String GRANT_TYPE_MOBILE = "mobile";
-
-    /**
-     * 手机号类型
-     */
-    public static final String UPDATE_TYPE_MOBILE = "update";
-
-    /**
-     * redis验证码前缀
-     */
-
-    public static final String DEFAULT_CODE_KEY = "DEFAULT_CODE_KEY_";
-
-    /**
-     * 手机登录验证码有效期(分钟)
-     */
-    public static final long CODE_EXPIRATION = 5;
-}

+ 80 - 0
zd-model/src/main/java/com/zd/model/constant/MqttConstants.java

@@ -0,0 +1,80 @@
+package com.zd.model.constant;
+
+/**
+ * <p>MQTT配置常量</p>
+ *
+ * @author linft
+ * @version 1.0
+ * @date 10/26/2022
+ */
+public interface MqttConstants {
+
+    String TOPIC_ALERT = "alarm/";
+
+    String TOPIC_LAB = "lab/new";
+
+    //实验室项目配置
+
+    //实验室信息变更通知 topic
+    String TOPIC_LAB_SUB_INFO = "lab/subInfo";
+    //数据大屏数据改变通知 topic
+    String TOPIC_LAB_BIG_VIEW = "lab/bigview";
+    //预警改变通知 topic
+    String TOPIC_LAB_WRAN = "lab/wran";
+    //测点数据topic
+    String TOPIC_LAB_FUNCTION_DATA = "lab/function/data";
+    //一体机消息推送 topic
+    String TOPIC_LAB_ONEPC_SUB_NEWS = "lab/news";
+    //一体机消息推送apk版本升级 topic
+    String TOPIC_LAB_ONEPC_SUB_APKUP = "lab/apkup";
+    //一体机消息推送配置变动 topic
+    String TOPIC_LAB_ONEPC_SUB_UPCONFIG = "lab/upconfig";
+    //硬件状态变化 LAB_HARDWARE_DATA_SUB和LAB_VIDEO的合集
+    String TOPIC_LAB_VIDEO_DATA = "lab/hardware/data";
+
+    //硬件状态变化,实验室为主体 (继电器)
+    String TOPIC_LAB_HARDWARE_DATA_SUB = "lab/hardware/data/sub";
+    //视频、一体机上下线
+    String TOPIC_LAB_VIDEO = "lab/video";
+
+    //硬件统计 好像不需要
+    String TOPIC_LAB_HARDWARE_TOTAL = "lab/hardware/total";
+
+    //传感器
+    String TOPIC_LAB_SENSOR = "lab/sensor";
+
+    // 一体机检查通知
+    String TOPIC_LAB_CHECK = "lab/check";
+
+    // 一体机消息通知
+    String TOPIC_LAB_CONTENT = "lab/content";
+
+    // 一体机轮播图变更通知
+    String TOPIC_LAB_ROTATION = "lab/rotation";
+
+    //逃生指引线路通知
+    String TOPIC_LAB_EXIT_LINE = "lab/exit/line";
+
+    //管控工作通知
+    String TOPIC_LAB_MANAGE_WORK = "manage/work";
+
+    //大屏通知计划更新通知
+    String TOPIC_LAB_BIG_VIEW_PLAN = "lab/bigview/plan";
+
+    //大屏安全检查更新通知
+    String TOPIC_LAB_BIG_VIEW_CHECKAPPLY = "lab/bigview/checkApply";
+
+    //logo同步通知 topic
+    String TOPIC_SYS_LOGO_CONFIG = "sys/logo";
+
+    // 化学品终端心跳 + {设备编号}
+    String TOPIC_SYS_CHEMICAL_ON = "lab/chemical/";
+
+    // 化学品终端离线遗嘱 + {设备编号}
+    String TOPIC_SYS_CHEMICAL_OFF = "lab/off-chemical/";
+    //坨机接收topic
+    String TOPIC_HEAP_RECIVER = "lab/heap/";
+
+    // 柜锁操作成功topic  lab/cabinetLock/{subId}/{lockId}
+    String TOPIC_CABINET_LOCK = "lab/cabinetLock/";
+}

+ 75 - 75
zd-model/src/main/java/com/zd/model/enums/CodeToValueEnumTypeHandler.java

@@ -1,75 +1,75 @@
-//package com.zd.model.enums;
-//
-//import org.apache.ibatis.type.BaseTypeHandler;
-//import org.apache.ibatis.type.JdbcType;
-//import org.apache.ibatis.type.MappedTypes;
-//
-//import java.sql.CallableStatement;
-//import java.sql.PreparedStatement;
-//import java.sql.ResultSet;
-//import java.sql.SQLException;
-//
-///**
-// * code 作为值的转换器
-// *
-// * @Author: zhoupan
-// * @Date: 2021/09/10/10:29
-// * @Description:
-// */
-//@MappedTypes({BaseEnum.class})
-//public class CodeToValueEnumTypeHandler<E extends Enum<?> & BaseEnum> extends BaseTypeHandler<BaseEnum> {
-//
-//    private Class<E> type;
-//
-//    public CodeToValueEnumTypeHandler(Class<E> type) {
-//        if (type == null) {
-//            throw new IllegalArgumentException("要转换的枚举类不能为空");
-//        }
-//        this.type = type;
-//    }
-//
-//
-//    @Override
-//    public void setNonNullParameter(PreparedStatement preparedStatement, int i, BaseEnum baseEnum, JdbcType jdbcType) throws SQLException {
-//        if (baseEnum == null) {
-//            preparedStatement.setObject(i, null, jdbcType.TYPE_CODE);
-//            return;
-//        }
-//        if (jdbcType == null) {
-//            preparedStatement.setObject(i, baseEnum.getDictKey());
-//            return;
-//        }
-//
-//        preparedStatement.setObject(i, baseEnum.getDictKey(), jdbcType.TYPE_CODE);
-//    }
-//
-//    @Override
-//    public BaseEnum getNullableResult(ResultSet resultSet, String s) throws SQLException {
-//        Object code = resultSet.getObject(s);
-//        if (resultSet.wasNull()) {
-//            return null;
-//        }
-//        return BaseEnum.valueOfEnum(type, code);
-//
-//    }
-//
-//    @Override
-//    public BaseEnum getNullableResult(ResultSet resultSet, int i) throws SQLException {
-//        Object code = resultSet.getObject(i);
-//        if (resultSet.wasNull()) {
-//            return null;
-//        }
-//
-//        return BaseEnum.valueOfEnum(type, code);
-//    }
-//
-//    @Override
-//    public BaseEnum getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
-//        Object code = callableStatement.getObject(i);
-//        if (callableStatement.wasNull()) {
-//            return null;
-//        }
-//
-//        return BaseEnum.valueOfEnum(type, code);
-//    }
-//}
+package com.zd.model.enums;
+
+import org.apache.ibatis.type.BaseTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+import org.apache.ibatis.type.MappedTypes;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * code 作为值的转换器
+ *
+ * @Author: zhoupan
+ * @Date: 2021/09/10/10:29
+ * @Description:
+ */
+@MappedTypes({BaseEnum.class})
+public class CodeToValueEnumTypeHandler<E extends Enum<?> & BaseEnum> extends BaseTypeHandler<BaseEnum> {
+
+    private Class<E> type;
+
+    public CodeToValueEnumTypeHandler(Class<E> type) {
+        if (type == null) {
+            throw new IllegalArgumentException("要转换的枚举类不能为空");
+        }
+        this.type = type;
+    }
+
+
+    @Override
+    public void setNonNullParameter(PreparedStatement preparedStatement, int i, BaseEnum baseEnum, JdbcType jdbcType) throws SQLException {
+        if (baseEnum == null) {
+            preparedStatement.setObject(i, null, jdbcType.TYPE_CODE);
+            return;
+        }
+        if (jdbcType == null) {
+            preparedStatement.setObject(i, baseEnum.getDictKey());
+            return;
+        }
+
+        preparedStatement.setObject(i, baseEnum.getDictKey(), jdbcType.TYPE_CODE);
+    }
+
+    @Override
+    public BaseEnum getNullableResult(ResultSet resultSet, String s) throws SQLException {
+        Object code = resultSet.getObject(s);
+        if (resultSet.wasNull()) {
+            return null;
+        }
+        return BaseEnum.valueOfEnum(type, code);
+
+    }
+
+    @Override
+    public BaseEnum getNullableResult(ResultSet resultSet, int i) throws SQLException {
+        Object code = resultSet.getObject(i);
+        if (resultSet.wasNull()) {
+            return null;
+        }
+
+        return BaseEnum.valueOfEnum(type, code);
+    }
+
+    @Override
+    public BaseEnum getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
+        Object code = callableStatement.getObject(i);
+        if (callableStatement.wasNull()) {
+            return null;
+        }
+
+        return BaseEnum.valueOfEnum(type, code);
+    }
+}

+ 0 - 1
zd-modules/pom.xml

@@ -15,7 +15,6 @@
         <module>zd-modules-system</module>
         <module>zd-modules-system</module>
         <module>zd-exam</module>
         <module>zd-exam</module>
         <module>zd-modules-laboratory</module>
         <module>zd-modules-laboratory</module>
-        <module>zd-modules-app</module>
         <module>zd-airbottle</module>
         <module>zd-airbottle</module>
         <module>zd-chemical</module>
         <module>zd-chemical</module>
         <module>zd-bottle-parent</module>
         <module>zd-bottle-parent</module>

+ 2 - 3
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/QpSupplierServiceImpl.java

@@ -17,7 +17,7 @@ import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.TransferUtils;
 import com.zd.common.core.utils.TransferUtils;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
@@ -29,7 +29,6 @@ import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -232,7 +231,7 @@ public class QpSupplierServiceImpl implements IQpSupplierService {
         sysUser.setPhonenumber(qpSupplierDto.getPhone());
         sysUser.setPhonenumber(qpSupplierDto.getPhone());
         sysUser.setPassword(SecurityUtils.encryptPassword(sysUserDto.getPassword()));
         sysUser.setPassword(SecurityUtils.encryptPassword(sysUserDto.getPassword()));
         sysUser.setUserType(USER_TYPE);
         sysUser.setUserType(USER_TYPE);
-        sysUser.setStatus(Constants.NORMAL);
+        sysUser.setStatus(BaseConstants.NORMAL);
         sysUser.setCreateTime(DateUtils.getNowDate());
         sysUser.setCreateTime(DateUtils.getNowDate());
         sysUser.setCreateBy(SecurityUtils.getUsername());
         sysUser.setCreateBy(SecurityUtils.getUsername());
         R<Boolean> userInfo = userService.registerUserInfo(sysUser, SecurityConstants.INNER);
         R<Boolean> userInfo = userService.registerUserInfo(sysUser, SecurityConstants.INNER);

+ 0 - 10
zd-modules/zd-airbottle/src/main/resources/banner.txt

@@ -1,10 +0,0 @@
-Spring Boot Version: ${spring-boot.version}
-Spring Application Name: ${spring.application.name}
-                            _                           _                    
-                           (_)                         | |                   
- _ __  _   _   ___   _   _  _  ______  ___  _   _  ___ | |_   ___  _ __ ___  
-| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \ 
-| |   | |_| || (_) || |_| || |        \__ \| |_| |\__ \| |_ |  __/| | | | | |
-|_|    \__,_| \___/  \__, ||_|        |___/ \__, ||___/ \__| \___||_| |_| |_|
-                      __/ |                  __/ |                           
-                     |___/                  |___/                            

+ 2 - 1
zd-modules/zd-airbottle/src/main/resources/bootstrap.yml

@@ -7,8 +7,9 @@ mybatis:
   typeAliasesPackage: com.zd.airbottle
   typeAliasesPackage: com.zd.airbottle
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   mapperLocations: classpath:mapper/**/*.xml
   mapperLocations: classpath:mapper/**/*.xml
+  type-handlers-package: com.zd.model.enums
   configuration:
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     call-setters-on-nulls: true
     call-setters-on-nulls: true
     # Mybatis开启驼峰映射
     # Mybatis开启驼峰映射
-    mapUnderscoreToCamelCase: true
+    mapUnderscoreToCamelCase: true

+ 4 - 0
zd-modules/zd-algorithm/pom.xml

@@ -185,6 +185,10 @@
             <groupId>com.zd.system</groupId>
             <groupId>com.zd.system</groupId>
             <artifactId>zd-system-api</artifactId>
             <artifactId>zd-system-api</artifactId>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>com.zd.auth</groupId>
+            <artifactId>zd-auth-api</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

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

@@ -8,20 +8,20 @@ import com.zd.common.core.annotation.EnableRyFeignClients;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.common.mqtt.model.MqttProperties;
 import com.zd.common.mqtt.model.MqttProperties;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.constant.ApplicationConstants;
-import com.zd.model.constant.Constants;
-import lombok.extern.slf4j.Slf4j;
+import com.zd.model.constant.BaseConstants;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 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.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
 
 
+/**
+ * @author Administrator
+ */
 @ServletComponentScan("com.zd.alg.iot.vmp.conf")
 @ServletComponentScan("com.zd.alg.iot.vmp.conf")
-@EnableFeignClients(basePackages = Constants.BASE_PACKAGE)
 @EnableCustomConfig
 @EnableCustomConfig
 @EnableRyFeignClients
 @EnableRyFeignClients
-@SpringBootApplication(scanBasePackages = Constants.BASE_PACKAGE)
+@SpringBootApplication(scanBasePackages = BaseConstants.BASE_PACKAGE)
 @EnableConfigurationProperties({MqttProperties.class, AlgorithmYml.class, FireProperties.class})
 @EnableConfigurationProperties({MqttProperties.class, AlgorithmYml.class, FireProperties.class})
 public class AlgorithmApplication {
 public class AlgorithmApplication {
 
 
@@ -29,12 +29,14 @@ public class AlgorithmApplication {
     private static ConfigurableApplicationContext context;
     private static ConfigurableApplicationContext context;
     public static void main(String[] args) {
     public static void main(String[] args) {
         AlgorithmApplication.args=args;
         AlgorithmApplication.args=args;
-        context = ZdStartApplication.run(ApplicationConstants.ALGORITHM_SERVICE, AlgorithmApplication.class, args);
+        AlgorithmApplication.context = ZdStartApplication.run(ApplicationConstants.ALGORITHM_SERVICE, AlgorithmApplication.class, args);
     }
     }
 
 
-    // 项目重启
+    /**
+     * 项目重启
+     */
     public static void restart() {
     public static void restart() {
-        context.close();
-        AlgorithmApplication.context = SpringApplication.run(AlgorithmApplication.class, args);
+        AlgorithmApplication.context.close();
+        AlgorithmApplication.context = ZdStartApplication.run(ApplicationConstants.ALGORITHM_SERVICE, AlgorithmApplication.class, args);
     }
     }
 }
 }

+ 8 - 11
zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/controller/FaceManagerApi.java

@@ -57,11 +57,9 @@ public class FaceManagerApi {
 
 
     @PostMapping()
     @PostMapping()
     @ApiOperation("上传sdk-lib")
     @ApiOperation("上传sdk-lib")
-    public R uploadLib(@RequestParam("files") MultipartFile [] multipartFiles) throws IOException {
+    public R uploadLib(@RequestParam("files") MultipartFile [] multipartFiles) {
 
 
-        String path =faceEngineFactory.getPath();
-
-//        final String path = absolutePath+ File.separator+faceProperties.getLib_folder();
+        String path =FaceEngineFactory.CACHE_LIB_FOLDER;
 
 
         //先删除原来的文件。。如果直接删除,但又没有保存成功还会导致之前的功能异常,所以这里要先保存再删除
         //先删除原来的文件。。如果直接删除,但又没有保存成功还会导致之前的功能异常,所以这里要先保存再删除
         //生成操作ID
         //生成操作ID
@@ -69,14 +67,13 @@ public class FaceManagerApi {
 
 
         Map<String,MultipartFile> temp = new HashMap<>(multipartFiles.length);
         Map<String,MultipartFile> temp = new HashMap<>(multipartFiles.length);
 
 
-        for (int i = 0; i < multipartFiles.length; i++) {
+        for (MultipartFile multipartFile : multipartFiles) {
 
 
-            String originalFilename = multipartFiles[i].getOriginalFilename();
-            if(!libSet.contains(originalFilename))
-            {
-                return R.fail("上传文件名错误,请确认为:"+libSet.stream().collect(Collectors.joining(",")));
+            String originalFilename = multipartFile.getOriginalFilename();
+            if (!libSet.contains(originalFilename)) {
+                return R.fail("上传文件名错误,请确认为:" + String.join(",", libSet));
             }
             }
-            temp.put( originalFilename,multipartFiles[i]);
+            temp.put(originalFilename, multipartFile);
         }
         }
 
 
         if(CollUtil.isNotEmpty(temp))
         if(CollUtil.isNotEmpty(temp))
@@ -131,7 +128,7 @@ public class FaceManagerApi {
 
 
     @PostMapping("activation")
     @PostMapping("activation")
     @ApiOperation("激活")
     @ApiOperation("激活")
-    public R activation() throws IOException {
+    public R activation() {
         faceEngineFactory.activeOnline();
         faceEngineFactory.activeOnline();
         return R.ok("激活成功!");
         return R.ok("激活成功!");
     }
     }

+ 6 - 30
zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/handle/FaceEngineFactory.java

@@ -1,6 +1,5 @@
 package com.zd.alg.face.handle;
 package com.zd.alg.face.handle;
 
 
-import cn.hutool.core.util.StrUtil;
 import com.arcsoft.face.ActiveFileInfo;
 import com.arcsoft.face.ActiveFileInfo;
 import com.arcsoft.face.EngineConfiguration;
 import com.arcsoft.face.EngineConfiguration;
 import com.arcsoft.face.FaceEngine;
 import com.arcsoft.face.FaceEngine;
@@ -16,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.FileSystemResource;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.io.File;
 import java.io.File;
@@ -49,10 +47,10 @@ public class FaceEngineFactory {
 
 
     public static String CACHE_LIB_FOLDER;
     public static String CACHE_LIB_FOLDER;
 
 
-    public String ARC_FACE_VERSION = "3.0";
+    public static final String ARC_FACE_VERSION = "3.0";
 
 
     //初始化一个图片模式引擎
     //初始化一个图片模式引擎
-    public FaceEngine initFaceEngineImage() throws IOException {
+    public FaceEngine initFaceEngineImage() {
         //初始化IMAGE模式
         //初始化IMAGE模式
         return init();
         return init();
     }
     }
@@ -161,7 +159,7 @@ public class FaceEngineFactory {
                 if (facePath.length() == faceLength) {
                 if (facePath.length() == faceLength) {
                     continue;
                     continue;
                 }
                 }
-                facePath.delete();
+                facePath.deleteOnExit();
             }
             }
             writeToLocal(CACHE_LIB_FOLDER + lib + suffix, inputStream);
             writeToLocal(CACHE_LIB_FOLDER + lib + suffix, inputStream);
         }
         }
@@ -180,19 +178,8 @@ public class FaceEngineFactory {
         input.close();
         input.close();
     }
     }
 
 
-    public String getPath() throws IOException {
-        FileSystemResource resource = new FileSystemResource("../");
-        String canonicalPath = resource.getFile().getCanonicalPath();
-        if (StrUtil.isNotBlank(faceProperties.getLib_folder())) {
-            canonicalPath = canonicalPath + File.separator + faceProperties.getLib_folder();
-        }
-        return CACHE_LIB_FOLDER;
-    }
-
     public void activation(FaceEngine faceEngine) {
     public void activation(FaceEngine faceEngine) {
-
-        //
-        String key = "";
+        String key;
         String os = System.getProperty("os.name");
         String os = System.getProperty("os.name");
         if (os.toLowerCase().startsWith("win")) {
         if (os.toLowerCase().startsWith("win")) {
             key = faceProperties.getWinKey();
             key = faceProperties.getWinKey();
@@ -200,7 +187,6 @@ public class FaceEngineFactory {
             key = faceProperties.getLinuxKey();
             key = faceProperties.getLinuxKey();
 
 
         }
         }
-        logger.info("配置信息打印:" + faceProperties.getAppId() + ", " + key);
         int errorCode = faceEngine.activeOnline(faceProperties.getAppId(), key);
         int errorCode = faceEngine.activeOnline(faceProperties.getAppId(), key);
         if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
         if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
             logger.error("引擎激活失败:errorCode:{},", errorCode);
             logger.error("引擎激活失败:errorCode:{},", errorCode);
@@ -213,26 +199,18 @@ public class FaceEngineFactory {
      */
      */
     public void activeOnline() {
     public void activeOnline() {
         FaceEngine faceEngine = getFaceEngine();
         FaceEngine faceEngine = getFaceEngine();
-        if (faceEngine == null) return;
         activation(faceEngine);
         activation(faceEngine);
         getActiveInfo(faceEngine);
         getActiveInfo(faceEngine);
     }
     }
 
 
     private FaceEngine getFaceEngine() {
     private FaceEngine getFaceEngine() {
-        FaceEngine faceEngine = null;
+        FaceEngine faceEngine;
         //默认放在资源文件下
         //默认放在资源文件下
-
-        String canonicalPath = null;
         try {
         try {
             afterPropertiesSet();
             afterPropertiesSet();
         } catch (IOException e) {
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            throw new ServiceException(e.getMessage());
         }
         }
-        //FaceEngine 里加载sdk的方法已经写死了,没办法从打的jar文件中正确获取文件,
-        // 里面用的System.load方法,没办法通过路径加载jar文件中的文件
-        //所以这里只能把lib文件放在jar文件外部
-//            canonicalPath = getPath();
-        logger.info("获取lib文件路径!:{}", CACHE_LIB_FOLDER);
         faceEngine = new FaceEngine(CACHE_LIB_FOLDER);
         faceEngine = new FaceEngine(CACHE_LIB_FOLDER);
         return faceEngine;
         return faceEngine;
     }
     }
@@ -240,8 +218,6 @@ public class FaceEngineFactory {
 
 
     /**
     /**
      * 注入IMAGE 模式配置
      * 注入IMAGE 模式配置
-     *
-     * @return
      */
      */
     @Bean
     @Bean
     public EngineConfiguration getEngineConfiguration() {
     public EngineConfiguration getEngineConfiguration() {

+ 4 - 13
zd-modules/zd-algorithm/src/main/java/com/zd/alg/face/service/FaceService.java

@@ -36,9 +36,8 @@ public class FaceService {
      * 人脸检测
      * 人脸检测
      *
      *
      * @param imageInfo 待检测的图片信息
      * @param imageInfo 待检测的图片信息
-     * @return
      */
      */
-    public List<FaceInfo> faceDetect(ImageInfo imageInfo) throws IOException {
+    public List<FaceInfo> faceDetect(ImageInfo imageInfo) {
         List<FaceInfo> faceInfoList = new ArrayList<>();
         List<FaceInfo> faceInfoList = new ArrayList<>();
         int errorCode = faceEngineFactory.initFaceEngineImage().detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
         int errorCode = faceEngineFactory.initFaceEngineImage().detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
         Assert.isTrue(errorCode == ErrorInfo.MOK.getValue(), "人脸检测失败!");
         Assert.isTrue(errorCode == ErrorInfo.MOK.getValue(), "人脸检测失败!");
@@ -48,8 +47,6 @@ public class FaceService {
 
 
     /**
     /**
      * 人脸特征提取
      * 人脸特征提取
-     *
-     * @return
      */
      */
     public FaceFeature faceFeature(ImageInfo imageInfo, List<FaceInfo> faceInfoList) {
     public FaceFeature faceFeature(ImageInfo imageInfo, List<FaceInfo> faceInfoList) {
         FaceFeature faceFeature = new FaceFeature();
         FaceFeature faceFeature = new FaceFeature();
@@ -58,9 +55,7 @@ public class FaceService {
         try {
         try {
             imageFaceEngine = faceEngineFactory.initFaceEngineImage();
             imageFaceEngine = faceEngineFactory.initFaceEngineImage();
             errorCode = imageFaceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
             errorCode = imageFaceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        } finally {
+        }  finally {
             if (imageFaceEngine != null) {
             if (imageFaceEngine != null) {
                 imageFaceEngine.unInit();
                 imageFaceEngine.unInit();
             }
             }
@@ -74,20 +69,16 @@ public class FaceService {
 
 
     /**
     /**
      * 人脸对比
      * 人脸对比
-     *
-     * @return
      */
      */
     public Boolean compore(FaceFeature targetFaceFeature, FaceFeature sourceFaceFeature) {
     public Boolean compore(FaceFeature targetFaceFeature, FaceFeature sourceFaceFeature) {
 
 
         FaceSimilar faceSimilar = new FaceSimilar();
         FaceSimilar faceSimilar = new FaceSimilar();
         FaceEngine faceEngine = null;
         FaceEngine faceEngine = null;
-        int errorCode = 0;
+        int errorCode;
         try {
         try {
             faceEngine = faceEngineFactory.initFaceEngineImage();
             faceEngine = faceEngineFactory.initFaceEngineImage();
             errorCode = faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
             errorCode = faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        } finally {
+        }  finally {
             if (faceEngine != null) {
             if (faceEngine != null) {
                 faceEngine.unInit();
                 faceEngine.unInit();
             }
             }

+ 15 - 15
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/config/AlgorithmYml.java

@@ -15,7 +15,7 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Optional;
 
 
-@ConfigurationProperties("sys.config")
+@ConfigurationProperties("forward.config")
 @RefreshScope
 @RefreshScope
 @Validated
 @Validated
 public class AlgorithmYml {
 public class AlgorithmYml {
@@ -23,17 +23,17 @@ public class AlgorithmYml {
     /**
     /**
      * 视频算法
      * 视频算法
      */
      */
-    Map<Integer,VideoCheckValid> videoAidMap = Collections.emptyMap();
+    Map<Integer, VideoCheckValid> videoAidMap = Collections.emptyMap();
 
 
     /**
     /**
      * 算法集合
      * 算法集合
      */
      */
-    Map<Integer,CheckValid> algorithmMap = Collections.emptyMap();
+    Map<Integer, CheckValid> algorithmMap = Collections.emptyMap();
 
 
     /**
     /**
      * 警报配置
      * 警报配置
      */
      */
-    Map<Integer,AlarmConfig> alarmConfigMap = Collections.emptyMap();
+    Map<Integer, AlarmConfig> alarmConfigMap = Collections.emptyMap();
 
 
     /**
     /**
      * 中转服务图片提交地址
      * 中转服务图片提交地址
@@ -51,9 +51,9 @@ public class AlgorithmYml {
     String checkLogUrl;
     String checkLogUrl;
 
 
     /**
     /**
-    * 跳过次数 -1 为不开启跳过 默认为3
+     * 跳过次数 -1 为不开启跳过 默认为3
      */
      */
-    Integer jumpThreshold=2;
+    Integer jumpThreshold = 2;
 
 
 
 
     @NotBlank(message = "项目地址不能为空")
     @NotBlank(message = "项目地址不能为空")
@@ -76,7 +76,7 @@ public class AlgorithmYml {
     /**
     /**
      * 喇叭开关
      * 喇叭开关
      */
      */
-    boolean loudspeakerSwitch=false;
+    boolean loudspeakerSwitch = false;
 
 
     public boolean isLoudspeakerSwitch() {
     public boolean isLoudspeakerSwitch() {
         return loudspeakerSwitch;
         return loudspeakerSwitch;
@@ -158,11 +158,11 @@ public class AlgorithmYml {
         this.checkLogUrl = checkLogUrl;
         this.checkLogUrl = checkLogUrl;
     }
     }
 
 
-    public static class VideoCheckValid{
-        @NotNull (message = "描述不能为空")
+    public static class VideoCheckValid {
+        @NotNull(message = "描述不能为空")
         String tips;
         String tips;
 
 
-        @NotBlank (message = "算法结构解析实现类不能为空")
+        @NotBlank(message = "算法结构解析实现类不能为空")
         private String name = "videoCheckResultValidImpl";
         private String name = "videoCheckResultValidImpl";
 
 
         private VideoCheckResultValid videoCheckResultValid;
         private VideoCheckResultValid videoCheckResultValid;
@@ -192,7 +192,7 @@ public class AlgorithmYml {
         }
         }
     }
     }
 
 
-    public static class AlarmConfig{
+    public static class AlarmConfig {
         private String funNum;
         private String funNum;
         private String describe;
         private String describe;
 
 
@@ -215,16 +215,16 @@ public class AlgorithmYml {
 
 
     public static class CheckValid {
     public static class CheckValid {
         //算法ID
         //算法ID
-        @NotNull (message = "算法ID不能为空")
+        @NotNull(message = "算法ID不能为空")
         private Integer algoId;
         private Integer algoId;
         //cid
         //cid
-        @NotNull (message = "数据ID不能为空")
+        @NotNull(message = "数据ID不能为空")
         private String did;
         private String did;
 
 
         private String algorithmName;
         private String algorithmName;
 
 
         //默认使用图片post 推送结果解析类
         //默认使用图片post 推送结果解析类
-        @NotNull (message = "算法结构解析实现类不能为空")
+        @NotNull(message = "算法结构解析实现类不能为空")
         private Class<?> classPath = ImageCheckResultValidImpl.class;
         private Class<?> classPath = ImageCheckResultValidImpl.class;
         //检查结果检查实现类
         //检查结果检查实现类
         private CheckResultValid checkResultValid;
         private CheckResultValid checkResultValid;
@@ -282,7 +282,7 @@ public class AlgorithmYml {
         return Collections.unmodifiableMap(algorithmMap);
         return Collections.unmodifiableMap(algorithmMap);
     }
     }
 
 
-    public void setAlgorithmMap(Map<Integer,CheckValid> algorithmMap) {
+    public void setAlgorithmMap(Map<Integer, CheckValid> algorithmMap) {
         this.algorithmMap = algorithmMap;
         this.algorithmMap = algorithmMap;
     }
     }
 
 

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/controller/SignInCheckController.java

@@ -158,7 +158,7 @@ public class SignInCheckController {
      * 火焰算法验证
      * 火焰算法验证
      * @param file 带验证图片
      * @param file 带验证图片
      */
      */
-    @ApiOperation(value = "进入项验证:合并,codes格式:1,2,3")
+    @ApiOperation(value = "火焰算法验证")
     @PostMapping("/checkFire")
     @PostMapping("/checkFire")
     public R checkFire(@ApiParam("图片文件") @RequestParam("file") MultipartFile file) {
     public R checkFire(@ApiParam("图片文件") @RequestParam("file") MultipartFile file) {
         return R.ok(fireImageService.catchImage(file));
         return R.ok(fireImageService.catchImage(file));

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

@@ -24,7 +24,7 @@ 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.common.mqtt.model.MessageBody;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import com.zd.model.entity.Algorithm;
 import com.zd.model.entity.Algorithm;
@@ -44,14 +44,12 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 import sun.misc.BASE64Decoder;
 import sun.misc.BASE64Decoder;
-
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStream;
 import java.util.*;
 import java.util.*;
-
 import static com.zd.alg.forward.utils.HttpUtils.*;
 import static com.zd.alg.forward.utils.HttpUtils.*;
 
 
 @Service
 @Service
@@ -160,9 +158,9 @@ public class CheckService {
                     if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
                     if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
                         //如果没有通过则次数加一
                         //如果没有通过则次数加一
                         //键为前缀+签到id +下划线+验证类型
                         //键为前缀+签到id +下划线+验证类型
-                        String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+                        String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
                         Long increment = redisTemplate.opsForValue().increment(key);
                         Long increment = redisTemplate.opsForValue().increment(key);
-                        redisService.expire(key, Constants.SINGIN_OUT_TIME);
+                        redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
                         if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
                         if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
                             //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
                             //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
                             return R.fail(700, "符合跳过条件执行跳过");
                             return R.fail(700, "符合跳过条件执行跳过");
@@ -228,9 +226,9 @@ public class CheckService {
             if (!f && algorithmYml.getJumpThreshold() != -1) {
             if (!f && algorithmYml.getJumpThreshold() != -1) {
                 //如果没有通过则次数加一
                 //如果没有通过则次数加一
                 //键为前缀+签到id +下划线+验证类型
                 //键为前缀+签到id +下划线+验证类型
-                String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+                String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
                 Long increment = redisTemplate.opsForValue().increment(key);
                 Long increment = redisTemplate.opsForValue().increment(key);
-                redisService.expire(key, Constants.SINGIN_OUT_TIME);
+                redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
                 if (increment >= algorithmYml.getJumpThreshold()) {
                 if (increment >= algorithmYml.getJumpThreshold()) {
                     //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
                     //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
                     apply.setCode(700);
                     apply.setCode(700);
@@ -374,12 +372,12 @@ public class CheckService {
 
 
 
 
     private R<Long> getObjectR(Long id) {
     private R<Long> getObjectR(Long id) {
-        Long subId = redisService.getCacheObject(Constants.SINGIN_id_KEY + id);
+        Long subId = redisService.getCacheObject(BaseConstants.SINGIN_id_KEY + id);
         if (subId == null) {
         if (subId == null) {
             return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
             return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
         }
         }
         //刷新key
         //刷新key
-        boolean expire = redisService.expire(Constants.SINGIN_id_KEY + id, 120);
+        boolean expire = redisService.expire(BaseConstants.SINGIN_id_KEY + id, 120);
         if (!expire) {
         if (!expire) {
             return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
             return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
         }
         }
@@ -402,9 +400,9 @@ public class CheckService {
         //如果没有通过则次数加一
         //如果没有通过则次数加一
         Map<String, Boolean> map = new HashMap(1);
         Map<String, Boolean> map = new HashMap(1);
         //键为前缀+签到id +下划线+验证类型
         //键为前缀+签到id +下划线+验证类型
-        String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+        String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
         Long increment = redisTemplate.opsForValue().increment(key);
         Long increment = redisTemplate.opsForValue().increment(key);
-        redisService.expire(key, Constants.SINGIN_OUT_TIME);
+        redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
         Boolean isJump = increment >= algorithmYml.getJumpThreshold();
         Boolean isJump = increment >= algorithmYml.getJumpThreshold();
         map.put("jump", isJump);
         map.put("jump", isJump);
         R<Object> fail = R.fail();
         R<Object> fail = R.fail();

+ 14 - 15
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/LoginService.java

@@ -1,6 +1,9 @@
 package com.zd.alg.forward.serivce;
 package com.zd.alg.forward.serivce;
 
 
+import com.alibaba.fastjson.JSON;
 import com.zd.alg.forward.config.AlgorithmYml;
 import com.zd.alg.forward.config.AlgorithmYml;
+import com.zd.auth.feign.RemoteAuthService;
+import com.zd.auth.form.LoginBody;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.security.TokenService;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
@@ -18,6 +21,7 @@ import org.springframework.util.Assert;
 import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.client.RestTemplate;
 
 
+import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -32,6 +36,9 @@ public class LoginService {
     @Autowired
     @Autowired
     TokenService tokenService;
     TokenService tokenService;
 
 
+    @Resource
+    private RemoteAuthService remoteAuthService;
+
     private String token;
     private String token;
 
 
     public String getToken() {
     public String getToken() {
@@ -48,22 +55,14 @@ public class LoginService {
      */
      */
     public void loginLab() {
     public void loginLab() {
         //不再重复登录
         //不再重复登录
-        RestTemplate restTemplate = new RestTemplate();
-        //创建请求头
-        String url = algorithmYml.getLoginUri() + "auth/one/login";
-        Map<String, String> map = new HashMap<>(2);
-        map.put("username", "admin");
-        map.put("password", "zd123456..");
-        ParameterizedTypeReference<R<Map<String, Object>>> reference = new ParameterizedTypeReference<R<Map<String, Object>>>(){};
+        LoginBody body=new LoginBody();
+        body.setUsername("admin");
+        body.setPassword("zd123456..");
         try {
         try {
-            ResponseEntity<R<Map<String, Object>>> response = restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(map), reference);
-            R<Map<String, Object>> parse = response.getBody();
-            if (parse != null) {
-                Assert.isTrue(parse.getCode() == R.SUCCESS, "登录失败:" + parse.getMsg());
-                //拿到token
-                Map<String, Object> data = parse.getData();
-                setToken("Bearer " + data.get("access_token"));
-            }
+            R<?> r = remoteAuthService.oneLogin(body);
+            Assert.isTrue(r.getCode() == R.SUCCESS, "登录失败:" + r.getMsg());
+            Map<String, Object> data = (Map<String, Object>) r.getData();
+            setToken("Bearer " + data.get("access_token"));
         } catch (RestClientException e) {
         } catch (RestClientException e) {
             throw new ServiceException(e.getMessage());
             throw new ServiceException(e.getMessage());
         }
         }

+ 6 - 11
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/SendSginAccessLogService.java

@@ -6,6 +6,7 @@ import com.zd.alg.forward.domain.VideoRequestData;
 import com.zd.alg.forward.properties.FireProperties;
 import com.zd.alg.forward.properties.FireProperties;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
 import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
 import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
+import com.zd.common.core.exception.PreAuthorizeException;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
@@ -220,9 +221,7 @@ public class SendSginAccessLogService {
         ResponseEntity<R<T>> exchange = restTemplateLocal.exchange(url, method, requestEntity, reference);
         ResponseEntity<R<T>> exchange = restTemplateLocal.exchange(url, method, requestEntity, reference);
         R<T> body = exchange.getBody();
         R<T> body = exchange.getBody();
         if (body != null && body.getCode() == HttpStatus.UNAUTHORIZED) {
         if (body != null && body.getCode() == HttpStatus.UNAUTHORIZED) {
-            requestEntity = getMapHttpEntityLogin(params);
-            exchange = restTemplateLocal.exchange(url, method, requestEntity, reference);
-
+            throw new PreAuthorizeException();
         }
         }
         body = exchange.getBody();
         body = exchange.getBody();
         return body;
         return body;
@@ -249,14 +248,10 @@ public class SendSginAccessLogService {
 
 
     private <T> HttpEntity<T> getMapHttpEntity(T params) {
     private <T> HttpEntity<T> getMapHttpEntity(T params) {
         String token = loginLab.getToken();
         String token = loginLab.getToken();
-        HttpHeaders headers = new HttpHeaders();
-        headers.add(SecurityConstants.TOKEN_AUTHENTICATION, token);
-        return new HttpEntity<>(params, headers);
-    }
-
-    private <T> HttpEntity<T> getMapHttpEntityLogin(T params) {
-        loginLab.loginLab();
-        String token = loginLab.getToken();
+        if (token==null){
+            loginLab.loginLab();
+            token = loginLab.getToken();
+        }
         HttpHeaders headers = new HttpHeaders();
         HttpHeaders headers = new HttpHeaders();
         headers.add(SecurityConstants.TOKEN_AUTHENTICATION, token);
         headers.add(SecurityConstants.TOKEN_AUTHENTICATION, token);
         return new HttpEntity<>(params, headers);
         return new HttpEntity<>(params, headers);

+ 20 - 20
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/conf/MediaConfig.java

@@ -10,64 +10,64 @@ import java.text.SimpleDateFormat;
 @Configuration("mediaConfig")
 @Configuration("mediaConfig")
 public class MediaConfig{
 public class MediaConfig{
 
 
-    @Value("${media.id:}")
+    @Value("${camera.media.id:}")
     private String id;
     private String id;
 
 
-    @Value("${media.ip}")
+    @Value("${camera.media.ip}")
     private String ip;
     private String ip;
 
 
-    @Value("${media.hook-ip:${sip.ip}}")
+    @Value("${camera.media.hook-ip:${camera.sip.ip}}")
     private String hookIp;
     private String hookIp;
 
 
-    @Value("${sip.ip}")
+    @Value("${camera.sip.ip}")
     private String sipIp;
     private String sipIp;
 
 
-    @Value("${sip.domain}")
+    @Value("${camera.sip.domain}")
     private String sipDomain;
     private String sipDomain;
 
 
-    @Value("${media.sdp-ip:${media.ip}}")
+    @Value("${camera.media.sdp-ip:${camera.media.ip}}")
     private String sdpIp;
     private String sdpIp;
 
 
-    @Value("${media.stream-ip:${media.ip}}")
+    @Value("${camera.media.stream-ip:${camera.media.ip}}")
     private String streamIp;
     private String streamIp;
 
 
-    @Value("${media.http-port}")
+    @Value("${camera.media.http-port}")
     private Integer httpPort;
     private Integer httpPort;
 
 
-    @Value("${media.http-ssl-port:0}")
+    @Value("${camera.media.http-ssl-port:0}")
     private Integer httpSSlPort = 0;
     private Integer httpSSlPort = 0;
 
 
-    @Value("${media.rtmp-port:0}")
+    @Value("${camera.media.rtmp-port:0}")
     private Integer rtmpPort = 0;
     private Integer rtmpPort = 0;
 
 
-    @Value("${media.rtmp-ssl-port:0}")
+    @Value("${camera.media.rtmp-ssl-port:0}")
     private Integer rtmpSSlPort = 0;
     private Integer rtmpSSlPort = 0;
 
 
-    @Value("${media.rtp-proxy-port:0}")
+    @Value("${camera.media.rtp-proxy-port:0}")
     private Integer rtpProxyPort = 0;
     private Integer rtpProxyPort = 0;
 
 
-    @Value("${media.rtsp-port:0}")
+    @Value("${camera.media.rtsp-port:0}")
     private Integer rtspPort = 0;
     private Integer rtspPort = 0;
 
 
-    @Value("${media.rtsp-ssl-port:0}")
+    @Value("${camera.media.rtsp-ssl-port:0}")
     private Integer rtspSSLPort = 0;
     private Integer rtspSSLPort = 0;
 
 
-    @Value("${media.auto-config:true}")
+    @Value("${camera.media.auto-config:true}")
     private boolean autoConfig = true;
     private boolean autoConfig = true;
 
 
-    @Value("${media.secret}")
+    @Value("${camera.media.secret}")
     private String secret;
     private String secret;
 
 
-    @Value("${media.stream-none-reader-delay-ms:18000}")
+    @Value("${camera.media.stream-none-reader-delay-ms:18000}")
     private String streamNoneReaderDelayMS = "18000";
     private String streamNoneReaderDelayMS = "18000";
 
 
-    @Value("${media.rtp.enable}")
+    @Value("${camera.media.rtp.enable}")
     private boolean rtpEnable;
     private boolean rtpEnable;
 
 
-    @Value("${media.rtp.port-range}")
+    @Value("${camera.media.rtp.port-range}")
     private String rtpPortRange;
     private String rtpPortRange;
 
 
-    @Value("${media.record-assist-port:0}")
+    @Value("${camera.media.record-assist-port:0}")
     private Integer recordAssistPort = 0;
     private Integer recordAssistPort = 0;
 
 
     public String getId() {
     public String getId() {

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/conf/UserSetup.java

@@ -8,7 +8,7 @@ import java.util.List;
 
 
 
 
 @Component
 @Component
-@ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true)
+@ConfigurationProperties(prefix = "camera.user-settings", ignoreInvalidFields = true)
 public class UserSetup {
 public class UserSetup {
 
 
     private Boolean savePositionHistory = Boolean.FALSE;
     private Boolean savePositionHistory = Boolean.FALSE;

+ 0 - 4
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/device/DeviceQuery.java

@@ -283,7 +283,6 @@ public class DeviceQuery {
 	@ApiOperation("更新通道信息")
 	@ApiOperation("更新通道信息")
 	@ApiImplicitParams({
 	@ApiImplicitParams({
 			@ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class),
 			@ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class),
-			@ApiImplicitParam(name="channel", value = "通道", required = true, dataTypeClass = String.class),
 	})
 	})
 	@PostMapping("/channel/update/{deviceId}")
 	@PostMapping("/channel/update/{deviceId}")
 	public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
 	public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
@@ -317,9 +316,6 @@ public class DeviceQuery {
 	 * @return
 	 * @return
 	 */
 	 */
 	@ApiOperation("更新设备信息")
 	@ApiOperation("更新设备信息")
-	@ApiImplicitParams({
-			@ApiImplicitParam(name = "device", value = "设备信息", required = true, dataTypeClass = Device.class)
-	})
 	@PostMapping("/device/update/")
 	@PostMapping("/device/update/")
 	public ResponseEntity<WVPResult<String>> updateDevice(Device device){
 	public ResponseEntity<WVPResult<String>> updateDevice(Device device){
 
 

+ 0 - 7
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java

@@ -55,10 +55,6 @@ public class GbStreamController {
      * @return
      * @return
      */
      */
     @ApiOperation("移除国标关联")
     @ApiOperation("移除国标关联")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true,
-                    dataTypeClass = GbStreamParam.class),
-    })
     @DeleteMapping(value = "/del")
     @DeleteMapping(value = "/del")
     @ResponseBody
     @ResponseBody
     public Object del(@RequestBody GbStreamParam gbStreamParam){
     public Object del(@RequestBody GbStreamParam gbStreamParam){
@@ -76,9 +72,6 @@ public class GbStreamController {
      * @return
      * @return
      */
      */
     @ApiOperation("保存国标关联")
     @ApiOperation("保存国标关联")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, dataTypeClass = GbStreamParam.class),
-    })
     @PostMapping(value = "/add")
     @PostMapping(value = "/add")
     @ResponseBody
     @ResponseBody
     public Object add(@RequestBody GbStreamParam gbStreamParam){
     public Object add(@RequestBody GbStreamParam gbStreamParam){

+ 0 - 9
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/platform/PlatformController.java

@@ -85,9 +85,6 @@ public class PlatformController {
      * @return
      * @return
      */
      */
     @ApiOperation("保存上级平台信息")
     @ApiOperation("保存上级平台信息")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "parentPlatform", value = "上级平台信息", dataTypeClass = ParentPlatform.class),
-    })
     @PostMapping("/save")
     @PostMapping("/save")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){
     public ResponseEntity<String> savePlatform(@RequestBody ParentPlatform parentPlatform){
@@ -243,9 +240,6 @@ public class PlatformController {
      * @return
      * @return
      */
      */
     @ApiOperation("向上级平台添加国标通道")
     @ApiOperation("向上级平台添加国标通道")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class),
-    })
     @PostMapping("/update_channel_for_gb")
     @PostMapping("/update_channel_for_gb")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
     public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
@@ -264,9 +258,6 @@ public class PlatformController {
      * @return
      * @return
      */
      */
     @ApiOperation("从上级平台移除国标通道")
     @ApiOperation("从上级平台移除国标通道")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "param", value = "通道关联参数", dataTypeClass = UpdateChannelParam.class),
-    })
     @DeleteMapping("/del_channel_for_gb")
     @DeleteMapping("/del_channel_for_gb")
     @ResponseBody
     @ResponseBody
     public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){
     public ResponseEntity<String> delChannelForGB(@RequestBody UpdateChannelParam param){

+ 10 - 18
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlApplyApprovalController.java

@@ -28,8 +28,7 @@ import java.util.Map;
 @RestController
 @RestController
 @Api(tags = "【申请审核】")
 @Api(tags = "【申请审核】")
 @RequestMapping("/smartlock/approval")
 @RequestMapping("/smartlock/approval")
-public class SlApplyApprovalController extends BaseController
-{
+public class SlApplyApprovalController extends BaseController {
     @Autowired
     @Autowired
     private ISlApplyApprovalService slApplyApprovalService;
     private ISlApplyApprovalService slApplyApprovalService;
 
 
@@ -40,8 +39,7 @@ public class SlApplyApprovalController extends BaseController
     //@PreAuthorize(hasPermi = "laboratory:approval:list")
     //@PreAuthorize(hasPermi = "laboratory:approval:list")
     @GetMapping("/list")
     @GetMapping("/list")
     @ApiOperation(value = "查询申请审核列表")
     @ApiOperation(value = "查询申请审核列表")
-    public TableDataInfo<SlApplyApproval> list(SlApplyApproval slApplyApproval)
-    {
+    public TableDataInfo<SlApplyApproval> list(SlApplyApproval slApplyApproval) {
         startPage();
         startPage();
         List<SlApplyApproval> list = slApplyApprovalService.selectSlApplyApprovalList(slApplyApproval);
         List<SlApplyApproval> list = slApplyApprovalService.selectSlApplyApprovalList(slApplyApproval);
         return getDataTable(list);
         return getDataTable(list);
@@ -54,8 +52,7 @@ public class SlApplyApprovalController extends BaseController
     //@PreAuthorize(hasPermi = "laboratory:approval:export")
     //@PreAuthorize(hasPermi = "laboratory:approval:export")
     @Log(title = "申请审核", businessType = BusinessType.EXPORT)
     @Log(title = "申请审核", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SlApplyApproval slApplyApproval) throws IOException
-    {
+    public void export(HttpServletResponse response, SlApplyApproval slApplyApproval) throws IOException {
         List<SlApplyApproval> list = slApplyApprovalService.selectSlApplyApprovalList(slApplyApproval);
         List<SlApplyApproval> list = slApplyApprovalService.selectSlApplyApprovalList(slApplyApproval);
         ExcelUtil<SlApplyApproval> util = new ExcelUtil<SlApplyApproval>(SlApplyApproval.class);
         ExcelUtil<SlApplyApproval> util = new ExcelUtil<SlApplyApproval>(SlApplyApproval.class);
         util.exportExcel(response, list, "申请审核数据");
         util.exportExcel(response, list, "申请审核数据");
@@ -67,8 +64,7 @@ public class SlApplyApprovalController extends BaseController
     @ApiOperation(value = "获取申请审核详细信息")
     @ApiOperation(value = "获取申请审核详细信息")
     //@PreAuthorize(hasPermi = "laboratory:approval:query")
     //@PreAuthorize(hasPermi = "laboratory:approval:query")
     @GetMapping(value = "/{id}")
     @GetMapping(value = "/{id}")
-    public ResultData<SlApplyApproval> getInfo(@PathVariable("id") Long id)
-    {
+    public ResultData<SlApplyApproval> getInfo(@PathVariable("id") Long id) {
         return ResultData.success(slApplyApprovalService.selectSlApplyApprovalById(id));
         return ResultData.success(slApplyApprovalService.selectSlApplyApprovalById(id));
     }
     }
 
 
@@ -79,8 +75,7 @@ public class SlApplyApprovalController extends BaseController
     //@PreAuthorize(hasPermi = "laboratory:approval:add")
     //@PreAuthorize(hasPermi = "laboratory:approval:add")
     @Log(title = "申请审核", businessType = BusinessType.INSERT)
     @Log(title = "申请审核", businessType = BusinessType.INSERT)
     @PostMapping
     @PostMapping
-    public ResultData add(@RequestBody SlApplyApproval slApplyApproval)
-    {
+    public ResultData add(@RequestBody SlApplyApproval slApplyApproval) {
         return ResultData.result(slApplyApprovalService.insertSlApplyApproval(slApplyApproval));
         return ResultData.result(slApplyApprovalService.insertSlApplyApproval(slApplyApproval));
     }
     }
 
 
@@ -91,9 +86,8 @@ public class SlApplyApprovalController extends BaseController
     //@PreAuthorize(hasPermi = "laboratory:approval:edit")
     //@PreAuthorize(hasPermi = "laboratory:approval:edit")
     @Log(title = "申请审核", businessType = BusinessType.UPDATE)
     @Log(title = "申请审核", businessType = BusinessType.UPDATE)
     @PutMapping
     @PutMapping
-    public ResultData edit(@RequestBody SlApplyApproval slApplyApproval)
-    {
-        return  ResultData.result(slApplyApprovalService.updateSlApplyApproval(slApplyApproval));
+    public ResultData edit(@RequestBody SlApplyApproval slApplyApproval) {
+        return ResultData.result(slApplyApprovalService.updateSlApplyApproval(slApplyApproval));
     }
     }
 
 
     /**
     /**
@@ -103,8 +97,7 @@ public class SlApplyApprovalController extends BaseController
     //@PreAuthorize(hasPermi = "laboratory:approval:remove")
     //@PreAuthorize(hasPermi = "laboratory:approval:remove")
     @Log(title = "申请审核", businessType = BusinessType.DELETE)
     @Log(title = "申请审核", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @DeleteMapping("/{ids}")
-    public ResultData remove(@PathVariable Long[] ids)
-    {
+    public ResultData remove(@PathVariable Long[] ids) {
         return ResultData.result(slApplyApprovalService.deleteSlApplyApprovalByIds(ids));
         return ResultData.result(slApplyApprovalService.deleteSlApplyApprovalByIds(ids));
     }
     }
 
 
@@ -117,9 +110,8 @@ public class SlApplyApprovalController extends BaseController
      */
      */
     @ApiOperation(value = "门锁短信审核")
     @ApiOperation(value = "门锁短信审核")
     @GetMapping("/sysMsgApprova")
     @GetMapping("/sysMsgApprova")
-    public AjaxResult sysMsgApprova(String phone, String content, Long lockApplyId)
-    {   // msg:异常说明  status:处理状态(ok-成功  error-失败)
-        Map<String,Object> map = slApplyApprovalService.sysMsgApprova(phone,content,lockApplyId);
+    public AjaxResult sysMsgApprova(String phone, String content, Long lockApplyId) {   // msg:异常说明  status:处理状态(ok-成功  error-失败)
+        Map<String, Object> map = slApplyApprovalService.sysMsgApprova(phone, content, lockApplyId);
         return AjaxResult.success(map);
         return AjaxResult.success(map);
     }
     }
 
 

+ 27 - 38
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlOpendoorApplyController.java

@@ -35,8 +35,7 @@ import java.util.List;
 @RestController
 @RestController
 @Api(tags = "【申请开门】")
 @Api(tags = "【申请开门】")
 @RequestMapping("/smartlock/openDoorApply")
 @RequestMapping("/smartlock/openDoorApply")
-public class SlOpendoorApplyController extends BaseController
-{
+public class SlOpendoorApplyController extends BaseController {
     @Autowired
     @Autowired
     private ISlOpendoorApplyService slOpendoorApplyService;
     private ISlOpendoorApplyService slOpendoorApplyService;
 
 
@@ -46,18 +45,17 @@ public class SlOpendoorApplyController extends BaseController
     /**
     /**
      * 查询申请开门列表
      * 查询申请开门列表
      */
      */
-    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ PerFun.LIST)
+    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY + PerFun.LIST)
     @GetMapping("/list")
     @GetMapping("/list")
     @ApiOperation(value = "查询申请开门列表")
     @ApiOperation(value = "查询申请开门列表")
-    public TableDataInfo<SlOpendoorApplyVo> list(SlOpendoorApplyVo slOpendoorApply)
-    {
+    public TableDataInfo<SlOpendoorApplyVo> list(SlOpendoorApplyVo slOpendoorApply) {
         //获取登录用户
         //获取登录用户
         // SysUser sysUser = tokenService.getLoginUser().getSysUser();
         // SysUser sysUser = tokenService.getLoginUser().getSysUser();
 
 
-        startPage("creat_time","descending");
+        startPage("creat_time", "descending");
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyList(slOpendoorApply);
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyList(slOpendoorApply);
-        for (SlOpendoorApplyVo vo:list) {
-            if(vo.getLoseTime().getTime()<System.currentTimeMillis()){
+        for (SlOpendoorApplyVo vo : list) {
+            if (vo.getLoseTime().getTime() < System.currentTimeMillis()) {
                 vo.setApplyStatus(2L);
                 vo.setApplyStatus(2L);
             }
             }
         }
         }
@@ -70,15 +68,14 @@ public class SlOpendoorApplyController extends BaseController
     //@PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ "applyList")
     //@PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ "applyList")
     @GetMapping("/applyList")
     @GetMapping("/applyList")
     @ApiOperation(value = "查询申请开门列表")
     @ApiOperation(value = "查询申请开门列表")
-    public TableDataInfo<SlOpendoorApplyVo> applylist(SlOpendoorApplyVo slOpendoorApply)
-    {
+    public TableDataInfo<SlOpendoorApplyVo> applylist(SlOpendoorApplyVo slOpendoorApply) {
         //获取登录用户
         //获取登录用户
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         slOpendoorApply.setUserId(sysUser.getUserId());
         slOpendoorApply.setUserId(sysUser.getUserId());
-        startPage("creat_time","descending");
+        startPage("creat_time", "descending");
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyList(slOpendoorApply);
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyList(slOpendoorApply);
-        for (SlOpendoorApplyVo vo:list) {
-            if(vo.getLoseTime().getTime()<System.currentTimeMillis()){
+        for (SlOpendoorApplyVo vo : list) {
+            if (vo.getLoseTime().getTime() < System.currentTimeMillis()) {
                 vo.setApplyStatus(2L);
                 vo.setApplyStatus(2L);
             }
             }
         }
         }
@@ -90,16 +87,15 @@ public class SlOpendoorApplyController extends BaseController
      */
      */
     @GetMapping("/listStudent")
     @GetMapping("/listStudent")
     @ApiOperation(value = "查询申请开门列表(学生端)")
     @ApiOperation(value = "查询申请开门列表(学生端)")
-    public TableDataInfo<SlOpendoorApplyVo> listStudent(SlOpendoorApplyVo slOpendoorApply)
-    {
+    public TableDataInfo<SlOpendoorApplyVo> listStudent(SlOpendoorApplyVo slOpendoorApply) {
         //获取登录用户
         //获取登录用户
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         slOpendoorApply.setUserId(sysUser.getUserId());
         slOpendoorApply.setUserId(sysUser.getUserId());
 
 
-        startPage("creat_time","descending");
+        startPage("creat_time", "descending");
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyListStudent(slOpendoorApply);
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyListStudent(slOpendoorApply);
-        for (SlOpendoorApplyVo vo:list) {
-            if(vo.getLoseTime().getTime()<System.currentTimeMillis()){
+        for (SlOpendoorApplyVo vo : list) {
+            if (vo.getLoseTime().getTime() < System.currentTimeMillis()) {
                 vo.setApplyStatus(2L);
                 vo.setApplyStatus(2L);
             }
             }
         }
         }
@@ -110,11 +106,10 @@ public class SlOpendoorApplyController extends BaseController
      * 导出申请开门列表
      * 导出申请开门列表
      */
      */
     @ApiOperation(value = "导出申请开门列表")
     @ApiOperation(value = "导出申请开门列表")
-    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ PerFun.EXPORT)
+    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY + PerFun.EXPORT)
     @Log(title = "申请开门", businessType = BusinessType.EXPORT)
     @Log(title = "申请开门", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SlOpendoorApplyVo slOpendoorApply) throws IOException
-    {
+    public void export(HttpServletResponse response, SlOpendoorApplyVo slOpendoorApply) throws IOException {
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyList(slOpendoorApply);
         List<SlOpendoorApplyVo> list = slOpendoorApplyService.selectSlOpendoorApplyList(slOpendoorApply);
         ExcelUtil<SlOpendoorApplyVo> util = new ExcelUtil<SlOpendoorApplyVo>(SlOpendoorApplyVo.class);
         ExcelUtil<SlOpendoorApplyVo> util = new ExcelUtil<SlOpendoorApplyVo>(SlOpendoorApplyVo.class);
         util.exportExcel(response, list, "申请开门数据");
         util.exportExcel(response, list, "申请开门数据");
@@ -124,10 +119,9 @@ public class SlOpendoorApplyController extends BaseController
      * 获取申请开门详细信息
      * 获取申请开门详细信息
      */
      */
     @ApiOperation(value = "获取申请开门详细信息")
     @ApiOperation(value = "获取申请开门详细信息")
-    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ PerFun.QUERY)
+    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY + PerFun.QUERY)
     @GetMapping(value = "/{id}")
     @GetMapping(value = "/{id}")
-    public ResultData<SlOpendoorApply> getInfo(@PathVariable("id") Long id)
-    {
+    public ResultData<SlOpendoorApply> getInfo(@PathVariable("id") Long id) {
         return ResultData.success(slOpendoorApplyService.selectSlOpendoorApplyById(id));
         return ResultData.success(slOpendoorApplyService.selectSlOpendoorApplyById(id));
     }
     }
 
 
@@ -135,11 +129,10 @@ public class SlOpendoorApplyController extends BaseController
      * 新增申请开门
      * 新增申请开门
      */
      */
     @ApiOperation(value = "新增申请开门")
     @ApiOperation(value = "新增申请开门")
-    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ PerFun.ADD)
+    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY + PerFun.ADD)
     @Log(title = "申请开门", businessType = BusinessType.INSERT)
     @Log(title = "申请开门", businessType = BusinessType.INSERT)
     @PostMapping
     @PostMapping
-    public ResultData add(@RequestBody SlOpendoorApply slOpendoorApply)
-    {
+    public ResultData add(@RequestBody SlOpendoorApply slOpendoorApply) {
         /*user_id 申请人id
         /*user_id 申请人id
         user_id2 人员2 id
         user_id2 人员2 id
         subject_id 实验室id
         subject_id 实验室id
@@ -156,8 +149,7 @@ public class SlOpendoorApplyController extends BaseController
     @ApiOperation(value = "新增申请开门")
     @ApiOperation(value = "新增申请开门")
     @Log(title = "申请开门", businessType = BusinessType.INSERT)
     @Log(title = "申请开门", businessType = BusinessType.INSERT)
     @PostMapping("/addStudent")
     @PostMapping("/addStudent")
-    public ResultData addStudent(@RequestBody SlOpendoorApply slOpendoorApply)
-    {
+    public ResultData addStudent(@RequestBody SlOpendoorApply slOpendoorApply) {
         return ResultData.result(slOpendoorApplyService.insertSlOpendoorApply(slOpendoorApply));
         return ResultData.result(slOpendoorApplyService.insertSlOpendoorApply(slOpendoorApply));
     }
     }
 
 
@@ -166,23 +158,21 @@ public class SlOpendoorApplyController extends BaseController
      * 修改申请开门
      * 修改申请开门
      */
      */
     @ApiOperation(value = "修改申请开门")
     @ApiOperation(value = "修改申请开门")
-    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ PerFun.EDIT)
+    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY + PerFun.EDIT)
     @Log(title = "申请开门", businessType = BusinessType.UPDATE)
     @Log(title = "申请开门", businessType = BusinessType.UPDATE)
     @PutMapping
     @PutMapping
-    public ResultData edit(@RequestBody SlOpendoorApply slOpendoorApply)
-    {
-        return  ResultData.result(slOpendoorApplyService.updateSlOpendoorApply(slOpendoorApply));
+    public ResultData edit(@RequestBody SlOpendoorApply slOpendoorApply) {
+        return ResultData.result(slOpendoorApplyService.updateSlOpendoorApply(slOpendoorApply));
     }
     }
 
 
     /**
     /**
      * 删除申请开门
      * 删除申请开门
      */
      */
     @ApiOperation(value = "删除申请开门")
     @ApiOperation(value = "删除申请开门")
-    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY+ PerFun.REMOVE)
+    @PreAuthorize(hasPermi = PerPrefix.SMARTLOCK_OPENDOORAPPLY + PerFun.REMOVE)
     @Log(title = "申请开门", businessType = BusinessType.DELETE)
     @Log(title = "申请开门", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @DeleteMapping("/{ids}")
-    public ResultData remove(@PathVariable Long[] ids)
-    {
+    public ResultData remove(@PathVariable Long[] ids) {
         return ResultData.result(slOpendoorApplyService.deleteSlOpendoorApplyByIds(ids));
         return ResultData.result(slOpendoorApplyService.deleteSlOpendoorApplyByIds(ids));
     }
     }
 
 
@@ -193,8 +183,7 @@ public class SlOpendoorApplyController extends BaseController
      */
      */
     @ApiOperation(value = "重新授权")
     @ApiOperation(value = "重新授权")
     @GetMapping("/auth/{id}")
     @GetMapping("/auth/{id}")
-    public AjaxResult againAuth(@PathVariable Long id)
-    {
+    public AjaxResult againAuth(@PathVariable Long id) {
         return AjaxResult.success(slOpendoorApplyService.againAuth(id));
         return AjaxResult.success(slOpendoorApplyService.againAuth(id));
     }
     }
 }
 }

+ 5 - 5
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlSubjectRelationController.java

@@ -153,9 +153,9 @@ public class SlSubjectRelationController extends BaseController {
     @GetMapping("/listLockRoom")
     @GetMapping("/listLockRoom")
     @ApiOperation(value = "查询实验室关联列表")
     @ApiOperation(value = "查询实验室关联列表")
     public TableDataInfo<SlRoom> listLockRoom(SlRoom slRoom) {
     public TableDataInfo<SlRoom> listLockRoom(SlRoom slRoom) {
-        List<SlRoom> list = smartlockUtil.getRoom( slRoom);
+        List<SlRoom> list = smartlockUtil.getRoom(slRoom);
 
 
-        /*List<SlRoom> list = new ArrayList<>();
+        /* List<SlRoom> list = new ArrayList<>();
         slRoom.setRoomname("房间1");
         slRoom.setRoomname("房间1");
         slRoom.setRoomcode2("MS001");
         slRoom.setRoomcode2("MS001");
         slRoom.setRoomlocation("1-1-110");
         slRoom.setRoomlocation("1-1-110");
@@ -167,7 +167,7 @@ public class SlSubjectRelationController extends BaseController {
         slRoom1.setRoomcode2("MS002");
         slRoom1.setRoomcode2("MS002");
         slRoom1.setRoomlocation("1-1-112");
         slRoom1.setRoomlocation("1-1-112");
         slRoom1.setRoomid(330);
         slRoom1.setRoomid(330);
-        list.add(slRoom1);*/
+        list.add(slRoom1); */
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
@@ -184,9 +184,9 @@ public class SlSubjectRelationController extends BaseController {
         List<SlSubjectRelationVo> listrelation = slSubjectRelationService.selectSlSubjectRelationList(subjectRelation);
         List<SlSubjectRelationVo> listrelation = slSubjectRelationService.selectSlSubjectRelationList(subjectRelation);
 
 
         List<SlLockOnline> onlineList = new ArrayList<>();
         List<SlLockOnline> onlineList = new ArrayList<>();
-        for (SlSubjectRelation rl:listrelation) {
+        for (SlSubjectRelation rl : listrelation) {
             SlLockOnline lockOnline = smartlockUtil.getRoomDetails(rl.getLockRoomId());
             SlLockOnline lockOnline = smartlockUtil.getRoomDetails(rl.getLockRoomId());
-            if(lockOnline!=null){
+            if (lockOnline != null) {
                 onlineList.add(lockOnline);
                 onlineList.add(lockOnline);
             }
             }
         }
         }

+ 1 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SlUserRelationController.java

@@ -29,7 +29,7 @@ import java.util.List;
  */
  */
 
 
 @RestController
 @RestController
-@Api(tags = "门锁相关信息查询")
+@Api(tags = "用户关联")
 @RequestMapping("/smartlock/userRelation")
 @RequestMapping("/smartlock/userRelation")
 public class SlUserRelationController extends BaseController
 public class SlUserRelationController extends BaseController
 {
 {

+ 3 - 5
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/controller/SmartlockController.java

@@ -45,15 +45,14 @@ public class SmartlockController extends BaseController {
      */
      */
     @GetMapping("/detalis")
     @GetMapping("/detalis")
     @ApiOperation(value = "查询实验室门锁信息")
     @ApiOperation(value = "查询实验室门锁信息")
-    public TableDataInfo<SlLockOnline> list(Long subjectId)
-    {
+    public TableDataInfo<SlLockOnline> list(Long subjectId) {
         List<SlLockOnline> lockOnlineslist = new ArrayList<>();
         List<SlLockOnline> lockOnlineslist = new ArrayList<>();
 
 
         //查询实验室绑定的门锁集合
         //查询实验室绑定的门锁集合
         SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
         SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
         subjectRelation.setSubjectId(subjectId);
         subjectRelation.setSubjectId(subjectId);
         List<SlSubjectRelationVo> list = slSubjectRelationService.selectSlSubjectRelationList(subjectRelation);
         List<SlSubjectRelationVo> list = slSubjectRelationService.selectSlSubjectRelationList(subjectRelation);
-        for (SlSubjectRelationVo sub: list ) {
+        for (SlSubjectRelationVo sub : list) {
             //查询门锁状态
             //查询门锁状态
             SlLockOnline lockOnline = smartlockUtil.getRoomDetails(sub.getLockRoomId());
             SlLockOnline lockOnline = smartlockUtil.getRoomDetails(sub.getLockRoomId());
             lockOnlineslist.add(lockOnline);
             lockOnlineslist.add(lockOnline);
@@ -62,8 +61,7 @@ public class SmartlockController extends BaseController {
     }
     }
 
 
     @GetMapping("/test")
     @GetMapping("/test")
-    public ResultData<Long> test()
-    {
+    public ResultData<Long> test() {
         R<SysUser> r = remoteUserService.getUserInfoByUserId(1L, SecurityConstants.INNER);
         R<SysUser> r = remoteUserService.getUserInfoByUserId(1L, SecurityConstants.INNER);
         logger.info(r.getData().toString());
         logger.info(r.getData().toString());
         logger.info(smartlockUtil.SERVICE_URL);
         logger.info(smartlockUtil.SERVICE_URL);

+ 99 - 107
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlApplyApprovalServiceImpl.java

@@ -30,8 +30,7 @@ import java.util.*;
  */
  */
 @Slf4j
 @Slf4j
 @Service
 @Service
-public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
-{
+public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService {
 
 
     @Autowired
     @Autowired
     private TokenService tokenService;
     private TokenService tokenService;
@@ -62,8 +61,7 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      * @return 申请审核
      * @return 申请审核
      */
      */
     @Override
     @Override
-    public SlApplyApproval selectSlApplyApprovalById(Long id)
-    {
+    public SlApplyApproval selectSlApplyApprovalById(Long id) {
         return slApplyApprovalMapper.selectSlApplyApprovalById(id);
         return slApplyApprovalMapper.selectSlApplyApprovalById(id);
     }
     }
 
 
@@ -74,14 +72,13 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      * @return 申请审核
      * @return 申请审核
      */
      */
     @Override
     @Override
-    public List<SlApplyApproval> selectSlApplyApprovalList(SlApplyApproval slApplyApproval)
-    {
+    public List<SlApplyApproval> selectSlApplyApprovalList(SlApplyApproval slApplyApproval) {
         return slApplyApprovalMapper.selectSlApplyApprovalList(slApplyApproval);
         return slApplyApprovalMapper.selectSlApplyApprovalList(slApplyApproval);
     }
     }
 
 
     @Override
     @Override
-    public List<SlApplyApproval> getListByIds(List<Long> ids){
-        if (ids.isEmpty()){
+    public List<SlApplyApproval> getListByIds(List<Long> ids) {
+        if (ids.isEmpty()) {
             new ArrayList<>();
             new ArrayList<>();
         }
         }
         return slApplyApprovalMapper.getListByIds(ids);
         return slApplyApprovalMapper.getListByIds(ids);
@@ -95,9 +92,8 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int insertSlApplyApproval(SlApplyApproval slApplyApproval)
-    {
-        int flg=0;
+    public int insertSlApplyApproval(SlApplyApproval slApplyApproval) {
+        int flg = 0;
         try {
         try {
             SysUser sysUser = tokenService.getLoginUser().getSysUser();
             SysUser sysUser = tokenService.getLoginUser().getSysUser();
             //部门id
             //部门id
@@ -114,55 +110,55 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
             //查询申请记录
             //查询申请记录
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(slApplyApproval.getApplyId());
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(slApplyApproval.getApplyId());
 
 
-            if(opendoorApply.getApplyStatus()==3){
+            if (opendoorApply.getApplyStatus() == 3) {
                 throw new ServiceException("该记录已驳回,无需审核!");
                 throw new ServiceException("该记录已驳回,无需审核!");
             }
             }
-            if(opendoorApply.getApplyNumber()==2){
+            if (opendoorApply.getApplyNumber() == 2) {
                 throw new ServiceException("该记录已有两次审核,无需再次审核!");
                 throw new ServiceException("该记录已有两次审核,无需再次审核!");
             }
             }
             //通过
             //通过
-            if(slApplyApproval.getApprovaStatus()==1){
-                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber()+1);
+            if (slApplyApproval.getApprovaStatus() == 1) {
+                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber() + 1);
                 //审核通过,下发密码(第二次,审核通过的情况下)
                 //审核通过,下发密码(第二次,审核通过的情况下)
-                if(opendoorApply.getApplyNumber()==2){
+                if (opendoorApply.getApplyNumber() == 2) {
                     //判断是否同一个人连续审核
                     //判断是否同一个人连续审核
                     SlApplyApproval approval = new SlApplyApproval();
                     SlApplyApproval approval = new SlApplyApproval();
                     approval.setApplyId(slApplyApproval.getApplyId());
                     approval.setApplyId(slApplyApproval.getApplyId());
                     approval.setApprovaId(sysUser.getUserId());
                     approval.setApprovaId(sysUser.getUserId());
                     List<SlApplyApproval> applyVoList = slApplyApprovalMapper.selectSlApplyApprovalList(approval);
                     List<SlApplyApproval> applyVoList = slApplyApprovalMapper.selectSlApplyApprovalList(approval);
-                    if(applyVoList.size()>0){
+                    if (applyVoList.size() > 0) {
                         throw new ServiceException("您已审核过该条申请,无需重复审核!");
                         throw new ServiceException("您已审核过该条申请,无需重复审核!");
                     }
                     }
                     //审核通过,刷新审核状态
                     //审核通过,刷新审核状态
                     opendoorApply.setApplyStatus(2L);
                     opendoorApply.setApplyStatus(2L);
                     //审核通过后,添加人员并且授权、短信发送
                     //审核通过后,添加人员并且授权、短信发送
-                    String str =  authPower(opendoorApply.getId());
-                    if(!"ok".equals(str)){
-                        log.info("人员授权以及短信发送结果:"+str);
+                    String str = authPower(opendoorApply.getId());
+                    if (!"ok".equals(str)) {
+                        log.info("人员授权以及短信发送结果:" + str);
                         throw new ServiceException(str);
                         throw new ServiceException(str);
                     }
                     }
                 }
                 }
-            }else if(slApplyApproval.getApprovaStatus()==2){
+            } else if (slApplyApproval.getApprovaStatus() == 2) {
                 //驳回
                 //驳回
-                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber()+1);
+                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber() + 1);
                 //修改申请表状态
                 //修改申请表状态
                 opendoorApply.setApplyStatus(3L);
                 opendoorApply.setApplyStatus(3L);
 
 
                 //申请人1短信发送通知
                 //申请人1短信发送通知
-               R r1= remoteStockService.sendSydSms("【实验室安全系统】"+opendoorApply.getSubjectName()+"-门禁远程授权申请已拒绝,请联系实验室管理人员。",3,opendoorApply.getId(),opendoorApply.getPhonenumber());
-               log.info("开门申请拒绝,人员1短信通知结果:"+r1);
+                R r1 = remoteStockService.sendSydSms("【实验室安全系统】" + opendoorApply.getSubjectName() + "-门禁远程授权申请已拒绝,请联系实验室管理人员。", 3, opendoorApply.getId(), opendoorApply.getPhonenumber());
+                log.info("开门申请拒绝,人员1短信通知结果:" + r1);
                 //申请人2短信发送通知
                 //申请人2短信发送通知
-               R r2= remoteStockService.sendSydSms("【实验室安全系统】"+opendoorApply.getSubjectName()+"-门禁远程授权申请已拒绝,请联系实验室管理人员。",3,opendoorApply.getId(),opendoorApply.getPhonenumber2());
-                log.info("开门申请拒绝,人员2短信通知结果:"+r2);
+                R r2 = remoteStockService.sendSydSms("【实验室安全系统】" + opendoorApply.getSubjectName() + "-门禁远程授权申请已拒绝,请联系实验室管理人员。", 3, opendoorApply.getId(), opendoorApply.getPhonenumber2());
+                log.info("开门申请拒绝,人员2短信通知结果:" + r2);
             }
             }
             //申请表操作
             //申请表操作
             opendoorApply.setApprovalTime(new Date());
             opendoorApply.setApprovalTime(new Date());
             opendoorApply.setApprovalUser(sysUser.getNickName());
             opendoorApply.setApprovalUser(sysUser.getNickName());
 
 
             slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
             slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
-            flg= slApplyApprovalMapper.insertSlApplyApproval(slApplyApproval);
-        }catch (Exception e){
-            log.info("申请审核异常"+e);
+            flg = slApplyApprovalMapper.insertSlApplyApproval(slApplyApproval);
+        } catch (Exception e) {
+            log.info("申请审核异常" + e);
         }
         }
         return flg;
         return flg;
     }
     }
@@ -175,8 +171,7 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int updateSlApplyApproval(SlApplyApproval slApplyApproval)
-    {
+    public int updateSlApplyApproval(SlApplyApproval slApplyApproval) {
         return slApplyApprovalMapper.updateSlApplyApproval(slApplyApproval);
         return slApplyApprovalMapper.updateSlApplyApproval(slApplyApproval);
     }
     }
 
 
@@ -188,8 +183,7 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int deleteSlApplyApprovalByIds(Long[] ids)
-    {
+    public int deleteSlApplyApprovalByIds(Long[] ids) {
         return slApplyApprovalMapper.deleteSlApplyApprovalByIds(ids);
         return slApplyApprovalMapper.deleteSlApplyApprovalByIds(ids);
     }
     }
 
 
@@ -201,8 +195,7 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int deleteSlApplyApprovalById(Long id)
-    {
+    public int deleteSlApplyApprovalById(Long id) {
         return slApplyApprovalMapper.deleteSlApplyApprovalById(id);
         return slApplyApprovalMapper.deleteSlApplyApprovalById(id);
     }
     }
 
 
@@ -215,70 +208,70 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public Map<String,Object> sysMsgApprova(String phone, String content, Long lockApplyId) {
-        Map<String,Object> map = new HashMap<>();
+    public Map<String, Object> sysMsgApprova(String phone, String content, Long lockApplyId) {
+        Map<String, Object> map = new HashMap<>();
         try {
         try {
             //审核状态 1通过 2驳回
             //审核状态 1通过 2驳回
-            Long approvalStatus=1L ;
-            SysUser sysUser =  remoteUserService.getUserByPhone(phone).getData();
-            if(sysUser==null){
-                map.put("msg","未查询到相关人信息");
-                map.put("status","error");
+            Long approvalStatus = 1L;
+            SysUser sysUser = remoteUserService.getUserByPhone(phone).getData();
+            if (sysUser == null) {
+                map.put("msg", "未查询到相关人信息");
+                map.put("status", "error");
                 return map;
                 return map;
             }
             }
 
 
             //查询申请记录
             //查询申请记录
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(lockApplyId);
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(lockApplyId);
 
 
-            if(opendoorApply.getApplyStatus()==3){
-                map.put("msg","该记录已驳回,无需审核!");
-                map.put("status","error");
+            if (opendoorApply.getApplyStatus() == 3) {
+                map.put("msg", "该记录已驳回,无需审核!");
+                map.put("status", "error");
                 return map;
                 return map;
             }
             }
-            if(opendoorApply.getApplyNumber()==2){
-                map.put("msg","该记录已有两次审核,无需再次审核!");
-                map.put("status","error");
+            if (opendoorApply.getApplyNumber() == 2) {
+                map.put("msg", "该记录已有两次审核,无需再次审核!");
+                map.put("status", "error");
                 return map;
                 return map;
             }
             }
             //通过
             //通过
-            if( "1".equals(content)){
-                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber()+1);
+            if ("1".equals(content)) {
+                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber() + 1);
                 //审核通过,下发密码(第二次,审核通过的情况下)
                 //审核通过,下发密码(第二次,审核通过的情况下)
-                if(opendoorApply.getApplyNumber()==2){
+                if (opendoorApply.getApplyNumber() == 2) {
                     //判断是否同一个人连续审核
                     //判断是否同一个人连续审核
                     SlApplyApproval approval = new SlApplyApproval();
                     SlApplyApproval approval = new SlApplyApproval();
                     approval.setApplyId(lockApplyId);
                     approval.setApplyId(lockApplyId);
                     approval.setApprovaId(sysUser.getUserId());
                     approval.setApprovaId(sysUser.getUserId());
                     List<SlApplyApproval> applyVoList = slApplyApprovalMapper.selectSlApplyApprovalList(approval);
                     List<SlApplyApproval> applyVoList = slApplyApprovalMapper.selectSlApplyApprovalList(approval);
-                    if(applyVoList.size()>0){
-                        map.put("msg","您已审核过该条申请,无需重复审核!");
-                        map.put("status","error");
+                    if (applyVoList.size() > 0) {
+                        map.put("msg", "您已审核过该条申请,无需重复审核!");
+                        map.put("status", "error");
                         return map;
                         return map;
                     }
                     }
                     //审核通过,刷新审核状态
                     //审核通过,刷新审核状态
                     opendoorApply.setApplyStatus(2L);
                     opendoorApply.setApplyStatus(2L);
 
 
                     //审核通过后,添加人员并且授权、短信发送
                     //审核通过后,添加人员并且授权、短信发送
-                    String str =  authPower(opendoorApply.getId());
-                    if(!"ok".equals(str)){
-                        map.put("msg",str);
-                        map.put("status","error");
+                    String str = authPower(opendoorApply.getId());
+                    if (!"ok".equals(str)) {
+                        map.put("msg", str);
+                        map.put("status", "error");
                         return map;
                         return map;
                     }
                     }
                 }
                 }
-            }else if( "0".equals(content)){
-                approvalStatus=2L;
+            } else if ("0".equals(content)) {
+                approvalStatus = 2L;
                 //驳回
                 //驳回
-                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber()+1);
+                opendoorApply.setApplyNumber(opendoorApply.getApplyNumber() + 1);
                 //修改申请表状态
                 //修改申请表状态
                 opendoorApply.setApplyStatus(3L);
                 opendoorApply.setApplyStatus(3L);
 
 
                 //申请人1短信发送通知
                 //申请人1短信发送通知
-                R r1= remoteStockService.sendSydSms("【实验室安全系统】"+opendoorApply.getSubjectName()+"-门禁远程授权申请已拒绝,请联系实验室管理人员。",3,opendoorApply.getId(),opendoorApply.getPhonenumber());
-                log.info("短信开门申请拒绝,人员1短信通知结果:"+r1);
+                R r1 = remoteStockService.sendSydSms("【实验室安全系统】" + opendoorApply.getSubjectName() + "-门禁远程授权申请已拒绝,请联系实验室管理人员。", 3, opendoorApply.getId(), opendoorApply.getPhonenumber());
+                log.info("短信开门申请拒绝,人员1短信通知结果:" + r1);
                 //申请人2短信发送通知
                 //申请人2短信发送通知
-                R r2= remoteStockService.sendSydSms("【实验室安全系统】"+opendoorApply.getSubjectName()+"-门禁远程授权申请已拒绝,请联系实验室管理人员。",3,opendoorApply.getId(),opendoorApply.getPhonenumber2());
-                log.info("短信开门申请拒绝,人员2短信通知结果:"+r2);
+                R r2 = remoteStockService.sendSydSms("【实验室安全系统】" + opendoorApply.getSubjectName() + "-门禁远程授权申请已拒绝,请联系实验室管理人员。", 3, opendoorApply.getId(), opendoorApply.getPhonenumber2());
+                log.info("短信开门申请拒绝,人员2短信通知结果:" + r2);
             }
             }
             //申请表操作
             //申请表操作
             opendoorApply.setApprovalTime(new Date());
             opendoorApply.setApprovalTime(new Date());
@@ -295,14 +288,14 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
             approval.setApprovaStatus(approvalStatus);
             approval.setApprovaStatus(approvalStatus);
             approval.setCretaTime(new Date());
             approval.setCretaTime(new Date());
             slApplyApprovalMapper.insertSlApplyApproval(approval);
             slApplyApprovalMapper.insertSlApplyApproval(approval);
-        }catch (Exception e){
-            log.info("短信审核处理异常:"+e);
-            map.put("msg",e);
-            map.put("status","error");
+        } catch (Exception e) {
+            log.info("短信审核处理异常:" + e);
+            map.put("msg", e);
+            map.put("status", "error");
             return map;
             return map;
         }
         }
-        map.put("msg","成功");
-        map.put("status","ok");
+        map.put("msg", "成功");
+        map.put("status", "ok");
         return map;
         return map;
     }
     }
 
 
@@ -313,97 +306,96 @@ public class SlApplyApprovalServiceImpl implements ISlApplyApprovalService
     public String authPower(Long applyId) throws Exception {
     public String authPower(Long applyId) throws Exception {
         log.info("========开始门锁授权===========");
         log.info("========开始门锁授权===========");
         //人员1 授权结果
         //人员1 授权结果
-        Boolean auths1=false;
+        Boolean auths1 = false;
         //人员2授权结果
         //人员2授权结果
-        Boolean auths2=false;
+        Boolean auths2 = false;
         //返回值
         //返回值
-        String strMsg="ok";
+        String strMsg = "ok";
         try {
         try {
             //查询申请记录
             //查询申请记录
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(applyId);
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(applyId);
 
 
             SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
             SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
             subjectRelation.setSubjectId(opendoorApply.getSubjectId());
             subjectRelation.setSubjectId(opendoorApply.getSubjectId());
-            List<SlSubjectRelationVo>  listsubRla = slSubjectRelationMapper.selectSlSubjectRelationList(subjectRelation);
-            if(listsubRla.size()!=2){
-                strMsg="该实验室暂未绑定双锁!";
+            List<SlSubjectRelationVo> listsubRla = slSubjectRelationMapper.selectSlSubjectRelationList(subjectRelation);
+            if (listsubRla.size() != 2) {
+                strMsg = "该实验室暂未绑定双锁!";
             }
             }
 
 
-            Map<String,Object> detalisMap = new HashMap<>();
+            Map<String, Object> detalisMap = new HashMap<>();
             SlUser user = new SlUser();
             SlUser user = new SlUser();
             //学号、工号
             //学号、工号
             user.setPersoncode(opendoorApply.getUserCode());
             user.setPersoncode(opendoorApply.getUserCode());
             //姓名
             //姓名
             user.setPersonname(opendoorApply.getUserName());
             user.setPersonname(opendoorApply.getUserName());
             //性别 (0=女,1=男)
             //性别 (0=女,1=男)
-            user.setPersonsex(opendoorApply.getUserSex()==null?1+"":0+"");
+            user.setPersonsex(opendoorApply.getUserSex() == null ? 1 + "" : 0 + "");
             //人员类别(1=学生,2=教职工,3=临时人员)
             //人员类别(1=学生,2=教职工,3=临时人员)
             user.setPersontype("1");
             user.setPersontype("1");
             //电话
             //电话
             user.setPersonmobile(opendoorApply.getPhonenumber());
             user.setPersonmobile(opendoorApply.getPhonenumber());
             log.info("=======人员1授权开始========");
             log.info("=======人员1授权开始========");
-            Map<String,Object> map1= smartlockUtil.addUser(user,listsubRla.get(0).getLockRoomId());
+            Map<String, Object> map1 = smartlockUtil.addUser(user, listsubRla.get(0).getLockRoomId());
 
 
-            if(!smartlockUtil.RESULT_MSG.equals(map1.get("resultMsg").toString())){
-                log.info("人员:"+opendoorApply.getUserName()+",授权失败,原因:"+map1.get("resultMsg")+",请联系管理员");
-                strMsg="人员:"+opendoorApply.getUserName()+",授权失败,原因:"+map1.get("resultMsg")+",请联系管理员";
+            if (!smartlockUtil.RESULT_MSG.equals(map1.get("resultMsg").toString())) {
+                log.info("人员:" + opendoorApply.getUserName() + ",授权失败,原因:" + map1.get("resultMsg") + ",请联系管理员");
+                strMsg = "人员:" + opendoorApply.getUserName() + ",授权失败,原因:" + map1.get("resultMsg") + ",请联系管理员";
                 return strMsg;
                 return strMsg;
-            }else {
+            } else {
                 log.info("=======人员1授权成功========");
                 log.info("=======人员1授权成功========");
-                auths1=true;
+                auths1 = true;
             }
             }
 
 
 
 
             //人员1 备注详情
             //人员1 备注详情
-            detalisMap.put("人员1",opendoorApply.getUserName());
-            detalisMap.put("锁编1号",listsubRla.get(0).getLockCode());
-            detalisMap.put("人员1密码",map1.get("password"));
+            detalisMap.put("人员1", opendoorApply.getUserName());
+            detalisMap.put("锁编1号", listsubRla.get(0).getLockCode());
+            detalisMap.put("人员1密码", map1.get("password"));
 
 
             //学号、工号
             //学号、工号
             user.setPersoncode(opendoorApply.getUserCode2());
             user.setPersoncode(opendoorApply.getUserCode2());
             //姓名
             //姓名
             user.setPersonname(opendoorApply.getUserName2());
             user.setPersonname(opendoorApply.getUserName2());
             //性别 (0=女,1=男)
             //性别 (0=女,1=男)
-            user.setPersonsex(opendoorApply.getUserSex2()==null?1+"":0+"");
+            user.setPersonsex(opendoorApply.getUserSex2() == null ? 1 + "" : 0 + "");
             //人员类别(1=学生,2=教职工,3=临时人员)
             //人员类别(1=学生,2=教职工,3=临时人员)
             user.setPersontype("1");
             user.setPersontype("1");
             //电话
             //电话
             user.setPersonmobile(opendoorApply.getPhonenumber2());
             user.setPersonmobile(opendoorApply.getPhonenumber2());
 
 
             log.info("=======人员2授权开始========");
             log.info("=======人员2授权开始========");
-            Map<String,Object> map2= smartlockUtil.addUser(user,listsubRla.get(1).getLockRoomId());
+            Map<String, Object> map2 = smartlockUtil.addUser(user, listsubRla.get(1).getLockRoomId());
 
 
             //人员2 备注详情
             //人员2 备注详情
-            detalisMap.put("人员2",opendoorApply.getUserName());
-            detalisMap.put("锁编2号",listsubRla.get(1).getLockCode());
-            detalisMap.put("人员2密码",map2.get("password"));
-            if(!smartlockUtil.RESULT_MSG.equals(map2.get("resultMsg").toString())){
-                log.info("人员2:"+opendoorApply.getUserName()+",授权失败,原因:"+map2.get("resultMsg")+",请联系管理员");
-                strMsg="人员:"+opendoorApply.getUserName()+",授权失败,原因:"+map2.get("resultMsg")+",请联系管理员";
+            detalisMap.put("人员2", opendoorApply.getUserName());
+            detalisMap.put("锁编2号", listsubRla.get(1).getLockCode());
+            detalisMap.put("人员2密码", map2.get("password"));
+            if (!smartlockUtil.RESULT_MSG.equals(map2.get("resultMsg").toString())) {
+                log.info("人员2:" + opendoorApply.getUserName() + ",授权失败,原因:" + map2.get("resultMsg") + ",请联系管理员");
+                strMsg = "人员:" + opendoorApply.getUserName() + ",授权失败,原因:" + map2.get("resultMsg") + ",请联系管理员";
                 return strMsg;
                 return strMsg;
-            }else {
+            } else {
                 log.info("=======人员2授权成功========");
                 log.info("=======人员2授权成功========");
-                auths2=true;
+                auths2 = true;
             }
             }
 
 
 
 
-
-            log.info("=======授权结束========人员1授权结果:"+auths1+" ,人员2授权结果:"+auths2);
+            log.info("=======授权结束========人员1授权结果:" + auths1 + " ,人员2授权结果:" + auths2);
             //人员入住办理成功,发送短信提示
             //人员入住办理成功,发送短信提示
-            if(auths1 && auths2){
+            if (auths1 && auths2) {
                 log.info("=============双人授权成功,下发短信================");
                 log.info("=============双人授权成功,下发短信================");
-                R p1 = remoteStockService.sendSydSms("【实验室安全系统】授权码:"+map1.get("password")+"("+smartlockUtil.AUTHS_LENGTH+"小时内有效),"+opendoorApply.getSubjectName()+"-门禁远程授权申请已通过,请勿泄露给他人。",3,applyId,new String[] {opendoorApply.getPhonenumber()});
-                log.info("人员1短信发送结果:"+p1.getData());
+                R p1 = remoteStockService.sendSydSms("【实验室安全系统】授权码:" + map1.get("password") + "(" + smartlockUtil.AUTHS_LENGTH + "小时内有效)," + opendoorApply.getSubjectName() + "-门禁远程授权申请已通过,请勿泄露给他人。", 3, applyId, new String[]{opendoorApply.getPhonenumber()});
+                log.info("人员1短信发送结果:" + p1.getData());
 
 
-                R p2 = remoteStockService.sendSydSms("【实验室安全系统】授权码:"+map1.get("password")+"("+smartlockUtil.AUTHS_LENGTH+"小时内有效),"+opendoorApply.getSubjectName()+"-门禁远程授权申请已通过,请勿泄露给他人。",3,applyId,new String[] {opendoorApply.getPhonenumber2()});
-                log.info("人员2短信发送结果:"+p2.getData());
+                R p2 = remoteStockService.sendSydSms("【实验室安全系统】授权码:" + map1.get("password") + "(" + smartlockUtil.AUTHS_LENGTH + "小时内有效)," + opendoorApply.getSubjectName() + "-门禁远程授权申请已通过,请勿泄露给他人。", 3, applyId, new String[]{opendoorApply.getPhonenumber2()});
+                log.info("人员2短信发送结果:" + p2.getData());
             }
             }
 
 
             opendoorApply.setIllustrate(detalisMap.toString());
             opendoorApply.setIllustrate(detalisMap.toString());
             slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
             slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
 
 
-        }catch (Exception e){
-            log.info("=======人员授权失败========"+e);
+        } catch (Exception e) {
+            log.info("=======人员授权失败========" + e);
         }
         }
         return strMsg;
         return strMsg;
     }
     }

+ 65 - 64
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlOpendoorApplyServiceImpl.java

@@ -138,16 +138,16 @@ public class SlOpendoorApplyServiceImpl implements ISlOpendoorApplyService {
             //短信发送成功 数据入库
             //短信发送成功 数据入库
             slOpendoorApplyMapper.insertSlOpendoorApply(slOpendoorApply);
             slOpendoorApplyMapper.insertSlOpendoorApply(slOpendoorApply);
 
 
-            String msg =sendMsgToSafeUser(slOpendoorApply.getId());
-            if(!"ok".equals(msg)){
+            String msg = sendMsgToSafeUser(slOpendoorApply.getId());
+            if (!"ok".equals(msg)) {
                 //授权失败删除申请数据
                 //授权失败删除申请数据
                 slOpendoorApplyMapper.deleteSlOpendoorApplyById(slOpendoorApply.getId());
                 slOpendoorApplyMapper.deleteSlOpendoorApplyById(slOpendoorApply.getId());
-                log.info("操作失败:"+msg);
+                log.info("操作失败:" + msg);
                 return 0;
                 return 0;
             }
             }
-            log.info("短信通知结果:"+msg);
+            log.info("短信通知结果:" + msg);
         } catch (Exception e) {
         } catch (Exception e) {
-            log.info("授权失败:"+e);
+            log.info("授权失败:" + e);
         }
         }
         return 1;
         return 1;
     }
     }
@@ -196,18 +196,19 @@ public class SlOpendoorApplyServiceImpl implements ISlOpendoorApplyService {
      */
      */
     @Override
     @Override
     public String againAuth(Long id) {
     public String againAuth(Long id) {
-        String str="";
+        String str = "";
         try {
         try {
-            str =  authPowerNew(id);
-        }catch (Exception e) {
+            str = authPowerNew(id);
+        } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
-            log.error("重新授权失败:"+e);
+            log.error("重新授权失败:" + e);
         }
         }
         return str;
         return str;
     }
     }
 
 
     /**
     /**
      * 发送短信给相关门锁负责人
      * 发送短信给相关门锁负责人
+     *
      * @param applyId
      * @param applyId
      * @return
      * @return
      * @throws Exception
      * @throws Exception
@@ -215,19 +216,19 @@ public class SlOpendoorApplyServiceImpl implements ISlOpendoorApplyService {
     public String sendMsgToSafeUser(Long applyId) throws Exception {
     public String sendMsgToSafeUser(Long applyId) throws Exception {
         log.info("========开始发送短信===========");
         log.info("========开始发送短信===========");
         //返回值
         //返回值
-        String strMsg="ok";
+        String strMsg = "ok";
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         try {
         try {
             //查询申请记录
             //查询申请记录
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(applyId);
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(applyId);
-            Map<String,Object> detalisMap = new HashMap<>();
+            Map<String, Object> detalisMap = new HashMap<>();
 
 
             //检查是否绑定双锁
             //检查是否绑定双锁
             SlSubjectRelationVo relationVo = new SlSubjectRelationVo();
             SlSubjectRelationVo relationVo = new SlSubjectRelationVo();
             relationVo.setSubjectId(opendoorApply.getSubjectId());
             relationVo.setSubjectId(opendoorApply.getSubjectId());
             List<SlSubjectRelationVo> relist = slSubjectRelationMapper.selectSlSubjectRelationList(relationVo);
             List<SlSubjectRelationVo> relist = slSubjectRelationMapper.selectSlSubjectRelationList(relationVo);
-            if(relist.size()<2){
-                strMsg="该实验室暂未关联双门锁。";
+            if (relist.size() < 2) {
+                strMsg = "该实验室暂未关联双门锁。";
                 log.info("该实验室暂未关联双门锁。");
                 log.info("该实验室暂未关联双门锁。");
                 return strMsg;
                 return strMsg;
             }
             }
@@ -238,18 +239,18 @@ public class SlOpendoorApplyServiceImpl implements ISlOpendoorApplyService {
             rv.setSubjectId(opendoorApply.getSubjectId());
             rv.setSubjectId(opendoorApply.getSubjectId());
             relist = slSubjectRelationMapper.selectSlSubjectRelationList(rv);
             relist = slSubjectRelationMapper.selectSlSubjectRelationList(rv);
 
 
-            if(relist.size()==0){
-                strMsg="未查询到安全负责人关联的实验室信息。";
+            if (relist.size() == 0) {
+                strMsg = "未查询到安全负责人关联的实验室信息。";
                 return strMsg;
                 return strMsg;
             }
             }
 
 
             //获取token
             //获取token
             String token = smartlockUtil.getToken();
             String token = smartlockUtil.getToken();
-            log.info("安全负责人电话:"+relist.get(0).getSafeUserPhone());
+            log.info("安全负责人电话:" + relist.get(0).getSafeUserPhone());
 
 
             //查询用户是否存在授权
             //查询用户是否存在授权
             String authis = smartlockUtil.checkUserAuthExis(relist.get(0).getSafeUserPhone(), token);
             String authis = smartlockUtil.checkUserAuthExis(relist.get(0).getSafeUserPhone(), token);
-            log.info("权限id:"+authis);
+            log.info("权限id:" + authis);
 
 
             if (StringUtils.isNotEmpty(authis)) {
             if (StringUtils.isNotEmpty(authis)) {
                 /*//修改授权
                 /*//修改授权
@@ -258,47 +259,47 @@ public class SlOpendoorApplyServiceImpl implements ISlOpendoorApplyService {
                 strMsg = map.get("resultMsg").toString();*/
                 strMsg = map.get("resultMsg").toString();*/
 
 
                 //删除用户授权
                 //删除用户授权
-                map = smartlockUtil.deleteAuths(token, relist.get(0).getLockRoomId(), Integer.valueOf(authis) );
-                log.info("删除用户授权结果:"+map.get("resultMsg"));
-                if("ok".equals(map.get("resultMsg"))){
-                    strMsg="删除授权失败,"+map.get("resultMsg");
+                map = smartlockUtil.deleteAuths(token, relist.get(0).getLockRoomId(), Integer.valueOf(authis));
+                log.info("删除用户授权结果:" + map.get("resultMsg"));
+                if ("ok".equals(map.get("resultMsg"))) {
+                    strMsg = "删除授权失败," + map.get("resultMsg");
                     return strMsg;
                     return strMsg;
                 }
                 }
 
 
                 Thread.sleep(8000);//等待8秒,等待门锁指令发送完毕
                 Thread.sleep(8000);//等待8秒,等待门锁指令发送完毕
 
 
                 //重新添加授权
                 //重新添加授权
-                map = smartlockUtil.addUserAuths(token,  relist.get(0).getSafeUserPhone(), relist.get(0).getLockRoomId());
-                log.info("重新添加授权结果:"+map.get("resultMsg"));
-                if("ok".equals(map.get("resultMsg"))){
-                    strMsg="添加授权失败,"+map.get("resultMsg");
+                map = smartlockUtil.addUserAuths(token, relist.get(0).getSafeUserPhone(), relist.get(0).getLockRoomId());
+                log.info("重新添加授权结果:" + map.get("resultMsg"));
+                if ("ok".equals(map.get("resultMsg"))) {
+                    strMsg = "添加授权失败," + map.get("resultMsg");
                     return strMsg;
                     return strMsg;
                 }
                 }
 
 
 
 
                 log.info("=============下发短信================");
                 log.info("=============下发短信================");
                 //人员1 备注详情
                 //人员1 备注详情
-                detalisMap.put("人员",opendoorApply.getUserName());
-                detalisMap.put("锁编号",relist.get(0).getLockCode());
-                detalisMap.put("人员密码",map.get("password"));
+                detalisMap.put("人员", opendoorApply.getUserName());
+                detalisMap.put("锁编号", relist.get(0).getLockCode());
+                detalisMap.put("人员密码", map.get("password"));
 
 
-                R r1= remoteStockService.sendSydSms(
+                R r1 = remoteStockService.sendSydSms(
                         "【实验室安全系统】" + opendoorApply.getUserName() + "申请" +
                         "【实验室安全系统】" + opendoorApply.getUserName() + "申请" +
                                 opendoorApply.getSubjectName() +
                                 opendoorApply.getSubjectName() +
-                                "-门禁远程授权,手机号:"+opendoorApply.getPhonenumber()+",授权码:"+map.get("password")+
-                                "("+ smartlockUtil.AUTHS_LENGTH+"小时内有效),请勿泄露给他人。",
+                                "-门禁远程授权,手机号:" + opendoorApply.getPhonenumber() + ",授权码:" + map.get("password") +
+                                "(" + smartlockUtil.AUTHS_LENGTH + "小时内有效),请勿泄露给他人。",
                         3, opendoorApply.getId(), relist.get(0).getSafeUserPhone());
                         3, opendoorApply.getId(), relist.get(0).getSafeUserPhone());
-                log.info("人员1短信发送结果:"+r1.getData());
+                log.info("人员1短信发送结果:" + r1.getData());
 
 
                 //修改申请数据
                 //修改申请数据
                 opendoorApply.setIllustrate(detalisMap.toString());
                 opendoorApply.setIllustrate(detalisMap.toString());
                 slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
                 slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
-            }else{
-                strMsg="用户暂无授权。";
+            } else {
+                strMsg = "用户暂无授权。";
             }
             }
 
 
-        }catch (Exception e){
-            log.info("=======人员授权失败========"+e);
+        } catch (Exception e) {
+            log.info("=======人员授权失败========" + e);
         }
         }
         return strMsg;
         return strMsg;
     }
     }
@@ -310,78 +311,78 @@ public class SlOpendoorApplyServiceImpl implements ISlOpendoorApplyService {
     public String authPowerNew(Long applyId) throws Exception {
     public String authPowerNew(Long applyId) throws Exception {
         log.info("========开始门锁授权===========");
         log.info("========开始门锁授权===========");
         //人员1 授权结果
         //人员1 授权结果
-        Boolean auths1=false;
+        Boolean auths1 = false;
         //返回值
         //返回值
-        String strMsg="ok";
+        String strMsg = "ok";
         try {
         try {
             //查询申请记录
             //查询申请记录
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(applyId);
             SlOpendoorApply opendoorApply = slOpendoorApplyMapper.selectSlOpendoorApplyById(applyId);
 
 
             SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
             SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
             subjectRelation.setSubjectId(opendoorApply.getSubjectId());
             subjectRelation.setSubjectId(opendoorApply.getSubjectId());
-            List<SlSubjectRelationVo>  listsubRla = slSubjectRelationMapper.selectSlSubjectRelationList(subjectRelation);
-            if(listsubRla.size()!=2){
-                strMsg="该实验室暂未绑定双锁!";
+            List<SlSubjectRelationVo> listsubRla = slSubjectRelationMapper.selectSlSubjectRelationList(subjectRelation);
+            if (listsubRla.size() != 2) {
+                strMsg = "该实验室暂未绑定双锁!";
             }
             }
 
 
-            Map<String,Object> detalisMap = new HashMap<>();
+            Map<String, Object> detalisMap = new HashMap<>();
             SlUser user = new SlUser();
             SlUser user = new SlUser();
             //学号、工号
             //学号、工号
             user.setPersoncode(opendoorApply.getUserCode());
             user.setPersoncode(opendoorApply.getUserCode());
             //姓名
             //姓名
             user.setPersonname(opendoorApply.getUserName());
             user.setPersonname(opendoorApply.getUserName());
             //性别 (0=女,1=男)
             //性别 (0=女,1=男)
-            user.setPersonsex(opendoorApply.getUserSex()==null?1+"":0+"");
+            user.setPersonsex(opendoorApply.getUserSex() == null ? 1 + "" : 0 + "");
             //人员类别(1=学生,2=教职工,3=临时人员)
             //人员类别(1=学生,2=教职工,3=临时人员)
             user.setPersontype("1");
             user.setPersontype("1");
             //电话
             //电话
             user.setPersonmobile(opendoorApply.getPhonenumber());
             user.setPersonmobile(opendoorApply.getPhonenumber());
             log.info("=======人员1授权开始========");
             log.info("=======人员1授权开始========");
-            Map<String,Object> map1= smartlockUtil.addUser(user,listsubRla.get(0).getLockRoomId());
+            Map<String, Object> map1 = smartlockUtil.addUser(user, listsubRla.get(0).getLockRoomId());
 
 
-            if(!smartlockUtil.RESULT_MSG.equals(map1.get("resultMsg").toString())){
-                log.info("人员:"+opendoorApply.getUserName()+",授权失败,原因:"+map1.get("resultMsg")+",请联系管理员");
-                strMsg="人员:"+opendoorApply.getUserName()+",授权失败,原因:"+map1.get("resultMsg")+",请联系管理员";
+            if (!smartlockUtil.RESULT_MSG.equals(map1.get("resultMsg").toString())) {
+                log.info("人员:" + opendoorApply.getUserName() + ",授权失败,原因:" + map1.get("resultMsg") + ",请联系管理员");
+                strMsg = "人员:" + opendoorApply.getUserName() + ",授权失败,原因:" + map1.get("resultMsg") + ",请联系管理员";
                 return strMsg;
                 return strMsg;
-            }else {
+            } else {
                 log.info("=======人员1授权成功========");
                 log.info("=======人员1授权成功========");
-                auths1=true;
+                auths1 = true;
             }
             }
 
 
-            log.info("=======授权结束========人员授权结果:"+auths1);
+            log.info("=======授权结束========人员授权结果:" + auths1);
             //人员入住办理成功,发送短信提示
             //人员入住办理成功,发送短信提示
-            if(auths1){
+            if (auths1) {
                 SlSubjectRelationVo relationVo = new SlSubjectRelationVo();
                 SlSubjectRelationVo relationVo = new SlSubjectRelationVo();
                 relationVo.setSubjectId(opendoorApply.getSubjectId());
                 relationVo.setSubjectId(opendoorApply.getSubjectId());
                 List<SlSubjectRelationVo> relist = slSubjectRelationMapper.selectSlSubjectRelationList(relationVo);
                 List<SlSubjectRelationVo> relist = slSubjectRelationMapper.selectSlSubjectRelationList(relationVo);
-                if(relist.size()<2){
+                if (relist.size() < 2) {
                     log.info("该实验室暂未关联双门锁。");
                     log.info("该实验室暂未关联双门锁。");
-                    throw  new ServiceException("该实验室暂未关联双门锁。");
+                    throw new ServiceException("该实验室暂未关联双门锁。");
                 }
                 }
 
 
-                for (SlSubjectRelationVo rvo:relist) {
-                    if(opendoorApply.getSafeUserId().equals(String.valueOf(rvo.getSubjectId())) ){
+                for (SlSubjectRelationVo rvo : relist) {
+                    if (opendoorApply.getSafeUserId().equals(String.valueOf(rvo.getSubjectId()))) {
                         log.info("=============授权成功,下发短信================");
                         log.info("=============授权成功,下发短信================");
                         //人员1 备注详情
                         //人员1 备注详情
-                        detalisMap.put("人员",opendoorApply.getUserName());
-                        detalisMap.put("锁编号",rvo.getLockCode());
-                        detalisMap.put("人员密码",map1.get("password"));
+                        detalisMap.put("人员", opendoorApply.getUserName());
+                        detalisMap.put("锁编号", rvo.getLockCode());
+                        detalisMap.put("人员密码", map1.get("password"));
 
 
-                        R r1= remoteStockService.sendSydSms(
+                        R r1 = remoteStockService.sendSydSms(
                                 "【实验室安全系统】" + opendoorApply.getUserName() + "申请" +
                                 "【实验室安全系统】" + opendoorApply.getUserName() + "申请" +
                                         opendoorApply.getSubjectName() +
                                         opendoorApply.getSubjectName() +
-                                        "-门禁远程授权,手机号:"+opendoorApply.getPhonenumber()+",授权码:"+map1.get("password")+
-                                        "("+ smartlockUtil.AUTHS_LENGTH+"小时内有效),请勿泄露给他人。",
+                                        "-门禁远程授权,手机号:" + opendoorApply.getPhonenumber() + ",授权码:" + map1.get("password") +
+                                        "(" + smartlockUtil.AUTHS_LENGTH + "小时内有效),请勿泄露给他人。",
                                 3, opendoorApply.getId(), rvo.getSafeUserPhone());
                                 3, opendoorApply.getId(), rvo.getSafeUserPhone());
-                        log.info("人员1短信发送结果:"+r1);
+                        log.info("人员1短信发送结果:" + r1);
                     }
                     }
                 }
                 }
             }
             }
             opendoorApply.setIllustrate(detalisMap.toString());
             opendoorApply.setIllustrate(detalisMap.toString());
             slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
             slOpendoorApplyMapper.updateSlOpendoorApply(opendoorApply);
 
 
-        }catch (Exception e){
-            log.info("=======人员授权失败========"+e);
+        } catch (Exception e) {
+            log.info("=======人员授权失败========" + e);
         }
         }
         return strMsg;
         return strMsg;
     }
     }

+ 17 - 24
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlSubjectRelationServiceImpl.java

@@ -25,8 +25,7 @@ import java.util.List;
  * @date 2022-09-03
  * @date 2022-09-03
  */
  */
 @Service
 @Service
-public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
-{
+public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService {
     @Autowired
     @Autowired
     private SlSubjectRelationMapper slSubjectRelationMapper;
     private SlSubjectRelationMapper slSubjectRelationMapper;
 
 
@@ -40,8 +39,7 @@ public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
      * @return 实验室关联
      * @return 实验室关联
      */
      */
     @Override
     @Override
-    public SlSubjectRelation selectSlSubjectRelationById(Long id)
-    {
+    public SlSubjectRelation selectSlSubjectRelationById(Long id) {
         return slSubjectRelationMapper.selectSlSubjectRelationById(id);
         return slSubjectRelationMapper.selectSlSubjectRelationById(id);
     }
     }
 
 
@@ -52,14 +50,13 @@ public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
      * @return 实验室关联
      * @return 实验室关联
      */
      */
     @Override
     @Override
-    public List<SlSubjectRelationVo> selectSlSubjectRelationList(SlSubjectRelationVo slSubjectRelation)
-    {
+    public List<SlSubjectRelationVo> selectSlSubjectRelationList(SlSubjectRelationVo slSubjectRelation) {
         return slSubjectRelationMapper.selectSlSubjectRelationList(slSubjectRelation);
         return slSubjectRelationMapper.selectSlSubjectRelationList(slSubjectRelation);
     }
     }
 
 
     @Override
     @Override
-    public List<SlSubjectRelation> getListByIds(List<Long> ids){
-        if (ids.isEmpty()){
+    public List<SlSubjectRelation> getListByIds(List<Long> ids) {
+        if (ids.isEmpty()) {
             new ArrayList<>();
             new ArrayList<>();
         }
         }
         return slSubjectRelationMapper.getListByIds(ids);
         return slSubjectRelationMapper.getListByIds(ids);
@@ -73,29 +70,28 @@ public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int insertSlSubjectRelation(SlSubjectRelationVo vo)
-    {
+    public int insertSlSubjectRelation(SlSubjectRelationVo vo) {
         List<SlSubjectRelation> list = vo.getSlSubjectList();
         List<SlSubjectRelation> list = vo.getSlSubjectList();
-        if(list==null || list.size()==0){
+        if (list == null || list.size() == 0) {
             throw new ServiceException("没有要关联的数据!");
             throw new ServiceException("没有要关联的数据!");
         }
         }
         System.out.println(SecurityUtils.getUsername());
         System.out.println(SecurityUtils.getUsername());
         //校验本次提交是否存在已绑定情况
         //校验本次提交是否存在已绑定情况
         SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
         SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
-        for (SlSubjectRelation sl:list ) {
-            if(StringUtils.isEmpty(sl.getLockCode())){
-                throw new ServiceException("房间: "+sl.getRoomName()+",位置: "+sl.getRoomLocation()+"未绑定门锁。");
+        for (SlSubjectRelation sl : list) {
+            if (StringUtils.isEmpty(sl.getLockCode())) {
+                throw new ServiceException("房间: " + sl.getRoomName() + ",位置: " + sl.getRoomLocation() + "未绑定门锁。");
             }
             }
             subjectRelation.setLockRoomId(sl.getLockRoomId());
             subjectRelation.setLockRoomId(sl.getLockRoomId());
-            List<SlSubjectRelationVo> sellist=  slSubjectRelationMapper.selectSlSubjectRelationList(subjectRelation);
-            if(sellist.size()>0){
-                throw new ServiceException("房间: "+sl.getRoomName()+",位置: "+sl.getRoomLocation()+"已被绑定。");
+            List<SlSubjectRelationVo> sellist = slSubjectRelationMapper.selectSlSubjectRelationList(subjectRelation);
+            if (sellist.size() > 0) {
+                throw new ServiceException("房间: " + sl.getRoomName() + ",位置: " + sl.getRoomLocation() + "已被绑定。");
             }
             }
         }
         }
 
 
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         SysUser sysUser = tokenService.getLoginUser().getSysUser();
         //关系绑定
         //关系绑定
-        for (SlSubjectRelation slsub:list ) {
+        for (SlSubjectRelation slsub : list) {
             slsub.setDeptId(sysUser.getDept().getDeptId());
             slsub.setDeptId(sysUser.getDept().getDeptId());
             slsub.setDeptName(sysUser.getDept().getDeptName());
             slsub.setDeptName(sysUser.getDept().getDeptName());
             slsub.setUserId(sysUser.getUserId());
             slsub.setUserId(sysUser.getUserId());
@@ -114,8 +110,7 @@ public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int updateSlSubjectRelation(SlSubjectRelation slSubjectRelation)
-    {
+    public int updateSlSubjectRelation(SlSubjectRelation slSubjectRelation) {
         return slSubjectRelationMapper.updateSlSubjectRelation(slSubjectRelation);
         return slSubjectRelationMapper.updateSlSubjectRelation(slSubjectRelation);
     }
     }
 
 
@@ -127,8 +122,7 @@ public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int deleteSlSubjectRelationByIds(Long[] ids)
-    {
+    public int deleteSlSubjectRelationByIds(Long[] ids) {
         return slSubjectRelationMapper.deleteSlSubjectRelationByIds(ids);
         return slSubjectRelationMapper.deleteSlSubjectRelationByIds(ids);
     }
     }
 
 
@@ -140,8 +134,7 @@ public class SlSubjectRelationServiceImpl implements ISlSubjectRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int deleteSlSubjectRelationById(Long id)
-    {
+    public int deleteSlSubjectRelationById(Long id) {
         return slSubjectRelationMapper.deleteSlSubjectRelationById(id);
         return slSubjectRelationMapper.deleteSlSubjectRelationById(id);
     }
     }
 }
 }

+ 9 - 16
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/service/impl/SlUserRelationServiceImpl.java

@@ -17,8 +17,7 @@ import java.util.List;
  * @date 2022-09-02
  * @date 2022-09-02
  */
  */
 @Service
 @Service
-public class SlUserRelationServiceImpl implements ISlUserRelationService
-{
+public class SlUserRelationServiceImpl implements ISlUserRelationService {
     @Autowired
     @Autowired
     private SlUserRelationMapper slUserRelationMapper;
     private SlUserRelationMapper slUserRelationMapper;
 
 
@@ -29,8 +28,7 @@ public class SlUserRelationServiceImpl implements ISlUserRelationService
      * @return 人员关联
      * @return 人员关联
      */
      */
     @Override
     @Override
-    public SlUserRelation selectSlUserRelationById(Long id)
-    {
+    public SlUserRelation selectSlUserRelationById(Long id) {
         return slUserRelationMapper.selectSlUserRelationById(id);
         return slUserRelationMapper.selectSlUserRelationById(id);
     }
     }
 
 
@@ -41,14 +39,13 @@ public class SlUserRelationServiceImpl implements ISlUserRelationService
      * @return 人员关联
      * @return 人员关联
      */
      */
     @Override
     @Override
-    public List<SlUserRelation> selectSlUserRelationList(SlUserRelation slUserRelation)
-    {
+    public List<SlUserRelation> selectSlUserRelationList(SlUserRelation slUserRelation) {
         return slUserRelationMapper.selectSlUserRelationList(slUserRelation);
         return slUserRelationMapper.selectSlUserRelationList(slUserRelation);
     }
     }
 
 
     @Override
     @Override
-    public List<SlUserRelation> getListByIds(List<Long> ids){
-        if (ids.isEmpty()){
+    public List<SlUserRelation> getListByIds(List<Long> ids) {
+        if (ids.isEmpty()) {
             new ArrayList<>();
             new ArrayList<>();
         }
         }
         return slUserRelationMapper.getListByIds(ids);
         return slUserRelationMapper.getListByIds(ids);
@@ -62,8 +59,7 @@ public class SlUserRelationServiceImpl implements ISlUserRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int insertSlUserRelation(SlUserRelation slUserRelation)
-    {
+    public int insertSlUserRelation(SlUserRelation slUserRelation) {
         return slUserRelationMapper.insertSlUserRelation(slUserRelation);
         return slUserRelationMapper.insertSlUserRelation(slUserRelation);
     }
     }
 
 
@@ -75,8 +71,7 @@ public class SlUserRelationServiceImpl implements ISlUserRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int updateSlUserRelation(SlUserRelation slUserRelation)
-    {
+    public int updateSlUserRelation(SlUserRelation slUserRelation) {
         return slUserRelationMapper.updateSlUserRelation(slUserRelation);
         return slUserRelationMapper.updateSlUserRelation(slUserRelation);
     }
     }
 
 
@@ -88,8 +83,7 @@ public class SlUserRelationServiceImpl implements ISlUserRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int deleteSlUserRelationByIds(Long[] ids)
-    {
+    public int deleteSlUserRelationByIds(Long[] ids) {
         return slUserRelationMapper.deleteSlUserRelationByIds(ids);
         return slUserRelationMapper.deleteSlUserRelationByIds(ids);
     }
     }
 
 
@@ -101,8 +95,7 @@ public class SlUserRelationServiceImpl implements ISlUserRelationService
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public int deleteSlUserRelationById(Long id)
-    {
+    public int deleteSlUserRelationById(Long id) {
         return slUserRelationMapper.deleteSlUserRelationById(id);
         return slUserRelationMapper.deleteSlUserRelationById(id);
     }
     }
 }
 }

+ 13 - 12
zd-modules/zd-algorithm/src/main/java/com/zd/alg/smartlock/utils/SmartlockUtil.java

@@ -12,6 +12,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
+
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 
 
@@ -125,7 +126,7 @@ public class SmartlockUtil {
      * @param
      * @param
      * @return
      * @return
      */
      */
-    public  List<SlRoom> getRoom(SlRoom room) {
+    public List<SlRoom> getRoom(SlRoom room) {
         SlBuild slBuild = null;
         SlBuild slBuild = null;
         String token = getToken();
         String token = getToken();
         List<SlRoom> listRoom = new ArrayList<>();
         List<SlRoom> listRoom = new ArrayList<>();
@@ -223,7 +224,7 @@ public class SmartlockUtil {
             String lockCode = JSON.parseObject(JSON.parseObject(str).get("result").toString()).get("roomcode2").toString();
             String lockCode = JSON.parseObject(JSON.parseObject(str).get("result").toString()).get("roomcode2").toString();
             lockOnline.setOnLine(roomnetquality);
             lockOnline.setOnLine(roomnetquality);
             lockOnline.setLockCode(lockCode);
             lockOnline.setLockCode(lockCode);
-            lockOnline.setOnLineStatus("在线".equals(roomnetquality)?1:0);
+            lockOnline.setOnLineStatus("在线".equals(roomnetquality) ? 1 : 0);
             // System.out.println("房间详情,门锁状态 roomnetquality: " + roomnetquality + " lockCode: " + lockCode);
             // System.out.println("房间详情,门锁状态 roomnetquality: " + roomnetquality + " lockCode: " + lockCode);
         } catch (Exception e) {
         } catch (Exception e) {
             logger.error("获取房间详情失败2:" + e);
             logger.error("获取房间详情失败2:" + e);
@@ -349,11 +350,11 @@ public class SmartlockUtil {
                 if (StringUtils.isNotEmpty(authis)) {
                 if (StringUtils.isNotEmpty(authis)) {
                     //修改授权
                     //修改授权
                     map = updateAuths(token, roomId, Integer.valueOf(authis));
                     map = updateAuths(token, roomId, Integer.valueOf(authis));
-                    resultMsg= map.get("resultMsg").toString();
+                    resultMsg = map.get("resultMsg").toString();
                 } else {
                 } else {
                     //添加授权
                     //添加授权
                     map = addUserAuths(token, user.getPersoncode(), roomId);
                     map = addUserAuths(token, user.getPersoncode(), roomId);
-                    resultMsg= map.get("resultMsg").toString();
+                    resultMsg = map.get("resultMsg").toString();
                 }
                 }
             }
             }
             //操作结果
             //操作结果
@@ -375,7 +376,7 @@ public class SmartlockUtil {
     public Map<String, Object> deleteAuths(String token, String roomid, Integer authid) {
     public Map<String, Object> deleteAuths(String token, String roomid, Integer authid) {
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         try {
         try {
-            String url2 = SERVICE_URL + "/lockauth/operate/5/deleteauths?token=" + token + "&roomid="+roomid ;
+            String url2 = SERVICE_URL + "/lockauth/operate/5/deleteauths?token=" + token + "&roomid=" + roomid;
             List<SlupdateAuths> list = new ArrayList<>();
             List<SlupdateAuths> list = new ArrayList<>();
             SlupdateAuths slupdateAuths = new SlupdateAuths();
             SlupdateAuths slupdateAuths = new SlupdateAuths();
             slupdateAuths.setAuthid(authid);//权限id
             slupdateAuths.setAuthid(authid);//权限id
@@ -386,8 +387,8 @@ public class SmartlockUtil {
             HttpResponse response2 = request2.execute();
             HttpResponse response2 = request2.execute();
             String resultMsg = JSON.parseObject(response2.body()).get("resultMsg").toString();
             String resultMsg = JSON.parseObject(response2.body()).get("resultMsg").toString();
             map.put("resultMsg", resultMsg);
             map.put("resultMsg", resultMsg);
-            logger.info("删除用户授权结果:"+response2.body());
-        }catch (Exception e) {
+            logger.info("删除用户授权结果:" + response2.body());
+        } catch (Exception e) {
             logger.error("删除用户授权失败" + e);
             logger.error("删除用户授权失败" + e);
         }
         }
         return map;
         return map;
@@ -408,20 +409,20 @@ public class SmartlockUtil {
             slupdateAuths.setRctype(3);
             slupdateAuths.setRctype(3);
             list.add(slupdateAuths);
             list.add(slupdateAuths);
             //授权开始日期
             //授权开始日期
-            String empsdate =sdf.format(new Date());
+            String empsdate = sdf.format(new Date());
             //授权结束日期
             //授权结束日期
             String empedate = sdf.format(getTime(AUTHS_LENGTH));
             String empedate = sdf.format(getTime(AUTHS_LENGTH));
 
 
             String pw = getRandom(6);
             String pw = getRandom(6);
             String url2 = SERVICE_URL + "/lockauth/operate/7/updateauths?token=" + token + "&roomid=" + roomId + "&password=" + pw
             String url2 = SERVICE_URL + "/lockauth/operate/7/updateauths?token=" + token + "&roomid=" + roomId + "&password=" + pw
-                    +"&empsdate="+empsdate+"&empedate="+empedate;
+                    + "&empsdate=" + empsdate + "&empedate=" + empedate;
             HttpRequest request2 = SmartlockUtil.httpSendPost(url2, JSONObject.toJSONString(list));
             HttpRequest request2 = SmartlockUtil.httpSendPost(url2, JSONObject.toJSONString(list));
             HttpResponse response2 = request2.execute();
             HttpResponse response2 = request2.execute();
             String resultMsg = JSON.parseObject(response2.body()).get("resultMsg").toString();
             String resultMsg = JSON.parseObject(response2.body()).get("resultMsg").toString();
-            logger.info("用户申请修改:"+response2.body());
+            logger.info("用户申请修改:" + response2.body());
 
 
             map.put("password", pw);
             map.put("password", pw);
-            logger.info("用户密码:"+pw);
+            logger.info("用户密码:" + pw);
             map.put("resultMsg", resultMsg);
             map.put("resultMsg", resultMsg);
         } catch (Exception e) {
         } catch (Exception e) {
             logger.error("修改用户授权失败" + e);
             logger.error("修改用户授权失败" + e);
@@ -578,7 +579,7 @@ public class SmartlockUtil {
      * @param personcode
      * @param personcode
      * @return
      * @return
      */
      */
-    public  String checkUserAuthExis(String personcode, String token) {
+    public String checkUserAuthExis(String personcode, String token) {
         String authid = null;
         String authid = null;
         //查询用户授权信息
         //查询用户授权信息
         //String token =  SmartlockUtil.getToken();
         //String token =  SmartlockUtil.getToken();

+ 7 - 7
zd-modules/zd-algorithm/src/main/java/com/zd/alg/speaker/domain/RemoteAddress.java

@@ -7,19 +7,19 @@ import org.springframework.stereotype.Component;
 @Component
 @Component
 @RefreshScope
 @RefreshScope
 public class RemoteAddress {
 public class RemoteAddress {
-    @Value("${remote.ip_addr}")
+    @Value("${speaker.remote.ip_addr}")
     private String remoteIp;
     private String remoteIp;
-    @Value("${remote.port}")
+    @Value("${speaker.remote.port}")
     private String remotePort;
     private String remotePort;
-    @Value("${remote.operation.login_url}")
+    @Value("${speaker.remote.operation.login_url}")
     private String loginUrl;
     private String loginUrl;
-    @Value("${remote.protocol}")
+    @Value("${speaker.remote.protocol}")
     private String protocol;
     private String protocol;
-    @Value("${remote.operation.get_device}")
+    @Value("${speaker.remote.operation.get_device}")
     private String deviceUrl;
     private String deviceUrl;
-    @Value("${remote.tts_ip}")
+    @Value("${speaker.remote.tts_ip}")
     private String ttsIp;
     private String ttsIp;
-    @Value("${remote.tts_port}")
+    @Value("${speaker.remote.tts_port}")
     private String ttsPort;
     private String ttsPort;
 
 
     public String getRemoteIp() {
     public String getRemoteIp() {

+ 7 - 4
zd-modules/zd-algorithm/src/main/java/com/zd/alg/speaker/service/impl/SpeakerServiceImpl.java

@@ -6,6 +6,7 @@ import com.zd.alg.speaker.service.ISpeakerService;
 import com.zd.alg.speaker.utils.OkHttpRequest;
 import com.zd.alg.speaker.utils.OkHttpRequest;
 import com.zd.algorithm.api.speaker.entity.PlayBatchVo;
 import com.zd.algorithm.api.speaker.entity.PlayBatchVo;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
 import com.zd.algorithm.api.speaker.entity.PlayVo;
+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.StringUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.model.entity.UrlVo;
 import com.zd.model.entity.UrlVo;
@@ -75,10 +76,12 @@ public class SpeakerServiceImpl implements ISpeakerService {
         jsonUser.put("user", jsonObject);
         jsonUser.put("user", jsonObject);
         String remoteUrl = remoteAddress.getProtocol() + "://" + remoteAddress.getRemoteIp() + ":" + remoteAddress.getRemotePort() + remoteAddress.getLoginUrl();
         String remoteUrl = remoteAddress.getProtocol() + "://" + remoteAddress.getRemoteIp() + ":" + remoteAddress.getRemotePort() + remoteAddress.getLoginUrl();
         String responseStr = okHttpRequest.doPostJson(remoteUrl, jsonUser.toString());
         String responseStr = okHttpRequest.doPostJson(remoteUrl, jsonUser.toString());
-        JSONObject responseJson = JSONObject.parseObject(responseStr);
-        JSONObject userJson = responseJson.getJSONObject("user");
-        String tokenStr = userJson.getString("token");
-        return tokenStr;
+        if (org.springframework.util.StringUtils.hasLength(responseStr)){
+            JSONObject responseJson = JSONObject.parseObject(responseStr);
+            JSONObject userJson = responseJson.getJSONObject("user");
+            return userJson.getString("token");
+        }
+        throw new ServiceException("喇叭服务登录异常");
     }
     }
 
 
     @Override
     @Override

+ 9 - 146
zd-modules/zd-algorithm/src/main/resources/bootstrap.yml

@@ -1,12 +1,20 @@
 server:
 server:
   port: ${service.port.algorithm}
   port: ${service.port.algorithm}
 
 
+#文件大小
+spring:
+  servlet:
+    multipart:
+      max-file-size: 20MB
+      max-request-size: 50MB
+
 # mybatis配置
 # mybatis配置
 mybatis:
 mybatis:
   # 搜索指定包别名
   # 搜索指定包别名
   typeAliasesPackage: com.zd.alg
   typeAliasesPackage: com.zd.alg
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   mapperLocations: classpath:mapper/**/*.xml
   mapperLocations: classpath:mapper/**/*.xml
+  type-handlers-package: com.zd.model.enums
   configuration:
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     call-setters-on-nulls: true
     call-setters-on-nulls: true
@@ -21,34 +29,6 @@ ok-http:
   read-timeout-ms: 500
   read-timeout-ms: 500
   write-timeout-ms: 500
   write-timeout-ms: 500
 
 
-#远程请求地址配置
-remote:
-  protocol: http
-  ip_addr: 192.168.1.88
-  port: 17808
-  operation:
-    login_url: /api/users/login #登录
-    get_device: /api/devices  #获取设备列表
-    set_device: /api/sendtodevice #设置设备
-  tts_ip: 192.168.1.88
-  tts_port: 10008
-
-#ip喇叭控制端口
-speaker:
-  port: 8888
-  isOnline: 0  #1表示公网部署,0表示局域网部署
-# 电话报警
-alarm:
-  host: http://${ALARM_HOST:192.168.1.100}
-  retry: 3
-face:
-  appId: A3XKg9AUQhgd7RjBk8JKDrVkkoQRd6W9kxm5R2MtAeu1
-  ## windows:HXf4r2UBofUkGPUPQPQKag58fQoTiw5LHBMHPeFbY1n8  linux:HXf4r2UBofUkGPUPQPQKag58XJEK8LYpNvi1qH4g1t4f
-  sdkKey: HXf4r2UBofUkGPUPQPQKag58XJEK8LYpNvi1qH4g1t4f
-  linuxKey: HXf4r2UBofUkGPUPQPQKag58XJEK8LYpNvi1qH4g1t4f
-  winKey: HXf4r2UBofUkGPUPQPQKag58fQoTiw5LHBMHPeFbY1n8
-  activation: true
-  init: true
 sys:
 sys:
   mqtt:
   mqtt:
     topics: lab/news  # 订阅主题, 多个用,隔开
     topics: lab/news  # 订阅主题, 多个用,隔开
@@ -56,115 +36,11 @@ sys:
     inbound: true
     inbound: true
     ## 默认为true 不需要发送则关闭
     ## 默认为true 不需要发送则关闭
     outbound: true
     outbound: true
-  config:
-    loginUri: http://${INNER_HOST:192.168.1.88}:${INNER_PORT:9800}/
-    #跳过阈值 跳过检查项触发阈值
-    jumpThreshold: 2
-    ## 日志检查提交地址
-    checkLogUrl: laboratory/checklog
-    ## 图片提交地址
-    # 原地址 http://180.76.134.43:31005/api/analysis/image
-    imgPostUrl: http://${ARITHMETIC_HOST:192.168.1.248}:${ARITHMETIC_PORT:80}/api/open/data/postAnalysis
-    #loginUri: 默认为云上地址 http://lab.sxitdlc.com/labSystem/
-    #转发目标地址
-    targetUrl: https://${NET_HOST:lab.sxitdlc.com}/appTest/
-    #1号喇叭IP
-    loudspeakerIp1: 192.168.1.103
-    # 2号喇叭IP
-    loudspeakerIp2:
-    # 语音播报开关
-    loudspeakerSwitch: true
-    #临时媒体文件存放地址
-    imgTemp: /home/upload
-    algorithmMap:
-      ## 护目镜
-      1:
-        algoId: 9787
-        did: 1557192675937570818
-        algorithmName: "护目镜识别图片算法"
-      ## 实验服
-      2:
-        algoId: 10285
-        did: 1557192675937570818
-        algorithmName: "实验服识别图片算法"
-    videoAidMap:
-      9688:
-        tips: 非法闯入人员
-        name: peopleCheckResultValidImpl
-      10258:
-        tips: 未穿戴实验服人员
-      9787:
-        tips: 未佩戴护目镜人员
-    alarmConfigMap:
-      9610:
-        funNum: "huoyan"
-        describe: "火焰识别"
-      9611:
-        funNum: "huoyan"
-        describe: "火焰识别"
-      9684:
-        funNum: "yanwu"
-        describe: "烟雾识别"
-      9688:
-        funNum: "juzhong"
-        describe: "聚众识别"
-      9690:
-        funNum: "ligang"
-        describe: "离岗识别"
 
 
 file:
 file:
   path: /home/AIPIC
   path: /home/AIPIC
-fire:
-  algo_id: 9611
-  did: 1557192675937570818
-  algorithm_name: "火焰算法"
-  hardware_num: "040C7E75CA85"
-  stream_url: "rtsp://admin:hk123456@192.168.1.64:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1"
-  wait_time: 5
-# 作为28181服务器的配置
-sip:
-  # [必须修改] 本机的IP
-  ip: 192.168.1.88
-  # [可???] 28181服务监听的端??
-  port: 5060
-  # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级???区级???基层编号组成,参照GB/T 2260-2007??
-  # 后两位为行业编码,定义参照附录D.3
-  # 3701020049标识山东济南历下?? 信息行业接入
-  # [可???]
-  domain: 4401020049
-  # [可???]
-  id: 44010200492000000001
-  # [可???] 默认设备认证密码,后续扩展使用设备单独密??, 移除密码将不进行校验
-  password: admin123
-
-#zlm 默认服务器配??
-media:
-  # [必须修改] zlm服务器的内网IP
-  ip: 192.168.1.88
-  # [必须修改] zlm服务器的http.port
-  http-port: 8230
-  # [可???] zlm服务器的hook.admin_params=secret
-  secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
-  # [可???] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修??
-  auto-config: false
-  # 启用多端口模??, 多端口模式使用端口区分每路流,兼容???更好??? 单端口使用流的ssrc区分?? 点播超时建议使用多端口测??
-  # [可???] zlm服务器的general.streamNoneReaderDelayMS
-  stream-none-reader-delay-ms:  -1  # 无人观看多久自动关闭??, -1表示永不自动关闭,?? 关闭按需拉流
-  rtp:
-    # [可???] 是否启用多端口模??, ??启后会在portRange范围内???择端口用于媒体流传??
-    enable: true
-    # [可???] 在此范围内???择端口用于媒体流传??,
-    port-range: 30000,30500 # 端口范围
-  # 录像辅助服务?? 部署此服务可以实现zlm录像的管理与下载?? 0 表示不使??
-  record-assist-port: 0
 
 
-
-# [根据业务??求配置]
-user-settings:
-  # 推流直播是否录制
-  record-push-live: true
-
-# 在线文档?? swagger-ui(生产环境建议关闭)
+# swagger-ui(生产环境建议关闭)
 swagger-ui:
 swagger-ui:
   enabled: true
   enabled: true
 
 
@@ -173,16 +49,3 @@ version:
   version: "@project.version@"
   version: "@project.version@"
   description: "@project.description@"
   description: "@project.description@"
   artifact-id: "@project.artifactId@"
   artifact-id: "@project.artifactId@"
-
-# [必须配置] 智能门锁配置信息
-smartlock:
-  # 访问地址
-  serviceurl: http://192.168.1.66/info
-  # 用户名
-  userlogin: admin
-  # 密码
-  password: admin123
-  # 授权时长(小时)
-  authslength: 1
-  # 允许开门次数
-  opencount: 1

+ 2 - 1
zd-modules/zd-algorithm/src/main/resources/mapper/smartlock/SlApplyApprovalMapper.xml

@@ -66,7 +66,8 @@
         where id = #{id}
         where id = #{id}
     </select>
     </select>
 
 
-    <insert id="insertSlApplyApproval" parameterType="com.zd.algorithm.api.smartlock.entity.SlApplyApproval" useGeneratedKeys="true"
+    <insert id="insertSlApplyApproval" parameterType="com.zd.algorithm.api.smartlock.entity.SlApplyApproval"
+            useGeneratedKeys="true"
             keyProperty="id">
             keyProperty="id">
         insert into sl_apply_approval
         insert into sl_apply_approval
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 15 - 8
zd-modules/zd-algorithm/src/main/resources/mapper/smartlock/SlOpendoorApplyMapper.xml

@@ -89,11 +89,13 @@
                t.approval_user,
                t.approval_user,
                t.approval_time,
                t.approval_time,
                t.creat_time,
                t.creat_time,
-               (select GROUP_CONCAT(safe_user_name) from sl_subject_relation r where r.subject_id= t.subject_id ) authName,
+               (select GROUP_CONCAT(safe_user_name)
+                from sl_subject_relation r
+                where r.subject_id = t.subject_id)     authName,
                date_add(t.creat_time, interval 1 hour) loseTime
                date_add(t.creat_time, interval 1 hour) loseTime
         from sl_opendoor_apply as t
         from sl_opendoor_apply as t
-        LEFT JOIN   sys_dept d on   t.dept_id=d.dept_id
-        LEFT JOIN sys_user u on  t.user_id=u.user_id
+                 LEFT JOIN sys_dept d on t.dept_id = d.dept_id
+                 LEFT JOIN sys_user u on t.user_id = u.user_id
     </sql>
     </sql>
     <select id="selectSlOpendoorApplyList" parameterType="com.zd.algorithm.api.smartlock.entity.vo.SlOpendoorApplyVo"
     <select id="selectSlOpendoorApplyList" parameterType="com.zd.algorithm.api.smartlock.entity.vo.SlOpendoorApplyVo"
             resultMap="SlOpendoorApplyResult">
             resultMap="SlOpendoorApplyResult">
@@ -120,9 +122,9 @@
             <if test="position != null  and position != ''">and t.position = #{position}</if>
             <if test="position != null  and position != ''">and t.position = #{position}</if>
             <if test="college != null  and college != ''">and t.college = #{college}</if>
             <if test="college != null  and college != ''">and t.college = #{college}</if>
             <if test="applyStatus != null ">
             <if test="applyStatus != null ">
-                <if test="applyStatus == 1 ">and t.creat_time &gt; now() </if>
+                <if test="applyStatus == 1 ">and t.creat_time &gt; now()</if>
 
 
-                <if test="applyStatus == 2 ">and t.creat_time &lt; now() </if>
+                <if test="applyStatus == 2 ">and t.creat_time &lt; now()</if>
             </if>
             </if>
             <if test="applyNumber != null ">and t.apply_number = #{applyNumber}</if>
             <if test="applyNumber != null ">and t.apply_number = #{applyNumber}</if>
             <if test="illustrate != null ">and t.illustrate = #{illustrate}</if>
             <if test="illustrate != null ">and t.illustrate = #{illustrate}</if>
@@ -136,8 +138,12 @@
                 t.subject_name like concat('%', #{searchValue}, '%')
                 t.subject_name like concat('%', #{searchValue}, '%')
                 )
                 )
             </if>
             </if>
-            <if test="startTime != null "> and date_format(t.creat_time,'%Y-%m-%d') &gt;= date_format(#{startTime},'%Y-%m-%d')</if>
-            <if test="endTime != null "> and date_format(t.creat_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')</if>
+            <if test="startTime != null ">and date_format(t.creat_time,'%Y-%m-%d') &gt;=
+                date_format(#{startTime},'%Y-%m-%d')
+            </if>
+            <if test="endTime != null ">and date_format(t.creat_time,'%Y-%m-%d') &lt;=
+                date_format(#{endTime},'%Y-%m-%d')
+            </if>
         </where>
         </where>
         <!-- 数据范围过滤 -->
         <!-- 数据范围过滤 -->
         ${params.dataScope}
         ${params.dataScope}
@@ -158,7 +164,8 @@
         where id = #{id}
         where id = #{id}
     </select>
     </select>
 
 
-    <insert id="insertSlOpendoorApply" parameterType="com.zd.algorithm.api.smartlock.entity.SlOpendoorApply" useGeneratedKeys="true"
+    <insert id="insertSlOpendoorApply" parameterType="com.zd.algorithm.api.smartlock.entity.SlOpendoorApply"
+            useGeneratedKeys="true"
             keyProperty="id">
             keyProperty="id">
         insert into sl_opendoor_apply
         insert into sl_opendoor_apply
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 2 - 3
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/ExamApi.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.controller;
 
 
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.SecurityUtils;
@@ -9,7 +9,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
-
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -19,7 +18,7 @@ import java.util.Map;
  * @Description:
  * @Description:
  */
  */
 @RestController
 @RestController
-@RequestMapping("/exam")
+@RequestMapping("/app/exam")
 @Api(tags = {"考试相关"})
 @Api(tags = {"考试相关"})
 public class ExamApi {
 public class ExamApi {
 
 

+ 2 - 3
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LabApi.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.controller;
 
 
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.security.TokenService;
 import com.zd.laboratory.api.entity.LabSubjectControllerVO;
 import com.zd.laboratory.api.entity.LabSubjectControllerVO;
@@ -12,13 +12,12 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
-
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
 @RestController
 @RestController
-@RequestMapping("/lab/api")
+@RequestMapping("/app/lab/api")
 @Api(tags = {"实验室系统相关"})
 @Api(tags = {"实验室系统相关"})
 public class LabApi {
 public class LabApi {
 
 

+ 2 - 3
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LabManageController.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.controller;
 
 
 import com.zd.laboratory.api.entity.LabGradeManageRecord;
 import com.zd.laboratory.api.entity.LabGradeManageRecord;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
@@ -8,11 +8,10 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
-
 import java.util.List;
 import java.util.List;
 
 
 @RestController
 @RestController
-@RequestMapping("/lab/manage")
+@RequestMapping("/app/lab/manage")
 @Api(tags = {"分级管控"})
 @Api(tags = {"分级管控"})
 public class LabManageController {
 public class LabManageController {
 
 

+ 2 - 3
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LaboratoryApi.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.controller;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.security.TokenService;
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
-
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -24,7 +23,7 @@ import java.util.Map;
  * @date 2021/9/15
  * @date 2021/9/15
  */
  */
 @RestController
 @RestController
-@RequestMapping("/laboratory")
+@RequestMapping("/app/laboratory")
 @Api(tags = {"实验室相关"})
 @Api(tags = {"实验室相关"})
 public class LaboratoryApi {
 public class LaboratoryApi {
 
 

+ 2 - 2
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/MessageContentApi.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.controller;
 
 
 import com.zd.laboratory.api.entity.LabMessageUser;
 import com.zd.laboratory.api.entity.LabMessageUser;
 import com.zd.laboratory.api.feign.RemoteMessageContentService;
 import com.zd.laboratory.api.feign.RemoteMessageContentService;
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
  */
  */
 @Api(tags = {"消息管理"})
 @Api(tags = {"消息管理"})
 @RestController
 @RestController
-@RequestMapping("/message/content")
+@RequestMapping("/app/message/content")
 public class MessageContentApi {
 public class MessageContentApi {
 
 
     @Autowired
     @Autowired

+ 2 - 2
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/SysUserApi.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.controller;
 
 
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.security.TokenService;
 import com.zd.common.core.utils.file.ImageUtils;
 import com.zd.common.core.utils.file.ImageUtils;
@@ -26,7 +26,7 @@ import java.util.Map;
  * @date 2021/9/17
  * @date 2021/9/17
  */
  */
 @RestController
 @RestController
-@RequestMapping("/sysuser/api")
+@RequestMapping("/app/sysuser/api")
 @Api(tags = {"用户相关"})
 @Api(tags = {"用户相关"})
 public class SysUserApi {
 public class SysUserApi {
 
 

+ 1 - 1
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/LabPhotoInspection.java

@@ -1,4 +1,4 @@
-package com.zd.app.controller;
+package com.zd.base.app.domain;
 
 
 import com.zd.model.annotation.Excel;
 import com.zd.model.annotation.Excel;
 import com.zd.model.entity.BaseEntity;
 import com.zd.model.entity.BaseEntity;

+ 2 - 2
zd-modules/zd-modules-app/src/main/java/com/zd/app/controller/PhotoVo.java

@@ -1,8 +1,8 @@
-package com.zd.app.controller;
+package com.zd.base.app.domain;
+
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
-import java.util.Map;
 
 
 /**
 /**
  * Controller
  * Controller

+ 1 - 0
zd-modules/zd-base/src/main/java/com/zd/base/message/service/impl/WechatMsgSendServiceImpl.java

@@ -50,6 +50,7 @@ public class WechatMsgSendServiceImpl implements IWechatMsgSendService {
         messageOpenIdMap.put(-1, "系统繁忙,此时请开发者稍候再试");
         messageOpenIdMap.put(-1, "系统繁忙,此时请开发者稍候再试");
         messageOpenIdMap.put(0, "请求成功");
         messageOpenIdMap.put(0, "请求成功");
         messageOpenIdMap.put(40029, "code 无效");
         messageOpenIdMap.put(40029, "code 无效");
+        messageOpenIdMap.put(40163, "code 已被使用");
         messageOpenIdMap.put(45011, "频率限制,每个用户每分钟100次");
         messageOpenIdMap.put(45011, "频率限制,每个用户每分钟100次");
         messageOpenIdMap.put(40226, "高风险等级用户,小程序登录拦截 。风险等级详见用户安全解方案");
         messageOpenIdMap.put(40226, "高风险等级用户,小程序登录拦截 。风险等级详见用户安全解方案");
     }
     }

+ 6 - 2
zd-modules/zd-base/src/main/resources/bootstrap.yml

@@ -1,8 +1,11 @@
 server:
 server:
   port: ${service.port.base}
   port: ${service.port.base}
 
 
-
 spring:
 spring:
+  servlet:
+    multipart:
+      max-file-size: 300MB
+      max-request-size: 3000MB
   freemarker:
   freemarker:
     request-context-attribute: request
     request-context-attribute: request
     #prefix: /templates/
     #prefix: /templates/
@@ -26,8 +29,9 @@ mybatis:
   typeAliasesPackage: com.zd.base
   typeAliasesPackage: com.zd.base
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   mapperLocations: classpath:mapper/**/*.xml
   mapperLocations: classpath:mapper/**/*.xml
+  type-handlers-package: com.zd.model.enums
   configuration:
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     call-setters-on-nulls: true
     call-setters-on-nulls: true
     # Mybatis开启驼峰映射
     # Mybatis开启驼峰映射
-    mapUnderscoreToCamelCase: true
+    mapUnderscoreToCamelCase: true

+ 2 - 3
zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/ZdBottleApplication.java

@@ -4,9 +4,8 @@ import com.zd.common.core.annotation.EnableCustomConfig;
 import com.zd.common.core.annotation.EnableRyFeignClients;
 import com.zd.common.core.annotation.EnableRyFeignClients;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.model.constant.ApplicationConstants;
 import com.zd.model.constant.ApplicationConstants;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 
@@ -18,7 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
  */
  */
 @EnableCustomConfig
 @EnableCustomConfig
 @EnableRyFeignClients
 @EnableRyFeignClients
-@SpringBootApplication(scanBasePackages = Constants.BASE_PACKAGE)
+@SpringBootApplication(scanBasePackages = BaseConstants.BASE_PACKAGE)
 @EnableScheduling
 @EnableScheduling
 //@NacosPropertySource(dataId = "zd-bottle", autoRefreshed = true)
 //@NacosPropertySource(dataId = "zd-bottle", autoRefreshed = true)
 @Slf4j
 @Slf4j

+ 19 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/domain/vo/HxpAlarmRecordVo.java

@@ -2,10 +2,8 @@ package com.zd.chemical.domain.vo;
 
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zd.model.annotation.Excel;
 import com.zd.model.annotation.Excel;
-import com.zd.model.entity.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
-import org.hibernate.validator.constraints.Length;
 
 
 import java.util.Date;
 import java.util.Date;
 
 
@@ -81,6 +79,9 @@ public class HxpAlarmRecordVo {
     @ApiModelProperty(value = "报警时长")
     @ApiModelProperty(value = "报警时长")
     private String alarmDuration;
     private String alarmDuration;
 
 
+    private String liableUserIds;
+
+    private String adminId;
 
 
     public Long getId() {
     public Long getId() {
         return id;
         return id;
@@ -209,4 +210,20 @@ public class HxpAlarmRecordVo {
     public void setAlarmDuration(String alarmDuration) {
     public void setAlarmDuration(String alarmDuration) {
         this.alarmDuration = alarmDuration;
         this.alarmDuration = alarmDuration;
     }
     }
+
+    public String getLiableUserIds() {
+        return liableUserIds;
+    }
+
+    public void setLiableUserIds(String liableUserIds) {
+        this.liableUserIds = liableUserIds;
+    }
+
+    public String getAdminId() {
+        return adminId;
+    }
+
+    public void setAdminId(String adminId) {
+        this.adminId = adminId;
+    }
 }
 }

+ 6 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/mapper/HxpAlarmRecordMapper.java

@@ -1,11 +1,13 @@
 package com.zd.chemical.mapper;
 package com.zd.chemical.mapper;
 
 
-import java.util.List;
 import com.zd.chemical.domain.HxpAlarmRecord;
 import com.zd.chemical.domain.HxpAlarmRecord;
 import com.zd.chemical.domain.vo.AioAlarmRecordVo;
 import com.zd.chemical.domain.vo.AioAlarmRecordVo;
 import com.zd.chemical.domain.vo.HxpAlarmRecordSearch;
 import com.zd.chemical.domain.vo.HxpAlarmRecordSearch;
 import com.zd.chemical.domain.vo.HxpAlarmRecordVo;
 import com.zd.chemical.domain.vo.HxpAlarmRecordVo;
-import com.zd.chemical.domain.vo.HxpCabinetVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 化学品报警记录Mapper接口
  * 化学品报警记录Mapper接口
@@ -23,6 +25,8 @@ public interface HxpAlarmRecordMapper
      */
      */
     public HxpAlarmRecord selectHxpAlarmRecordById(Long id);
     public HxpAlarmRecord selectHxpAlarmRecordById(Long id);
 
 
+    public List<Map<String, String>> selectHxpAlarmRecordUserInfo();
+
     /**
     /**
      * 查询化学品报警记录列表
      * 查询化学品报警记录列表
      *
      *

+ 64 - 12
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpAlarmRecordServiceImpl.java

@@ -1,28 +1,28 @@
 package com.zd.chemical.service.impl;
 package com.zd.chemical.service.impl;
 
 
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
+import com.zd.chemical.domain.HxpAlarmRecord;
 import com.zd.chemical.domain.vo.AioAlarmRecordVo;
 import com.zd.chemical.domain.vo.AioAlarmRecordVo;
 import com.zd.chemical.domain.vo.HxpAlarmRecordSearch;
 import com.zd.chemical.domain.vo.HxpAlarmRecordSearch;
 import com.zd.chemical.domain.vo.HxpAlarmRecordVo;
 import com.zd.chemical.domain.vo.HxpAlarmRecordVo;
+import com.zd.chemical.mapper.HxpAlarmRecordMapper;
 import com.zd.chemical.mapper.HxpUserecordMapper;
 import com.zd.chemical.mapper.HxpUserecordMapper;
+import com.zd.chemical.service.IHxpAlarmRecordService;
 import com.zd.chemical.util.SmsSydUtil;
 import com.zd.chemical.util.SmsSydUtil;
-import com.zd.model.domain.per.PerPrefix;
+import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.exception.ServiceException;
 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.annotation.DataScope;
+import com.zd.model.domain.per.PerPrefix;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import com.zd.chemical.mapper.HxpAlarmRecordMapper;
-import com.zd.chemical.domain.HxpAlarmRecord;
-import com.zd.chemical.service.IHxpAlarmRecordService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 /**
 /**
  * 化学品报警记录Service业务层处理
  * 化学品报警记录Service业务层处理
@@ -60,7 +60,41 @@ public class HxpAlarmRecordServiceImpl implements IHxpAlarmRecordService {
     @Override
     @Override
     @DataScope(deptAlias = "st", permi = PerPrefix.HXP_ALARMRECORD)
     @DataScope(deptAlias = "st", permi = PerPrefix.HXP_ALARMRECORD)
     public List<HxpAlarmRecordVo> selectHxpAlarmRecordList(HxpAlarmRecordSearch hxpAlarmRecordSearch) {
     public List<HxpAlarmRecordVo> selectHxpAlarmRecordList(HxpAlarmRecordSearch hxpAlarmRecordSearch) {
-        return hxpAlarmRecordMapper.selectHxpAlarmRecordList(hxpAlarmRecordSearch);
+
+        List<HxpAlarmRecordVo> list = hxpAlarmRecordMapper.selectHxpAlarmRecordList(hxpAlarmRecordSearch);
+
+        List<Map<String,String>> userInfos = hxpAlarmRecordMapper.selectHxpAlarmRecordUserInfo();
+
+        list.forEach(a -> {
+            if(a.getAlarmModeStatus() != null){
+                if(a.getAlarmModeStatus() == 1 && a.getLiableUserIds() != null){
+                    a.setLiableUserName(
+                            userInfos.stream().filter(u -> a.getLiableUserIds().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
+                    );
+                }else if(a.getSafeUserId() != null){
+                    a.setLiableUserName(
+                            userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
+                    );
+                }
+            }
+
+            if(a.getAdminId() != null){
+                a.setAdminNames(
+                        userInfos.stream().filter(u -> a.getAdminId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+                        .stream().map(n -> n.get("nick_name") + ", " + n.get("phonenumber")).collect(Collectors.joining(","))
+                );
+            }
+            if(a.getSafeUserId() != null){
+                a.setSafeUserNames(
+                        userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+                        .stream().map(n -> n.get("nick_name") + ", " + n.get("phonenumber")).collect(Collectors.joining(","))
+                );
+            }
+        });
+
+        return list;
     }
     }
 
 
     /**
     /**
@@ -128,7 +162,25 @@ public class HxpAlarmRecordServiceImpl implements IHxpAlarmRecordService {
 
 
     @Override
     @Override
     public List<AioAlarmRecordVo> queryAlarmRecordList(AioAlarmRecordVo aioAlarmRecordVo) {
     public List<AioAlarmRecordVo> queryAlarmRecordList(AioAlarmRecordVo aioAlarmRecordVo) {
-        return hxpAlarmRecordMapper.queryAlarmRecordList(aioAlarmRecordVo);
+        List<AioAlarmRecordVo> list = hxpAlarmRecordMapper.queryAlarmRecordList(aioAlarmRecordVo);
+
+        List<Map<String,String>> userInfos = hxpAlarmRecordMapper.selectHxpAlarmRecordUserInfo();
+        list.forEach(a -> {
+            if(a.getAlarmMode() != null){
+                if(a.getAlarmMode() == 1 && a.getLiableUserIds() != null){
+                    a.setLiableUserNames(
+                            userInfos.stream().filter(u -> a.getLiableUserIds().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
+                    );
+                }else if(a.getSafeUserId() != null){
+                    a.setLiableUserNames(
+                            userInfos.stream().filter(u -> a.getSafeUserId().contains(String.valueOf(u.get("user_id")))).collect(Collectors.toList())
+                            .stream().map(n -> n.get("nick_name")).collect(Collectors.joining(","))
+                    );
+                }
+            }
+        });
+        return list;
     }
     }
 
 
     @Override
     @Override

+ 7 - 4
zd-modules/zd-chemical/src/main/resources/bootstrap.yml

@@ -8,7 +8,10 @@ mybatis:
   typeAliasesPackage: com.zd.chemical
   typeAliasesPackage: com.zd.chemical
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   mapperLocations: classpath:mapper/**/*.xml
   mapperLocations: classpath:mapper/**/*.xml
-  # 配置日志打印
-  log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-  # Mybatis开启驼峰映射
-  mapUnderscoreToCamelCase: true
+  type-handlers-package: com.zd.model.enums
+  # 配置项
+  configuration:
+    # 配置日志打印
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    # Mybatis开启驼峰映射
+    mapUnderscoreToCamelCase: true

+ 33 - 20
zd-modules/zd-chemical/src/main/resources/mapper/chemical/HxpAlarmRecordMapper.xml

@@ -23,14 +23,6 @@
     </resultMap>
     </resultMap>
 
 
     <resultMap id="AioAlarmRecordResult" type="com.zd.chemical.domain.vo.AioAlarmRecordVo">
     <resultMap id="AioAlarmRecordResult" type="com.zd.chemical.domain.vo.AioAlarmRecordVo">
-<!--        <association property="safeUserNames" column="safe_user_id" javaType="string"-->
-<!--                     select="com.zd.chemical.mapper.HxpChemicalJoinCabinetMapper.queryUserNameBySafeUserId"/>-->
-<!--        <association property="safeUserPhones" column="safe_user_id" javaType="string"-->
-<!--                     select="com.zd.chemical.mapper.HxpChemicalJoinCabinetMapper.queryUserPhoneBySafeUserId"/>-->
-<!--        <association property="liableUserNames" column="liable_user_ids" javaType="string"-->
-<!--                     select="com.zd.chemical.mapper.HxpChemicalJoinCabinetMapper.queryUserNameBySafeUserId"/>-->
-<!--        <association property="liableUserPhones" column="liable_user_ids" javaType="string"-->
-<!--                     select="com.zd.chemical.mapper.HxpChemicalJoinCabinetMapper.queryUserPhoneBySafeUserId"/>-->
     </resultMap>
     </resultMap>
 
 
     <sql id="selectHxpAlarmRecordVo">
     <sql id="selectHxpAlarmRecordVo">
@@ -71,21 +63,18 @@
             resultType="com.zd.chemical.domain.vo.HxpAlarmRecordVo">
             resultType="com.zd.chemical.domain.vo.HxpAlarmRecordVo">
         SELECT ard.`id`,ard.alarm_time alarmTime,ard.`alarm_content` alarmContent,CASE WHEN ard.alarm_mode=1 THEN '系统通知'
         SELECT ard.`id`,ard.alarm_time alarmTime,ard.`alarm_content` alarmContent,CASE WHEN ard.alarm_mode=1 THEN '系统通知'
         ELSE CASE WHEN ard.alarm_mode=2 THEN '声光报警' ELSE '短信通知' END END alarmMode,
         ELSE CASE WHEN ard.alarm_mode=2 THEN '声光报警' ELSE '短信通知' END END alarmMode,
-        (SELECT dt.dept_name FROM sys_dept dt,lab_subject st WHERE dt.dept_id = st.dept_id AND st.id = ard.`sub_id`)
-        alarmDeptName,
-        (SELECT st.name FROM lab_subject st WHERE st.id = ard.`sub_id`) subName,
-        CASE WHEN ard.alarm_mode = 1 THEN (SELECT GROUP_CONCAT(nick_name) FROM sys_user WHERE FIND_IN_SET(user_id, ard.liable_user_ids))
-        ELSE (select GROUP_CONCAT(nick_name) FROM sys_user where FIND_IN_SET(user_id, st.safe_user_id))
-        END liableUserName,
+        dt.dept_name as alarmDeptName,
+        st.`name` as subName,
+        ard.liable_user_ids,
         ard.handling_time handlingTime,
         ard.handling_time handlingTime,
         (SELECT ur.nick_name FROM sys_user ur WHERE ur.user_id = ard.handling_user_id) handlingUserName,
         (SELECT ur.nick_name FROM sys_user ur WHERE ur.user_id = ard.handling_user_id) handlingUserName,
         CASE WHEN ard.handling_status = 1 THEN '待处理' ELSE '已处理' END operate,
         CASE WHEN ard.handling_status = 1 THEN '待处理' ELSE '已处理' END operate,
-        (SELECT GROUP_CONCAT(nick_name,' ',phonenumber SEPARATOR '、') FROM sys_user WHERE FIND_IN_SET(user_id, st.admin_id)) adminNames,
-        (SELECT GROUP_CONCAT(nick_name,' ',phonenumber SEPARATOR '、') FROM sys_user WHERE FIND_IN_SET(user_id, st.safe_user_id)) safeUserNames,
+        st.admin_id,
         ard.handling_status handlingStatus,st.safe_user_id safeUserId,ard.alarm_mode alarmModeStatus,
         ard.handling_status handlingStatus,st.safe_user_id safeUserId,ard.alarm_mode alarmModeStatus,
         concat(TIMESTAMPDIFF(MINUTE, ard.alarm_time, ard.handling_time),'分',TIMESTAMPDIFF(SECOND, ard.alarm_time, ard.handling_time)%60,'秒') alarmDuration
         concat(TIMESTAMPDIFF(MINUTE, ard.alarm_time, ard.handling_time),'分',TIMESTAMPDIFF(SECOND, ard.alarm_time, ard.handling_time)%60,'秒') alarmDuration
         FROM hxp_alarm_record ard
         FROM hxp_alarm_record ard
         inner join lab_subject st on ard.sub_id = st.id
         inner join lab_subject st on ard.sub_id = st.id
+        left join sys_dept dt on dt.dept_id = st.dept_id
         <where>
         <where>
             ard.has_valid = 1
             ard.has_valid = 1
             <if test="searchValue != null  and searchValue != ''">
             <if test="searchValue != null  and searchValue != ''">
@@ -117,14 +106,38 @@
         where id = #{id}
         where id = #{id}
     </select>
     </select>
 
 
+    <select id="selectHxpAlarmRecordUserInfo" resultType="map">
+        <!--select
+               <choose>
+                   <when test="type == 2">
+                       GROUP_CONCAT(nick_name,' ',phonenumber SEPARATOR '、')
+                   </when>
+                   <otherwise>
+                       GROUP_CONCAT(nick_name)
+                   </otherwise>
+               </choose>
+        from
+        (-->
+            select user_id, nick_name, phonenumber from sys_user u where
+            FIND_IN_SET(u.user_id, (select group_concat(DISTINCT CONCAT_WS(",", st.safe_user_id,ard.liable_user_ids,st.admin_id)) as safe_user_id
+                                    FROM hxp_alarm_record ard
+                                             left JOIN lab_subject st ON ard.sub_id = st.id
+                                             left join sys_dept dt on dt.dept_id = st.dept_id
+                                    where ard.alarm_mode = 1))
+        <!--) as u
+        <where>
+            <if test="userIds != null">
+                FIND_IN_SET(user_id, #{userIds})
+            </if>
+        </where>-->
+    </select>
+
+
     <select id="queryAlarmRecordList" resultMap="AioAlarmRecordResult">
     <select id="queryAlarmRecordList" resultMap="AioAlarmRecordResult">
         select ar.*,
         select ar.*,
                s.dept_id,
                s.dept_id,
                s.safe_user_id,
                s.safe_user_id,
-               d.dept_name,
-               CASE WHEN ar.alarm_mode = 1 THEN (SELECT GROUP_CONCAT(nick_name) FROM sys_user WHERE FIND_IN_SET(user_id, ar.liable_user_ids))
-                    ELSE (select GROUP_CONCAT(nick_name) FROM sys_user where FIND_IN_SET(user_id, s.safe_user_id))
-                   END liableUserNames
+               d.dept_name
         from hxp_alarm_record ar
         from hxp_alarm_record ar
                  left join lab_subject s on ar.sub_id = s.id
                  left join lab_subject s on ar.sub_id = s.id
                  left join sys_dept d on s.dept_id = d.dept_id
                  left join sys_dept d on s.dept_id = d.dept_id

+ 7 - 4
zd-modules/zd-exam/src/main/resources/bootstrap.yml

@@ -9,7 +9,10 @@ mybatis:
   typeAliasesPackage: com.zd.exam
   typeAliasesPackage: com.zd.exam
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   # 配置mapper的扫描,找到所有的mapper.xml映射文件
   mapperLocations: classpath:mapper/**/*.xml
   mapperLocations: classpath:mapper/**/*.xml
-  # 配置日志打印
-  log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-  # Mybatis开启驼峰映射
-  mapUnderscoreToCamelCase: true
+  type-handlers-package: com.zd.model.enums
+  # 配置项
+  configuration:
+    # 配置日志打印
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    # Mybatis开启驼峰映射
+    mapUnderscoreToCamelCase: true

+ 0 - 97
zd-modules/zd-modules-app/pom.xml

@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>zd-modules</artifactId>
-        <groupId>com.zd</groupId>
-        <version>3.1.0</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>zd-modules-app</artifactId>
-    <packaging>jar</packaging>
-    <description>小程序服务</description>
-
-    <dependencies>
-        <!-- SpringCloud Alibaba Nacos -->
-        <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
-        </dependency>
-
-        <!-- SpringCloud Alibaba Nacos Config -->
-        <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
-        </dependency>
-
-        <!-- SpringCloud Alibaba Sentinel -->
-        <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>
-
-        <!-- SpringBoot Actuator -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-
-        <!-- zd Common Swagger -->
-        <dependency>
-            <groupId>com.zd.swagger</groupId>
-            <artifactId>common-swagger</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.zd.core</groupId>
-            <artifactId>common-core</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.baomidou</groupId>
-                    <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>poi-ooxml</artifactId>
-                    <groupId>org.apache.poi</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>mybatis-spring-boot-starter</artifactId>
-                    <groupId>org.mybatis.spring.boot</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>com.zd.exam</groupId>
-            <artifactId>zd-exam-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.zd.laboratory</groupId>
-            <artifactId>zd-laboratory-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.zd.system</groupId>
-            <artifactId>zd-system-api</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <finalName>${project.artifactId}</finalName>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 25
zd-modules/zd-modules-app/src/main/java/com/zd/app/ZdAppApplication.java

@@ -1,25 +0,0 @@
-package com.zd.app;
-
-import com.zd.common.core.annotation.EnableCustomConfig;
-import com.zd.common.core.annotation.EnableRyFeignClients;
-import com.zd.common.core.launch.ZdStartApplication;
-import com.zd.model.constant.ApplicationConstants;
-import com.zd.model.constant.BaseConstants;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.context.annotation.ComponentScan;
-
-/**
- * 小程序web层
- *
- * @author zhoupan
- */
-@EnableCustomConfig
-@EnableRyFeignClients
-@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
-@ComponentScan(basePackages = BaseConstants.BASE_PACKAGE)
-public class ZdAppApplication {
-    public static void main(String[] args) {
-        ZdStartApplication.run(ApplicationConstants.APP_SERVICE, ZdAppApplication.class, args);
-    }
-}

+ 0 - 4
zd-modules/zd-modules-app/src/main/resources/bootstrap.yml

@@ -1,4 +0,0 @@
-# Tomcat
-server:
-  port: ${service.port.app}
-

+ 0 - 74
zd-modules/zd-modules-app/src/main/resources/logback.xml

@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration scan="true" scanPeriod="60 seconds" debug="false">
-    <!-- 日志存放路径 -->
-    <property name="log.path" value="logs/zd-app"/>
-    <!-- 日志输出格式 -->
-    <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
-
-    <!-- 控制台输出 -->
-    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>${log.pattern}</pattern>
-        </encoder>
-    </appender>
-
-    <!-- 系统日志输出 -->
-    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${log.path}/info.log</file>
-        <!-- 循环政策:基于时间创建日志文件 -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- 日志文件名格式 -->
-            <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
-            <!-- 日志最大的历史 60天 -->
-            <maxHistory>60</maxHistory>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${log.pattern}</pattern>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <!-- 过滤的级别 -->
-            <level>INFO</level>
-            <!-- 匹配时的操作:接收(记录) -->
-            <onMatch>ACCEPT</onMatch>
-            <!-- 不匹配时的操作:拒绝(不记录) -->
-            <onMismatch>DENY</onMismatch>
-        </filter>
-    </appender>
-
-    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${log.path}/error.log</file>
-        <!-- 循环政策:基于时间创建日志文件 -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- 日志文件名格式 -->
-            <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
-            <!-- 日志最大的历史 60天 -->
-            <maxHistory>60</maxHistory>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${log.pattern}</pattern>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <!-- 过滤的级别 -->
-            <level>ERROR</level>
-            <!-- 匹配时的操作:接收(记录) -->
-            <onMatch>ACCEPT</onMatch>
-            <!-- 不匹配时的操作:拒绝(不记录) -->
-            <onMismatch>DENY</onMismatch>
-        </filter>
-    </appender>
-
-    <!-- 系统模块日志级别控制  -->
-    <logger name="com.zd" level="info"/>
-    <!-- Spring日志级别控制  -->
-    <logger name="org.springframework" level="info"/>
-
-    <root level="info">
-        <appender-ref ref="console"/>
-    </root>
-
-    <!--系统操作日志-->
-    <root level="info">
-        <appender-ref ref="file_info"/>
-        <appender-ref ref="file_error"/>
-    </root>
-</configuration>

+ 0 - 182
zd-modules/zd-modules-app/wait-for-it.sh

@@ -1,182 +0,0 @@
-#!/usr/bin/env bash
-# Use this script to test if a given TCP host/port are available
-
-WAITFORIT_cmdname=${0##*/}
-
-echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
-
-usage()
-{
-    cat << USAGE >&2
-Usage:
-    $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
-    -h HOST | --host=HOST       Host or IP under test
-    -p PORT | --port=PORT       TCP port under test
-                                Alternatively, you specify the host and port as host:port
-    -s | --strict               Only execute subcommand if the test succeeds
-    -q | --quiet                Don't output any status messages
-    -t TIMEOUT | --timeout=TIMEOUT
-                                Timeout in seconds, zero for no timeout
-    -- COMMAND ARGS             Execute command with args after the test finishes
-USAGE
-    exit 1
-}
-
-wait_for()
-{
-    if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
-        echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
-    else
-        echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout"
-    fi
-    WAITFORIT_start_ts=$(date +%s)
-    while :
-    do
-        if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
-            nc -z $WAITFORIT_HOST $WAITFORIT_PORT
-            WAITFORIT_result=$?
-        else
-            (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
-            WAITFORIT_result=$?
-        fi
-        if [[ $WAITFORIT_result -eq 0 ]]; then
-            WAITFORIT_end_ts=$(date +%s)
-            echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds"
-            break
-        fi
-        sleep 1
-    done
-    return $WAITFORIT_result
-}
-
-wait_for_wrapper()
-{
-    # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
-    if [[ $WAITFORIT_QUIET -eq 1 ]]; then
-        timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
-    else
-        timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
-    fi
-    WAITFORIT_PID=$!
-    trap "kill -INT -$WAITFORIT_PID" INT
-    wait $WAITFORIT_PID
-    WAITFORIT_RESULT=$?
-    if [[ $WAITFORIT_RESULT -ne 0 ]]; then
-        echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
-    fi
-    return $WAITFORIT_RESULT
-}
-
-# process arguments
-while [[ $# -gt 0 ]]
-do
-    case "$1" in
-        *:* )
-        WAITFORIT_hostport=(${1//:/ })
-        WAITFORIT_HOST=${WAITFORIT_hostport[0]}
-        WAITFORIT_PORT=${WAITFORIT_hostport[1]}
-        shift 1
-        ;;
-        --child)
-        WAITFORIT_CHILD=1
-        shift 1
-        ;;
-        -q | --quiet)
-        WAITFORIT_QUIET=1
-        shift 1
-        ;;
-        -s | --strict)
-        WAITFORIT_STRICT=1
-        shift 1
-        ;;
-        -h)
-        WAITFORIT_HOST="$2"
-        if [[ $WAITFORIT_HOST == "" ]]; then break; fi
-        shift 2
-        ;;
-        --host=*)
-        WAITFORIT_HOST="${1#*=}"
-        shift 1
-        ;;
-        -p)
-        WAITFORIT_PORT="$2"
-        if [[ $WAITFORIT_PORT == "" ]]; then break; fi
-        shift 2
-        ;;
-        --port=*)
-        WAITFORIT_PORT="${1#*=}"
-        shift 1
-        ;;
-        -t)
-        WAITFORIT_TIMEOUT="$2"
-        if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi
-        shift 2
-        ;;
-        --timeout=*)
-        WAITFORIT_TIMEOUT="${1#*=}"
-        shift 1
-        ;;
-        --)
-        shift
-        WAITFORIT_CLI=("$@")
-        break
-        ;;
-        --help)
-        usage
-        ;;
-        *)
-        echoerr "Unknown argument: $1"
-        usage
-        ;;
-    esac
-done
-
-if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then
-    echoerr "Error: you need to provide a host and port to test."
-    usage
-fi
-
-WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15}
-WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
-WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
-WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
-
-# Check to see if timeout is from busybox?
-WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
-WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
-
-WAITFORIT_BUSYTIMEFLAG=""
-if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
-    WAITFORIT_ISBUSY=1
-    # Check if busybox timeout uses -t flag
-    # (recent Alpine versions don't support -t anymore)
-    if timeout &>/dev/stdout | grep -q -e '-t '; then
-        WAITFORIT_BUSYTIMEFLAG="-t"
-    fi
-else
-    WAITFORIT_ISBUSY=0
-fi
-
-if [[ $WAITFORIT_CHILD -gt 0 ]]; then
-    wait_for
-    WAITFORIT_RESULT=$?
-    exit $WAITFORIT_RESULT
-else
-    if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
-        wait_for_wrapper
-        WAITFORIT_RESULT=$?
-    else
-        wait_for
-        WAITFORIT_RESULT=$?
-    fi
-fi
-
-if [[ $WAITFORIT_CLI != "" ]]; then
-    if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then
-        echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess"
-        exit $WAITFORIT_RESULT
-    fi
-    exec "${WAITFORIT_CLI[@]}"
-else
-    exit $WAITFORIT_RESULT
-fi

+ 41 - 41
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/AlarmController.java

@@ -1,41 +1,41 @@
-//package com.zd.laboratory.controller;
-//
-//import com.zd.algorithm.api.alarm.entity.AlarmLog;
-//import com.zd.common.core.annotation.PreAuthorize;
-//import com.zd.common.core.web.controller.BaseController;
-//import com.zd.laboratory.service.IAlarmLogService;
-//import com.zd.model.domain.per.PerFun;
-//import com.zd.model.domain.per.PerPrefix;
-//import com.zd.model.page.TableDataInfo;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import org.springframework.beans.factory.annotation.Autowired;
-//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;
-//
-///**
-// * 电话报警日志
-// */
-//@Api(tags = {"电话报警日志"})
-//@RestController
-//@RequestMapping("/alarmLog")
-//public class AlarmController extends BaseController {
-//
-//    @Autowired
-//    private IAlarmLogService alarmLogService;
-//
-//    /**
-//     * 查询算法结果列表
-//     */
-//    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_ALARM + PerFun.LIST)
-//    @ApiOperation("查询列表")
-//    @GetMapping("/list")
-//    public TableDataInfo<AlarmLog> list(AlarmLog alarmLog) {
-//        startPage();
-//        List<AlarmLog> list = alarmLogService.selectAlarmLogList(alarmLog);
-//        return getDataTable(list);
-//    }
-//}
+package com.zd.laboratory.controller;
+
+import com.zd.algorithm.api.alarm.entity.AlarmLog;
+import com.zd.common.core.annotation.PreAuthorize;
+import com.zd.common.core.web.controller.BaseController;
+import com.zd.laboratory.service.IAlarmLogService;
+import com.zd.model.domain.per.PerFun;
+import com.zd.model.domain.per.PerPrefix;
+import com.zd.model.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+/**
+ * 电话报警日志
+ */
+@Api(tags = {"电话报警日志"})
+@RestController
+@RequestMapping("/alarmLog")
+public class AlarmController extends BaseController {
+
+    @Autowired
+    private IAlarmLogService alarmLogService;
+
+    /**
+     * 查询算法结果列表
+     */
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_ALARM + PerFun.LIST)
+    @ApiOperation("查询列表")
+    @GetMapping("/list")
+    public TableDataInfo<AlarmLog> list(AlarmLog alarmLog) {
+        startPage();
+        List<AlarmLog> list = alarmLogService.selectAlarmLogList(alarmLog);
+        return getDataTable(list);
+    }
+}

+ 3 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHardwareController.java

@@ -204,10 +204,10 @@ public class LabHardwareController extends BaseController {
      * 查询硬件功能列表
      * 查询硬件功能列表
      */
      */
     @PostMapping("/getFunList")
     @PostMapping("/getFunList")
-    public List<HardwareCVO> getFunList() {
+    public ResultData getFunList() {
         Map <HardwareTypeEnum, List <FunctionStatus>> list = labHardwareService.getFunList();
         Map <HardwareTypeEnum, List <FunctionStatus>> list = labHardwareService.getFunList();
 
 
-        return Optional.ofNullable(list)
+        return ResultData.success( Optional.ofNullable(list)
                 .filter(a -> a.size() > 0)
                 .filter(a -> a.size() > 0)
                 .orElseGet(Collections::emptyMap)
                 .orElseGet(Collections::emptyMap)
                 .entrySet()
                 .entrySet()
@@ -218,7 +218,7 @@ public class LabHardwareController extends BaseController {
                     hardwareCVO.setHardwareTypeEnum(a.getKey());
                     hardwareCVO.setHardwareTypeEnum(a.getKey());
                     hardwareCVO.setFunctionStatusList(a.getValue());
                     hardwareCVO.setFunctionStatusList(a.getValue());
                     return hardwareCVO;
                     return hardwareCVO;
-                }).collect(Collectors.toList());
+                }).collect(Collectors.toList()));
 
 
     }
     }
 
 

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHazardBookController.java

@@ -50,9 +50,9 @@ public class LabHazardBookController extends BaseController {
      */
      */
     @GetMapping("/queryOption")
     @GetMapping("/queryOption")
     @ApiOperation(value = "一体机查询危化品")
     @ApiOperation(value = "一体机查询危化品")
-    public List<LabHazardBook> queryOption(LabHazardBook labHazardBook) {
+    public ResultData queryOption(LabHazardBook labHazardBook) {
         List<LabHazardBook> list = labHazardBookService.selectLabHazardBookList(labHazardBook);
         List<LabHazardBook> list = labHazardBookService.selectLabHazardBookList(labHazardBook);
-        return list;
+        return ResultData.success(list);
     }
     }
 
 
     /**
     /**

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabMoldController.java

@@ -47,9 +47,9 @@ public class LabMoldController extends BaseController {
      */
      */
     @PostMapping("/queryOption")
     @PostMapping("/queryOption")
     @ApiOperation(value = "查询实验室类型下拉列表")
     @ApiOperation(value = "查询实验室类型下拉列表")
-    public List<LabMold> queryOption(@RequestBody LabMold labMold) {
+    public ResultData queryOption(@RequestBody LabMold labMold) {
         List<LabMold> list = labMoldService.selectLabMoldList(labMold);
         List<LabMold> list = labMoldService.selectLabMoldList(labMold);
-        return list;
+        return ResultData.success(list);
     }
     }
 
 
 
 

+ 5 - 5
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabRotationChartController.java

@@ -5,10 +5,10 @@ import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 
 
 import com.github.xiaoymin.knife4j.annotations.ApiSupport;
 import com.github.xiaoymin.knife4j.annotations.ApiSupport;
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.ResultData;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -98,7 +98,7 @@ public class LabRotationChartController extends BaseController
     {
     {
         int num = labRotationChartService.insertLabRotationChart(labRotationChart);
         int num = labRotationChartService.insertLabRotationChart(labRotationChart);
 
 
-        commonSend.send(MqttConstants.LAB_ROTATION, "新增了一个轮播图");
+        commonSend.send(MqttConstants.TOPIC_LAB_ROTATION, "新增了一个轮播图");
         return ResultData.result(num);
         return ResultData.result(num);
     }
     }
 
 
@@ -112,7 +112,7 @@ public class LabRotationChartController extends BaseController
     public ResultData edit(@RequestBody LabRotationChart labRotationChart)
     public ResultData edit(@RequestBody LabRotationChart labRotationChart)
     {
     {
         int count = labRotationChartService.updateLabRotationChart(labRotationChart);
         int count = labRotationChartService.updateLabRotationChart(labRotationChart);
-        commonSend.send(MqttConstants.LAB_ROTATION, "修改了一个轮播图");
+        commonSend.send(MqttConstants.TOPIC_LAB_ROTATION, "修改了一个轮播图");
         return  ResultData.result(count);
         return  ResultData.result(count);
     }
     }
 
 
@@ -126,7 +126,7 @@ public class LabRotationChartController extends BaseController
     public ResultData remove(@PathVariable Long[] ids)
     public ResultData remove(@PathVariable Long[] ids)
     {
     {
         int count = labRotationChartService.deleteLabRotationChartByIds(ids);
         int count = labRotationChartService.deleteLabRotationChartByIds(ids);
-        commonSend.send(MqttConstants.LAB_ROTATION, "删除了一个轮播图");
+        commonSend.send(MqttConstants.TOPIC_LAB_ROTATION, "删除了一个轮播图");
         return ResultData.result(count);
         return ResultData.result(count);
     }
     }
 
 
@@ -146,7 +146,7 @@ public class LabRotationChartController extends BaseController
             labRotationChart.setImgType(1);
             labRotationChart.setImgType(1);
         }
         }
         labRotationChartService.updateLabRotationChart(labRotationChart);
         labRotationChartService.updateLabRotationChart(labRotationChart);
-        commonSend.send(MqttConstants.LAB_ROTATION, "打开或关闭轮播图");
+        commonSend.send(MqttConstants.TOPIC_LAB_ROTATION, "打开或关闭轮播图");
         return  ResultData.success(labRotationChart.getImgType());
         return  ResultData.success(labRotationChart.getImgType());
     }
     }
 
 

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubMangerController.java

@@ -90,8 +90,8 @@ public class LabSubMangerController extends BaseController {
     @ApiOperation("查询实验室详情")
     @ApiOperation("查询实验室详情")
     @GetMapping("/query/{id}/{type}")
     @GetMapping("/query/{id}/{type}")
     @PreAuthorize(hasPermi = PerPrefix.LABORATORY_SUBJECT + PerFun.QUERY)
     @PreAuthorize(hasPermi = PerPrefix.LABORATORY_SUBJECT + PerFun.QUERY)
-    public LabSubjectControllerVO querySubById(@PathVariable("id") Long id, @PathVariable("type") Integer type) {
-        return subjectManagerService.querySubById(id, type);
+    public ResultData<LabSubjectControllerVO> querySubById(@PathVariable("id") Long id, @PathVariable("type") Integer type) {
+        return ResultData.success(subjectManagerService.querySubById(id, type));
     }
     }
 
 
     /**
     /**

+ 11 - 11
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubjectController.java

@@ -14,11 +14,11 @@ import com.zd.laboratory.domain.LabSubject;
 import com.zd.laboratory.domain.vo.LabHazardSubjectRelationVO;
 import com.zd.laboratory.domain.vo.LabHazardSubjectRelationVO;
 import com.zd.laboratory.domain.vo.LabSubjectVO;
 import com.zd.laboratory.domain.vo.LabSubjectVO;
 import com.zd.laboratory.mapper.LabSubjectMapper;
 import com.zd.laboratory.mapper.LabSubjectMapper;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.ILabHazardSubjectRelationService;
 import com.zd.laboratory.service.ILabHazardSubjectRelationService;
 import com.zd.laboratory.service.ILabQpSubjectRelationService;
 import com.zd.laboratory.service.ILabQpSubjectRelationService;
 import com.zd.laboratory.service.ILabSubjectService;
 import com.zd.laboratory.service.ILabSubjectService;
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerFun;
@@ -93,11 +93,11 @@ public class LabSubjectController extends BaseController {
      */
      */
     @Deprecated
     @Deprecated
     @GetMapping("/list/nopage")
     @GetMapping("/list/nopage")
-    public List<LabSubject> listNoPage(LabSubject labSubject) {
+    public ResultData listNoPage(LabSubject labSubject) {
 //        startPage();
 //        startPage();
 //        labSubject.setAdminId(-1L);
 //        labSubject.setAdminId(-1L);
         List<LabSubject> list = labSubjectService.selectLabSubjectList(labSubject);
         List<LabSubject> list = labSubjectService.selectLabSubjectList(labSubject);
-        return list;
+        return ResultData.success(list);
     }
     }
 
 
     /**
     /**
@@ -105,19 +105,19 @@ public class LabSubjectController extends BaseController {
      */
      */
     @Deprecated
     @Deprecated
     @GetMapping("/list/security")
     @GetMapping("/list/security")
-    public List<LabSubject> listSecurity(LabSubject labSubject) {
+    public ResultData listSecurity(LabSubject labSubject) {
         List<LabSubject> list = labSubjectService.selectLabSubjectListSecurity(labSubject);
         List<LabSubject> list = labSubjectService.selectLabSubjectListSecurity(labSubject);
-        return list;
+        return ResultData.success(list);
     }
     }
 
 
     @GetMapping("/list/listAdmin")
     @GetMapping("/list/listAdmin")
-    public List<LabSubject> listAdmin(LabSubject labSubject) {
+    public ResultData listAdmin(LabSubject labSubject) {
         //获取当前登录用户所属学校和学院的deptid
         //获取当前登录用户所属学校和学院的deptid
         R<List<Long>> listdeptids = remoteUserService.getLogingUserDeptids();
         R<List<Long>> listdeptids = remoteUserService.getLogingUserDeptids();
         List<Long> deptIds= listdeptids.getData();
         List<Long> deptIds= listdeptids.getData();
         labSubject.setDeptIds(deptIds);
         labSubject.setDeptIds(deptIds);
         List<LabSubject> list = labSubjectService.selectLabSubjectListByadminidNotnull(labSubject);
         List<LabSubject> list = labSubjectService.selectLabSubjectListByadminidNotnull(labSubject);
-        return list;
+        return ResultData.success(list);
     }
     }
 
 
     /**
     /**
@@ -197,7 +197,7 @@ public class LabSubjectController extends BaseController {
     @PutMapping
     @PutMapping
     public ResultData edit(@RequestBody LabSubject labSubject) {
     public ResultData edit(@RequestBody LabSubject labSubject) {
         labSubjectService.updateLabSubject(labSubject);
         labSubjectService.updateLabSubject(labSubject);
-        commonSend.send(MqttConstants.LAB_SUB_INFO + labSubject.getId(), labSubject.getId() + "实验室信息变更通知!");
+        commonSend.send(MqttConstants.TOPIC_LAB_SUB_INFO + labSubject.getId(), labSubject.getId() + "实验室信息变更通知!");
         return ResultData.success();
         return ResultData.success();
     }
     }
 
 
@@ -210,7 +210,7 @@ public class LabSubjectController extends BaseController {
     @PutMapping("/editJoinHazard")
     @PutMapping("/editJoinHazard")
     public ResultData editJoinHazard(@RequestBody LabSubject labSubject) {
     public ResultData editJoinHazard(@RequestBody LabSubject labSubject) {
         labSubjectService.editJoinHazard(labSubject);
         labSubjectService.editJoinHazard(labSubject);
-        commonSend.send(MqttConstants.LAB_SUB_INFO + labSubject.getId(), labSubject.getId() + "实验室信息变更通知!");
+        commonSend.send(MqttConstants.TOPIC_LAB_SUB_INFO + labSubject.getId(), labSubject.getId() + "实验室信息变更通知!");
         return ResultData.success();
         return ResultData.success();
     }
     }
 
 
@@ -387,8 +387,8 @@ public class LabSubjectController extends BaseController {
      * 查询多个院系下的实验室
      * 查询多个院系下的实验室
      */
      */
     @GetMapping("/multipleDetp/subList/{ids}")
     @GetMapping("/multipleDetp/subList/{ids}")
-    public List<LabSubject> multipleDeptBySubList(@PathVariable("ids") Long[] ids) {
-        return labSubjectService.multipleDetpBysubList(ids);
+    public ResultData multipleDeptBySubList(@PathVariable("ids") Long[] ids) {
+        return ResultData.success(labSubjectService.multipleDetpBysubList(ids));
     }
     }
 
 
     /**
     /**

+ 0 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubjectDengerRelationController.java

@@ -9,7 +9,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
-
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/SensorLabMessageEvent.java

@@ -2,7 +2,7 @@ package com.zd.laboratory.event;
 
 
 import com.zd.laboratory.api.entity.SensorFunctionStatus;
 import com.zd.laboratory.api.entity.SensorFunctionStatus;
 import com.zd.laboratory.api.vo.SubFunction;
 import com.zd.laboratory.api.vo.SubFunction;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
+import com.zd.model.constant.MqttConstants;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 /**
 /**
@@ -31,6 +31,6 @@ public class SensorLabMessageEvent extends LabMessageEvent<SubFunction<SensorFun
 
 
     @Override
     @Override
     public  String topic() {
     public  String topic() {
-        return MqttConstants.LAB_FUNCTION_DATA;
+        return MqttConstants.TOPIC_LAB_FUNCTION_DATA;
     }
     }
 }
 }

+ 64 - 64
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/AlarmLogMapper.java

@@ -1,64 +1,64 @@
-//package com.zd.laboratory.mapper;
-//
-//import com.zd.algorithm.api.alarm.entity.AlarmLog;
-//
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * 电话报警推送日志Mapper接口
-// *
-// * @author liubo
-// * @date 2021-11-11
-// */
-//public interface AlarmLogMapper {
-//    /**
-//     * 查询电话报警推送日志
-//     *
-//     * @param id 电话报警推送日志主键
-//     * @return 电话报警推送日志
-//     */
-//    public AlarmLog selectAlarmLogById(Long id);
-//
-//    /**
-//     * 查询电话报警推送日志列表
-//     *
-//     * @param alarmLog 电话报警推送日志
-//     * @return 电话报警推送日志集合
-//     */
-//    public List<AlarmLog> selectAlarmLogList(AlarmLog alarmLog);
-//
-//    /**
-//     * 新增电话报警推送日志
-//     *
-//     * @param alarmLog 电话报警推送日志
-//     * @return 结果
-//     */
-//    public int insertAlarmLog(AlarmLog alarmLog);
-//
-//    /**
-//     * 修改电话报警推送日志
-//     *
-//     * @param alarmLog 电话报警推送日志
-//     * @return 结果
-//     */
-//    public int updateAlarmLog(AlarmLog alarmLog);
-//
-//    /**
-//     * 删除电话报警推送日志
-//     *
-//     * @param id 电话报警推送日志主键
-//     * @return 结果
-//     */
-//    public int deleteAlarmLogById(Long id);
-//
-//    /**
-//     * 批量删除电话报警推送日志
-//     *
-//     * @param ids 需要删除的数据主键集合
-//     * @return 结果
-//     */
-//    public int deleteAlarmLogByIds(Long[] ids);
-//
-//    List<AlarmLog> selectNoBackAlarmLogList(Map<String, Object> params);
-//}
+package com.zd.laboratory.mapper;
+
+import com.zd.algorithm.api.alarm.entity.AlarmLog;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 电话报警推送日志Mapper接口
+ *
+ * @author liubo
+ * @date 2021-11-11
+ */
+public interface AlarmLogMapper {
+    /**
+     * 查询电话报警推送日志
+     *
+     * @param id 电话报警推送日志主键
+     * @return 电话报警推送日志
+     */
+    public AlarmLog selectAlarmLogById(Long id);
+
+    /**
+     * 查询电话报警推送日志列表
+     *
+     * @param alarmLog 电话报警推送日志
+     * @return 电话报警推送日志集合
+     */
+    public List<AlarmLog> selectAlarmLogList(AlarmLog alarmLog);
+
+    /**
+     * 新增电话报警推送日志
+     *
+     * @param alarmLog 电话报警推送日志
+     * @return 结果
+     */
+    public int insertAlarmLog(AlarmLog alarmLog);
+
+    /**
+     * 修改电话报警推送日志
+     *
+     * @param alarmLog 电话报警推送日志
+     * @return 结果
+     */
+    public int updateAlarmLog(AlarmLog alarmLog);
+
+    /**
+     * 删除电话报警推送日志
+     *
+     * @param id 电话报警推送日志主键
+     * @return 结果
+     */
+    public int deleteAlarmLogById(Long id);
+
+    /**
+     * 批量删除电话报警推送日志
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteAlarmLogByIds(Long[] ids);
+
+    List<AlarmLog> selectNoBackAlarmLogList(Map<String, Object> params);
+}

+ 34 - 33
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/config/MqttConfig.java

@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject;
 import com.zd.common.core.utils.SpringUtils;
 import com.zd.common.core.utils.SpringUtils;
 import com.zd.laboratory.event.LabMessageEvent;
 import com.zd.laboratory.event.LabMessageEvent;
 import com.zd.laboratory.event.SensorNewStatusEvent;
 import com.zd.laboratory.event.SensorNewStatusEvent;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
 import com.zd.laboratory.utils.HexUtils;
 import com.zd.laboratory.utils.HexUtils;
+import com.zd.model.constant.MqttConstants;
 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;
@@ -31,6 +31,7 @@ import java.util.stream.Collectors;
 
 
 /**
 /**
  * mqtt配置
  * mqtt配置
+ *
  * @author dgs
  * @author dgs
  */
  */
 @Configuration
 @Configuration
@@ -79,14 +80,13 @@ public class MqttConfig {
 
 
     private MqttPahoMessageDrivenChannelAdapter adapter;
     private MqttPahoMessageDrivenChannelAdapter adapter;
 
 
-    final Map<String, List<LabMessageEvent>> labMessMap = new HashMap <>();
+    final Map<String, List<LabMessageEvent>> labMessMap = new HashMap<>();
 
 
     public Map<String, List<LabMessageEvent>> getLabMessMap() {
     public Map<String, List<LabMessageEvent>> getLabMessMap() {
         return labMessMap;
         return labMessMap;
     }
     }
 
 
-    public  MqttConfig(List<LabMessageEvent> messageEvents)
-    {
+    public MqttConfig(List<LabMessageEvent> messageEvents) {
         Map<String, List<LabMessageEvent>> collect = Optional.ofNullable(messageEvents)
         Map<String, List<LabMessageEvent>> collect = Optional.ofNullable(messageEvents)
                 .filter(a -> a.size() > 0)
                 .filter(a -> a.size() > 0)
                 .orElseGet(Collections::emptyList)
                 .orElseGet(Collections::emptyList)
@@ -94,6 +94,7 @@ public class MqttConfig {
                 .collect(Collectors.groupingBy(LabMessageEvent::topic));
                 .collect(Collectors.groupingBy(LabMessageEvent::topic));
         labMessMap.putAll(collect);
         labMessMap.putAll(collect);
     }
     }
+
     /**
     /**
      * 连接mqtt配置
      * 连接mqtt配置
      *
      *
@@ -184,7 +185,8 @@ public class MqttConfig {
 
 
     /**
     /**
      * 消费者消息处理
      * 消费者消息处理
-     *设备心跳
+     * 设备心跳
+     *
      * @return
      * @return
      */
      */
     @Bean
     @Bean
@@ -198,54 +200,54 @@ public class MqttConfig {
                 String receivedTopic = (String) messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
                 String receivedTopic = (String) messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
 //                logger.info("[通道] - [{}]",receivedTopic);
 //                logger.info("[通道] - [{}]",receivedTopic);
 //                logger.info("[消息] - [{}]",message.getPayload());
 //                logger.info("[消息] - [{}]",message.getPayload());
-                String messageStr=message.getPayload().toString();
-                if(receivedTopic.startsWith(devicePrefix)){
-                    if(receivedTopic.contains("788D4C6C6187ABC")){
-                        logger.info("[原始消息] - [{}]",message.getPayload());
+                String messageStr = message.getPayload().toString();
+                if (receivedTopic.startsWith(devicePrefix)) {
+                    if (receivedTopic.contains("788D4C6C6187ABC")) {
+                        logger.info("[原始消息] - [{}]", message.getPayload());
                     }
                     }
-                    String topicEnd=receivedTopic.substring(receivedTopic.lastIndexOf("/")+1);
-                    JSONObject jsonObject=JSONObject.parseObject(messageStr);
-                    jsonObject.put("deviceNo",topicEnd);
-                    SensorNewStatusEvent newStatusEvent=new SensorNewStatusEvent(jsonObject);
+                    String topicEnd = receivedTopic.substring(receivedTopic.lastIndexOf("/") + 1);
+                    JSONObject jsonObject = JSONObject.parseObject(messageStr);
+                    jsonObject.put("deviceNo", topicEnd);
+                    SensorNewStatusEvent newStatusEvent = new SensorNewStatusEvent(jsonObject);
                     SpringUtils.getApplicationContext().publishEvent(newStatusEvent);
                     SpringUtils.getApplicationContext().publishEvent(newStatusEvent);
-                }else if(receivedTopic.startsWith(MqttConstants.SYS_CHEMICAL_ON)){
+                } else if (receivedTopic.startsWith(MqttConstants.TOPIC_SYS_CHEMICAL_ON)) {
                     // 化学品终端设备 心跳消息
                     // 化学品终端设备 心跳消息
-                    String codeNum = receivedTopic.replaceAll(MqttConstants.SYS_CHEMICAL_ON, "");
+                    String codeNum = receivedTopic.replaceAll(MqttConstants.TOPIC_SYS_CHEMICAL_ON, "");
                     logger.info("化学品终端设备心跳编号:" + codeNum);
                     logger.info("化学品终端设备心跳编号:" + codeNum);
                     TerminalRouter.routerMap.get("HxpTerminalService").onLine(codeNum);
                     TerminalRouter.routerMap.get("HxpTerminalService").onLine(codeNum);
-                }else if(receivedTopic.startsWith(MqttConstants.SYS_CHEMICAL_OFF)){
+                } else if (receivedTopic.startsWith(MqttConstants.TOPIC_SYS_CHEMICAL_OFF)) {
                     logger.warn(messageHeaders.get(MqttHeaders.ID) + "意外中断!");
                     logger.warn(messageHeaders.get(MqttHeaders.ID) + "意外中断!");
-                    String codeNum = receivedTopic.replaceAll(MqttConstants.SYS_CHEMICAL_OFF, "");
+                    String codeNum = receivedTopic.replaceAll(MqttConstants.TOPIC_SYS_CHEMICAL_OFF, "");
                     logger.warn(" 中断设备编码: " + codeNum);
                     logger.warn(" 中断设备编码: " + codeNum);
                     TerminalRouter.routerMap.get("HxpTerminalService").offLine(codeNum);
                     TerminalRouter.routerMap.get("HxpTerminalService").offLine(codeNum);
-                }else if(receivedTopic.startsWith(steerPublishPrefix)){
+                } else if (receivedTopic.startsWith(steerPublishPrefix)) {
 //                    messageStr = byte2Hex(message.getPayload().toString().getBytes(StandardCharsets.UTF_8));
 //                    messageStr = byte2Hex(message.getPayload().toString().getBytes(StandardCharsets.UTF_8));
                     char[] str = message.getPayload().toString().toCharArray();
                     char[] str = message.getPayload().toString().toCharArray();
                     logger.info("柜锁mqtt消费:" + messageStr);
                     logger.info("柜锁mqtt消费:" + messageStr);
-                    String replaceMess=messageStr.replace(" ","");
+                    String replaceMess = messageStr.replace(" ", "");
                     //坨机写指令返回数据
                     //坨机写指令返回数据
-                    if(replaceMess.length()==12){
-                        String command=replaceMess.substring(8,10);
+                    if (replaceMess.length() == 12) {
+                        String command = replaceMess.substring(8, 10);
                         //表示坨机成功
                         //表示坨机成功
-                        if(HexUtils.hexToInteger(command)==0){
+                        if (HexUtils.hexToInteger(command) == 0) {
                             //TODO 成功逻辑、、
                             //TODO 成功逻辑、、
-                            Long lockId = Long.parseLong(HexUtils.hexToInteger(replaceMess.substring(4,6))+ "");
+                            Long lockId = Long.parseLong(HexUtils.hexToInteger(replaceMess.substring(4, 6)) + "");
                             String[] prefix = steerPublishPrefix.split("/");
                             String[] prefix = steerPublishPrefix.split("/");
-                            if(prefix != null && prefix.length > 0){
+                            if (prefix != null && prefix.length > 0) {
                                 // 采集器编号
                                 // 采集器编号
-                                String relayCode = prefix[prefix.length-1];
+                                String relayCode = prefix[prefix.length - 1];
                                 TerminalRouter.routerMap.get("HxpLockService").onLine(relayCode + "/" + lockId);
                                 TerminalRouter.routerMap.get("HxpLockService").onLine(relayCode + "/" + lockId);
                             }
                             }
                         }
                         }
-                    //坨机读指令返回数据,用于在线监测
-                    }else if(replaceMess.length()==16){
+                        //坨机读指令返回数据,用于在线监测
+                    } else if (replaceMess.length() == 16) {
 //                        String command=replaceMess.substring(4,6);
 //                        String command=replaceMess.substring(4,6);
 //                        Long lockId = Long.parseLong(HexUtils.hexToInteger(command) + "");
 //                        Long lockId = Long.parseLong(HexUtils.hexToInteger(command) + "");
 //                        System.out.println("坨机编号");
 //                        System.out.println("坨机编号");
                         String[] prefix = steerPublishPrefix.split("/");
                         String[] prefix = steerPublishPrefix.split("/");
-                        if(prefix != null && prefix.length > 0){
+                        if (prefix != null && prefix.length > 0) {
                             // 采集器编号
                             // 采集器编号
-                            String relayCode = prefix[prefix.length-1];
+                            String relayCode = prefix[prefix.length - 1];
                             TerminalRouter.routerMap.get("HxpLockService").offLine(relayCode);
                             TerminalRouter.routerMap.get("HxpLockService").offLine(relayCode);
                         }
                         }
 
 
@@ -254,17 +256,16 @@ public class MqttConfig {
 
 
                 // TODO
                 // TODO
 //                MessageBody messageBody = JSONObject.parseObject(messageStr, MessageBody.class);
 //                MessageBody messageBody = JSONObject.parseObject(messageStr, MessageBody.class);
-
 //                mqttResHandler.deal(JSONUtil.toBean(msg,com.ffy.mqtt.model.Message.class));
 //                mqttResHandler.deal(JSONUtil.toBean(msg,com.ffy.mqtt.model.Message.class));
                 List<LabMessageEvent> labMessageEvents = labMessMap.get(receivedTopic);
                 List<LabMessageEvent> labMessageEvents = labMessMap.get(receivedTopic);
-                if(CollUtil.isEmpty(labMessageEvents)){
-                    return ;
+                if (CollUtil.isEmpty(labMessageEvents)) {
+                    return;
                 }
                 }
             }
             }
         };
         };
     }
     }
 
 
-    public static String byte2Hex(byte[] bytes){
+    public static String byte2Hex(byte[] bytes) {
         StringBuilder builder = new StringBuilder();
         StringBuilder builder = new StringBuilder();
         String temp;
         String temp;
         for (byte aByte : bytes) {
         for (byte aByte : bytes) {

+ 0 - 86
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/constants/MqttConstants.java

@@ -1,86 +0,0 @@
-package com.zd.laboratory.mqtt.constants;
-
-/**
- * mqtt常量类
- */
-public class MqttConstants {
-
-    public static final String MSG="支付成功,货道缺货,已做退款操作!";
-//    //支付成功topic
-//    public static final String PAY_SUCESS_SEND="renming/pay/";
-//    //apk版本发生改变
-//    public static final String APK_VERSION="renming/updateApk/";
-//    //广告发生改变
-//    public static final String ADVICE_="renming/advice/";
-//    //登录
-//    public static final String LOGIN_SCAN="renming/login/";
-//    //设备初始化
-//    public static final String INIT="renming/init/";
-
-
-    //实验室项目配置
-
-    //实验室信息变更通知 topic
-    public static final String LAB_SUB_INFO = "lab/subInfo";
-    //数据大屏数据改变通知 topic
-    public static final String LAB_BIG_VIEW = "lab/bigview";
-    //预警改变通知 topic
-    public static final String LAB_WRAN = "lab/wran";
-    //测点数据topic
-    public static final String LAB_FUNCTION_DATA = "lab/function/data";
-    //一体机消息推送 topic
-    public static final String LAB_ONEPC_SUB_NEWS = "lab/news";
-    //一体机消息推送apk版本升级 topic
-    public static final String LAB_ONEPC_SUB_APKUP = "lab/apkup";
-    //一体机消息推送配置变动 topic
-    public static final String LAB_ONEPC_SUB_UPCONFIG = "lab/upconfig";
-    //硬件状态变化 LAB_HARDWARE_DATA_SUB和LAB_VIDEO的合集
-    public static final String LAB_VIDEO_DATA = "lab/hardware/data";
-
-    //硬件状态变化,实验室为主体 (继电器)
-    public static final String LAB_HARDWARE_DATA_SUB = "lab/hardware/data/sub";
-    //视频、一体机上下线
-    public static final String LAB_VIDEO = "lab/video";
-
-    //硬件统计 好像不需要
-    public static final String LAB_HARDWARE_TOTAL = "lab/hardware/total";
-
-    //传感器
-    public static final String LAB_SENSOR = "lab/sensor";
-
-    // 一体机检查通知
-    public static final String LAB_CHECK = "lab/check";
-
-    // 一体机消息通知
-    public static final String LAB_CONTENT = "lab/content";
-
-    // 一体机轮播图变更通知
-    public static final String LAB_ROTATION = "lab/rotation";
-
-    //逃生指引线路通知
-    public static final String LAB_EXIT_LINE = "lab/exit/line";
-
-    //管控工作通知
-    public static final String LAB_MANAGE_WORK = "manage/work";
-
-    //大屏通知计划更新通知
-    public static final String LAB_BIG_VIEW_PLAN = "lab/bigview/plan";
-
-    //大屏安全检查更新通知
-    public static final String LAB_BIG_VIEW_CHECKAPPLY = "lab/bigview/checkApply";
-
-    //logo同步通知 topic
-    public static final String SYS_LOGO_CONFIG = "sys/logo";
-
-    // 化学品终端心跳 + {设备编号}
-    public static final String SYS_CHEMICAL_ON = "lab/chemical/";
-
-    // 化学品终端离线遗嘱 + {设备编号}
-    public static final String SYS_CHEMICAL_OFF = "lab/off-chemical/";
-    //坨机接收topic
-    public static final String HEAP_RECIVER = "lab/heap/";
-
-    // 柜锁操作成功topic  lab/cabinetLock/{subId}/{lockId}
-    public static final String CABINET_LOCK = "lab/cabinetLock/";
-
-}

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/hxp/HxpLockService.java

@@ -2,11 +2,11 @@ package com.zd.laboratory.mqtt.service.hxp;
 
 
 import com.zd.laboratory.mapper.HxpTerminalMapper;
 import com.zd.laboratory.mapper.HxpTerminalMapper;
 import com.zd.laboratory.mapper.LabHardwareMapper;
 import com.zd.laboratory.mapper.LabHardwareMapper;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
+import com.zd.model.constant.MqttConstants;
 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;
@@ -36,7 +36,7 @@ public class HxpLockService implements TerminalRouter {
                 MessageBody messageBody = new MessageBody();
                 MessageBody messageBody = new MessageBody();
                 messageBody.setData("柜锁操作成功");
                 messageBody.setData("柜锁操作成功");
                 logger.info("发送柜锁操作mqtt");
                 logger.info("发送柜锁操作mqtt");
-                commonSend.send(MqttConstants.SYS_LOGO_CONFIG + subId + "/" + lockId, messageBody, SendMode.ONCE);
+                commonSend.send(MqttConstants.TOPIC_SYS_LOGO_CONFIG + subId + "/" + lockId, messageBody, SendMode.ONCE);
             }
             }
         }
         }
     }
     }

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

@@ -11,17 +11,21 @@ import com.zd.laboratory.api.vo.SubFunction;
 import com.zd.laboratory.domain.LabHardware;
 import com.zd.laboratory.domain.LabHardware;
 import com.zd.laboratory.event.LabMessageEvent;
 import com.zd.laboratory.event.LabMessageEvent;
 import com.zd.laboratory.mqtt.config.MqttConfig;
 import com.zd.laboratory.mqtt.config.MqttConfig;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.EquipmentStatus;
 import com.zd.laboratory.mqtt.entiy.EquipmentStatus;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.SensorStatus;
 import com.zd.laboratory.mqtt.entiy.SensorStatus;
 import com.zd.laboratory.mqtt.entiy.SubHardwareStatus;
 import com.zd.laboratory.mqtt.entiy.SubHardwareStatus;
 import com.zd.laboratory.mqtt.enums.BigViewDataType;
 import com.zd.laboratory.mqtt.enums.BigViewDataType;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.enums.SendMode;
+import com.zd.model.constant.MqttConstants;
 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.stereotype.Service;
 import org.springframework.stereotype.Service;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 
 
 import java.util.*;
 import java.util.*;
 
 
@@ -57,7 +61,7 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(exitLineNotic);
         messageBody.setData(exitLineNotic);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_EXIT_LINE, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_EXIT_LINE, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -71,7 +75,7 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(bigViewDataType);
         messageBody.setData(bigViewDataType);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_BIG_VIEW, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_BIG_VIEW, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -87,7 +91,7 @@ public class SubMessageSendManager {
         }
         }
 
 
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_BIG_VIEW, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_BIG_VIEW, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -119,18 +123,18 @@ public class SubMessageSendManager {
             SubHardwareStatus subHardwareStatus = new SubHardwareStatus();
             SubHardwareStatus subHardwareStatus = new SubHardwareStatus();
             subHardwareStatus.setSubId(hardware.getSubjectId());
             subHardwareStatus.setSubId(hardware.getSubjectId());
             subHardwareStatus.setEquipmentStatus(equipmentStatus);
             subHardwareStatus.setEquipmentStatus(equipmentStatus);
-            String topic = MqttConstants.LAB_VIDEO_DATA + hardware.getSubjectId();
+            String topic = MqttConstants.TOPIC_LAB_VIDEO_DATA + hardware.getSubjectId();
             //发送实验室主题
             //发送实验室主题
             commonSend.send(topic, messageBody, SendMode.ONCE);
             commonSend.send(topic, messageBody, SendMode.ONCE);
             //发送以实验室为主体数据
             //发送以实验室为主体数据
             if (type == 1) {
             if (type == 1) {
-                commonSend.send(MqttConstants.LAB_HARDWARE_DATA_SUB, getMessageBody(subHardwareStatus), SendMode.ONCE);
+                commonSend.send(MqttConstants.TOPIC_LAB_HARDWARE_DATA_SUB, getMessageBody(subHardwareStatus), SendMode.ONCE);
             } else {
             } else {
-                commonSend.send(MqttConstants.LAB_VIDEO, getMessageBody(subHardwareStatus), SendMode.ONCE);
+                commonSend.send(MqttConstants.TOPIC_LAB_VIDEO, getMessageBody(subHardwareStatus), SendMode.ONCE);
             }
             }
         }
         }
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_VIDEO_DATA, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_VIDEO_DATA, messageBody, SendMode.ONCE);
     }
     }
 
 
 
 
@@ -141,7 +145,7 @@ public class SubMessageSendManager {
     public void sendNewHardwareUpdate(List<EquipmentStatus> equipmentStatus) {
     public void sendNewHardwareUpdate(List<EquipmentStatus> equipmentStatus) {
         MessageBody messageBody = getMessageBody(equipmentStatus);
         MessageBody messageBody = getMessageBody(equipmentStatus);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_VIDEO_DATA, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_VIDEO_DATA, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -152,7 +156,7 @@ public class SubMessageSendManager {
         if(null!=subjectId){
         if(null!=subjectId){
             MessageBody messageBody = getMessageBody(equipmentStatus);
             MessageBody messageBody = getMessageBody(equipmentStatus);
             //仅发送一次
             //仅发送一次
-            commonSend.send(MqttConstants.LAB_VIDEO_DATA+subjectId, messageBody, SendMode.ONCE);
+            commonSend.send(MqttConstants.TOPIC_LAB_VIDEO_DATA+subjectId, messageBody, SendMode.ONCE);
         }
         }
     }
     }
 
 
@@ -197,7 +201,7 @@ public class SubMessageSendManager {
         logger.error("@@@@@@@@" + json);
         logger.error("@@@@@@@@" + json);
         //发送事件
         //发送事件
         //本来使用mqtt接收,因为mqtt 每个客户端接受到都会处理,
         //本来使用mqtt接收,因为mqtt 每个客户端接受到都会处理,
-        List<LabMessageEvent> labMessageEvents = mqttConfig.getLabMessMap().get(MqttConstants.LAB_FUNCTION_DATA);
+        List<LabMessageEvent> labMessageEvents = mqttConfig.getLabMessMap().get(MqttConstants.TOPIC_LAB_FUNCTION_DATA);
         if (CollUtil.isNotEmpty(labMessageEvents)) {
         if (CollUtil.isNotEmpty(labMessageEvents)) {
             labMessageEvents.forEach(a -> {
             labMessageEvents.forEach(a -> {
                 SpringUtils.getApplicationContext().publishEvent(a.getNewLabMessageEvent(subFunction));
                 SpringUtils.getApplicationContext().publishEvent(a.getNewLabMessageEvent(subFunction));
@@ -207,7 +211,7 @@ public class SubMessageSendManager {
         messageBody.setData(subFunction);
         messageBody.setData(subFunction);
         //同时发送到对应实验室
         //同时发送到对应实验室
         sendFunctionUpdate(subFunction);
         sendFunctionUpdate(subFunction);
-        commonSend.send(MqttConstants.LAB_FUNCTION_DATA, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_FUNCTION_DATA, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -221,7 +225,7 @@ public class SubMessageSendManager {
         }
         }
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(BigViewDataType.SUB_WRAN);
         messageBody.setData(BigViewDataType.SUB_WRAN);
-        commonSend.send(MqttConstants.LAB_WRAN + id, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_WRAN + id, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -231,7 +235,7 @@ public class SubMessageSendManager {
     public void noticeFunctionToOneMachine() {
     public void noticeFunctionToOneMachine() {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(BigViewDataType.NOTICE_ONEPC_LOGO);
         messageBody.setData(BigViewDataType.NOTICE_ONEPC_LOGO);
-        commonSend.send(MqttConstants.SYS_LOGO_CONFIG, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_SYS_LOGO_CONFIG, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -241,7 +245,7 @@ public class SubMessageSendManager {
      * @return
      * @return
      */
      */
     private String getFunctionSubTopic(Long subId) {
     private String getFunctionSubTopic(Long subId) {
-        return Optional.ofNullable(subId).map(a -> MqttConstants.LAB_FUNCTION_DATA + subId).orElseThrow(() -> new ServiceException("实验室ID不能为空"));
+        return Optional.ofNullable(subId).map(a -> MqttConstants.TOPIC_LAB_FUNCTION_DATA + subId).orElseThrow(() -> new ServiceException("实验室ID不能为空"));
 
 
     }
     }
 
 
@@ -265,7 +269,7 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(map);
         messageBody.setData(map);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_ONEPC_SUB_NEWS + subId, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_ONEPC_SUB_NEWS + subId, messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -278,7 +282,7 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(object);
         messageBody.setData(object);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_ONEPC_SUB_APKUP + object.get("onepcHardwareNum"), messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_ONEPC_SUB_APKUP + object.get("onepcHardwareNum"), messageBody, SendMode.ONCE);
     }
     }
 
 
 
 
@@ -292,7 +296,7 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(object);
         messageBody.setData(object);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_ONEPC_SUB_UPCONFIG + object.get("onepcHardwareNum"), messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_ONEPC_SUB_UPCONFIG + object.get("onepcHardwareNum"), messageBody, SendMode.ONCE);
     }
     }
 
 
     /**
     /**
@@ -304,6 +308,6 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         MessageBody messageBody = new MessageBody();
         messageBody.setData(context);
         messageBody.setData(context);
         //仅发送一次
         //仅发送一次
-        commonSend.send(MqttConstants.LAB_SENSOR, messageBody, SendMode.ONCE);
+        commonSend.send(MqttConstants.TOPIC_LAB_SENSOR, messageBody, SendMode.ONCE);
     }
     }
 }
 }

+ 0 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/test/MqttTest.java

@@ -1,7 +1,6 @@
 package com.zd.laboratory.mqtt.test;
 package com.zd.laboratory.mqtt.test;
 
 
 import com.zd.laboratory.config.HardwareFunctionStatusConfig;
 import com.zd.laboratory.config.HardwareFunctionStatusConfig;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
 import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
 import org.springframework.boot.context.event.ApplicationStartedEvent;
 import org.springframework.boot.context.event.ApplicationStartedEvent;
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.ApplicationListener;

+ 92 - 92
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/AlarmLogServiceImpl.java

@@ -1,92 +1,92 @@
-//package com.zd.laboratory.service.impl;
-//
-//import com.zd.algorithm.api.alarm.entity.AlarmLog;
-//import com.zd.laboratory.mapper.AlarmLogMapper;
-//import com.zd.laboratory.service.IAlarmLogService;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * 电话报警推送日志Service业务层处理
-// *
-// * @author liubo
-// */
-//@Service
-//public class AlarmLogServiceImpl implements IAlarmLogService {
-//    @Autowired
-//    private AlarmLogMapper alarmLogMapper;
-//
-//    /**
-//     * 查询电话报警推送日志
-//     *
-//     * @param id 电话报警推送日志主键
-//     * @return 电话报警推送日志
-//     */
-//    @Override
-//    public AlarmLog selectAlarmLogById(Long id) {
-//        return alarmLogMapper.selectAlarmLogById(id);
-//    }
-//
-//    /**
-//     * 查询电话报警推送日志列表
-//     *
-//     * @param alarmLog 电话报警推送日志
-//     * @return 电话报警推送日志
-//     */
-//    @Override
-//    public List<AlarmLog> selectAlarmLogList(AlarmLog alarmLog) {
-//        return alarmLogMapper.selectAlarmLogList(alarmLog);
-//    }
-//
-//    /**
-//     * 新增电话报警推送日志
-//     *
-//     * @param alarmLog 电话报警推送日志
-//     * @return 结果
-//     */
-//    @Override
-//    public int insertAlarmLog(AlarmLog alarmLog) {
-//        return alarmLogMapper.insertAlarmLog(alarmLog);
-//    }
-//
-//    /**
-//     * 修改电话报警推送日志
-//     *
-//     * @param alarmLog 电话报警推送日志
-//     * @return 结果
-//     */
-//    @Override
-//    public int updateAlarmLog(AlarmLog alarmLog) {
-//        return alarmLogMapper.updateAlarmLog(alarmLog);
-//    }
-//
-//    /**
-//     * 批量删除电话报警推送日志
-//     *
-//     * @param ids 需要删除的电话报警推送日志主键
-//     * @return 结果
-//     */
-//    @Override
-//    public int deleteAlarmLogByIds(Long[] ids) {
-//        return alarmLogMapper.deleteAlarmLogByIds(ids);
-//    }
-//
-//    /**
-//     * 删除电话报警推送日志信息
-//     *
-//     * @param id 电话报警推送日志主键
-//     * @return 结果
-//     */
-//    @Override
-//    public int deleteAlarmLogById(Long id) {
-//        return alarmLogMapper.deleteAlarmLogById(id);
-//    }
-//
-//    @Override
-//    public List<AlarmLog> selectNoBackAlarmLogList(Map<String, Object> params) {
-//        return alarmLogMapper.selectNoBackAlarmLogList(params);
-//    }
-//}
+package com.zd.laboratory.service.impl;
+
+import com.zd.algorithm.api.alarm.entity.AlarmLog;
+import com.zd.laboratory.mapper.AlarmLogMapper;
+import com.zd.laboratory.service.IAlarmLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 电话报警推送日志Service业务层处理
+ *
+ * @author liubo
+ */
+@Service
+public class AlarmLogServiceImpl implements IAlarmLogService {
+    @Autowired
+    private AlarmLogMapper alarmLogMapper;
+
+    /**
+     * 查询电话报警推送日志
+     *
+     * @param id 电话报警推送日志主键
+     * @return 电话报警推送日志
+     */
+    @Override
+    public AlarmLog selectAlarmLogById(Long id) {
+        return alarmLogMapper.selectAlarmLogById(id);
+    }
+
+    /**
+     * 查询电话报警推送日志列表
+     *
+     * @param alarmLog 电话报警推送日志
+     * @return 电话报警推送日志
+     */
+    @Override
+    public List<AlarmLog> selectAlarmLogList(AlarmLog alarmLog) {
+        return alarmLogMapper.selectAlarmLogList(alarmLog);
+    }
+
+    /**
+     * 新增电话报警推送日志
+     *
+     * @param alarmLog 电话报警推送日志
+     * @return 结果
+     */
+    @Override
+    public int insertAlarmLog(AlarmLog alarmLog) {
+        return alarmLogMapper.insertAlarmLog(alarmLog);
+    }
+
+    /**
+     * 修改电话报警推送日志
+     *
+     * @param alarmLog 电话报警推送日志
+     * @return 结果
+     */
+    @Override
+    public int updateAlarmLog(AlarmLog alarmLog) {
+        return alarmLogMapper.updateAlarmLog(alarmLog);
+    }
+
+    /**
+     * 批量删除电话报警推送日志
+     *
+     * @param ids 需要删除的电话报警推送日志主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAlarmLogByIds(Long[] ids) {
+        return alarmLogMapper.deleteAlarmLogByIds(ids);
+    }
+
+    /**
+     * 删除电话报警推送日志信息
+     *
+     * @param id 电话报警推送日志主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAlarmLogById(Long id) {
+        return alarmLogMapper.deleteAlarmLogById(id);
+    }
+
+    @Override
+    public List<AlarmLog> selectNoBackAlarmLogList(Map<String, Object> params) {
+        return alarmLogMapper.selectNoBackAlarmLogList(params);
+    }
+}

+ 67 - 67
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckMachineMsgServiceImpl.java

@@ -14,11 +14,11 @@ import com.zd.laboratory.domain.LabCheckRecord;
 import com.zd.laboratory.domain.LabCheckRecordDetails;
 import com.zd.laboratory.domain.LabCheckRecordDetails;
 import com.zd.laboratory.domain.vo.LabCheckMachineMsgVo;
 import com.zd.laboratory.domain.vo.LabCheckMachineMsgVo;
 import com.zd.laboratory.mapper.LabCheckMachineMsgMapper;
 import com.zd.laboratory.mapper.LabCheckMachineMsgMapper;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.*;
 import com.zd.laboratory.service.*;
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import com.zd.model.entity.SysUser;
 import com.zd.model.entity.SysUser;
@@ -28,7 +28,6 @@ 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.stereotype.Service;
 import org.springframework.stereotype.Service;
-
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -92,7 +91,7 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
             checkMachineMsg.setDetails(labCheckRecordDetailsService.selectLabCheckRecordDetailsList(labCheckRecordDetails));
             checkMachineMsg.setDetails(labCheckRecordDetailsService.selectLabCheckRecordDetailsList(labCheckRecordDetails));
 
 
             labCheckRecord = labCheckRecordService.selectLabCheckRecordById(checkMachineMsg.getCheckRecordId());
             labCheckRecord = labCheckRecordService.selectLabCheckRecordById(checkMachineMsg.getCheckRecordId());
-            if(labCheckRecord != null){
+            if (labCheckRecord != null) {
                 checkMachineMsg.setCheckRecord(labCheckRecord);
                 checkMachineMsg.setCheckRecord(labCheckRecord);
 
 
             }
             }
@@ -100,7 +99,7 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
 
             String str = "  学院于check_date对你实验室实施了安全管理现场检查,共发现了count个整改项(见整改详情)。请逐一对照、分析原因、采取有效措施实施整改,并于check_date在系统里提交整改证明材料和整改报告。\n" +
             String str = "  学院于check_date对你实验室实施了安全管理现场检查,共发现了count个整改项(见整改详情)。请逐一对照、分析原因、采取有效措施实施整改,并于check_date在系统里提交整改证明材料和整改报告。\n" +
                     "  请你实验室务必高度重视,积极采取有效措施,切实加强对实验室的安全管理。同时,要举一反三,对实验室定期开展安全自查与整改,不断提升实验室安全工作水平。";
                     "  请你实验室务必高度重视,积极采取有效措施,切实加强对实验室的安全管理。同时,要举一反三,对实验室定期开展安全自查与整改,不断提升实验室安全工作水平。";
-            str = str.replaceAll("check_date", checkDateStr).replaceAll("count", checkMachineMsg.getDetails().size()+"");
+            str = str.replaceAll("check_date", checkDateStr).replaceAll("count", checkMachineMsg.getDetails().size() + "");
 
 
             checkMachineMsg.setNotifyMsg(str);
             checkMachineMsg.setNotifyMsg(str);
             checkMachineMsg.setCheckDateStr(checkDateStr);
             checkMachineMsg.setCheckDateStr(checkDateStr);
@@ -112,7 +111,8 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
 
     /**
     /**
      * 新增一体机安全检查通知消息
      * 新增一体机安全检查通知消息
-     * @param type 通知类型 1 一般整改,2 重大整改
+     *
+     * @param type          通知类型 1 一般整改,2 重大整改
      * @param checkRecordId 安全检查ID
      * @param checkRecordId 安全检查ID
      * @return 结果
      * @return 结果
      */
      */
@@ -122,11 +122,11 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
 
         // 查询配置信息
         // 查询配置信息
         LabCheckConfig checkConfigInfo = labCheckConfigService.getCheckConfigInfo();
         LabCheckConfig checkConfigInfo = labCheckConfigService.getCheckConfigInfo();
-        if(checkConfigInfo != null){
+        if (checkConfigInfo != null) {
             boolean senMsg = false;
             boolean senMsg = false;
             LabCheckRecord checkRecord = labCheckRecordService.selectLabCheckRecordById(checkRecordId);
             LabCheckRecord checkRecord = labCheckRecordService.selectLabCheckRecordById(checkRecordId);
 
 
-            if(checkRecord == null){
+            if (checkRecord == null) {
                 logger.error("发送消息通知失败,ID无效");
                 logger.error("发送消息通知失败,ID无效");
             }
             }
             // 查询实验室负责人
             // 查询实验室负责人
@@ -134,9 +134,9 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
 
             LabCheckMachineMsg labCheckMachineMsg = null;
             LabCheckMachineMsg labCheckMachineMsg = null;
             LabMessageContent labMessageContent = null;
             LabMessageContent labMessageContent = null;
-            if(type == 1){
+            if (type == 1) {
                 // 1.短信通知
                 // 1.短信通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckSmsMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckSmsMsg())) {
                     // 查询负责人手机号
                     // 查询负责人手机号
 //                    ResultData<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
 //                    ResultData<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
 //                    if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
 //                    if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
@@ -144,14 +144,14 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     // 修改为 提交输入的手机号
                     // 修改为 提交输入的手机号
 
 
                     if (StringUtils.isNotBlank(checkRecord.getFzrLxfs())) {
                     if (StringUtils.isNotBlank(checkRecord.getFzrLxfs())) {
-                        AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, new String[]{checkRecord.getFzrLxfs()}, SendTypes.SMS+"", checkConfigInfo.getCheckSmsMsg());
+                        AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, new String[]{checkRecord.getFzrLxfs()}, SendTypes.SMS + "", checkConfigInfo.getCheckSmsMsg());
                         MessageBody messageBody = new MessageBody();
                         MessageBody messageBody = new MessageBody();
                         messageBody.setData(alarmEntrty);
                         messageBody.setData(alarmEntrty);
-                        commonSend.send("alarm/"+checkRecordId,messageBody, SendMode.DISTINCT);
+                        commonSend.send(MqttConstants.TOPIC_ALERT + checkRecordId, messageBody, SendMode.DISTINCT);
                     }
                     }
                 }
                 }
                 // 2.一体机通知
                 // 2.一体机通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckAioMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckAioMsg())) {
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setType(type);
                     labCheckMachineMsg.setType(type);
@@ -161,29 +161,29 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     senMsg = true;
                     senMsg = true;
                 }
                 }
                 // 3.小程序消息通知
                 // 3.小程序消息通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckAppMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckAppMsg())) {
                     labMessageContent = new LabMessageContent();
                     labMessageContent = new LabMessageContent();
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
                     labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
-                    labMessageContent.setUserIds(userId+"");
+                    labMessageContent.setUserIds(userId + "");
 
 
                 }
                 }
-            }else if(type == 2){
+            } else if (type == 2) {
                 // 1.短信通知
                 // 1.短信通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifySmsMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifySmsMsg())) {
                     // 查询负责人手机号
                     // 查询负责人手机号
                     R<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
                     R<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
                     if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
                     if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
-                        AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, new String[]{user.getData().getPhonenumber()}, SendTypes.SMS+"", checkConfigInfo.getRectifySmsMsg());
+                        AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, new String[]{user.getData().getPhonenumber()}, SendTypes.SMS + "", checkConfigInfo.getRectifySmsMsg());
                         MessageBody messageBody = new MessageBody();
                         MessageBody messageBody = new MessageBody();
                         messageBody.setData(alarmEntrty);
                         messageBody.setData(alarmEntrty);
-                        commonSend.send("alarm/"+checkRecordId,messageBody, SendMode.DISTINCT);
+                        commonSend.send(MqttConstants.TOPIC_ALERT + checkRecordId, messageBody, SendMode.DISTINCT);
                     }
                     }
                 }
                 }
                 // 2.一体机通知
                 // 2.一体机通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifyAioMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifyAioMsg())) {
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setType(type);
                     labCheckMachineMsg.setType(type);
@@ -193,28 +193,28 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     senMsg = true;
                     senMsg = true;
                 }
                 }
                 // 3.小程序消息通知
                 // 3.小程序消息通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifyAppMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifyAppMsg())) {
                     labMessageContent = new LabMessageContent();
                     labMessageContent = new LabMessageContent();
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
                     labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
-                    labMessageContent.setUserIds(userId+"");
+                    labMessageContent.setUserIds(userId + "");
                 }
                 }
             }
             }
 
 
-            if(labCheckMachineMsg != null){
+            if (labCheckMachineMsg != null) {
                 labCheckMachineMsg.setStatus(1);
                 labCheckMachineMsg.setStatus(1);
                 labCheckMachineMsgMapper.insertLabCheckMachineMsg(labCheckMachineMsg);
                 labCheckMachineMsgMapper.insertLabCheckMachineMsg(labCheckMachineMsg);
             }
             }
-            if(labMessageContent != null){
+            if (labMessageContent != null) {
                 labMessageContentService.insertLabMessageContent(labMessageContent);
                 labMessageContentService.insertLabMessageContent(labMessageContent);
             }
             }
-            if(senMsg){
+            if (senMsg) {
                 MessageBody messageBody = new MessageBody();
                 MessageBody messageBody = new MessageBody();
                 messageBody.setData(labCheckMachineMsg);
                 messageBody.setData(labCheckMachineMsg);
                 //仅发送一次
                 //仅发送一次
-                commonSend.send(MqttConstants.LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
+                commonSend.send(MqttConstants.TOPIC_LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
             }
             }
         }
         }
     }
     }
@@ -228,13 +228,13 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
     public void insertLabCheckMachineJcz(int type, long checkRecordId) {
     public void insertLabCheckMachineJcz(int type, long checkRecordId) {
         // 查询配置信息
         // 查询配置信息
         LabCheckConfig checkConfigInfo = labCheckConfigService.getCheckConfigInfo();
         LabCheckConfig checkConfigInfo = labCheckConfigService.getCheckConfigInfo();
-        if(checkConfigInfo != null){
+        if (checkConfigInfo != null) {
             boolean senMsg = false;
             boolean senMsg = false;
             //String count="您有新的整改报告需要审批,请注意查看";//发送的内容
             //String count="您有新的整改报告需要审批,请注意查看";//发送的内容
 
 
             LabCheckRecord checkRecord = labCheckRecordService.selectLabCheckRecordById(checkRecordId);
             LabCheckRecord checkRecord = labCheckRecordService.selectLabCheckRecordById(checkRecordId);
 
 
-            if(checkRecord == null){
+            if (checkRecord == null) {
                 logger.error("发送消息通知失败,ID无效");
                 logger.error("发送消息通知失败,ID无效");
             }
             }
             // 查询实验室负责人
             // 查询实验室负责人
@@ -242,9 +242,9 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
 
             LabCheckMachineMsg labCheckMachineMsg = null;
             LabCheckMachineMsg labCheckMachineMsg = null;
             LabMessageContent labMessageContent = null;
             LabMessageContent labMessageContent = null;
-            if(type == 1){
+            if (type == 1) {
                 // 1.短信通知
                 // 1.短信通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckSmsMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckSmsMsg())) {
                     // 查询负责人手机号
                     // 查询负责人手机号
 //                    ResultData<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
 //                    ResultData<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
 //                    if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
 //                    if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
@@ -259,7 +259,7 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     }*/
                     }*/
                 }
                 }
                 // 2.一体机通知
                 // 2.一体机通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckAioMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckAioMsg())) {
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setType(type);
                     labCheckMachineMsg.setType(type);
@@ -269,17 +269,17 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     senMsg = true;
                     senMsg = true;
                 }
                 }
                 // 3.小程序消息通知
                 // 3.小程序消息通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckAppMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckAppMsg())) {
                     labMessageContent = new LabMessageContent();
                     labMessageContent = new LabMessageContent();
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
                     labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
                     //labMessageContent.setContent(count);
                     //labMessageContent.setContent(count);
-                    labMessageContent.setUserIds(userId+"");
+                    labMessageContent.setUserIds(userId + "");
 
 
                 }
                 }
-            }else if(type == 2){
+            } else if (type == 2) {
                 // 1.短信通知
                 // 1.短信通知
                 /*if(StringUtils.isNotBlank(checkConfigInfo.getRectifySmsMsg())){
                 /*if(StringUtils.isNotBlank(checkConfigInfo.getRectifySmsMsg())){
                     // 查询负责人手机号
                     // 查询负责人手机号
@@ -292,7 +292,7 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     }
                     }
                 }*/
                 }*/
                 // 2.一体机通知
                 // 2.一体机通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifyAioMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifyAioMsg())) {
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setType(type);
                     labCheckMachineMsg.setType(type);
@@ -302,36 +302,36 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     senMsg = true;
                     senMsg = true;
                 }
                 }
                 // 3.小程序消息通知
                 // 3.小程序消息通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifyAppMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifyAppMsg())) {
                     labMessageContent = new LabMessageContent();
                     labMessageContent = new LabMessageContent();
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setContent(checkConfigInfo.getRectifyAppMsg());
                     labMessageContent.setContent(checkConfigInfo.getRectifyAppMsg());
-                    labMessageContent.setUserIds(userId+"");
+                    labMessageContent.setUserIds(userId + "");
                 }
                 }
             }
             }
 
 
-            if(labCheckMachineMsg != null){
+            if (labCheckMachineMsg != null) {
                 //检查消息通知是否存在
                 //检查消息通知是否存在
-                LabCheckMachineMsg lmm= new LabCheckMachineMsg();
+                LabCheckMachineMsg lmm = new LabCheckMachineMsg();
                 lmm.setCheckRecordId(checkRecordId);
                 lmm.setCheckRecordId(checkRecordId);
                 List<LabCheckMachineMsg> list = labCheckMachineMsgMapper.selectLabCheckMachineMsgList(lmm);
                 List<LabCheckMachineMsg> list = labCheckMachineMsgMapper.selectLabCheckMachineMsgList(lmm);
-                if(list.size()==0){
+                if (list.size() == 0) {
                     senMsg = true;
                     senMsg = true;
                     labCheckMachineMsg.setStatus(1);
                     labCheckMachineMsg.setStatus(1);
                     labCheckMachineMsgMapper.insertLabCheckMachineMsg(labCheckMachineMsg);
                     labCheckMachineMsgMapper.insertLabCheckMachineMsg(labCheckMachineMsg);
                 }
                 }
 
 
             }
             }
-            if(labMessageContent != null){
+            if (labMessageContent != null) {
                 labMessageContentService.insertLabMessageContent(labMessageContent);
                 labMessageContentService.insertLabMessageContent(labMessageContent);
             }
             }
-            if(senMsg){
+            if (senMsg) {
                 MessageBody messageBody = new MessageBody();
                 MessageBody messageBody = new MessageBody();
                 messageBody.setData(labCheckMachineMsg);
                 messageBody.setData(labCheckMachineMsg);
                 //仅发送一次
                 //仅发送一次
-                commonSend.send(MqttConstants.LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
+                commonSend.send(MqttConstants.TOPIC_LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
             }
             }
         }
         }
     }
     }
@@ -348,19 +348,19 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
     public void insertLabCheckMachineTjz(int type, long checkRecordId, int status) {
     public void insertLabCheckMachineTjz(int type, long checkRecordId, int status) {
         // 查询配置信息
         // 查询配置信息
         LabCheckConfig checkConfigInfo = labCheckConfigService.getCheckConfigInfo();
         LabCheckConfig checkConfigInfo = labCheckConfigService.getCheckConfigInfo();
-        if(checkConfigInfo != null){
+        if (checkConfigInfo != null) {
             boolean senMsg = false;
             boolean senMsg = false;
-            String count=null;//发送的内容
-            if(status==1){//提交时
+            String count = null;//发送的内容
+            if (status == 1) {//提交时
 
 
-            }else if(status==2){
-                count="您的整改报告未能通过审批,请注意查看";
-            }else if(status==4){
-                count="您的整改报告通过了审批,请注意查看";
+            } else if (status == 2) {
+                count = "您的整改报告未能通过审批,请注意查看";
+            } else if (status == 4) {
+                count = "您的整改报告通过了审批,请注意查看";
             }
             }
             LabCheckRecord checkRecord = labCheckRecordService.selectLabCheckRecordById(checkRecordId);
             LabCheckRecord checkRecord = labCheckRecordService.selectLabCheckRecordById(checkRecordId);
 
 
-            if(checkRecord == null){
+            if (checkRecord == null) {
                 logger.error("发送消息通知失败,ID无效");
                 logger.error("发送消息通知失败,ID无效");
             }
             }
             // 查询实验室负责人
             // 查询实验室负责人
@@ -368,9 +368,9 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
 
             LabCheckMachineMsg labCheckMachineMsg = null;
             LabCheckMachineMsg labCheckMachineMsg = null;
             LabMessageContent labMessageContent = null;
             LabMessageContent labMessageContent = null;
-            if(type == 1){
+            if (type == 1) {
                 // 1.短信通知
                 // 1.短信通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckSmsMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckSmsMsg())) {
                     // 查询负责人手机号
                     // 查询负责人手机号
 //                    ResultData<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
 //                    ResultData<SysUser> user = remoteUserService.getUserInfoByUserId(userId, SecurityConstants.INNER);
 //                    if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
 //                    if (user.getCode() == 200 && user.getData() != null && StringUtils.isNotBlank(user.getData().getPhonenumber())) {
@@ -385,7 +385,7 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     }*/
                     }*/
                 }
                 }
                 // 2.一体机通知
                 // 2.一体机通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckAioMsg()) && status==1){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckAioMsg()) && status == 1) {
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setType(type);
                     labCheckMachineMsg.setType(type);
@@ -396,17 +396,17 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     senMsg = true;
                     senMsg = true;
                 }
                 }
                 // 3.小程序消息通知
                 // 3.小程序消息通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getCheckAppMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getCheckAppMsg())) {
                     labMessageContent = new LabMessageContent();
                     labMessageContent = new LabMessageContent();
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setMessClass(1);
                     //labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
                     //labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
-                    labMessageContent.setContent(count!=null?count:checkConfigInfo.getCheckAppMsg());
-                    labMessageContent.setUserIds(userId+"");
+                    labMessageContent.setContent(count != null ? count : checkConfigInfo.getCheckAppMsg());
+                    labMessageContent.setUserIds(userId + "");
 
 
                 }
                 }
-            }else if(type == 2){
+            } else if (type == 2) {
                 // 1.短信通知
                 // 1.短信通知
                 /*if(StringUtils.isNotBlank(checkConfigInfo.getRectifySmsMsg())){
                 /*if(StringUtils.isNotBlank(checkConfigInfo.getRectifySmsMsg())){
                     // 查询负责人手机号
                     // 查询负责人手机号
@@ -419,7 +419,7 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     }
                     }
                 }*/
                 }*/
                 // 2.一体机通知
                 // 2.一体机通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifyAioMsg()) && status==1){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifyAioMsg()) && status == 1) {
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg = new LabCheckMachineMsg();
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setCheckRecordId(checkRecordId);
                     labCheckMachineMsg.setType(type);
                     labCheckMachineMsg.setType(type);
@@ -430,36 +430,36 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
                     senMsg = true;
                     senMsg = true;
                 }
                 }
                 // 3.小程序消息通知
                 // 3.小程序消息通知
-                if(StringUtils.isNotBlank(checkConfigInfo.getRectifyAppMsg())){
+                if (StringUtils.isNotBlank(checkConfigInfo.getRectifyAppMsg())) {
                     labMessageContent = new LabMessageContent();
                     labMessageContent = new LabMessageContent();
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendMode(2);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setSendRange(3);
                     labMessageContent.setMessClass(1);
                     labMessageContent.setMessClass(1);
                     //labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
                     //labMessageContent.setContent(checkConfigInfo.getCheckAppMsg());
-                    labMessageContent.setContent(count!=null?count:checkConfigInfo.getRectifyAppMsg());
-                    labMessageContent.setUserIds(userId+"");
+                    labMessageContent.setContent(count != null ? count : checkConfigInfo.getRectifyAppMsg());
+                    labMessageContent.setUserIds(userId + "");
                 }
                 }
             }
             }
 
 
-            if(labCheckMachineMsg != null && status==1){
+            if (labCheckMachineMsg != null && status == 1) {
                 //检查消息通知是否存在
                 //检查消息通知是否存在
-                LabCheckMachineMsg lmm= new LabCheckMachineMsg();
+                LabCheckMachineMsg lmm = new LabCheckMachineMsg();
                 lmm.setCheckRecordId(checkRecordId);
                 lmm.setCheckRecordId(checkRecordId);
                 List<LabCheckMachineMsg> list = labCheckMachineMsgMapper.selectLabCheckMachineMsgList(lmm);
                 List<LabCheckMachineMsg> list = labCheckMachineMsgMapper.selectLabCheckMachineMsgList(lmm);
-                if(list.size()==0){
+                if (list.size() == 0) {
                     senMsg = true;
                     senMsg = true;
                     labCheckMachineMsg.setStatus(1);
                     labCheckMachineMsg.setStatus(1);
                     labCheckMachineMsgMapper.insertLabCheckMachineMsg(labCheckMachineMsg);
                     labCheckMachineMsgMapper.insertLabCheckMachineMsg(labCheckMachineMsg);
                 }
                 }
             }
             }
-            if(labMessageContent != null){
+            if (labMessageContent != null) {
                 labMessageContentService.insertLabMessageContent(labMessageContent);
                 labMessageContentService.insertLabMessageContent(labMessageContent);
             }
             }
-            if(senMsg){
+            if (senMsg) {
                 MessageBody messageBody = new MessageBody();
                 MessageBody messageBody = new MessageBody();
                 messageBody.setData(labCheckMachineMsg);
                 messageBody.setData(labCheckMachineMsg);
                 //仅发送一次
                 //仅发送一次
-                commonSend.send(MqttConstants.LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
+                commonSend.send(MqttConstants.TOPIC_LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
             }
             }
         }
         }
     }
     }

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

@@ -3,6 +3,7 @@ package com.zd.laboratory.service.impl;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.annotation.DataScope;
@@ -11,7 +12,6 @@ import com.zd.common.core.utils.SaveUtil;
 
 
 import com.zd.laboratory.domain.LabCheckRecord;
 import com.zd.laboratory.domain.LabCheckRecord;
 import com.zd.laboratory.domain.vo.LabCheckRecordReleaseVO;
 import com.zd.laboratory.domain.vo.LabCheckRecordReleaseVO;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.ILabCheckMachineMsgService;
 import com.zd.laboratory.service.ILabCheckMachineMsgService;
@@ -112,7 +112,7 @@ public class LabCheckRecordReleaseServiceImpl implements ILabCheckRecordReleaseS
 
 
         if(id>0){
         if(id>0){
             //3 有新的发布信息
             //3 有新的发布信息
-            commonSend.send(MqttConstants.LAB_BIG_VIEW_CHECKAPPLY, new MessageBody("有新的检查发布。", 3));
+            commonSend.send(MqttConstants.TOPIC_LAB_BIG_VIEW_CHECKAPPLY, new MessageBody("有新的检查发布。", 3));
         }
         }
         return id;
         return id;
     }
     }

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

@@ -15,13 +15,13 @@ import com.zd.laboratory.domain.vo.LabCheckRecordVO;
 import com.zd.laboratory.domain.vo.LabSecurityApplyVO;
 import com.zd.laboratory.domain.vo.LabSecurityApplyVO;
 import com.zd.laboratory.domain.vo.LabSubjectVO;
 import com.zd.laboratory.domain.vo.LabSubjectVO;
 import com.zd.laboratory.mapper.*;
 import com.zd.laboratory.mapper.*;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.ILabCheckRecordReleaseService;
 import com.zd.laboratory.service.ILabCheckRecordReleaseService;
 import com.zd.laboratory.service.ILabCheckRecordService;
 import com.zd.laboratory.service.ILabCheckRecordService;
 import com.zd.laboratory.service.ILabMessageContentService;
 import com.zd.laboratory.service.ILabMessageContentService;
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.entity.SysUser;
 import com.zd.model.entity.SysUser;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
@@ -319,7 +319,7 @@ public class LabCheckRecordServiceImpl implements ILabCheckRecordService
             // 不确定前端传值是否有实验室ID 故重新查询保证
             // 不确定前端传值是否有实验室ID 故重新查询保证
             LabCheckRecord checkRecord = labCheckRecordMapper.selectLabCheckRecordById(labCheckRecordVo.getId());
             LabCheckRecord checkRecord = labCheckRecordMapper.selectLabCheckRecordById(labCheckRecordVo.getId());
             //仅发送一次
             //仅发送一次
-            commonSend.send(MqttConstants.LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
+            commonSend.send(MqttConstants.TOPIC_LAB_CHECK + checkRecord.getLaboratoryId(), messageBody, SendMode.ONCE);
         }
         }
 
 
         return id;
         return id;

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

@@ -5,9 +5,9 @@ import com.zd.common.core.utils.SecurityUtils;
 import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.api.entity.LabMessageContent;
 import com.zd.laboratory.domain.LabContentMachineMsg;
 import com.zd.laboratory.domain.LabContentMachineMsg;
 import com.zd.laboratory.mapper.LabContentMachineMsgMapper;
 import com.zd.laboratory.mapper.LabContentMachineMsgMapper;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.ILabContentMachineMsgService;
 import com.zd.laboratory.service.ILabContentMachineMsgService;
+import com.zd.model.constant.MqttConstants;
 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;
@@ -119,7 +119,7 @@ public class LabContentMachineMsgServiceImpl implements ILabContentMachineMsgSer
             insertLabContentMachineMsg(labContentMachineMsg);
             insertLabContentMachineMsg(labContentMachineMsg);
 
 
             // 生成一条通知一个,此处不应该有重复的实验室ID
             // 生成一条通知一个,此处不应该有重复的实验室ID
-            commonSend.send(MqttConstants.LAB_CONTENT + subId, "收到一条新的消息通知!");
+            commonSend.send(MqttConstants.TOPIC_LAB_CONTENT + subId, "收到一条新的消息通知!");
             logger.info("发送实验室一体机消息通知:" + subId);
             logger.info("发送实验室一体机消息通知:" + subId);
         }
         }
 
 

+ 103 - 104
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabGradeManageRecordServiceImpl.java

@@ -17,12 +17,12 @@ import com.zd.laboratory.domain.LabGradeManageRuleUser;
 import com.zd.laboratory.domain.LabMessageDynamic;
 import com.zd.laboratory.domain.LabMessageDynamic;
 import com.zd.laboratory.domain.vo.LabManageWorkChartVo;
 import com.zd.laboratory.domain.vo.LabManageWorkChartVo;
 import com.zd.laboratory.mapper.*;
 import com.zd.laboratory.mapper.*;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.ILabGradeManageRecordService;
 import com.zd.laboratory.service.ILabGradeManageRecordService;
 import com.zd.laboratory.service.ILabSubjectService;
 import com.zd.laboratory.service.ILabSubjectService;
 import com.zd.laboratory.utils.word.WordUtils;
 import com.zd.laboratory.utils.word.WordUtils;
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.entity.SysDept;
 import com.zd.model.entity.SysDept;
@@ -34,7 +34,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.*;
@@ -90,37 +89,36 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
         labGradeManageRecord.setDetail(labGradeManageRecordDetailMapper.selectLabGradeManageRecordDetailByRecordId(id));
         labGradeManageRecord.setDetail(labGradeManageRecordDetailMapper.selectLabGradeManageRecordDetailByRecordId(id));
         // 列出规则制定的所有人员- 沙士比鸭
         // 列出规则制定的所有人员- 沙士比鸭
-        if(labGradeManageRecord.getStatus() == 0){
+        if (labGradeManageRecord.getStatus() == 0) {
             LabGradeManageRuleUser ruleUser = labGradeManageRuleUserMapper.selectLabGradeManageRuleUserById(labGradeManageRecord.getRuleUserId());
             LabGradeManageRuleUser ruleUser = labGradeManageRuleUserMapper.selectLabGradeManageRuleUserById(labGradeManageRecord.getRuleUserId());
-            if(StringUtils.isNull(ruleUser)){
-                throw new ServiceException("管控工作已失效或被删除!",504);
+            if (StringUtils.isNull(ruleUser)) {
+                throw new ServiceException("管控工作已失效或被删除!", 504);
             }
             }
             List<Long> subIds = labGradeManageMapper.selectSubIdsByManageId(ruleUser.getGradeManageId());
             List<Long> subIds = labGradeManageMapper.selectSubIdsByManageId(ruleUser.getGradeManageId());
 
 
             List<Long> users = new ArrayList<>();
             List<Long> users = new ArrayList<>();
-            if(ruleUser.getType() == 3){
-                users.addAll( Arrays.asList(ruleUser.getUserIds() .split(",")).stream().map(s -> (Long.parseLong(s.trim()))).collect(Collectors.toList()));
-            }else if(ruleUser.getType() == 1){
+            if (ruleUser.getType() == 3) {
+                users.addAll(Arrays.asList(ruleUser.getUserIds().split(",")).stream().map(s -> (Long.parseLong(s.trim()))).collect(Collectors.toList()));
+            } else if (ruleUser.getType() == 1) {
                 List<Map<String, Long>> datas = labSubjectMapper.selectLabAdminByIds(subIds);
                 List<Map<String, Long>> datas = labSubjectMapper.selectLabAdminByIds(subIds);
                 datas.forEach(d -> {
                 datas.forEach(d -> {
                     users.add(d.get("adminId"));
                     users.add(d.get("adminId"));
                 });
                 });
-            }else if(ruleUser.getType() == 2){
+            } else if (ruleUser.getType() == 2) {
                 List<Map<String, Long>> datas = labSubjectAccessRecordMapper.selectJoinUsers(subIds, ruleUser.getUpdateTime());
                 List<Map<String, Long>> datas = labSubjectAccessRecordMapper.selectJoinUsers(subIds, ruleUser.getUpdateTime());
                 datas.forEach(d -> {
                 datas.forEach(d -> {
                     users.add(d.get("userId"));
                     users.add(d.get("userId"));
                 });
                 });
-            }else if(ruleUser.getType() == 4){
+            } else if (ruleUser.getType() == 4) {
                 List<Map<String, Long>> datas = labSecurityApplyMapper.selectApplyListBySubIds(subIds);
                 List<Map<String, Long>> datas = labSecurityApplyMapper.selectApplyListBySubIds(subIds);
                 datas.forEach(d -> {
                 datas.forEach(d -> {
                     users.add(d.get("userId"));
                     users.add(d.get("userId"));
                 });
                 });
             }
             }
-            if(users.size() > 0){
+            if (users.size() > 0) {
                 labGradeManageRecord.setAllUserName(labGradeManageRuleUserMapper.selectUserNameByUserIds(users));
                 labGradeManageRecord.setAllUserName(labGradeManageRuleUserMapper.selectUserNameByUserIds(users));
             }
             }
         }
         }
-
         return labGradeManageRecord;
         return labGradeManageRecord;
     }
     }
 
 
@@ -131,7 +129,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
      * @return 管控执行记录
      * @return 管控执行记录
      */
      */
     @Override
     @Override
-    @DataScope(deptAlias = "d" , userAlias = "u" , permi = PerPrefix.LABORATORY_GRADEMANAGERECORD)
+    @DataScope(deptAlias = "d", userAlias = "u", permi = PerPrefix.LABORATORY_GRADEMANAGERECORD)
     public List<LabGradeManageRecord> selectLabGradeManageRecordList(LabGradeManageRecord labGradeManageRecord) {
     public List<LabGradeManageRecord> selectLabGradeManageRecordList(LabGradeManageRecord labGradeManageRecord) {
         return labGradeManageRecordMapper.selectLabGradeManageRecordList(labGradeManageRecord);
         return labGradeManageRecordMapper.selectLabGradeManageRecordList(labGradeManageRecord);
     }
     }
@@ -174,11 +172,10 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
         LabGradeManageRecord record = new LabGradeManageRecord();
         LabGradeManageRecord record = new LabGradeManageRecord();
         record.setJoinUserId(SecurityUtils.getUserId());
         record.setJoinUserId(SecurityUtils.getUserId());
         record.setStatus(0);
         record.setStatus(0);
-        if(labGradeManageRecordMapper.selectLabGradeManageRecordList(record).size() == 0){
+        if (labGradeManageRecordMapper.selectLabGradeManageRecordList(record).size() == 0) {
             // 1 新工作通知, 2 已过期工作通知, 21 关闭已过期通知
             // 1 新工作通知, 2 已过期工作通知, 21 关闭已过期通知
-            commonSend.send(MqttConstants.LAB_MANAGE_WORK+SecurityUtils.getUserId(), new MessageBody("您已过期的管控工作已全部完成。", 21));
+            commonSend.send(MqttConstants.TOPIC_LAB_MANAGE_WORK + SecurityUtils.getUserId(), new MessageBody("您已过期的管控工作已全部完成。", 21));
         }
         }
-
         return labGradeManageRecord;
         return labGradeManageRecord;
     }
     }
 
 
@@ -229,7 +226,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
         List<Long> ruleIds = manageRuleUserList.stream().map(LabGradeManageRuleUser::getGradeManageRuleId).collect(Collectors.toList());
         List<Long> ruleIds = manageRuleUserList.stream().map(LabGradeManageRuleUser::getGradeManageRuleId).collect(Collectors.toList());
 
 
-        if(CollectionUtils.isNotEmpty(ruleIds)){
+        if (CollectionUtils.isNotEmpty(ruleIds)) {
 
 
             List<LabGradeManageRecord> insertRecordList = new ArrayList<>();
             List<LabGradeManageRecord> insertRecordList = new ArrayList<>();
 
 
@@ -245,15 +242,15 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                 // 2.7 获取实验室方式变动- 此处要修改
                 // 2.7 获取实验室方式变动- 此处要修改
                 //LabGradeManage manage = labGradeManageMapper.selectLabGradeManageById(ruleUser.getGradeManageId());
                 //LabGradeManage manage = labGradeManageMapper.selectLabGradeManageById(ruleUser.getGradeManageId());
                 List<Long> subIds = labGradeManageMapper.selectSubIdsByManageId(ruleUser.getGradeManageId());
                 List<Long> subIds = labGradeManageMapper.selectSubIdsByManageId(ruleUser.getGradeManageId());
-                if(subIds.size() == 0){
+                if (subIds.size() == 0) {
                     continue;
                     continue;
                 }
                 }
                 for (Long subId : subIds) {
                 for (Long subId : subIds) {
-                    if(ruleUser.getIsAll() == 0){
+                    if (ruleUser.getIsAll() == 0) {
                         queryRecord.setSubId(subId);
                         queryRecord.setSubId(subId);
                         // 单人执行,有一个人执行,则其他人都不生成过期数据
                         // 单人执行,有一个人执行,则其他人都不生成过期数据
                         executedCount = labGradeManageRecordMapper.selectCountByUserRecord(queryRecord);
                         executedCount = labGradeManageRecordMapper.selectCountByUserRecord(queryRecord);
-                        if(executedCount > 0){
+                        if (executedCount > 0) {
                             continue;
                             continue;
                         }
                         }
                     }
                     }
@@ -262,8 +259,8 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                 //List<Long> users = new ArrayList<>();
                 //List<Long> users = new ArrayList<>();
 
 
 //                String userPosition = null;
 //                String userPosition = null;
-                if(ruleUser.getType() == 3){
-                    List<Long> users = Arrays.asList(ruleUser.getUserIds() .split(",")).stream().map(s -> (Long.parseLong(s.trim()))).collect(Collectors.toList());
+                if (ruleUser.getType() == 3) {
+                    List<Long> users = Arrays.asList(ruleUser.getUserIds().split(",")).stream().map(s -> (Long.parseLong(s.trim()))).collect(Collectors.toList());
 
 
                     // 多个实验室则需要生成多条工作 - 过期未执行记录
                     // 多个实验室则需要生成多条工作 - 过期未执行记录
                     for (Long subId : subIds) {
                     for (Long subId : subIds) {
@@ -296,14 +293,14 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 //                            insertRecordList.add(labGradeManageRecord);
 //                            insertRecordList.add(labGradeManageRecord);
                         }
                         }
                     }
                     }
-                }else if(ruleUser.getType() == 1){
+                } else if (ruleUser.getType() == 1) {
                     // 查询实验室负责人
                     // 查询实验室负责人
                     // users = labSubjectMapper.selectAdminIds(subIds);
                     // users = labSubjectMapper.selectAdminIds(subIds);
                     List<Map<String, Long>> datas = labSubjectMapper.selectLabAdminByIds(subIds);
                     List<Map<String, Long>> datas = labSubjectMapper.selectLabAdminByIds(subIds);
                     subIds.forEach(s -> {
                     subIds.forEach(s -> {
                         datas.forEach(d -> {
                         datas.forEach(d -> {
                             // adminId, id as subId
                             // adminId, id as subId
-                            if(s.equals(d.get("subId")) && d.get("adminId") != null){
+                            if (s.equals(d.get("subId")) && d.get("adminId") != null) {
                                 putUserData(ruleUser, d.get("subId"), d.get("adminId"), insertRecordList, "实验室负责人");
                                 putUserData(ruleUser, d.get("subId"), d.get("adminId"), insertRecordList, "实验室负责人");
 //                                LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
 //                                LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
 //                                labGradeManageRecord.setCreateTime(DateUtils.getNowDate());
 //                                labGradeManageRecord.setCreateTime(DateUtils.getNowDate());
@@ -325,14 +322,14 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                             }
                             }
                         });
                         });
                     });
                     });
-                }else if(ruleUser.getType() == 2){
+                } else if (ruleUser.getType() == 2) {
                     // 当天进入实验室人员
                     // 当天进入实验室人员
                     List<Map<String, Long>> datas = labSubjectAccessRecordMapper.selectJoinUsers(subIds, ruleUser.getUpdateTime());
                     List<Map<String, Long>> datas = labSubjectAccessRecordMapper.selectJoinUsers(subIds, ruleUser.getUpdateTime());
                     subIds.forEach(s -> {
                     subIds.forEach(s -> {
                         datas.forEach(d -> {
                         datas.forEach(d -> {
                             //  userId, subject_id as subId
                             //  userId, subject_id as subId
-                            if(s.equals(d.get("subId")) && d.get("userId") != null){
-                                putUserData(ruleUser,d.get("subId"), d.get("userId"), insertRecordList, "当天进入实验室人员");
+                            if (s.equals(d.get("subId")) && d.get("userId") != null) {
+                                putUserData(ruleUser, d.get("subId"), d.get("userId"), insertRecordList, "当天进入实验室人员");
 //                                LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
 //                                LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
 //                                labGradeManageRecord.setCreateTime(DateUtils.getNowDate());
 //                                labGradeManageRecord.setCreateTime(DateUtils.getNowDate());
 //                                labGradeManageRecord.setUserId(-1L);
 //                                labGradeManageRecord.setUserId(-1L);
@@ -353,13 +350,13 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                             }
                             }
                         });
                         });
                     });
                     });
-                }else if(ruleUser.getType() == 4){
+                } else if (ruleUser.getType() == 4) {
                     // 实验室准入人员
                     // 实验室准入人员
                     List<Map<String, Long>> datas = labSecurityApplyMapper.selectApplyListBySubIds(subIds);
                     List<Map<String, Long>> datas = labSecurityApplyMapper.selectApplyListBySubIds(subIds);
                     subIds.forEach(s -> {
                     subIds.forEach(s -> {
                         datas.forEach(d -> {
                         datas.forEach(d -> {
                             //  userId, subject_id as subId
                             //  userId, subject_id as subId
-                            if(s.equals(d.get("subId")) && d.get("userId") != null){
+                            if (s.equals(d.get("subId")) && d.get("userId") != null) {
                                 putUserData(ruleUser, d.get("subId"), d.get("userId"), insertRecordList, "实验室准入人员");
                                 putUserData(ruleUser, d.get("subId"), d.get("userId"), insertRecordList, "实验室准入人员");
 //                                LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
 //                                LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
 //                                labGradeManageRecord.setCreateTime(DateUtils.getNowDate());
 //                                labGradeManageRecord.setCreateTime(DateUtils.getNowDate());
@@ -381,7 +378,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                             }
                             }
                         });
                         });
                     });
                     });
-                }else {
+                } else {
                     logger.error("workArrange: 分级管控周期工作编排数据异常, {}", JSONUtil.toJsonStr(ruleUser));
                     logger.error("workArrange: 分级管控周期工作编排数据异常, {}", JSONUtil.toJsonStr(ruleUser));
                     continue;
                     continue;
                 }
                 }
@@ -397,7 +394,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                 }*/
                 }*/
             }
             }
 
 
-            if(insertRecordList.size() > 0){
+            if (insertRecordList.size() > 0) {
                 // 批量存储
                 // 批量存储
                 labGradeManageRecordMapper.insertBatch(insertRecordList);
                 labGradeManageRecordMapper.insertBatch(insertRecordList);
             }
             }
@@ -421,14 +418,14 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
     }
     }
 
 
     private void putUserData(LabGradeManageRuleUser ruleUser, @NotNull Long subId, @NotNull Long userId,
     private void putUserData(LabGradeManageRuleUser ruleUser, @NotNull Long subId, @NotNull Long userId,
-                             List<LabGradeManageRecord> insertRecordList, String userPosition){
+                             List<LabGradeManageRecord> insertRecordList, String userPosition) {
         LabGradeManageRecord queryRecord = new LabGradeManageRecord();
         LabGradeManageRecord queryRecord = new LabGradeManageRecord();
         queryRecord.setRuleId(ruleUser.getGradeManageRuleId());
         queryRecord.setRuleId(ruleUser.getGradeManageRuleId());
         queryRecord.setRuleUserId(ruleUser.getId());
         queryRecord.setRuleUserId(ruleUser.getId());
         queryRecord.setCycleCount(ruleUser.getCycleCount());
         queryRecord.setCycleCount(ruleUser.getCycleCount());
         queryRecord.setSubId(subId);
         queryRecord.setSubId(subId);
         queryRecord.setJoinUserId(userId);
         queryRecord.setJoinUserId(userId);
-        if(labGradeManageRecordMapper.selectCountByUserRecord(queryRecord) > 0){
+        if (labGradeManageRecordMapper.selectCountByUserRecord(queryRecord) > 0) {
             return;
             return;
         }
         }
         LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
         LabGradeManageRecord labGradeManageRecord = new LabGradeManageRecord();
@@ -492,9 +489,9 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
             messageUsers.add(labMessageUser);
             messageUsers.add(labMessageUser);
         });
         });
 
 
-        if(manageRecords.size() > 0){
+        if (manageRecords.size() > 0) {
             labMessageUserMapper.insertLabMessageUserBatch(messageUsers);
             labMessageUserMapper.insertLabMessageUserBatch(messageUsers);
-        }else {
+        } else {
             throw new ServiceException("消息通知未匹配到关联人员,事务回滚");
             throw new ServiceException("消息通知未匹配到关联人员,事务回滚");
         }
         }
     }
     }
@@ -530,13 +527,13 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
             // 查询哪些人需要通知
             // 查询哪些人需要通知
             List<Long> subIds = labGradeManageMapper.selectSubIdsByManageId(ruleUser.getGradeManageId());
             List<Long> subIds = labGradeManageMapper.selectSubIdsByManageId(ruleUser.getGradeManageId());
-            if(ruleUser.getType() == 3){
-                List<Long> users = Arrays.asList(ruleUser.getUserIds() .split(",")).stream().map(s -> (Long.parseLong(s.trim()))).collect(Collectors.toList());
+            if (ruleUser.getType() == 3) {
+                List<Long> users = Arrays.asList(ruleUser.getUserIds().split(",")).stream().map(s -> (Long.parseLong(s.trim()))).collect(Collectors.toList());
 
 
                 subIds.forEach(s -> {
                 subIds.forEach(s -> {
                     users.forEach(u -> {
                     users.forEach(u -> {
                         int count = labGradeManageRecordMapper.selectExecutionsByUserId(u, 2, s, ruleUser.getId());
                         int count = labGradeManageRecordMapper.selectExecutionsByUserId(u, 2, s, ruleUser.getId());
-                        if(count == 0){
+                        if (count == 0) {
                             LabMessageUser labMessageUser = new LabMessageUser();
                             LabMessageUser labMessageUser = new LabMessageUser();
                             labMessageUser.setJoinUserId(u);
                             labMessageUser.setJoinUserId(u);
                             labMessageUser.setCreateTime(DateUtils.getNowDate());
                             labMessageUser.setCreateTime(DateUtils.getNowDate());
@@ -549,14 +546,14 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                         }
                         }
                     });
                     });
                 });
                 });
-            }else if(ruleUser.getType() == 1){
+            } else if (ruleUser.getType() == 1) {
                 // 查询实验室负责人
                 // 查询实验室负责人
                 List<Map<String, Long>> datas = labSubjectMapper.selectLabAdminByIds(subIds);
                 List<Map<String, Long>> datas = labSubjectMapper.selectLabAdminByIds(subIds);
                 subIds.forEach(s -> {
                 subIds.forEach(s -> {
                     datas.forEach(d -> {
                     datas.forEach(d -> {
-                        if(s.equals(d.get("subId")) && d.get("adminId") != null){
+                        if (s.equals(d.get("subId")) && d.get("adminId") != null) {
                             int count = labGradeManageRecordMapper.selectExecutionsByUserId(d.get("adminId"), 2, d.get("subId"), ruleUser.getId());
                             int count = labGradeManageRecordMapper.selectExecutionsByUserId(d.get("adminId"), 2, d.get("subId"), ruleUser.getId());
-                            if(count == 0){
+                            if (count == 0) {
                                 LabMessageUser labMessageUser = new LabMessageUser();
                                 LabMessageUser labMessageUser = new LabMessageUser();
                                 labMessageUser.setJoinUserId(d.get("adminId"));
                                 labMessageUser.setJoinUserId(d.get("adminId"));
                                 labMessageUser.setCreateTime(DateUtils.getNowDate());
                                 labMessageUser.setCreateTime(DateUtils.getNowDate());
@@ -569,14 +566,14 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                         }
                         }
                     });
                     });
                 });
                 });
-            }else if(ruleUser.getType() == 2){
+            } else if (ruleUser.getType() == 2) {
                 // 当天进入实验室人员
                 // 当天进入实验室人员
                 List<Map<String, Long>> datas = labSubjectAccessRecordMapper.selectJoinUsers(subIds, ruleUser.getUpdateTime());
                 List<Map<String, Long>> datas = labSubjectAccessRecordMapper.selectJoinUsers(subIds, ruleUser.getUpdateTime());
                 subIds.forEach(s -> {
                 subIds.forEach(s -> {
                     datas.forEach(d -> {
                     datas.forEach(d -> {
-                        if(s.equals(d.get("subId")) && d.get("userId") != null){
+                        if (s.equals(d.get("subId")) && d.get("userId") != null) {
                             int count = labGradeManageRecordMapper.selectExecutionsByUserId(d.get("userId"), 2, s, ruleUser.getId());
                             int count = labGradeManageRecordMapper.selectExecutionsByUserId(d.get("userId"), 2, s, ruleUser.getId());
-                            if(count == 0){
+                            if (count == 0) {
                                 LabMessageUser labMessageUser = new LabMessageUser();
                                 LabMessageUser labMessageUser = new LabMessageUser();
                                 labMessageUser.setJoinUserId(d.get("userId"));
                                 labMessageUser.setJoinUserId(d.get("userId"));
                                 labMessageUser.setCreateTime(DateUtils.getNowDate());
                                 labMessageUser.setCreateTime(DateUtils.getNowDate());
@@ -589,14 +586,14 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                         }
                         }
                     });
                     });
                 });
                 });
-            }else if(ruleUser.getType() == 4){
+            } else if (ruleUser.getType() == 4) {
                 // 实验室准入人员
                 // 实验室准入人员
                 List<Map<String, Long>> datas = labSecurityApplyMapper.selectApplyListBySubIds(subIds);
                 List<Map<String, Long>> datas = labSecurityApplyMapper.selectApplyListBySubIds(subIds);
                 subIds.forEach(s -> {
                 subIds.forEach(s -> {
                     datas.forEach(d -> {
                     datas.forEach(d -> {
-                        if(s.equals(d.get("subId")) && d.get("userId") != null){
+                        if (s.equals(d.get("subId")) && d.get("userId") != null) {
                             int count = labGradeManageRecordMapper.selectExecutionsByUserId(d.get("userId"), 2, s, ruleUser.getId());
                             int count = labGradeManageRecordMapper.selectExecutionsByUserId(d.get("userId"), 2, s, ruleUser.getId());
-                            if(count == 0){
+                            if (count == 0) {
                                 LabMessageUser labMessageUser = new LabMessageUser();
                                 LabMessageUser labMessageUser = new LabMessageUser();
                                 labMessageUser.setJoinUserId(d.get("userId"));
                                 labMessageUser.setJoinUserId(d.get("userId"));
                                 labMessageUser.setCreateTime(DateUtils.getNowDate());
                                 labMessageUser.setCreateTime(DateUtils.getNowDate());
@@ -612,48 +609,48 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
             }
             }
         }
         }
 
 
-        if(messageUsers.size() > 0){
+        if (messageUsers.size() > 0) {
             labMessageUserMapper.insertLabMessageUserBatch(messageUsers);
             labMessageUserMapper.insertLabMessageUserBatch(messageUsers);
-        }else {
+        } else {
             throw new ServiceException("消息通知未匹配到关联人员,事务回滚");
             throw new ServiceException("消息通知未匹配到关联人员,事务回滚");
         }
         }
     }
     }
 
 
     /**
     /**
-     *  分级管控通知类型(执行人-可跳转处理)
-     *  2.执行通知:周,每周五早8点
-     *  3.执行周期:月,提前三天早8点
-     *  4.执行周期:年,季度,半年,提前一周早8点,提前三天早8点 各一次
+     * 分级管控通知类型(执行人-可跳转处理)
+     * 2.执行通知:周,每周五早8点
+     * 3.执行周期:月,提前三天早8点
+     * 4.执行周期:年,季度,半年,提前一周早8点,提前三天早8点 各一次
      */
      */
     @Override
     @Override
     public void workExecute() {
     public void workExecute() {
 
 
-        if(DateUtil.dayOfWeek(DateUtil.date()) == 6){
+        if (DateUtil.dayOfWeek(DateUtil.date()) == 6) {
             workExecuteByDay("一周");
             workExecuteByDay("一周");
         }
         }
 
 
-        if(DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2){
+        if (DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2) {
             workExecuteByDay("一月");
             workExecuteByDay("一月");
         }
         }
 
 
-        if(DateUtil.month(DateUtil.endOfQuarter(DateUtil.date())) == DateUtil.month(DateUtil.date()) && (
+        if (DateUtil.month(DateUtil.endOfQuarter(DateUtil.date())) == DateUtil.month(DateUtil.date()) && (
                 DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2 ||
                 DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2 ||
-                DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 6
-        )){
+                        DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 6
+        )) {
             workExecuteByDay("季度");
             workExecuteByDay("季度");
         }
         }
 
 
-        if((DateUtil.thisMonth() == 6 || DateUtil.thisMonth() == 12) && (
+        if ((DateUtil.thisMonth() == 6 || DateUtil.thisMonth() == 12) && (
                 DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2 ||
                 DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2 ||
-                DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 6
-        )){
+                        DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 6
+        )) {
             workExecuteByDay("半年");
             workExecuteByDay("半年");
         }
         }
 
 
-        if(DateUtil.thisMonth() == 12 && (
+        if (DateUtil.thisMonth() == 12 && (
                 DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2 ||
                 DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 2 ||
-                DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 6
-        )){
+                        DateUtil.dayOfMonth(DateUtil.endOfMonth(DateUtil.date())) - DateUtil.dayOfMonth(DateUtil.date()) == 6
+        )) {
             workExecuteByDay("一年");
             workExecuteByDay("一年");
         }
         }
 
 
@@ -666,13 +663,13 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
     public void sendManageMsgBySiginUser(Long userId, Long subId) {
     public void sendManageMsgBySiginUser(Long userId, Long subId) {
 
 
         try {
         try {
-            logger.info("进入实验室人员进行消息通知执行..." + subId + " : "+ userId);
+            logger.info("进入实验室人员进行消息通知执行..." + subId + " : " + userId);
             List<LabGradeManageRuleUser> manageRuleUserList = labGradeManageRuleUserMapper.selectType2ByAdminSubId(subId);
             List<LabGradeManageRuleUser> manageRuleUserList = labGradeManageRuleUserMapper.selectType2ByAdminSubId(subId);
-            if(manageRuleUserList.size() > 0){
-                commonSend.send(MqttConstants.LAB_MANAGE_WORK+userId, new MessageBody("您当前有" + manageRuleUserList.size() + "条管控工作需完成,请点击查看详情。", 1));
+            if (manageRuleUserList.size() > 0) {
+                commonSend.send(MqttConstants.TOPIC_LAB_MANAGE_WORK + userId, new MessageBody("您当前有" + manageRuleUserList.size() + "条管控工作需完成,请点击查看详情。", 1));
                 logger.info("已执行发送...");
                 logger.info("已执行发送...");
             }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             logger.error("进入实验室人员管控工作通知异常,{}", e.getMessage());
             logger.error("进入实验室人员管控工作通知异常,{}", e.getMessage());
         }
         }
     }
     }
@@ -683,25 +680,25 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
     @Override
     @Override
     public Map<String, Object> queryManageWorkInfo(LabManageWorkChartVo labManageWorkChartVo) {
     public Map<String, Object> queryManageWorkInfo(LabManageWorkChartVo labManageWorkChartVo) {
         labManageWorkChartVo.setStartTime(DateUtil.beginOfWeek(DateUtils.getNowDate()));
         labManageWorkChartVo.setStartTime(DateUtil.beginOfWeek(DateUtils.getNowDate()));
-        labManageWorkChartVo.setEndTime( DateUtil.offsetDay(labManageWorkChartVo.getStartTime(), 4));
+        labManageWorkChartVo.setEndTime(DateUtil.offsetDay(labManageWorkChartVo.getStartTime(), 4));
 
 
         labManageWorkChartVo.setTitle(
         labManageWorkChartVo.setTitle(
                 DateUtil.format(labManageWorkChartVo.getStartTime(), dateFormat) + "至" + DateUtil.format(labManageWorkChartVo.getEndTime(), dateFormat) +
                 DateUtil.format(labManageWorkChartVo.getStartTime(), dateFormat) + "至" + DateUtil.format(labManageWorkChartVo.getEndTime(), dateFormat) +
-                "分级管控工作");
+                        "分级管控工作");
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         map.put("title", labManageWorkChartVo.getTitle());
         map.put("title", labManageWorkChartVo.getTitle());
 
 
         List<LabManageWorkChartVo> list;
         List<LabManageWorkChartVo> list;
 
 
-        if(labManageWorkChartVo.getType() == 1){
+        if (labManageWorkChartVo.getType() == 1) {
             list = new ArrayList<>();
             list = new ArrayList<>();
             R r = remoteDeptService.getDeptList(new SysDept());
             R r = remoteDeptService.getDeptList(new SysDept());
             List<SysDept> deptList = (List<SysDept>) r.getData();
             List<SysDept> deptList = (List<SysDept>) r.getData();
 
 
-            LabManageWorkChartVo workChartVo ;
-            if(deptList.size() > 0){
+            LabManageWorkChartVo workChartVo;
+            if (deptList.size() > 0) {
                 for (SysDept dept : deptList) {
                 for (SysDept dept : deptList) {
-                    if(labManageWorkChartVo.getDeptId() == null || (labManageWorkChartVo.getDeptId() != null && dept.getDeptId().equals(labManageWorkChartVo.getDeptId()))){
+                    if (labManageWorkChartVo.getDeptId() == null || (labManageWorkChartVo.getDeptId() != null && dept.getDeptId().equals(labManageWorkChartVo.getDeptId()))) {
                         workChartVo = new LabManageWorkChartVo();
                         workChartVo = new LabManageWorkChartVo();
 
 
                         workChartVo.setDeptId(dept.getDeptId());
                         workChartVo.setDeptId(dept.getDeptId());
@@ -719,7 +716,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                     }
                     }
                 }
                 }
             }
             }
-        }else {
+        } else {
             list = labGradeManageRecordMapper.queryManageWorkChartDetailsType2(labManageWorkChartVo);
             list = labGradeManageRecordMapper.queryManageWorkChartDetailsType2(labManageWorkChartVo);
             for (LabManageWorkChartVo workChartVo : list) {
             for (LabManageWorkChartVo workChartVo : list) {
 
 
@@ -743,6 +740,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
     /**
     /**
      * 分级管控统计 柱状图2.4需求
      * 分级管控统计 柱状图2.4需求
+     *
      * @return
      * @return
      */
      */
     @Override
     @Override
@@ -782,54 +780,54 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
             chart.setParams(labManageWorkChartVo.getParams());
             chart.setParams(labManageWorkChartVo.getParams());
 
 
-            chart.setCurrentDateStr( DateUtil.format(chart.getCurrentDate(), dateFormat));
-            chart.setOfWeek("星期" + WordUtils.CN_NUM[(DateUtil.dayOfWeek(chart.getCurrentDate()) -2)]);
+            chart.setCurrentDateStr(DateUtil.format(chart.getCurrentDate(), dateFormat));
+            chart.setOfWeek("星期" + WordUtils.CN_NUM[(DateUtil.dayOfWeek(chart.getCurrentDate()) - 2)]);
 
 
 
 
             int compare = DateUtil.compare(chart.getCurrentDate(), now);
             int compare = DateUtil.compare(chart.getCurrentDate(), now);
             for (LabManageWorkChartVo date : dates) {
             for (LabManageWorkChartVo date : dates) {
-                if(i == 0){
-                    if(date.getCurrentDate().equals(chart.getCurrentDate())){
-                        if("一天".equals(date.getCycle())){
+                if (i == 0) {
+                    if (date.getCurrentDate().equals(chart.getCurrentDate())) {
+                        if ("一天".equals(date.getCycle())) {
                             chart.setPlanNum(date.getPlanNum());
                             chart.setPlanNum(date.getPlanNum());
                         }
                         }
                         break;
                         break;
                     }
                     }
 
 
-                }else if(i == 1){
-                    if(date.getCurrentDate().equals(chart.getCurrentDate())){
-                        if("一天".equals(date.getCycle())){
-                            chart.setPlanNum(date.getPlanNum() + list.get(i-1).getPlanNum());
+                } else if (i == 1) {
+                    if (date.getCurrentDate().equals(chart.getCurrentDate())) {
+                        if ("一天".equals(date.getCycle())) {
+                            chart.setPlanNum(date.getPlanNum() + list.get(i - 1).getPlanNum());
                         }
                         }
                         break;
                         break;
                     }
                     }
-                }else if(i == 2){
-                    if(date.getCurrentDate().equals(chart.getCurrentDate())){
-                        if("一天".equals(date.getCycle())){
-                            chart.setPlanNum(date.getPlanNum() + list.get(i-1).getPlanNum());
+                } else if (i == 2) {
+                    if (date.getCurrentDate().equals(chart.getCurrentDate())) {
+                        if ("一天".equals(date.getCycle())) {
+                            chart.setPlanNum(date.getPlanNum() + list.get(i - 1).getPlanNum());
                         }
                         }
                         break;
                         break;
                     }
                     }
-                }else if(i == 3){
-                    if("一天".equals(date.getCycle()) && date.getCurrentDate().equals(chart.getCurrentDate())){
-                        chart.setPlanNum(date.getPlanNum() + list.get(i-1).getPlanNum());
+                } else if (i == 3) {
+                    if ("一天".equals(date.getCycle()) && date.getCurrentDate().equals(chart.getCurrentDate())) {
+                        chart.setPlanNum(date.getPlanNum() + list.get(i - 1).getPlanNum());
                     }
                     }
                     break;
                     break;
-                }else if(i == 4){
-                    if(date.getCurrentDate().equals(chart.getCurrentDate())){
-                        if("一天".equals(date.getCycle())){
-                            chart.setPlanNum(date.getPlanNum() + list.get(i-1).getPlanNum());
+                } else if (i == 4) {
+                    if (date.getCurrentDate().equals(chart.getCurrentDate())) {
+                        if ("一天".equals(date.getCycle())) {
+                            chart.setPlanNum(date.getPlanNum() + list.get(i - 1).getPlanNum());
                         }
                         }
                         break;
                         break;
                     }
                     }
-                    if("一周".equals(date.getCycle())){
+                    if ("一周".equals(date.getCycle())) {
                         chart.setPlanNum(date.getPlanNum() + chart.getPlanNum());
                         chart.setPlanNum(date.getPlanNum() + chart.getPlanNum());
                     }
                     }
                 }
                 }
             }
             }
 
 
             // 如果今天大于这天, 查询的计划数量永远是0 需要查询记录中已执行和未执行的总和
             // 如果今天大于这天, 查询的计划数量永远是0 需要查询记录中已执行和未执行的总和
-            if(compare < 0){
+            if (compare < 0) {
                 chart.setPlanNum(chart.getPlanNum() + labGradeManageRecordMapper.selectAllWorkCountByDate(chart));
                 chart.setPlanNum(chart.getPlanNum() + labGradeManageRecordMapper.selectAllWorkCountByDate(chart));
             }
             }
 
 
@@ -840,10 +838,10 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
         }
         }
 
 
         List<List<Object>> datas = new ArrayList<>();
         List<List<Object>> datas = new ArrayList<>();
-        List<Object> data ;
+        List<Object> data;
         for (LabManageWorkChartVo workChartVo : list) {
         for (LabManageWorkChartVo workChartVo : list) {
             data = new ArrayList<>();
             data = new ArrayList<>();
-            data.add(workChartVo.getOfWeek()+" - " + workChartVo.getCurrentDateStr());
+            data.add(workChartVo.getOfWeek() + " - " + workChartVo.getCurrentDateStr());
             data.add(workChartVo.getPlanNum());
             data.add(workChartVo.getPlanNum());
             data.add(workChartVo.getFinishedNum());
             data.add(workChartVo.getFinishedNum());
 
 
@@ -854,20 +852,21 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
 
 
     /**
     /**
      * 分级管控统计 详情页列表2.4需求
      * 分级管控统计 详情页列表2.4需求
+     *
      * @return
      * @return
      */
      */
     @Override
     @Override
     public List<LabManageWorkChartVo> queryManageWorkChartDetails(LabManageWorkChartVo labManageWorkChartVo) {
     public List<LabManageWorkChartVo> queryManageWorkChartDetails(LabManageWorkChartVo labManageWorkChartVo) {
 
 
         List<LabManageWorkChartVo> list = new ArrayList<>();
         List<LabManageWorkChartVo> list = new ArrayList<>();
-        if(labManageWorkChartVo.getType() == 1){
+        if (labManageWorkChartVo.getType() == 1) {
             R r = remoteDeptService.getDeptList(new SysDept());
             R r = remoteDeptService.getDeptList(new SysDept());
             List<SysDept> deptList = (List<SysDept>) r.getData();
             List<SysDept> deptList = (List<SysDept>) r.getData();
 
 
-            LabManageWorkChartVo workChartVo ;
-            if(deptList.size() > 0){
+            LabManageWorkChartVo workChartVo;
+            if (deptList.size() > 0) {
                 for (SysDept dept : deptList) {
                 for (SysDept dept : deptList) {
-                    if(labManageWorkChartVo.getDeptId() == null || (labManageWorkChartVo.getDeptId() != null && dept.getDeptId().equals(labManageWorkChartVo.getDeptId()))){
+                    if (labManageWorkChartVo.getDeptId() == null || (labManageWorkChartVo.getDeptId() != null && dept.getDeptId().equals(labManageWorkChartVo.getDeptId()))) {
                         workChartVo = new LabManageWorkChartVo();
                         workChartVo = new LabManageWorkChartVo();
 
 
                         workChartVo.setDeptId(dept.getDeptId());
                         workChartVo.setDeptId(dept.getDeptId());
@@ -885,7 +884,7 @@ public class LabGradeManageRecordServiceImpl implements ILabGradeManageRecordSer
                     }
                     }
                 }
                 }
             }
             }
-        }else {
+        } else {
             list = labGradeManageRecordMapper.queryManageWorkChartDetailsType2(labManageWorkChartVo);
             list = labGradeManageRecordMapper.queryManageWorkChartDetailsType2(labManageWorkChartVo);
 
 
             for (LabManageWorkChartVo workChartVo : list) {
             for (LabManageWorkChartVo workChartVo : list) {

+ 46 - 53
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabMessageContentServiceImpl.java

@@ -23,11 +23,11 @@ import com.zd.laboratory.domain.vo.LabSubjectVO;
 import com.zd.laboratory.mapper.LabContentMachineMsgMapper;
 import com.zd.laboratory.mapper.LabContentMachineMsgMapper;
 import com.zd.laboratory.mapper.LabMessageContentMapper;
 import com.zd.laboratory.mapper.LabMessageContentMapper;
 import com.zd.laboratory.mapper.LabSubjectMapper;
 import com.zd.laboratory.mapper.LabSubjectMapper;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.enums.SendMode;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.*;
 import com.zd.laboratory.service.*;
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.R;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.enums.WarnUserAttrEnum;
 import com.zd.model.enums.WarnUserAttrEnum;
@@ -42,7 +42,6 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-
 import java.util.Collections;
 import java.util.Collections;
 import java.util.List;
 import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
@@ -89,7 +88,7 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
     public Integer phoneMode;
     public Integer phoneMode;
 
 
     @Value("${phoneMode:0}")
     @Value("${phoneMode:0}")
-    private void setPhoneMode(Integer phoneMode){
+    private void setPhoneMode(Integer phoneMode) {
         this.phoneMode = phoneMode;
         this.phoneMode = phoneMode;
     }
     }
 
 
@@ -97,7 +96,8 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
     RemoteStockService remoteStockService;
     RemoteStockService remoteStockService;
 
 
 
 
-    private final String smsFormat="{}: {},发生风险预案,{}";
+    private final String smsFormat = "{}: {},发生风险预案,{}";
+
     /**
     /**
      * 查询消息发布
      * 查询消息发布
      *
      *
@@ -129,7 +129,7 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
      * @return 消息发布
      * @return 消息发布
      */
      */
     @Override
     @Override
-    @DataScope(deptAlias = "s" , permi = PerPrefix.LABORATORY_CONTENT)
+    @DataScope(deptAlias = "s", permi = PerPrefix.LABORATORY_CONTENT)
     public List<LabMessageContentVO> selectLabMessageContentVOList(LabMessageContentListQuery labMessageContent) {
     public List<LabMessageContentVO> selectLabMessageContentVOList(LabMessageContentListQuery labMessageContent) {
         return labMessageContentMapper.selectLabMessageContentVOList(labMessageContent);
         return labMessageContentMapper.selectLabMessageContentVOList(labMessageContent);
     }
     }
@@ -141,19 +141,20 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
      * ①全院,院系和个人不再给用户单独发送
      * ①全院,院系和个人不再给用户单独发送
      * 坏处:1,查询复杂,逻辑不统一,2.新建的用户能看到全校和所属院系历史所有数据(可以增加时间过滤来解决,暂时不解决) ,3 用户院系发生变化,时能看到之前该院系消息(该方式无解)
      * 坏处:1,查询复杂,逻辑不统一,2.新建的用户能看到全校和所属院系历史所有数据(可以增加时间过滤来解决,暂时不解决) ,3 用户院系发生变化,时能看到之前该院系消息(该方式无解)
      * 好处:一次只产生一条消息,能极大的减少负载。
      * 好处:一次只产生一条消息,能极大的减少负载。
+     *
      * @param labMessageContent
      * @param labMessageContent
      */
      */
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public Boolean sendMessage(LabMessageContent labMessageContent) {
     public Boolean sendMessage(LabMessageContent labMessageContent) {
         //消息表入库
         //消息表入库
-        if(labMessageContent.getMessClass() == null){
+        if (labMessageContent.getMessClass() == null) {
             labMessageContent.setMessClass(1);
             labMessageContent.setMessClass(1);
         }
         }
 
 
         insertLabMessageContent(labMessageContent);
         insertLabMessageContent(labMessageContent);
 
 
-        if(labMessageContent.getMessClass() == 3 && StringUtils.isNotBlank(labMessageContent.getSubIds())){
+        if (labMessageContent.getMessClass() == 3 && StringUtils.isNotBlank(labMessageContent.getSubIds())) {
             // 一体机消息发送mqtt 通知,并生成相关数据
             // 一体机消息发送mqtt 通知,并生成相关数据
             labContentMachineMsgService.insert(labMessageContent);
             labContentMachineMsgService.insert(labMessageContent);
         }
         }
@@ -173,54 +174,49 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
      * 发送预警消息
      * 发送预警消息
      * 这里一定要重构,预警消息里内部又发送预案消息,以后需要重构为事件驱动
      * 这里一定要重构,预警消息里内部又发送预案消息,以后需要重构为事件驱动
      *
      *
-     *
-     * @param subId 实验室ID
+     * @param subId       实验室ID
      * @param newRiskPlan 预案
      * @param newRiskPlan 预案
      */
      */
     @Override
     @Override
     @Async("labExecutor")
     @Async("labExecutor")
-    public void  sendWranMessage(Long subId, LabRiskPlan newRiskPlan,Long groupId)
-    {
+    public void sendWranMessage(Long subId, LabRiskPlan newRiskPlan, Long groupId) {
         logger.info("*******************sendWranMessage***********************");
         logger.info("*******************sendWranMessage***********************");
         //获取实验室负责人信息
         //获取实验室负责人信息
         LabSubject subject = new LabSubject();
         LabSubject subject = new LabSubject();
         subject.setId(subId);
         subject.setId(subId);
         List<LabSubjectVO> labSubjects = labSubjectMapper.selectLabSubjectVOList(subject);
         List<LabSubjectVO> labSubjects = labSubjectMapper.selectLabSubjectVOList(subject);
-        logger.info("**************labSubjects.size()***********"+labSubjects.size());
+        logger.info("**************labSubjects.size()***********" + labSubjects.size());
         Optional.ofNullable(labSubjects)
         Optional.ofNullable(labSubjects)
                 .filter(a -> a.size() > 0)
                 .filter(a -> a.size() > 0)
                 .map(a -> a.get(0))
                 .map(a -> a.get(0))
-                .map(a->{
-                    sendSubWran(a,newRiskPlan,groupId);
+                .map(a -> {
+                    sendSubWran(a, newRiskPlan, groupId);
                     return a;
                     return a;
                 })
                 })
                 .orElse(null);
                 .orElse(null);
     }
     }
 
 
-    private void  sendSubWran(LabSubjectVO subject,LabRiskPlan newRiskPlan,Long groupId)
-    {
+    private void sendSubWran(LabSubjectVO subject, LabRiskPlan newRiskPlan, Long groupId) {
         logger.info("$$$$$$$$$$$$$进入sendSubWran$$$$$$$$$$$$$");
         logger.info("$$$$$$$$$$$$$进入sendSubWran$$$$$$$$$$$$$");
-        String safeUserId=subject.getSafeUserId();
-        if(StringUtils.isNotBlank(safeUserId)){
+        String safeUserId = subject.getSafeUserId();
+        if (StringUtils.isNotBlank(safeUserId)) {
             subject.setSafeUserPhone(labSubjectMapper.queryUserPhoneBySafeUserId(safeUserId));
             subject.setSafeUserPhone(labSubjectMapper.queryUserPhoneBySafeUserId(safeUserId));
         }
         }
         String deptName = "";
         String deptName = "";
         List<SubAddrr> subAddrrs = subjectLayoutService.selectAddrrByLayoutIds(subject.getLayoutId());
         List<SubAddrr> subAddrrs = subjectLayoutService.selectAddrrByLayoutIds(subject.getLayoutId());
-        if(CollectionUtils.isNotEmpty(subAddrrs) && subAddrrs.size() > 0){
+        if (CollectionUtils.isNotEmpty(subAddrrs) && subAddrrs.size() > 0) {
             deptName = subAddrrs.get(0).getBuildName();
             deptName = subAddrrs.get(0).getBuildName();
         }
         }
 
 
         String format = StrUtil.format(smsFormat, deptName, subject.getName(), StrUtil.isBlank(newRiskPlan.getMessage()) ? newRiskPlan.getName() : newRiskPlan.getMessage());
         String format = StrUtil.format(smsFormat, deptName, subject.getName(), StrUtil.isBlank(newRiskPlan.getMessage()) ? newRiskPlan.getName() : newRiskPlan.getMessage());
-        String phone =null;
+        String phone = null;
         String userids = null;
         String userids = null;
         try {
         try {
             userids = getDoingUserId(subject);
             userids = getDoingUserId(subject);
-            if(StrUtil.isNotBlank(userids))
-            {
+            if (StrUtil.isNotBlank(userids)) {
 
 
                 R<List<String>> phoneByUserIDS = remoteUserService.getPhoneByUserIDS(userids);
                 R<List<String>> phoneByUserIDS = remoteUserService.getPhoneByUserIDS(userids);
-                if(phoneByUserIDS.getCode()==200&& CollUtil.isNotEmpty(phoneByUserIDS.getData()))
-                {
+                if (phoneByUserIDS.getCode() == 200 && CollUtil.isNotEmpty(phoneByUserIDS.getData())) {
                     phone = phoneByUserIDS.getData().stream()
                     phone = phoneByUserIDS.getData().stream()
                             .collect(Collectors.joining(","));
                             .collect(Collectors.joining(","));
 
 
@@ -236,41 +232,38 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
                 .collect(Collectors.joining(","))
                 .collect(Collectors.joining(","))
                 .split(",");
                 .split(",");
 
 
-        logger.info("%%%%%%%%%%%%%%%%%%%%strings:"+strings);
+        logger.info("%%%%%%%%%%%%%%%%%%%%strings:" + strings);
         //todo 发送最多支持200个电话号码 , 这里不会超过200人 所以没有验证, 切割
         //todo 发送最多支持200个电话号码 , 这里不会超过200人 所以没有验证, 切割
         //todo 这里判断电话类型,如果是0,发送短信,如果是1,是四医大内部短信接口。
         //todo 这里判断电话类型,如果是0,发送短信,如果是1,是四医大内部短信接口。
-        if(phoneMode == 0){
-            if(strings!=null)
-            {
-                AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush,strings,format);
+        if (phoneMode == 0) {
+            if (strings != null) {
+                AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush, strings, format);
                 MessageBody messageBody = new MessageBody();
                 MessageBody messageBody = new MessageBody();
                 messageBody.setData(alarmEntrty);
                 messageBody.setData(alarmEntrty);
-                commonSend.send("alarm/"+newRiskPlan.getId()+"/"+subject.getId(),messageBody, SendMode.DISTINCT);
-                logger.info("&&&&"+"alarm/"+newRiskPlan.getId()+"/"+subject.getId());
-                logger.info("&&&&"+JSON.toJSONString(messageBody));
+                //commonSend.send("alarm/"+newRiskPlan.getId()+"/"+subject.getId(),messageBody, SendMode.DISTINCT);
+                commonSend.send(MqttConstants.TOPIC_ALERT + newRiskPlan.getId() + "/" + subject.getId(), messageBody, SendMode.DISTINCT);
+                logger.info("&&&&" + MqttConstants.TOPIC_ALERT + newRiskPlan.getId() + "/" + subject.getId());
+                logger.info("&&&&" + JSON.toJSONString(messageBody));
 //           改用mqtt
 //           改用mqtt
 //           ResultData send = remoteAlarmService.send(alarmEntrty);
 //           ResultData send = remoteAlarmService.send(alarmEntrty);
                 try {
                 try {
-                    if(subject.getAdminId()!=null)
-                    {
+                    if (subject.getAdminId() != null) {
                         //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message
                         //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message
-                        labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(),subject.getAdminId().toString(),groupId,newRiskPlan, WarnUserAttrEnum.ADMIN);
+                        labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(), subject.getAdminId().toString(), groupId, newRiskPlan, WarnUserAttrEnum.ADMIN);
                     }
                     }
                     //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message 保持实验室内部人员发送记录  ?安全的要不要保存展示?
                     //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message 保持实验室内部人员发送记录  ?安全的要不要保存展示?
-                    labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(),userids,groupId,newRiskPlan, WarnUserAttrEnum.NONE);
+                    labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(), userids, groupId, newRiskPlan, WarnUserAttrEnum.NONE);
                 } catch (Exception e) {
                 } catch (Exception e) {
                     logger.error("发送预案消息失败!");
                     logger.error("发送预案消息失败!");
                 }
                 }
             }
             }
 
 
             //发送消息
             //发送消息
-            if(StrUtil.isNotBlank(newRiskPlan.getInformation()))
-            {
-                String collect = Stream.of(new String[]{subject.getAdminId()==null?null:subject.getAdminId().toString(), subject.getSafeUserId()})
+            if (StrUtil.isNotBlank(newRiskPlan.getInformation())) {
+                String collect = Stream.of(new String[]{subject.getAdminId() == null ? null : subject.getAdminId().toString(), subject.getSafeUserId()})
                         .filter(a -> StrUtil.isNotBlank(a))
                         .filter(a -> StrUtil.isNotBlank(a))
                         .collect(Collectors.joining(","));
                         .collect(Collectors.joining(","));
-                if(StrUtil.isNotBlank(collect))
-                {
+                if (StrUtil.isNotBlank(collect)) {
                     LabMessageContentDTO labMessageContentDTO = new LabMessageContentDTO();
                     LabMessageContentDTO labMessageContentDTO = new LabMessageContentDTO();
                     labMessageContentDTO.setUserIds(collect);
                     labMessageContentDTO.setUserIds(collect);
                     labMessageContentDTO.setSendMode(2);
                     labMessageContentDTO.setSendMode(2);
@@ -281,9 +274,9 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
                 }
                 }
 
 
             }
             }
-        }else if(phoneMode == 1){
+        } else if (phoneMode == 1) {
             //走四医大发送短信服务接口
             //走四医大发送短信服务接口
-            remoteStockService.sendSydSms(newRiskPlan.getMessage(),5,null,strings);
+            remoteStockService.sendSydSms(newRiskPlan.getMessage(), 5, null, strings);
         }
         }
 
 
     }
     }
@@ -297,16 +290,15 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
         List<LabSubjectAccessRecordVo> labSubjectAccessRecordVos = subjectAccessRecordService.selectLabSubjectAccessRecordListNoAuth(labSubjectAccessRecordVo);
         List<LabSubjectAccessRecordVo> labSubjectAccessRecordVos = subjectAccessRecordService.selectLabSubjectAccessRecordListNoAuth(labSubjectAccessRecordVo);
         //userids
         //userids
         String userids = Optional.ofNullable(labSubjectAccessRecordVos)
         String userids = Optional.ofNullable(labSubjectAccessRecordVos)
-                        .filter(a->a.size()>0)
-                                .orElse(Collections.emptyList())
-                                .stream().map(a->a.getJoinUserId()).filter(a->a!=null)
-                .map(a->a.toString())
-                        .collect(Collectors.joining(","));
+                .filter(a -> a.size() > 0)
+                .orElse(Collections.emptyList())
+                .stream().map(a -> a.getJoinUserId()).filter(a -> a != null)
+                .map(a -> a.toString())
+                .collect(Collectors.joining(","));
         return userids;
         return userids;
     }
     }
 
 
 
 
-
     /**
     /**
      * 新增消息发布
      * 新增消息发布
      *
      *
@@ -319,8 +311,8 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
         logger.info("***************SaveUtil.setCommonAttr开始*****************");
         logger.info("***************SaveUtil.setCommonAttr开始*****************");
         try {
         try {
             SaveUtil.setCommonAttr(labMessageContent);
             SaveUtil.setCommonAttr(labMessageContent);
-        }catch (Exception e){
-            logger.info("异常了:"+e.getMessage());
+        } catch (Exception e) {
+            logger.info("异常了:" + e.getMessage());
         }
         }
         logger.info("***************SaveUtil.setCommonAttr结束*****************");
         logger.info("***************SaveUtil.setCommonAttr结束*****************");
         return labMessageContentMapper.insertLabMessageContent(labMessageContent);
         return labMessageContentMapper.insertLabMessageContent(labMessageContent);
@@ -364,6 +356,7 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
 
 
     /**
     /**
      * 查询预案向一体机推送的消息,如果超过两小时,需要清理
      * 查询预案向一体机推送的消息,如果超过两小时,需要清理
+     *
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
@@ -375,11 +368,11 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
         labMessageContentListQuery.setMessClass(3);
         labMessageContentListQuery.setMessClass(3);
         List<LabMessageContentVO> labMessageContentList = labMessageContentMapper.selectLabClearMessageList(labMessageContentListQuery);
         List<LabMessageContentVO> labMessageContentList = labMessageContentMapper.selectLabClearMessageList(labMessageContentListQuery);
         Optional.ofNullable(labMessageContentList).orElseGet(Collections::emptyList).stream()
         Optional.ofNullable(labMessageContentList).orElseGet(Collections::emptyList).stream()
-                .forEach(a->{
+                .forEach(a -> {
                     labContentMachineMsgMapper.deleteLabContentMachineMsgByContentId(a.getId());
                     labContentMachineMsgMapper.deleteLabContentMachineMsgByContentId(a.getId());
                     labMessageContentMapper.deleteLabMessageContentById(a.getId());
                     labMessageContentMapper.deleteLabMessageContentById(a.getId());
                     // 生成一条通知一个,此处不应该有重复的实验室ID
                     // 生成一条通知一个,此处不应该有重复的实验室ID
-                    commonSend.send(MqttConstants.LAB_CONTENT + a.getSubIds(), "收到一条新的消息通知!");
+                    commonSend.send(MqttConstants.TOPIC_LAB_CONTENT + a.getSubIds(), "收到一条新的消息通知!");
                 });
                 });
         return flag;
         return flag;
     }
     }

+ 2 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabNotifyplanServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zd.laboratory.service.impl;
 package com.zd.laboratory.service.impl;
 
 
+import com.zd.model.constant.MqttConstants;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.DateUtils;
@@ -12,7 +13,6 @@ import com.zd.laboratory.domain.LabNotifyplan;
 import com.zd.laboratory.domain.vo.LabNotifyplanExcelVO;
 import com.zd.laboratory.domain.vo.LabNotifyplanExcelVO;
 import com.zd.laboratory.domain.vo.LabNotifyplanVO;
 import com.zd.laboratory.domain.vo.LabNotifyplanVO;
 import com.zd.laboratory.mapper.LabNotifyplanMapper;
 import com.zd.laboratory.mapper.LabNotifyplanMapper;
-import com.zd.laboratory.mqtt.constants.MqttConstants;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.entiy.MessageBody;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.mqtt.service.impl.CommonSend;
 import com.zd.laboratory.service.ILabNotifyplanService;
 import com.zd.laboratory.service.ILabNotifyplanService;
@@ -20,7 +20,6 @@ import com.zd.model.entity.SysUser;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
@@ -339,7 +338,7 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
         int id = labNotifyplanMapper.insertLabNotifyplan(labNotifyplan);
         int id = labNotifyplanMapper.insertLabNotifyplan(labNotifyplan);
         if(id>0){
         if(id>0){
             //1通知 2计划
             //1通知 2计划
-            commonSend.send(MqttConstants.LAB_BIG_VIEW_PLAN, new MessageBody("有新的通知发布。", labNotifyplan.getType()));
+            commonSend.send(MqttConstants.TOPIC_LAB_BIG_VIEW_PLAN, new MessageBody("有新的通知发布。", labNotifyplan.getType()));
         }
         }
         return id;
         return id;
     }
     }

+ 0 - 0
zd-modules/zd-modules-laboratory/src/main/resources/bootstrap.yml


部分文件因文件數量過多而無法顯示