فهرست منبع

APP设备心跳新增接口

hanzhengyi 1 سال پیش
والد
کامیت
4c8c23a30f
100فایلهای تغییر یافته به همراه4895 افزوده شده و 0 حذف شده
  1. 20 0
      service-agbox/pom.xml
  2. 27 0
      service-agbox/service-agbox-api/pom.xml
  3. 28 0
      service-agbox/service-agbox-api/src/main/java/com/usky/agbox/RemoteUserService.java
  4. 105 0
      service-agbox/service-agbox-api/src/main/java/com/usky/agbox/domain/SysUserVO.java
  5. 48 0
      service-agbox/service-agbox-api/src/main/java/com/usky/agbox/factory/RemoteUserFallbackFactory.java
  6. 28 0
      service-agbox/service-agbox-api/src/main/java/com/usky/alarm/RemoteUserService.java
  7. 105 0
      service-agbox/service-agbox-api/src/main/java/com/usky/alarm/domain/SysUserVO.java
  8. 48 0
      service-agbox/service-agbox-api/src/main/java/com/usky/alarm/factory/RemoteUserFallbackFactory.java
  9. 89 0
      service-agbox/service-agbox-biz/pom.xml
  10. 45 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/RuoYiSystemApplication.java
  11. 108 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/controller/MybatisGeneratorUtils.java
  12. 2 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/controller/web/patrolAgboxController.java
  13. 2 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/job/patrolAgbox.java
  14. 136 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/util/HttpClientUtils.java
  15. 63 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/vo/BaseAlarmListVO.java
  16. 63 0
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/vo/EventVO.java
  17. 25 0
      service-agbox/service-agbox-biz/src/main/resources/bootstrap.yml
  18. 108 0
      service-agbox/service-agbox-biz/src/main/resources/doc/index.adoc
  19. 94 0
      service-agbox/service-agbox-biz/src/main/resources/logback.xml
  20. 41 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmMapper.xml
  21. 25 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmNoticeMapper.xml
  22. 20 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmNoticeResultMapper.xml
  23. 181 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmStatisticMapper.xml
  24. 22 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmTypeMapper.xml
  25. 14 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseFacilityDeviceMapper.xml
  26. 29 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/DmpDeviceMapper.xml
  27. 32 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/DmpProductMapper.xml
  28. 31 0
      service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/SysUserMapper.xml
  29. 15 0
      service-agbox/service-agbox-biz/src/main/resources/smart-doc.json
  30. 89 0
      service-agbox/service-alarm-biz/pom.xml
  31. 45 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/RuoYiSystemApplication.java
  32. 108 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/MybatisGeneratorUtils.java
  33. 60 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/api/SysUserControllerApi.java
  34. 40 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmController.java
  35. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmNoticeController.java
  36. 51 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmNoticeResultController.java
  37. 50 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmStatisticController.java
  38. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmTypeController.java
  39. 41 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseBuildController.java
  40. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseFacilityDeviceController.java
  41. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/DmpDeviceController.java
  42. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/DmpProductController.java
  43. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/SysUserController.java
  44. 30 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/TaskController.java
  45. 167 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarm.java
  46. 106 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmNotice.java
  47. 84 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmNoticeResult.java
  48. 66 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmStatistic.java
  49. 91 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmType.java
  50. 51 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseFacilityDevice.java
  51. 126 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/DmpDevice.java
  52. 141 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/DmpProduct.java
  53. 136 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/SysUser.java
  54. 19 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmMapper.java
  55. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmNoticeMapper.java
  56. 18 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmNoticeResultMapper.java
  57. 24 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmStatisticMapper.java
  58. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmTypeMapper.java
  59. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseFacilityDeviceMapper.java
  60. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/DmpDeviceMapper.java
  61. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/DmpProductMapper.java
  62. 18 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/SysUserMapper.java
  63. 22 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmNoticeResultService.java
  64. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmNoticeService.java
  65. 17 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmService.java
  66. 27 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmStatisticService.java
  67. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmTypeService.java
  68. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseFacilityDeviceService.java
  69. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/DmpDeviceService.java
  70. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/DmpProductService.java
  71. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/SysUserService.java
  72. 17 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/DateStringConvert.java
  73. 49 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/ExecutorConfig.java
  74. 29 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/FormatterConfiguration.java
  75. 17 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/StringDateConverter.java
  76. 50 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/mqtt/MqttBaseConfig.java
  77. 53 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/mqtt/MqttInConfig.java
  78. 84 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/mqtt/MqttOutConfig.java
  79. 5 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/smsmessage/SmsMessage.java
  80. 69 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/voice/VoiceNotice.java
  81. 75 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/websocket/WebSocket.java
  82. 16 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/websocket/WebSocketConfig.java
  83. 66 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/enums/TopListener.java
  84. 116 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmNoticeResultServiceImpl.java
  85. 20 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmNoticeServiceImpl.java
  86. 133 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmServiceImpl.java
  87. 96 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmStatisticServiceImpl.java
  88. 20 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmTypeServiceImpl.java
  89. 20 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseFacilityDeviceServiceImpl.java
  90. 20 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/DmpDeviceServiceImpl.java
  91. 20 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/DmpProductServiceImpl.java
  92. 20 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/SysUserServiceImpl.java
  93. 11 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/job/DmpDataOverviewJob.java
  94. 69 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/listener/MqttListener.java
  95. 26 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/MqttStrategy.java
  96. 26 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/SimpleContext.java
  97. 93 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/alarm/Alarm.java
  98. 136 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/util/HttpClientUtils.java
  99. 21 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/vo/MqttBaseVO.java
  100. 35 0
      service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/vo/MqttDataVO.java

+ 20 - 0
service-agbox/pom.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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>usky-modules</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>service-alarm</artifactId>
+
+    <packaging>pom</packaging>
+    <version>0.0.1</version>
+
+    <modules>
+        <module>service-alarm-biz</module>
+        <module>service-alarm-api</module>
+    </modules>
+</project>

+ 27 - 0
service-agbox/service-agbox-api/pom.xml

@@ -0,0 +1,27 @@
+<?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>service-alarm</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>service-alarm-api</artifactId>
+    <!-- SpringCloud Openfeign -->
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>usky-common-core</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+
+</project>

+ 28 - 0
service-agbox/service-agbox-api/src/main/java/com/usky/agbox/RemoteUserService.java

@@ -0,0 +1,28 @@
+package com.usky.alarm;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.alarm.domain.SysUserVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+@FeignClient(contextId = "remoteUserService", value = "usky-demo")
+public interface RemoteUserService {
+
+
+
+    @GetMapping("/byUserName")
+    ApiResult<List<SysUserVO>> getByUserName(@RequestParam("userName") String userName);
+
+
+    @PostMapping("/byUserName")
+    ApiResult<List<SysUserVO>> add(@RequestBody SysUserVO sysUserVO);
+
+
+    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    ApiResult<String> upload(@RequestPart(value = "file") MultipartFile file);
+}

+ 105 - 0
service-agbox/service-agbox-api/src/main/java/com/usky/agbox/domain/SysUserVO.java

@@ -0,0 +1,105 @@
+package com.usky.agbox.domain;
+
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class SysUserVO {
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 用户账号
+     */
+    private String userName;
+
+    /**
+     * 用户昵称
+     */
+    private String nickName;
+
+    /**
+     * 用户类型(00系统用户)
+     */
+    private String userType;
+
+    /**
+     * 用户邮箱
+     */
+    private String email;
+
+    /**
+     * 手机号码
+     */
+    private String phonenumber;
+
+    /**
+     * 用户性别(0男 1女 2未知)
+     */
+    private String sex;
+
+    /**
+     * 头像地址
+     */
+    private String avatar;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 帐号状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
+    private String delFlag;
+
+    /**
+     * 最后登录IP
+     */
+    private String loginIp;
+
+    /**
+     * 最后登录时间
+     */
+    private LocalDateTime loginDate;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 48 - 0
service-agbox/service-agbox-api/src/main/java/com/usky/agbox/factory/RemoteUserFallbackFactory.java

@@ -0,0 +1,48 @@
+package com.usky.alarm.factory;
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.exception.BusinessException;
+import com.usky.alarm.RemoteUserService;
+import com.usky.alarm.domain.SysUserVO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+
+/**
+ * 用户服务降级处理
+ *
+ * @author ruoyi
+ */
+@Component
+public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
+{
+    private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
+
+    @Override
+    public RemoteUserService create(Throwable throwable)
+    {
+        log.error("用户服务调用失败:{}", throwable.getMessage());
+        return new RemoteUserService() {
+            @Override
+            public ApiResult<List<SysUserVO>> getByUserName(String userName) {
+                throw new BusinessException(throwable.getMessage());
+            }
+
+            @Override
+            public ApiResult<List<SysUserVO>> add(SysUserVO sysUserVO) {
+                throw new BusinessException(throwable.getMessage());
+            }
+
+            @Override
+            public ApiResult<String> upload(MultipartFile file) {
+                throw new BusinessException(throwable.getMessage());
+            }
+        };
+    }
+}

+ 28 - 0
service-agbox/service-agbox-api/src/main/java/com/usky/alarm/RemoteUserService.java

@@ -0,0 +1,28 @@
+package com.usky.alarm;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.alarm.domain.SysUserVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+@FeignClient(contextId = "remoteUserService", value = "usky-demo")
+public interface RemoteUserService {
+
+
+
+    @GetMapping("/byUserName")
+    ApiResult<List<SysUserVO>> getByUserName(@RequestParam("userName") String userName);
+
+
+    @PostMapping("/byUserName")
+    ApiResult<List<SysUserVO>> add(@RequestBody SysUserVO sysUserVO);
+
+
+    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    ApiResult<String> upload(@RequestPart(value = "file") MultipartFile file);
+}

+ 105 - 0
service-agbox/service-agbox-api/src/main/java/com/usky/alarm/domain/SysUserVO.java

@@ -0,0 +1,105 @@
+package com.usky.alarm.domain;
+
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class SysUserVO {
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 用户账号
+     */
+    private String userName;
+
+    /**
+     * 用户昵称
+     */
+    private String nickName;
+
+    /**
+     * 用户类型(00系统用户)
+     */
+    private String userType;
+
+    /**
+     * 用户邮箱
+     */
+    private String email;
+
+    /**
+     * 手机号码
+     */
+    private String phonenumber;
+
+    /**
+     * 用户性别(0男 1女 2未知)
+     */
+    private String sex;
+
+    /**
+     * 头像地址
+     */
+    private String avatar;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 帐号状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
+    private String delFlag;
+
+    /**
+     * 最后登录IP
+     */
+    private String loginIp;
+
+    /**
+     * 最后登录时间
+     */
+    private LocalDateTime loginDate;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 48 - 0
service-agbox/service-agbox-api/src/main/java/com/usky/alarm/factory/RemoteUserFallbackFactory.java

@@ -0,0 +1,48 @@
+package com.usky.alarm.factory;
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.exception.BusinessException;
+import com.usky.alarm.RemoteUserService;
+import com.usky.alarm.domain.SysUserVO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+
+/**
+ * 用户服务降级处理
+ *
+ * @author ruoyi
+ */
+@Component
+public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
+{
+    private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
+
+    @Override
+    public RemoteUserService create(Throwable throwable)
+    {
+        log.error("用户服务调用失败:{}", throwable.getMessage());
+        return new RemoteUserService() {
+            @Override
+            public ApiResult<List<SysUserVO>> getByUserName(String userName) {
+                throw new BusinessException(throwable.getMessage());
+            }
+
+            @Override
+            public ApiResult<List<SysUserVO>> add(SysUserVO sysUserVO) {
+                throw new BusinessException(throwable.getMessage());
+            }
+
+            @Override
+            public ApiResult<String> upload(MultipartFile file) {
+                throw new BusinessException(throwable.getMessage());
+            }
+        };
+    }
+}

+ 89 - 0
service-agbox/service-agbox-biz/pom.xml

@@ -0,0 +1,89 @@
+<?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>service-alarm</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>service-alarm-biz</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>common-cloud-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-spring-boot-starter</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.5.16</version>
+        </dependency>
+
+        <!--语音依赖-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dyvmsapi</artifactId>
+            <version>1.2.2</version>
+        </dependency>
+
+        <!--短信依赖-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+            <version>1.1.0</version>
+        </dependency>
+
+        <!--MQTT依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-integration</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-mqtt</artifactId>
+        </dependency>
+        <!--websocket依赖-->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-websocket</artifactId>
+            <version>5.2.8.RELEASE</version>
+        </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>
+            <plugin>
+                <groupId>com.github.shalousun</groupId>
+                <artifactId>smart-doc-maven-plugin</artifactId>
+                <version>2.1.1</version>
+                <configuration>
+                    <!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
+                    <configFile>./src/main/resources/smart-doc.json</configFile>
+                    <!--指定项目名称-->
+                    <projectName>test</projectName>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 45 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/RuoYiSystemApplication.java

@@ -0,0 +1,45 @@
+package com.usky.alarm;
+
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.core.env.Environment;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * 系统模块
+ * 
+ * @author ruoyi
+ */
+
+
+@EnableFeignClients(basePackages = "com.usky")
+@MapperScan(value = "com.usky.alarm.mapper")
+@ComponentScan("com.usky")
+@SpringBootApplication
+public class RuoYiSystemApplication
+{
+    private static final Logger LOGGER = LoggerFactory.getLogger(RuoYiSystemApplication.class);
+
+    public static void main(String[] args) throws UnknownHostException {
+        ConfigurableApplicationContext application = SpringApplication.run(RuoYiSystemApplication.class, args);
+        Environment env = application.getEnvironment();
+        String ip = InetAddress.getLocalHost().getHostAddress();
+        String port = env.getProperty("server.port");
+        String path = env.getProperty("server.servlet.context-path");
+        LOGGER.info("\n----------------------------------------------------------\n\t" +
+                "Application is running! Access URLs:\n\t" +
+                "Local: \t\thttp://localhost:" + port + (null==path?"":path) + "/\n\t" +
+                "External: \thttp://" + ip + ":" + port + (null==path?"":path) + "/\n\t" +
+                "Api: \t\thttp://" + ip + ":" + port + (null==path?"":path) + "/swagger-ui/index.html\n\t" +
+                "----------------------------------------------------------");
+    }
+}

+ 108 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/controller/MybatisGeneratorUtils.java

@@ -0,0 +1,108 @@
+package com.usky.alarm.controller;//package com.usky.iot.controller;//package com.usky.dm.controller.web.business;//package com.usky.dm.controller.web;
+
+
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author yq
+ * @date 2021/7/6 11:42
+ */
+public class MybatisGeneratorUtils {
+    public static void main(String[] args) {
+
+            shell("service-alarm","service-alarm-biz");
+    }
+
+    private static void shell(String parentName,String model) {
+
+        AutoGenerator mpg = new AutoGenerator();
+        //1、全局配置
+        GlobalConfig gc = new GlobalConfig();
+//        File file = new File(model);
+//        String path = file.getAbsolutePath();
+        String projectPath = System.getProperty("user.dir");
+        projectPath+="/"+parentName;
+        projectPath+="/"+model;
+        gc.setOutputDir(projectPath+ "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面)
+        //修改为自己的名字
+        gc.setAuthor("han"); //设置作者
+        gc.setOpen(false);
+        gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉
+        gc.setServiceName("%sService"); //生成的service接口名字首字母是否为I,这样设置就没有
+        gc.setBaseResultMap(true); //生成resultMap
+        mpg.setGlobalConfig(gc);
+
+        //2、数据源配置
+        //修改数据源
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://172.16.120.165:3306/usky-cloud?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8");
+        dsc.setDriverName("com.mysql.jdbc.Driver");
+        dsc.setUsername("usky");
+        dsc.setPassword("Yt#75Usky");
+        mpg.setDataSource(dsc);
+
+        // 3、包配置
+        PackageConfig pc = new PackageConfig();
+        pc.setParent("com.usky.alarm");
+        pc.setController("controller.web");
+        pc.setEntity("domain");
+        pc.setMapper("mapper");
+        pc.setService("service");
+        pc.setServiceImpl("service.impl");
+//        pc.setXml("mapper.demo");
+        //pc.setModuleName("test");
+        mpg.setPackageInfo(pc);
+
+        // 4、策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setNaming(NamingStrategy.underline_to_camel);
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
+        strategy.setSuperMapperClass("com.usky.common.mybatis.core.CrudMapper");
+        strategy.setSuperServiceClass("com.usky.common.mybatis.core.CrudService");
+        strategy.setSuperServiceImplClass("com.usky.common.mybatis.core.AbstractCrudService");
+        // strategy.setTablePrefix("t_"); // 表名前缀
+        strategy.setEntityLombokModel(true); //使用lombok
+        //修改自己想要生成的表
+        strategy.setInclude("sys_user");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        mpg.setStrategy(strategy);
+
+        // 关闭默认 xml 生成,调整生成 至 根目录
+        //修改对应的模块名称
+        TemplateConfig tc = new TemplateConfig();
+        // 自定义配置
+        InjectionConfig cfg = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                // to do nothing
+            }
+        };
+        //如果模板引擎是 velocity
+        String templatePath = "/templates/mapper.xml.vm";
+        // 自定义输出配置
+        List<FileOutConfig> focList = new ArrayList<>();
+        // 自定义配置会被优先输出
+        String finalProjectPath = projectPath;
+        focList.add(new FileOutConfig(templatePath) {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return finalProjectPath + "/src/main/resources/mapper/alarm" + "/"
+                        + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+            }
+        });
+        cfg.setFileOutConfigList(focList);
+        mpg.setCfg(cfg);
+        tc.setXml(null);
+        mpg.setTemplate(tc);
+        //5、执行
+        mpg.execute();
+    }
+}

+ 2 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/controller/web/patrolAgboxController.java

@@ -0,0 +1,2 @@
+package com.usky.agbox.controller.web;public class patrolAgboxController {
+}

+ 2 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/job/patrolAgbox.java

@@ -0,0 +1,2 @@
+package com.usky.agbox.service.job;public class patrolAgbox {
+}

+ 136 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/util/HttpClientUtils.java

@@ -0,0 +1,136 @@
+package com.usky.alarm.service.util;
+
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ 1. 跨域请求工具类
+ */
+public class HttpClientUtils {
+
+    public static String doGet(String url, Map<String, String> param) {
+
+        // 创建Httpclient对象
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+
+        String resultString = "";
+        CloseableHttpResponse response = null;
+        try {
+            // 创建uri
+            URIBuilder builder = new URIBuilder(url);
+            if (param != null) {
+                for (String key : param.keySet()) {
+                    builder.addParameter(key, param.get(key));
+                }
+            }
+            URI uri = builder.build();
+
+            // 创建http GET请求
+            HttpGet httpGet = new HttpGet(uri);
+
+            // 执行请求
+            response = httpclient.execute(httpGet);
+            // 判断返回状态是否为200
+            if (response.getStatusLine().getStatusCode() == 200) {
+                resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return resultString;
+    }
+
+    public static String doGet(String url) {
+        return doGet(url, null);
+    }
+
+    public static String doPost(String url, Map<String, String> param) {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpPost httpPost = new HttpPost(url);
+            // 创建参数列表
+            if (param != null) {
+                List<NameValuePair> paramList = new ArrayList<>();
+                for (String key : param.keySet()) {
+                    paramList.add(new BasicNameValuePair(key, param.get(key)));
+                }
+                // 模拟表单
+                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
+                httpPost.setEntity(entity);
+            }
+            // 执行http请求
+            response = httpClient.execute(httpPost);
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        return resultString;
+    }
+
+    public static String doPost(String url) {
+        return doPost(url, null);
+    }
+
+    public static String doPostJson(String url, String json) {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpPost httpPost = new HttpPost(url);
+            // 创建请求内容
+            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
+            httpPost.setEntity(entity);
+            // 执行http请求
+            response = httpClient.execute(httpPost);
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        return resultString;
+    }
+}

+ 63 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/vo/BaseAlarmListVO.java

@@ -0,0 +1,63 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class BaseAlarmListVO {
+    /**
+     * 页数
+     */
+    private Integer current;
+    /**
+     * 条数
+     */
+    private Integer size;
+
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+    /**
+     * 单位名称
+     */
+    private String companyName;
+
+    /**
+     * 设备Id
+     */
+    private String deviceId;
+
+    /**
+     * 设备名称
+     */
+    private String deviceName;
+
+    /**
+     * 告警类型
+     */
+    private List<String> alarmType;
+
+    /**
+     * 处理状态;0 未处理,1 已处理
+     */
+    private Integer handleStatus;
+
+    /**
+     * 开始时间
+     */
+    private String startTime;
+
+    /**
+     * 结束时间
+     */
+    private String endTime;
+
+    /**
+     * 报警分类(1、报警 2、隐患)
+     */
+    private String typeCode;
+
+}

+ 63 - 0
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/vo/EventVO.java

@@ -0,0 +1,63 @@
+package com.usky.iot.service.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class BaseAlarmListVO {
+    /**
+     * 页数
+     */
+    private Integer current;
+    /**
+     * 条数
+     */
+    private Integer size;
+
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+    /**
+     * 单位名称
+     */
+    private String companyName;
+
+    /**
+     * 设备Id
+     */
+    private String deviceId;
+
+    /**
+     * 设备名称
+     */
+    private String deviceName;
+
+    /**
+     * 告警类型
+     */
+    private List<String> alarmType;
+
+    /**
+     * 处理状态;0 未处理,1 已处理
+     */
+    private Integer handleStatus;
+
+    /**
+     * 开始时间
+     */
+    private String startTime;
+
+    /**
+     * 结束时间
+     */
+    private String endTime;
+
+    /**
+     * 报警分类(1、报警 2、隐患)
+     */
+    private String typeCode;
+
+}

+ 25 - 0
service-agbox/service-agbox-biz/src/main/resources/bootstrap.yml

@@ -0,0 +1,25 @@
+# Tomcat
+server:
+  port: 9891
+
+# Spring
+spring: 
+  application:
+    # 应用名称
+    name: service-alarm
+  profiles:
+    # 环境配置
+    active: dev
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: usky-cloud-nacos:8848
+      config:
+        # 配置中心地址
+        server-addr: usky-cloud-nacos:8848
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

+ 108 - 0
service-agbox/service-agbox-biz/src/main/resources/doc/index.adoc

@@ -0,0 +1,108 @@
+= 安防项目
+
+[width="100%",options="header"]
+[stripes=even]
+|====================
+|Version |  Update Time  | Status | Author |  Description
+|v2022-04-21 16:57:08|2022-04-21 16:57:08|auto|@yq|Created by smart-doc
+|====================
+
+
+== &lt;p&gt;参数配置表 前端控制器&lt;/p&gt;
+== &lt;p&gt;部门信息&lt;/p&gt;
+=== 查看部门信息
+*URL:* http:10.23.39.1:8082/sysDept/list
+
+*Type:* POST
+
+*Author:* ya
+
+*Content-Type:* application/json; charset=utf-8
+
+
+
+
+*Body-parameters:*
+
+[width="100%",options="header"]
+[stripes=even]
+|====================
+|Parameter | Type|Description|Required|Since
+|deptId|int64|部门id|false|-
+|parentId|int64|父部门id|false|-
+|ancestors|string|祖级列表|false|-
+|deptName|string|部门名称|false|-
+|orderNum|int32|显示顺序|false|-
+|leader|string|负责人|false|-
+|phone|string|联系电话|false|-
+|email|string|邮箱|false|-
+|status|string|部门状态(0正常 1停用)|false|-
+|delFlag|string|删除标志(0代表存在 2代表删除)|false|-
+|createBy|string|创建者|false|-
+|createTime|string|创建时间|false|-
+|updateBy|string|更新者|false|-
+|updateTime|string|更新时间|false|-
+|bId|int64|建筑id|false|-
+|====================
+
+*Response-fields:*
+
+[width="100%",options="header"]
+[stripes=even]
+|====================
+|Field | Type|Description|Since
+|status|object|No comments found.|-
+|code|string|No comments found.|-
+|msg|string|No comments found.|-
+|data|object|No comments found.|-
+|└─deptId|int64|部门id|-
+|└─parentId|int64|父部门id|-
+|└─ancestors|string|祖级列表|-
+|└─deptName|string|部门名称|-
+|└─orderNum|int32|显示顺序|-
+|└─leader|string|负责人|-
+|└─phone|string|联系电话|-
+|└─email|string|邮箱|-
+|└─status|string|部门状态(0正常 1停用)|-
+|└─delFlag|string|删除标志(0代表存在 2代表删除)|-
+|└─createBy|string|创建者|-
+|└─createTime|string|创建时间|-
+|└─updateBy|string|更新者|-
+|└─updateTime|string|更新时间|-
+|└─bId|int64|建筑id|-
+|exception|string|No comments found.|-
+|====================
+
+*Response-example:*
+----
+{
+	"status": {
+		
+	},
+	"code": "97564",
+	"msg": "wnr5qt",
+	"data": [
+		{
+			"deptId": 540,
+			"parentId": 858,
+			"ancestors": "o5lg60",
+			"deptName": "文.沈",
+			"orderNum": 260,
+			"leader": "ufz93p",
+			"phone": "17852835049",
+			"email": "智渊.徐@yahoo.com",
+			"status": "nu6cnp",
+			"delFlag": "72oiji",
+			"createBy": "5fxr6j",
+			"createTime": "2022-04-21 16:57:10",
+			"updateBy": "4kcs4e",
+			"updateTime": "2022-04-21 16:57:10",
+			"bId": 977
+		}
+	],
+	"exception": "53u6bg"
+}
+----
+
+== &lt;p&gt;用户信息表 前端控制器&lt;/p&gt;
+

+ 94 - 0
service-agbox/service-agbox-biz/src/main/resources/logback.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <!-- 日志存放路径 -->
+    <property name="log.path" value="/var/log/uskycloud/service-alarm" />
+    <!-- 日志输出格式 -->
+    <property name="log.pattern" value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{26}:%line: %msg%n" />
+    <!--    	<property name="log.pattern" value="%gray(%d{MM-dd HH:mm:ss.SSS}) %highlight(%-5level) &#45;&#45; [%gray(%thread)] %cyan(%logger{26}:%line): %msg%n" />-->
+
+
+    <property name="SQL_PACKAGE" value="com.usky.alarm.mapper"/>
+
+    <!-- 控制台输出 -->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file_sql" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}/sql.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/sql.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>3</maxHistory>
+        </rollingPolicy>
+        <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>3</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.usky" level="info" />-->
+    <!-- Spring日志级别控制  -->
+    <!--	<logger name="org.springframework" level="warn" />-->
+
+    <logger name="${SQL_PACKAGE}" additivity="false" level="debug">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file_sql"/>
+    </logger>
+
+    <!--系统操作日志-->
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+        <appender-ref ref="console" />
+    </root>
+</configuration>

+ 41 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.BaseAlarmMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.BaseAlarm">
+        <id column="id" property="id" />
+        <result column="device_id" property="deviceId" />
+        <result column="alarm_time" property="alarmTime" />
+        <result column="alarm_type" property="alarmType" />
+        <result column="alarm_object" property="alarmObject" />
+        <result column="alarm_data" property="alarmData" />
+        <result column="alarm_attribute" property="alarmAttribute" />
+        <result column="alarm_content" property="alarmContent" />
+        <result column="alarm_grade" property="alarmGrade" />
+        <result column="alarm_address" property="alarmAddress" />
+        <result column="handle_by" property="handleBy" />
+        <result column="handle_time" property="handleTime" />
+        <result column="handle_content" property="handleContent" />
+        <result column="handle_phone" property="handlePhone" />
+        <result column="handle_status" property="handleStatus" />
+        <result column="alarm_false" property="alarmFalse" />
+        <result column="site_photo" property="sitePhoto" />
+        <result column="product_code" property="productCode" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+    </resultMap>
+    <select id="getAlarmTypeOne" resultType="com.usky.alarm.domain.BaseAlarmType">
+        select
+        *
+        from base_alarm_type
+        <where>
+            <if test="alarmType != null">
+                and type_code = #{alarmType}
+            </if>
+            <if test="1 == 1">
+                and delete_flag = 0
+            </if>
+        </where>
+    </select>
+</mapper>

+ 25 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmNoticeMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.BaseAlarmNoticeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.BaseAlarmNotice">
+        <id column="id" property="id" />
+        <result column="product_code" property="productCode" />
+        <result column="type_code" property="typeCode" />
+        <result column="receiver1" property="receiver1" />
+        <result column="receiver2" property="receiver2" />
+        <result column="receiver3" property="receiver3" />
+        <result column="time_out1" property="timeOut1" />
+        <result column="time_out2" property="timeOut2" />
+        <result column="notice_method" property="noticeMethod" />
+        <result column="create_by" property="createBy" />
+        <result column="create_time" property="createTime" />
+        <result column="update_by" property="updateBy" />
+        <result column="update_time" property="updateTime" />
+        <result column="delete_flag" property="deleteFlag" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+    </resultMap>
+
+</mapper>

+ 20 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmNoticeResultMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.BaseAlarmNoticeResultMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.BaseAlarmNoticeResult">
+        <id column="id" property="id" />
+        <result column="receiver" property="receiver" />
+        <result column="notice_result" property="noticeResult" />
+        <result column="alarm_id" property="alarmId" />
+        <result column="notice_time" property="noticeTime" />
+        <result column="notice_type" property="noticeType" />
+        <result column="notice_content" property="noticeContent" />
+        <result column="is_read" property="isRead" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="receiver_phone" property="receiverPhone" />
+    </resultMap>
+
+</mapper>

+ 181 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmStatisticMapper.xml

@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.BaseAlarmStatisticMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.BaseAlarmStatistic">
+        <id column="id" property="id" />
+        <result column="alarm_num" property="alarmNum" />
+        <result column="pitfall_num" property="pitfallNum" />
+        <result column="statistic_dimen" property="statisticDimen" />
+        <result column="statistic_time" property="statisticTime" />
+        <result column="create_time" property="createTime" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+    </resultMap>
+
+<!--    <select id="getStatistic" resultType="java.util.Map">-->
+<!--        SELECT-->
+<!--        d.date,-->
+<!--        IFNULL(t.total_rows, 0) AS total_rows-->
+<!--        FROM-->
+<!--        (-->
+<!--        SELECT-->
+<!--        date_add(-->
+<!--        #{startTime},-->
+<!--        INTERVAL ROW DAY-->
+<!--        ) date-->
+<!--        FROM-->
+<!--        (-->
+<!--        SELECT-->
+<!--        @ROW := @ROW + 1 AS ROW-->
+<!--        FROM-->
+<!--        (-->
+<!--        SELECT-->
+<!--        0-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        1-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        2-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        3-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        4-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        5-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        6-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        7-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        8-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        9-->
+<!--        ) t,-->
+<!--        (-->
+<!--        SELECT-->
+<!--        0-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        1-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        2-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        3-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        4-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        5-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        6-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        7-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        8-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        9-->
+<!--        ) t2,-->
+<!--        (-->
+<!--        SELECT-->
+<!--        0-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        1-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        2-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        3-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        4-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        5-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        6-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        7-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        8-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        9-->
+<!--        ) t3,-->
+<!--        (-->
+<!--        SELECT-->
+<!--        0-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        1-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        2-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        3-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        4-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        5-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        6-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        7-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        8-->
+<!--        UNION ALL-->
+<!--        SELECT-->
+<!--        9-->
+<!--        ) t4,-->
+<!--        (SELECT @ROW :=- 1) r-->
+<!--        ) se-->
+<!--        WHERE-->
+<!--        date_add(-->
+<!--        #{startTime},-->
+<!--        INTERVAL ROW DAY-->
+<!--        ) < #{endTime}-->
+<!--        ) AS d-->
+<!--        LEFT JOIN (-->
+<!--        SELECT-->
+<!--        DATE(alarm_time) AS date,-->
+<!--        COUNT(*) AS total_rows-->
+<!--        FROM-->
+<!--        base_alarm-->
+<!--        WHERE-->
+<!--        DATE(alarm_time) BETWEEN #{startTime}-->
+<!--        AND #{endTime}-->
+<!--        GROUP BY-->
+<!--        DATE(alarm_time)-->
+<!--        ) AS t ON d.date = t.date-->
+<!--        ORDER BY-->
+<!--        d.date-->
+<!--    </select>-->
+
+</mapper>

+ 22 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseAlarmTypeMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.BaseAlarmTypeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.BaseAlarmType">
+        <id column="id" property="id" />
+        <result column="type_code" property="typeCode" />
+        <result column="type_abbrevia" property="typeAbbrevia" />
+        <result column="type_name" property="typeName" />
+        <result column="type_img" property="typeImg" />
+        <result column="alarm_desc" property="alarmDesc" />
+        <result column="delete_flag" property="deleteFlag" />
+        <result column="create_by" property="createBy" />
+        <result column="create_time" property="createTime" />
+        <result column="update_by" property="updateBy" />
+        <result column="update_time" property="updateTime" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+    </resultMap>
+
+</mapper>

+ 14 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/BaseFacilityDeviceMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.BaseFacilityDeviceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.BaseFacilityDevice">
+        <id column="id" property="id" />
+        <result column="facility_id" property="facilityId" />
+        <result column="device_id" property="deviceId" />
+        <result column="created_by" property="createdBy" />
+        <result column="created_time" property="createdTime" />
+    </resultMap>
+
+</mapper>

+ 29 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/DmpDeviceMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.DmpDeviceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.DmpDevice">
+        <id column="id" property="id" />
+        <result column="device_id" property="deviceId" />
+        <result column="device_name" property="deviceName" />
+        <result column="device_type" property="deviceType" />
+        <result column="product_id" property="productId" />
+        <result column="sim_code" property="simCode" />
+        <result column="imsi_code" property="imsiCode" />
+        <result column="subscribe_flag" property="subscribeFlag" />
+        <result column="node_type" property="nodeType" />
+        <result column="group_id" property="groupId" />
+        <result column="delete_flag" property="deleteFlag" />
+        <result column="created_by" property="createdBy" />
+        <result column="created_time" property="createdTime" />
+        <result column="updated_by" property="updatedBy" />
+        <result column="updated_time" property="updatedTime" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="company_code" property="companyCode" />
+        <result column="install_address" property="installAddress" />
+        <result column="service_status" property="serviceStatus" />
+        <result column="product_code" property="productCode" />
+    </resultMap>
+
+</mapper>

+ 32 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/DmpProductMapper.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.DmpProductMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.DmpProduct">
+        <id column="id" property="id" />
+        <result column="product_name" property="productName" />
+        <result column="access_mode" property="accessMode" />
+        <result column="network_type" property="networkType" />
+        <result column="device_type" property="deviceType" />
+        <result column="com_protocol" property="comProtocol" />
+        <result column="auth_mode" property="authMode" />
+        <result column="device_model" property="deviceModel" />
+        <result column="product_describe" property="productDescribe" />
+        <result column="factory_name" property="factoryName" />
+        <result column="factory_person" property="factoryPerson" />
+        <result column="factory_phone" property="factoryPhone" />
+        <result column="certificate_url1" property="certificateUrl1" />
+        <result column="certificate_url2" property="certificateUrl2" />
+        <result column="certificate_url3" property="certificateUrl3" />
+        <result column="agreement_url" property="agreementUrl" />
+        <result column="delete_flag" property="deleteFlag" />
+        <result column="created_by" property="createdBy" />
+        <result column="created_time" property="createdTime" />
+        <result column="updated_by" property="updatedBy" />
+        <result column="updated_time" property="updatedTime" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="product_code" property="productCode" />
+    </resultMap>
+
+</mapper>

+ 31 - 0
service-agbox/service-agbox-biz/src/main/resources/mapper/alarm/SysUserMapper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.alarm.mapper.SysUserMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.alarm.domain.SysUser">
+        <id column="user_id" property="userId" />
+        <result column="dept_id" property="deptId" />
+        <result column="user_name" property="userName" />
+        <result column="nick_name" property="nickName" />
+        <result column="user_type" property="userType" />
+        <result column="email" property="email" />
+        <result column="phonenumber" property="phonenumber" />
+        <result column="sex" property="sex" />
+        <result column="full_name" property="fullName" />
+        <result column="avatar" property="avatar" />
+        <result column="password" property="password" />
+        <result column="status" property="status" />
+        <result column="del_flag" property="delFlag" />
+        <result column="login_ip" property="loginIp" />
+        <result column="login_date" property="loginDate" />
+        <result column="create_by" property="createBy" />
+        <result column="create_time" property="createTime" />
+        <result column="update_by" property="updateBy" />
+        <result column="update_time" property="updateTime" />
+        <result column="remark" property="remark" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="address" property="address" />
+    </resultMap>
+
+</mapper>

+ 15 - 0
service-agbox/service-agbox-biz/src/main/resources/smart-doc.json

@@ -0,0 +1,15 @@
+{
+  "outPath":"./src/main/resources/doc",
+  "serverUrl": "http:10.23.39.1:9887/",
+  "isStrict": false,
+  "coverOld": true,
+  "allInOne": true,
+  "packageFilters": "com.usky.iot.controller.web",
+  "requestExample":"false",
+  "responseExample":"true",
+  "projectName": "iot项目",
+  "appKey": "20211216921084883495813120",
+  "appToken":"967031b0cc6f474aaf73616cbf2b25c2",
+  "secret": "N@Pd,KXAHki*BW3=zK.XPNykf!=CM79J",
+  "openUrl": "http://101.133.214.75:7700/api"
+}

+ 89 - 0
service-agbox/service-alarm-biz/pom.xml

@@ -0,0 +1,89 @@
+<?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>service-alarm</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>service-alarm-biz</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>common-cloud-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-spring-boot-starter</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.5.16</version>
+        </dependency>
+
+        <!--语音依赖-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dyvmsapi</artifactId>
+            <version>1.2.2</version>
+        </dependency>
+
+        <!--短信依赖-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+            <version>1.1.0</version>
+        </dependency>
+
+        <!--MQTT依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-integration</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-mqtt</artifactId>
+        </dependency>
+        <!--websocket依赖-->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-websocket</artifactId>
+            <version>5.2.8.RELEASE</version>
+        </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>
+            <plugin>
+                <groupId>com.github.shalousun</groupId>
+                <artifactId>smart-doc-maven-plugin</artifactId>
+                <version>2.1.1</version>
+                <configuration>
+                    <!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
+                    <configFile>./src/main/resources/smart-doc.json</configFile>
+                    <!--指定项目名称-->
+                    <projectName>test</projectName>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 45 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/RuoYiSystemApplication.java

@@ -0,0 +1,45 @@
+package com.usky.alarm;
+
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.core.env.Environment;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * 系统模块
+ * 
+ * @author ruoyi
+ */
+
+
+@EnableFeignClients(basePackages = "com.usky")
+@MapperScan(value = "com.usky.alarm.mapper")
+@ComponentScan("com.usky")
+@SpringBootApplication
+public class RuoYiSystemApplication
+{
+    private static final Logger LOGGER = LoggerFactory.getLogger(RuoYiSystemApplication.class);
+
+    public static void main(String[] args) throws UnknownHostException {
+        ConfigurableApplicationContext application = SpringApplication.run(RuoYiSystemApplication.class, args);
+        Environment env = application.getEnvironment();
+        String ip = InetAddress.getLocalHost().getHostAddress();
+        String port = env.getProperty("server.port");
+        String path = env.getProperty("server.servlet.context-path");
+        LOGGER.info("\n----------------------------------------------------------\n\t" +
+                "Application is running! Access URLs:\n\t" +
+                "Local: \t\thttp://localhost:" + port + (null==path?"":path) + "/\n\t" +
+                "External: \thttp://" + ip + ":" + port + (null==path?"":path) + "/\n\t" +
+                "Api: \t\thttp://" + ip + ":" + port + (null==path?"":path) + "/swagger-ui/index.html\n\t" +
+                "----------------------------------------------------------");
+    }
+}

+ 108 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/MybatisGeneratorUtils.java

@@ -0,0 +1,108 @@
+package com.usky.alarm.controller;//package com.usky.iot.controller;//package com.usky.dm.controller.web.business;//package com.usky.dm.controller.web;
+
+
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author yq
+ * @date 2021/7/6 11:42
+ */
+public class MybatisGeneratorUtils {
+    public static void main(String[] args) {
+
+            shell("service-alarm","service-alarm-biz");
+    }
+
+    private static void shell(String parentName,String model) {
+
+        AutoGenerator mpg = new AutoGenerator();
+        //1、全局配置
+        GlobalConfig gc = new GlobalConfig();
+//        File file = new File(model);
+//        String path = file.getAbsolutePath();
+        String projectPath = System.getProperty("user.dir");
+        projectPath+="/"+parentName;
+        projectPath+="/"+model;
+        gc.setOutputDir(projectPath+ "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面)
+        //修改为自己的名字
+        gc.setAuthor("han"); //设置作者
+        gc.setOpen(false);
+        gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉
+        gc.setServiceName("%sService"); //生成的service接口名字首字母是否为I,这样设置就没有
+        gc.setBaseResultMap(true); //生成resultMap
+        mpg.setGlobalConfig(gc);
+
+        //2、数据源配置
+        //修改数据源
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://172.16.120.165:3306/usky-cloud?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8");
+        dsc.setDriverName("com.mysql.jdbc.Driver");
+        dsc.setUsername("usky");
+        dsc.setPassword("Yt#75Usky");
+        mpg.setDataSource(dsc);
+
+        // 3、包配置
+        PackageConfig pc = new PackageConfig();
+        pc.setParent("com.usky.alarm");
+        pc.setController("controller.web");
+        pc.setEntity("domain");
+        pc.setMapper("mapper");
+        pc.setService("service");
+        pc.setServiceImpl("service.impl");
+//        pc.setXml("mapper.demo");
+        //pc.setModuleName("test");
+        mpg.setPackageInfo(pc);
+
+        // 4、策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setNaming(NamingStrategy.underline_to_camel);
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
+        strategy.setSuperMapperClass("com.usky.common.mybatis.core.CrudMapper");
+        strategy.setSuperServiceClass("com.usky.common.mybatis.core.CrudService");
+        strategy.setSuperServiceImplClass("com.usky.common.mybatis.core.AbstractCrudService");
+        // strategy.setTablePrefix("t_"); // 表名前缀
+        strategy.setEntityLombokModel(true); //使用lombok
+        //修改自己想要生成的表
+        strategy.setInclude("sys_user");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        mpg.setStrategy(strategy);
+
+        // 关闭默认 xml 生成,调整生成 至 根目录
+        //修改对应的模块名称
+        TemplateConfig tc = new TemplateConfig();
+        // 自定义配置
+        InjectionConfig cfg = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                // to do nothing
+            }
+        };
+        //如果模板引擎是 velocity
+        String templatePath = "/templates/mapper.xml.vm";
+        // 自定义输出配置
+        List<FileOutConfig> focList = new ArrayList<>();
+        // 自定义配置会被优先输出
+        String finalProjectPath = projectPath;
+        focList.add(new FileOutConfig(templatePath) {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return finalProjectPath + "/src/main/resources/mapper/alarm" + "/"
+                        + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+            }
+        });
+        cfg.setFileOutConfigList(focList);
+        mpg.setCfg(cfg);
+        tc.setXml(null);
+        mpg.setTemplate(tc);
+        //5、执行
+        mpg.execute();
+    }
+}

+ 60 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/api/SysUserControllerApi.java

@@ -0,0 +1,60 @@
+//package com.usky.iot.controller.api;
+//
+//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+//import com.usky.common.core.bean.ApiResult;
+//import com.usky.common.core.exception.BusinessException;
+//import com.usky.common.core.util.BeanMapperUtils;
+//import com.usky.common.core.util.FileUtils;
+//import com.usky.common.core.util.GlobalUtils;
+//import com.usky.iot.domain.SysUser;
+//import com.usky.iot.service.SysUserService;
+//import com.usky.system.RemoteUserService;
+//import com.usky.system.domain.SysUserVO;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.RestController;
+//import org.springframework.web.multipart.MultipartFile;
+//
+//import java.io.File;
+//import java.io.IOException;
+//import java.util.ArrayList;
+//import java.util.List;
+//import java.util.Optional;
+//
+//@RestController
+//public class SysUserControllerApi implements RemoteUserService {
+//
+//    @Autowired
+//    private SysUserService sysUserService;
+//    @Override
+//    public ApiResult<List<SysUserVO>> getByUserName(String userName) {
+//        LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery();
+//        queryWrapper.eq(SysUser::getUserName,userName);
+//        return ApiResult.success(BeanMapperUtils.mapList(sysUserService.list(queryWrapper),SysUser.class,SysUserVO.class));
+//    }
+//
+//    @Override
+//    public ApiResult<List<SysUserVO>> add(SysUserVO sysUserVO) {
+//        sysUserService.save(BeanMapperUtils.map(sysUserVO, SysUser.class));
+//        return ApiResult.success(new ArrayList<>());
+//    }
+//
+//    @Override
+//    public ApiResult<String> upload(MultipartFile multipartFile) {
+//        Optional.ofNullable(multipartFile).orElseThrow(() ->  new BusinessException("文件为空"));
+//        String originalFilename = multipartFile.getOriginalFilename();
+//        String newFileName = System.currentTimeMillis() + originalFilename;
+//        File file = FileUtils.getFile(GlobalUtils.getTempBaseDir(), newFileName);
+//        String urlPath = "";
+//        try {
+//            try {
+//                multipartFile.transferTo(file);
+//            } catch (IOException e) {
+//                throw new BusinessException("文件上传失败");
+//            }
+//        } catch (Exception e) {
+//
+//        }
+//        return ApiResult.success(urlPath);
+//    }
+//}

+ 40 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmController.java

@@ -0,0 +1,40 @@
+package com.usky.alarm.controller.web;
+
+
+import com.aliyuncs.exceptions.ClientException;
+import com.usky.alarm.domain.BaseAlarm;
+import com.usky.alarm.service.BaseAlarmService;
+import com.usky.common.core.bean.ApiResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 统一告警表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@RestController
+@RequestMapping("/baseAlarm")
+public class BaseAlarmController {
+
+    @Autowired
+    private BaseAlarmService baseAlarmService;
+
+    /**
+     * 新增
+     * @param baseAlarm
+     * @return
+     */
+    @PostMapping("/alarmInfo")
+    public ApiResult<Void> add(@RequestBody BaseAlarm baseAlarm) throws ClientException {
+        baseAlarmService.add(baseAlarm);
+        return ApiResult.success();
+    }
+}
+

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmNoticeController.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 告警通知配置 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+@Controller
+@RequestMapping("/baseAlarmNotice")
+public class BaseAlarmNoticeController {
+
+}
+

+ 51 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmNoticeResultController.java

@@ -0,0 +1,51 @@
+package com.usky.alarm.controller.web;
+
+
+import com.usky.alarm.domain.BaseAlarmNoticeResult;
+import com.usky.alarm.service.BaseAlarmNoticeResultService;
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.log.annotation.Log;
+import com.usky.common.log.enums.BusinessType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 告警通知结果 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+@RestController
+@RequestMapping("/baseAlarmNoticeResult")
+public class BaseAlarmNoticeResultController {
+
+    @Autowired
+    private BaseAlarmNoticeResultService baseAlarmNoticeResultService;
+
+    /**
+     * 推送记录查看分页
+     * @param receiver  接收人
+     * @param alarmId  告警ID
+     * @param current      当前页
+     * @param size     每页条数
+     * @return
+     */
+    @Log(title = "关联设备查看分页", businessType = BusinessType.OTHER)
+    @GetMapping("/resultInfo")
+    public ApiResult<CommonPage<BaseAlarmNoticeResult>> resultInfo(@RequestParam(value = "receiver", required = false) String receiver,
+                                                                   @RequestParam(value = "alarmId") Integer alarmId,
+                                                                   @RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
+                                                                   @RequestParam(value = "size", required = false, defaultValue = "10") Integer size)
+    {
+        return ApiResult.success(baseAlarmNoticeResultService.resultInfo(receiver, alarmId, current, size));
+    }
+}
+

+ 50 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmStatisticController.java

@@ -0,0 +1,50 @@
+package com.usky.alarm.controller.web;
+
+
+import com.aliyuncs.exceptions.ClientException;
+import com.usky.alarm.domain.BaseAlarm;
+import com.usky.alarm.service.BaseAlarmService;
+import com.usky.alarm.service.BaseAlarmStatisticService;
+import com.usky.common.core.bean.ApiResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import org.springframework.stereotype.Controller;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 告警统计表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-11-24
+ */
+@RestController
+@RequestMapping("/baseAlarmStatistic")
+public class BaseAlarmStatisticController {
+    @Autowired
+    private BaseAlarmStatisticService baseAlarmStatisticService;
+
+    @GetMapping("/add")
+    public ApiResult<Void> add(@RequestParam(value = "alarmId") Integer alarmId) throws ClientException {
+        baseAlarmStatisticService.baseAlarmStatisticTask(alarmId);
+        return ApiResult.success();
+    }
+
+    /**
+     * 综合云图-告警及隐患折线图接口
+     *
+     * @param deptId 部门ID
+     * @param dateType 时间类型
+     * @return
+     */
+    @GetMapping("/alarmStatistic")
+    public ApiResult<List<Map<String,Object>>> alarmStatistic(@RequestParam(value = "deptId", required = false) Integer deptId,
+                                                              @RequestParam(value = "dateType", required = false) Integer dateType){
+        return ApiResult.success(baseAlarmStatisticService.alarmStatistic(deptId,dateType));
+    }
+}
+

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseAlarmTypeController.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 告警类型表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Controller
+@RequestMapping("/baseAlarmType")
+public class BaseAlarmTypeController {
+
+}
+

+ 41 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseBuildController.java

@@ -0,0 +1,41 @@
+package com.usky.alarm.controller.web;
+
+
+import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.usky.alarm.service.config.voice.VoiceNotice;
+import com.usky.common.core.bean.ApiResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * ceshi前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-06-07
+ */
+@RestController
+@RequestMapping("/baseBuild")
+public class BaseBuildController {
+
+    @Autowired
+    private VoiceNotice voiceNotice;
+    /**
+     * 新增
+     * @return
+     */
+    @PostMapping("/alarmInfo")
+    public SingleCallByTtsResponse add() throws ClientException {
+        SingleCallByTtsResponse code = voiceNotice.sendCVoice("15122423833","视频监控","火点侦测","2023-09-12 10:01:54");
+        return code;
+    }
+}
+
+
+
+
+

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/BaseFacilityDeviceController.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 地理设施设备关联表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Controller
+@RequestMapping("/baseFacilityDevice")
+public class BaseFacilityDeviceController {
+
+}
+

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/DmpDeviceController.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 设备信息表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Controller
+@RequestMapping("/dmpDevice")
+public class DmpDeviceController {
+
+}
+

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/DmpProductController.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 产品信息表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Controller
+@RequestMapping("/dmpProduct")
+public class DmpProductController {
+
+}
+

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/SysUserController.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 用户信息表 前端控制器
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-26
+ */
+@Controller
+@RequestMapping("/sysUser")
+public class SysUserController {
+
+}
+

+ 30 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/controller/web/TaskController.java

@@ -0,0 +1,30 @@
+package com.usky.alarm.controller.web;
+
+import com.usky.alarm.service.BaseAlarmStatisticService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author han
+ * @since 2023-12-04
+ */
+@EnableScheduling
+@Component
+public class TaskController {
+    @Autowired
+    private BaseAlarmStatisticService baseAlarmStatisticService;
+
+    @Scheduled(cron = "0 2 0 * * ? ") //每天凌晨2点执行
+    public void task() {
+        System.out.println(Thread.currentThread().getName() + "告警及隐患日统计定时任务执行中");
+        baseAlarmStatisticService.baseAlarmStatisticTask(1);
+    }
+
+    @Scheduled(cron = "0 0 1 1 * ?")//每月1号凌晨1点
+    public void task1() {
+        System.out.println(Thread.currentThread().getName() + "告警及隐患月统计定时任务执行中");
+        baseAlarmStatisticService.baseAlarmStatisticTask(2);
+    }
+}

+ 167 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarm.java

@@ -0,0 +1,167 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 统一告警表
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseAlarm implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 设备ID
+     */
+    private String deviceId;
+
+    /**
+     * 告警时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime alarmTime;
+
+    /**
+     * 告警类型
+     */
+    private String alarmType;
+
+    /**
+     * 告警对象
+     */
+    private String alarmObject;
+
+    /**
+     * 告警值
+     */
+    private String alarmData;
+
+    /**
+     * 告警属性
+     */
+    private String alarmAttribute;
+
+    /**
+     * 告警内容
+     */
+    private String alarmContent;
+
+    /**
+     * 告警等级;1 一级,2 二级,3 三级,4 四级,5 五级
+     */
+    private Integer alarmGrade;
+
+    /**
+     * 告警位置
+     */
+    private String alarmAddress;
+
+    /**
+     * 处理人
+     */
+    private String handleBy;
+
+    /**
+     * 处理时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime handleTime;
+
+    /**
+     * 处理内容
+     */
+    private String handleContent;
+
+    /**
+     * 处理人电话
+     */
+    private String handlePhone;
+
+    /**
+     * 处理状态;0 未处理,1 已处理
+     */
+    private Integer handleStatus;
+
+    /**
+     * 是否误报;0 非误报,1 误报
+     */
+    private Integer alarmFalse;
+
+    /**
+     * 现场照片
+     */
+    private String sitePhoto;
+
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位名称
+     */
+    @TableField(exist = false)
+    private String companyName;
+
+    /**
+     * 设备名称
+     */
+    @TableField(exist = false)
+    private String deviceName;
+
+    /**
+     * 处理范围
+     */
+    @TableField(exist = false)
+    private Integer handleRange;
+
+    /**
+     * 图标
+     */
+    @TableField(exist = false)
+    private String typeImg;
+
+    /**
+     * 设施编号
+     */
+    @TableField(exist = false)
+    private Integer facilityId;
+
+    /**
+     * 转换时间
+     */
+    @TableField(exist = false)
+    private String alarmTime1;
+
+
+}

+ 106 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmNotice.java

@@ -0,0 +1,106 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 告警通知配置
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseAlarmNotice implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 系统编码
+     */
+    private String productCode;
+
+    /**
+     * 告警类型编码
+     */
+    private String typeCode;
+
+    /**
+     * 第一次接收人
+     */
+    private String receiver1;
+
+    /**
+     * 第二次接收人
+     */
+    private String receiver2;
+
+    /**
+     * 第三次接收人
+     */
+    private String receiver3;
+
+    /**
+     * 第一次超时时间
+     */
+    private Integer timeOut1;
+
+    /**
+     * 第二次超时时间
+     */
+    private Integer timeOut2;
+
+    /**
+     * 通知方式
+     */
+    private String noticeMethod;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 删除标识
+     */
+    private Integer deleteFlag;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+
+}

+ 84 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmNoticeResult.java

@@ -0,0 +1,84 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 告警通知结果
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseAlarmNoticeResult implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 接收人
+     */
+    private String receiver;
+
+    /**
+     * 通知结果
+     */
+    private Integer noticeResult;
+
+    /**
+     * 告警ID
+     */
+    private Integer alarmId;
+
+    /**
+     * 通知时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime noticeTime;
+
+    /**
+     * 通知类型(1、站内 2、微信 3、语音 4、短信 5、邮件)
+     */
+    private Integer noticeType;
+
+    /**
+     * 推送内容
+     */
+    private String noticeContent;
+
+    /**
+     * 是否已读
+     */
+    private Integer isRead;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 接收人电话
+     */
+    private String receiverPhone;
+
+
+}

+ 66 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmStatistic.java

@@ -0,0 +1,66 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 告警统计表
+ * </p>
+ *
+ * @author han
+ * @since 2023-11-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseAlarmStatistic implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 告警数量
+     */
+    private Integer alarmNum;
+
+    /**
+     * 隐患数量
+     */
+    private Integer pitfallNum;
+
+    /**
+     * 统计维度;1、日 2、月
+     */
+    private Integer statisticDimen;
+
+    /**
+     * 统一时间
+     */
+    private LocalDateTime statisticTime;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+
+}

+ 91 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseAlarmType.java

@@ -0,0 +1,91 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 告警类型表
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseAlarmType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 类型编码
+     */
+    private String typeCode;
+
+    /**
+     * 类型简称
+     */
+    private String typeAbbrevia;
+
+    /**
+     * 类型名称
+     */
+    private String typeName;
+
+    /**
+     * 图标
+     */
+    private String typeImg;
+
+    /**
+     * 告警描述
+     */
+    private String alarmDesc;
+
+    /**
+     * 删除标识
+     */
+    private Integer deleteFlag;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+
+}

+ 51 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/BaseFacilityDevice.java

@@ -0,0 +1,51 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 地理设施设备关联表
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseFacilityDevice implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 设施id
+     */
+    private Integer facilityId;
+
+    /**
+     * 设备id
+     */
+    private String deviceId;
+
+    /**
+     * 创建人
+     */
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+
+}

+ 126 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/DmpDevice.java

@@ -0,0 +1,126 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 设备信息表
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DmpDevice implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 设备ID;设备注册时系统自动生成一个唯一编号
+     */
+    private String deviceId;
+
+    /**
+     * 设备名称
+     */
+    private String deviceName;
+
+    /**
+     * 设备类型(501、监控系统  502、门禁系统  503、梯控系统  504、机房系统  509、环境系统  510、照明系统)
+     */
+    private Integer deviceType;
+
+    /**
+     * 产品ID
+     */
+    private Integer productId;
+
+    /**
+     * 物联网卡号
+     */
+    private String simCode;
+
+    /**
+     * 国际移动用户识别码
+     */
+    private String imsiCode;
+
+    /**
+     * 自动订阅标识(0:否,1:是)
+     */
+    private Integer subscribeFlag;
+
+    /**
+     * 节点类型
+     */
+    private Integer nodeType;
+
+    /**
+     * 分组id
+     */
+    private Integer groupId;
+
+    /**
+     * 删除标识
+     */
+    private Integer deleteFlag;
+
+    /**
+     * 创建人
+     */
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新人
+     */
+    private String updatedBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedTime;
+
+    /**
+     * 租户号
+     */
+    private Integer tenantId;
+
+    /**
+     * 单位编号
+     */
+    private String companyCode;
+
+    /**
+     * 安装位置
+     */
+    private String installAddress;
+
+    /**
+     * 业务状态;1:未激活,2:已激活,3:禁用
+     */
+    private Integer serviceStatus;
+
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+
+}

+ 141 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/DmpProduct.java

@@ -0,0 +1,141 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 产品信息表
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DmpProduct implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 产品名称
+     */
+    private String productName;
+
+    /**
+     * 接入方式(1、设备直连  2、网关接入)
+     */
+    private Integer accessMode;
+
+    /**
+     * 网络类型(1、WIFI  2、移动蜂窝数据 3、NB-IoT 4、以太网)
+     */
+    private Integer networkType;
+
+    /**
+     * 设备类型(501、监控系统  502、门禁系统  503、梯控系统  504、机房系统  509、环境系统  510、照明系统)
+     */
+    private Integer deviceType;
+
+    /**
+     * 通信协议(1、MQTT  2、TCP设备直连 3、HTTP)
+     */
+    private Integer comProtocol;
+
+    /**
+     * 认证方式
+     */
+    private String authMode;
+
+    /**
+     * 设备型号
+     */
+    private String deviceModel;
+
+    /**
+     * 产品描述
+     */
+    private String productDescribe;
+
+    /**
+     * 厂家名称
+     */
+    private String factoryName;
+
+    /**
+     * 厂家联系人
+     */
+    private String factoryPerson;
+
+    /**
+     * 厂家联系电话
+     */
+    private String factoryPhone;
+
+    /**
+     * 资质证书1
+     */
+    private String certificateUrl1;
+
+    /**
+     * 资质证书2
+     */
+    private String certificateUrl2;
+
+    /**
+     * 资质证书3
+     */
+    private String certificateUrl3;
+
+    /**
+     * 协议文档
+     */
+    private String agreementUrl;
+
+    /**
+     * 删除标识
+     */
+    private Integer deleteFlag;
+
+    /**
+     * 创建人
+     */
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新人
+     */
+    private String updatedBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedTime;
+
+    /**
+     * 租户号
+     */
+    private Integer tenantId;
+
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+
+}

+ 136 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/domain/SysUser.java

@@ -0,0 +1,136 @@
+package com.usky.alarm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 用户信息表
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class SysUser implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 用户ID
+     */
+    @TableId(value = "user_id", type = IdType.AUTO)
+    private Long userId;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 用户账号
+     */
+    private String userName;
+
+    /**
+     * 用户昵称
+     */
+    private String nickName;
+
+    /**
+     * 用户类型(00系统用户, 01 租户管理员)
+     */
+    private String userType;
+
+    /**
+     * 用户邮箱
+     */
+    private String email;
+
+    /**
+     * 手机号码
+     */
+    private String phonenumber;
+
+    /**
+     * 用户性别(0男 1女 2未知)
+     */
+    private String sex;
+
+    /**
+     * 姓名
+     */
+    private String fullName;
+
+    /**
+     * 头像地址
+     */
+    private String avatar;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 帐号状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
+    private String delFlag;
+
+    /**
+     * 最后登录IP
+     */
+    private String loginIp;
+
+    /**
+     * 最后登录时间
+     */
+    private LocalDateTime loginDate;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+
+}

+ 19 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmMapper.java

@@ -0,0 +1,19 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.BaseAlarm;
+import com.usky.alarm.domain.BaseAlarmType;
+import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 统一告警表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Repository
+public interface BaseAlarmMapper extends CrudMapper<BaseAlarm> {
+    BaseAlarmType getAlarmTypeOne(String alarmType);
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmNoticeMapper.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.BaseAlarmNotice;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 告警通知配置 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+public interface BaseAlarmNoticeMapper extends CrudMapper<BaseAlarmNotice> {
+
+}

+ 18 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmNoticeResultMapper.java

@@ -0,0 +1,18 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.BaseAlarmNoticeResult;
+import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 告警通知结果 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-11-09
+ */
+@Repository
+public interface BaseAlarmNoticeResultMapper extends CrudMapper<BaseAlarmNoticeResult> {
+
+}

+ 24 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmStatisticMapper.java

@@ -0,0 +1,24 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.BaseAlarmStatistic;
+import com.usky.common.mybatis.core.CrudMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 告警统计表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-11-24
+ */
+@Repository
+public interface BaseAlarmStatisticMapper extends CrudMapper<BaseAlarmStatistic> {
+    List<Map<String, Object>> getStatistic(@Param("startTime") LocalDate startTime,
+                                          @Param("endTime") LocalDate endTime);
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseAlarmTypeMapper.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.BaseAlarmType;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 告警类型表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface BaseAlarmTypeMapper extends CrudMapper<BaseAlarmType> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/BaseFacilityDeviceMapper.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.BaseFacilityDevice;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 地理设施设备关联表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface BaseFacilityDeviceMapper extends CrudMapper<BaseFacilityDevice> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/DmpDeviceMapper.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.DmpDevice;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 设备信息表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface DmpDeviceMapper extends CrudMapper<DmpDevice> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/DmpProductMapper.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.DmpProduct;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 产品信息表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface DmpProductMapper extends CrudMapper<DmpProduct> {
+
+}

+ 18 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/mapper/SysUserMapper.java

@@ -0,0 +1,18 @@
+package com.usky.alarm.mapper;
+
+import com.usky.alarm.domain.SysUser;
+import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * 用户信息表 Mapper 接口
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-26
+ */
+@Repository
+public interface SysUserMapper extends CrudMapper<SysUser> {
+
+}

+ 22 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmNoticeResultService.java

@@ -0,0 +1,22 @@
+package com.usky.alarm.service;
+
+import com.aliyuncs.exceptions.ClientException;
+import com.usky.alarm.domain.*;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.mybatis.core.CrudService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 告警通知结果 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+public interface BaseAlarmNoticeResultService extends CrudService<BaseAlarmNoticeResult> {
+    CommonPage<BaseAlarmNoticeResult> resultInfo(String receiver, Integer alarmId, Integer current, Integer size);
+    Integer send(BaseAlarm baseAlarm, List<BaseAlarmNotice> records3, Integer alarmId, List<DmpProduct> records,
+                 BaseAlarmType baseAlarmType, List<DmpDevice> records2) throws ClientException;
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmNoticeService.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.BaseAlarmNotice;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 告警通知配置 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+public interface BaseAlarmNoticeService extends CrudService<BaseAlarmNotice> {
+
+}

+ 17 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmService.java

@@ -0,0 +1,17 @@
+package com.usky.alarm.service;
+
+import com.aliyuncs.exceptions.ClientException;
+import com.usky.alarm.domain.*;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 统一告警表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface BaseAlarmService extends CrudService<BaseAlarm> {
+    boolean add(BaseAlarm baseAlarm) throws ClientException;
+}

+ 27 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmStatisticService.java

@@ -0,0 +1,27 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.BaseAlarmStatistic;
+import com.usky.common.mybatis.core.CrudService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 告警统计表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-11-24
+ */
+public interface BaseAlarmStatisticService extends CrudService<BaseAlarmStatistic> {
+    /**
+     * 定时任务-告警日、月不同维度统计
+     */
+    void baseAlarmStatisticTask(Integer type);
+
+    /**
+     * 综合云图-告警及隐患折线图接口
+     */
+    List<Map<String,Object>> alarmStatistic(Integer deptId,Integer dateType);
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseAlarmTypeService.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.BaseAlarmType;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 告警类型表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface BaseAlarmTypeService extends CrudService<BaseAlarmType> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/BaseFacilityDeviceService.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.BaseFacilityDevice;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 地理设施设备关联表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface BaseFacilityDeviceService extends CrudService<BaseFacilityDevice> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/DmpDeviceService.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.DmpDevice;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 设备信息表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface DmpDeviceService extends CrudService<DmpDevice> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/DmpProductService.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.DmpProduct;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 产品信息表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+public interface DmpProductService extends CrudService<DmpProduct> {
+
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/SysUserService.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service;
+
+import com.usky.alarm.domain.SysUser;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 用户信息表 服务类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-26
+ */
+public interface SysUserService extends CrudService<SysUser> {
+
+}

+ 17 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/DateStringConvert.java

@@ -0,0 +1,17 @@
+package com.usky.alarm.service.config;
+
+
+import com.usky.common.core.util.DateUtils;
+import org.springframework.core.convert.converter.Converter;
+
+import java.util.Date;
+
+/**
+ * @author yq
+ */
+public class DateStringConvert implements Converter<Date, String> {
+    @Override
+    public String convert(Date source) {
+        return DateUtils.format(source);
+    }
+}

+ 49 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/ExecutorConfig.java

@@ -0,0 +1,49 @@
+package com.usky.alarm.service.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+@EnableAsync
+@Slf4j
+public class ExecutorConfig {
+
+    /** 核心线程数(默认线程数) */
+    private int corePoolSize = 10;
+    /** 最大线程数 */
+    private int maxPoolSize = 20;
+    /** 允许线程空闲时间(单位:默认为秒) */
+    private static final int keepAliveTime = 60;
+    /** 缓冲队列大小 */
+    private int queueCapacity = 10;
+
+    @Bean
+    public Executor asyncServiceExecutor(){
+        log.info("start asyncServiceExecutor++++++++++++++++++++++");
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        //配置核心线程数
+        executor.setCorePoolSize(corePoolSize);
+        //配置最大线程数
+        executor.setMaxPoolSize(maxPoolSize);
+        //配置空闲时间
+        executor.setKeepAliveSeconds(keepAliveTime);
+        //配置队列大小
+        executor.setQueueCapacity(queueCapacity);
+        //配置线程前缀名
+        executor.setThreadNamePrefix("async-service-");
+
+        // rejection-policy:当pool已经达到max size的时候,如何处理新任务
+        // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+
+        //执行初始化
+        executor.initialize();
+        return executor;
+    }
+}

+ 29 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/FormatterConfiguration.java

@@ -0,0 +1,29 @@
+package com.usky.alarm.service.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.format.FormatterRegistry;
+import org.springframework.format.support.FormattingConversionService;
+import org.springframework.http.converter.ObjectToStringHttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * @author yq
+ */
+@Configuration
+public class FormatterConfiguration implements WebMvcConfigurer {
+
+    @Override
+    public void addFormatters(FormatterRegistry registry) {
+        registry.addConverter(new StringDateConverter());
+    }
+
+    @Bean
+    public ObjectToStringHttpMessageConverter objectToStringHttpMessageConverter() {
+        FormattingConversionService conversionService = new FormattingConversionService();
+        conversionService.addConverter(new StringDateConverter());
+        conversionService.addConverter(new DateStringConvert());
+        ObjectToStringHttpMessageConverter httpMessageconverter = new ObjectToStringHttpMessageConverter(conversionService);
+        return httpMessageconverter;
+    }
+}

+ 17 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/StringDateConverter.java

@@ -0,0 +1,17 @@
+package com.usky.alarm.service.config;
+
+
+import com.usky.common.core.util.DateUtils;
+import org.springframework.core.convert.converter.Converter;
+
+import java.util.Date;
+
+/**
+ * @author yq
+ */
+public class StringDateConverter implements Converter<String, Date> {
+    @Override
+    public Date convert(String source) {
+        return DateUtils.parseDate(source);
+    }
+}

+ 50 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/mqtt/MqttBaseConfig.java

@@ -0,0 +1,50 @@
+package com.usky.alarm.service.config.mqtt;
+
+import lombok.Data;
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory;
+import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
+import org.springframework.stereotype.Component;
+
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Data
+@Component
+@ConfigurationProperties(prefix = "mqtt")
+public class MqttBaseConfig {
+
+	@Value("${mqtt.username}")
+	private String username;
+
+	@Value("${mqtt.password}")
+	private String password;
+
+	@Value("${mqtt.url}")
+	private String hostUrl;
+
+	@Value("${mqtt.sub-topics}")
+	private String msgTopic;
+
+	@Value("${mqtt.keep-alive-interval}")
+	//心跳间隔
+	private int keepAliveInterval;
+	@Value("${mqtt.completionTimeout}")
+	//心跳间隔
+	private int completionTimeout;
+
+
+	@Bean
+	public MqttPahoClientFactory mqttClientFactory() {
+		DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
+		MqttConnectOptions options = new MqttConnectOptions();
+		options.setServerURIs(new String[]{this.getHostUrl()});
+		options.setUserName(this.getUsername());
+		options.setPassword(this.getPassword().toCharArray());
+		factory.setConnectionOptions(options);
+		return factory;
+	}
+
+}

+ 53 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/mqtt/MqttInConfig.java

@@ -0,0 +1,53 @@
+package com.usky.alarm.service.config.mqtt;
+
+import com.usky.alarm.service.enums.TopListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.core.MessageProducer;
+import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;
+import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
+import org.springframework.messaging.MessageChannel;
+
+import java.util.List;
+
+/**
+ * @author yq
+ * @date 2021/11/1 16:37
+ */
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Configuration
+public class MqttInConfig {
+
+    @Autowired
+    private MqttBaseConfig mqttBaseConfig;
+
+    public static final String CHANNEL_NAME_INPUT = "mqttInputChannel";
+
+    @Bean(name = CHANNEL_NAME_INPUT)
+    public MessageChannel mqttInputChannel() {
+        return new DirectChannel();
+    }
+
+
+    /**
+     * 消息订阅绑定-消费者
+     *
+     * @return
+     */
+    @Bean
+    public MessageProducer inbound() {
+        List<TopListener> parse = TopListener.parse(1);
+        String[] tops = parse.stream().map(TopListener::getCode).toArray(String[]::new);
+        String clientId = "h-backend-mqtt-in-" + System.currentTimeMillis();
+        MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(clientId,
+                mqttBaseConfig.mqttClientFactory(), tops);
+        adapter.setCompletionTimeout(mqttBaseConfig.getCompletionTimeout());
+        adapter.setConverter(new DefaultPahoMessageConverter());
+        adapter.setQos(2);
+        adapter.setOutputChannel(mqttInputChannel());
+        return adapter;
+    }
+}

+ 84 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/mqtt/MqttOutConfig.java

@@ -0,0 +1,84 @@
+package com.usky.alarm.service.config.mqtt;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.annotation.MessagingGateway;
+import org.springframework.integration.annotation.ServiceActivator;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.mqtt.outbound.MqttPahoMessageHandler;
+import org.springframework.integration.mqtt.support.MqttHeaders;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.MessageHandler;
+import org.springframework.messaging.handler.annotation.Header;
+
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Configuration
+public class MqttOutConfig {
+
+    @Autowired
+    public MqttBaseConfig mqttBaseConfig;
+
+    public static final String CHANNEL_NAME_OUT = "mqttOutboundChannel";
+
+    public static final String MESSAGE_NAME = "messageOut";
+
+    public static final String DEFAULT_TOPIC = "testTopic";
+
+    /**
+     * 连接通道
+     *
+     * @return
+     */
+    @Bean(name = CHANNEL_NAME_OUT)
+    public MessageChannel mqttOutboundChannel() {
+        return new DirectChannel();
+    }
+
+    /**
+     * 发送消息和消费消息Channel可以使用相同MqttPahoClientFactory
+     *
+     * @return
+     */
+    @Bean(name = MESSAGE_NAME)
+    @ServiceActivator(inputChannel = CHANNEL_NAME_OUT)
+    public MessageHandler outbound() {
+        // 在这里进行mqttOutboundChannel的相关设置
+        String clientId = "h-backend-mqtt-out-" + System.currentTimeMillis();
+        MqttPahoMessageHandler messageHandler =
+                new MqttPahoMessageHandler(clientId, mqttBaseConfig.mqttClientFactory());
+        //如果设置成true,发送消息时将不会阻塞。
+        messageHandler.setAsync(true);
+        messageHandler.setDefaultTopic(DEFAULT_TOPIC);
+        return messageHandler;
+    }
+
+    @MessagingGateway(defaultRequestChannel = CHANNEL_NAME_OUT)
+    public interface MqttGateway {
+        /**
+         * 发送消息
+         *
+         * @param payload
+         */
+        void sendToMqtt(String payload);
+
+        /**
+         * 指定top发送消息
+         *
+         * @param topic
+         * @param payload
+         */
+        void sendToMqtt(@Header(MqttHeaders.TOPIC) String topic, String payload);
+
+        /**
+         * 指定队列和qos
+         *
+         * @param topic
+         * @param qos
+         * @param payload
+         */
+        void sendToMqtt(@Header(MqttHeaders.TOPIC) String topic, @Header(MqttHeaders.QOS) int qos, String payload);
+    }
+}

+ 5 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/smsmessage/SmsMessage.java

@@ -0,0 +1,5 @@
+package com.usky.alarm.service.config.smsmessage;
+
+public class SmsMessage {
+
+}

+ 69 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/voice/VoiceNotice.java

@@ -0,0 +1,69 @@
+package com.usky.alarm.service.config.voice;
+/**
+ * 语音拨号API
+ *
+ * @author han
+ * @date 2023/9/12
+ */
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsRequest;
+import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * 阿里云语音服务调用接口 - 根据文本模板来进行语音通知
+ */
+@Component
+public class VoiceNotice {
+    @Value("${oss.product}")
+    private String product;
+    @Value("${oss.domain}")
+    private String domain;
+    @Value("${oss.accessKeyId}")
+    private String accessKeyId;
+    @Value("${oss.accessKeySecret}")
+    private String accessKeySecret;
+
+    /**
+     * 调用阿里云语音服务的方法
+     *    当address为空的时候, 就说明不是采用面对面咨询的方式
+     *    使用GeneralUtil.isNotNullAndEmpty(address)判断
+     *
+     * @return
+     * @throws ClientException
+     */
+    public SingleCallByTtsResponse sendCVoice(String phone, String visitorName, String gz,String bjsj) throws ClientException{
+        //设置访问超时时间
+        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
+        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
+        //初始化acsClient 暂时不支持多region
+        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
+        DefaultProfile.addEndpoint("cn-hangzhou", product, domain);
+        IAcsClient acsClient = new DefaultAcsClient(profile);
+        SingleCallByTtsRequest request = new SingleCallByTtsRequest();
+        //必填-被叫显号,可在语音控制台中找到所购买的显号
+        request.setCalledShowNumber("07952097202");
+        //必填-被叫号码
+        request.setCalledNumber(phone);
+        //必填-Tts模板ID
+        request.setTtsCode("TTS_173475471");
+        // 这里主要是填写我们语音文字模板里面的参数 ${param}
+        request.setTtsParam("{\"type\":\"" + visitorName +"\", \"gz\":\"" + gz + "\", \"bjsj\":\"" + bjsj + "\"}");
+        //可选-音量 取值范围 0--200
+        request.setVolume(200);
+        //可选-播放次数
+        request.setPlayTimes(2);
+        //可选-外部扩展字段,此ID将在回执消息中带回给调用方
+        SingleCallByTtsResponse singleCallByTtsResponse = acsClient.getAcsResponse(request);
+        if(singleCallByTtsResponse.getCode() != null && singleCallByTtsResponse.getCode().equals("OK")) {
+            //请求成功
+            System.out.print(singleCallByTtsResponse.getRequestId()+singleCallByTtsResponse.getCode()+"15122423833");
+        }
+        return singleCallByTtsResponse;
+    }
+}

+ 75 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/websocket/WebSocket.java

@@ -0,0 +1,75 @@
+package com.usky.alarm.service.config.websocket;
+
+import cn.hutool.json.JSONUtil;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.OnClose;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+@ServerEndpoint(value = "/websocket/{userId}")
+@Component
+public class WebSocket {
+    private static ConcurrentHashMap<String, WebSocket> webSocketMap = new ConcurrentHashMap<>();
+    //实例一个session,这个session是websocket的session
+    private Session session;
+
+    //新增一个方法用于主动向客户端发送消息
+    public void sendMessage(Object message, String userId) {
+        Iterator<Map.Entry<String, WebSocket>> iterator = webSocketMap.entrySet().iterator();
+        while (iterator.hasNext()) {
+            Map.Entry<String, WebSocket> entry = iterator.next();
+            int index = entry.getKey().indexOf(",");
+            String result = entry.getKey().substring(0, index);
+            if (result.equals(userId)){
+                if (entry.getValue() != null) {
+                    try {
+                        entry.getValue().session.getBasicRemote().sendText(JSONUtil.toJsonStr(message));
+                        System.out.println("【websocket消息】发送消息成功,用户=" + userId + ",消息内容" + message.toString());
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+
+    public static ConcurrentHashMap<String, WebSocket> getWebSocketMap() {
+        return webSocketMap;
+    }
+
+    public static void setWebSocketMap(ConcurrentHashMap<String, WebSocket> webSocketMap) {
+        WebSocket.webSocketMap = webSocketMap;
+    }
+
+    //前端请求时一个websocket时
+    @OnOpen
+    public void onOpen(Session session, @PathParam("userId") String userId) {
+        this.session = session;
+        webSocketMap.put(userId, this);
+        sendMessage("CONNECT_SUCCESS", userId);
+        System.out.println("【websocket消息】有新的连接,连接id" + userId);
+    }
+
+    //前端关闭时一个websocket时
+    @OnClose
+    public void onClose(@PathParam("userId") String userId) {
+        webSocketMap.remove(userId);
+        System.out.println("【websocket消息】连接断开,总数:" + webSocketMap.size());
+    }
+
+    //前端向后端发送消息
+    @OnMessage
+    public void onMessage(String message) {
+        if (!message.equals("ping")) {
+            System.out.println("【websocket消息】收到客户端发来的消息:" + message);
+        }
+    }
+}

+ 16 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/config/websocket/WebSocketConfig.java

@@ -0,0 +1,16 @@
+package com.usky.alarm.service.config.websocket;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+//开启WebSocket的支持,并把该类注入到spring容器中
+@Configuration
+public class WebSocketConfig {
+
+    @Bean
+    public ServerEndpointExporter serverEndpointExporter() {
+        return new ServerEndpointExporter();
+    }
+
+}

+ 66 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/enums/TopListener.java

@@ -0,0 +1,66 @@
+package com.usky.alarm.service.enums;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author yq
+ * @date 2021/12/31 11:11
+ */
+public enum TopListener {
+    /**
+     * 全部设备告警对接
+     */
+    FIRE_ALERT("fireAlarm","/usky/ytDP0001/+/+/alarm",1),
+    WATER_ALERT("waterAlert","/usky/ytDP0002/+/+/alarm",1),
+    SMOKE_ALERT("smokeAlarm","/usky/ytDP0003/+/+/alarm",1),
+    LIQUID_ALERT("waterAlert","/usky/ytDP0005/+/+/alarm",1),
+    RTU_ALERT("rtuAlert","/usky/ytDP0006/+/+/alarm",1),
+    ELECTRICAL_ALERT("electricalAlarm","/usky/ytDP0007/+/+/alarm",1),
+    MH_COVER_ALERT("waterAlert","/usky/ytDP0008/+/+/alarm",1),
+    VIDEO_ALERT("videoAlert","/usky/ytCamCore/+/+/alarm",1),
+    LR_SMOKE_ALERT("smokeAlarm","/usky/ytDP00033/+/+/alarm",1);
+
+
+
+
+    private String name;
+    private String code;
+    //0发送队列,1监听队列2都是
+    private Integer type;
+
+    TopListener(String name, String code, Integer type){
+        this.name = name;
+        this.code = code;
+        this.type = type;
+    }
+
+    public static TopListener parse(String code){
+        TopListener topListener = null;
+        for (TopListener t:TopListener.values()) {
+            if (t.getCode().equals(code)){
+                topListener = t;
+                break;
+            }
+        }
+        return topListener;
+    }
+    public static List<TopListener> parse(Integer type){
+        List<TopListener> listeners = new ArrayList<>();
+        for (TopListener t:TopListener.values()) {
+            if (t.getType().equals(type)){
+                listeners.add(t);
+            }
+        }
+        return listeners;
+    }
+    public String getCode(){
+        return code;
+    }
+    public String getName(){
+        return name;
+    }
+    public Integer getType(){
+        return type;
+    }
+}

+ 116 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmNoticeResultServiceImpl.java

@@ -0,0 +1,116 @@
+package com.usky.alarm.service.impl;
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
+import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.profile.DefaultProfile;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.usky.alarm.domain.*;
+import com.usky.alarm.mapper.BaseAlarmNoticeResultMapper;
+import com.usky.alarm.mapper.SysUserMapper;
+import com.usky.alarm.service.BaseAlarmNoticeResultService;
+import com.usky.alarm.service.config.voice.VoiceNotice;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.common.security.utils.SecurityUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+/**
+ * <p>
+ * 告警通知结果 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+@Slf4j
+@Service
+public class BaseAlarmNoticeResultServiceImpl extends AbstractCrudService<BaseAlarmNoticeResultMapper, BaseAlarmNoticeResult> implements BaseAlarmNoticeResultService {
+    @Autowired
+    private VoiceNotice voiceNotice;
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
+    @Override
+    public CommonPage<BaseAlarmNoticeResult> resultInfo(String receiver, Integer alarmId, Integer current, Integer size) {
+        IPage<BaseAlarmNoticeResult> page = new Page<>(current, size);
+        LambdaQueryWrapper<BaseAlarmNoticeResult> queryWrapper1 = Wrappers.lambdaQuery();
+        queryWrapper1.like(StringUtils.isNotBlank(receiver),BaseAlarmNoticeResult::getReceiver, receiver)
+                .eq(BaseAlarmNoticeResult::getAlarmId, alarmId);
+//                .eq(BaseAlarmNoticeResult::getTenantId, SecurityUtils.getTenantId());
+        page = this.page(page,queryWrapper1);
+        return new CommonPage<>(page.getRecords(),page.getTotal(),page.getCurrent(),page.getSize());
+    }
+
+    //异步多线程调用
+    @Async("asyncServiceExecutor")
+    public Integer send(BaseAlarm baseAlarm, List<BaseAlarmNotice> records3, Integer alarmId, List<DmpProduct> records,
+                        BaseAlarmType baseAlarmType, List<DmpDevice> records2) throws ClientException {
+        log.info("start asyncServiceExecutor--------------------");
+        String[] array = records3.get(0).getReceiver1().split(",");
+        Integer saveAlarmResult = 0;
+        for (String s : array) {
+            LambdaQueryWrapper<SysUser> lambdaQuery4 = Wrappers.lambdaQuery();
+            lambdaQuery4.eq(SysUser::getUserId,s)
+                    .eq(SysUser::getDelFlag,0);
+            SysUser sysUser = sysUserMapper.selectOne(lambdaQuery4);
+            BaseAlarmNoticeResult baseAlarmNoticeResult = new BaseAlarmNoticeResult();
+            baseAlarmNoticeResult.setReceiver(sysUser.getNickName());
+            baseAlarmNoticeResult.setReceiverPhone(sysUser.getPhonenumber());
+            baseAlarmNoticeResult.setAlarmId(alarmId);
+            baseAlarmNoticeResult.setNoticeTime(LocalDateTime.now());
+            baseAlarmNoticeResult.setNoticeContent(records.get(0).getProductName()+","+baseAlarmType.getTypeName()+","+baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
+                    "HH:mm:ss")));
+            baseAlarmNoticeResult.setTenantId(records.get(0).getTenantId());
+            if (records3.get(0).getNoticeMethod().contains("电话")){
+                SingleCallByTtsResponse code = voiceNotice.sendCVoice(sysUser.getPhonenumber(),
+                        records.get(0).getProductName(),baseAlarmType.getTypeName(),
+                        baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
+                                "HH:mm:ss")));
+                baseAlarmNoticeResult.setNoticeType(3);
+                if(code.getCode() != null && code.getCode().equals("OK")) {
+                    //请求成功
+                    baseAlarmNoticeResult.setNoticeResult(1);
+                }else {
+                    baseAlarmNoticeResult.setNoticeResult(2);
+                }
+                saveAlarmResult = baseMapper.insert(baseAlarmNoticeResult);
+            }
+            if (records3.get(0).getNoticeMethod().contains("短信")){
+                DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI5tH3VvRL5BUkovCokHJX", "SaaWUouNqvcA0C746gcNOH9m6SRYN4");
+                IAcsClient client = new DefaultAcsClient(profile);
+                SendSmsRequest request = new SendSmsRequest();
+                request.setPhoneNumbers(sysUser.getPhonenumber());//接收短信的手机号码
+                request.setSignName("上海永天科技股份有限公司");//短信签名名称
+                request.setTemplateCode("SMS_463791105");//短信模板CODE
+                request.setTemplateParam("{\"deviceName\":\""+records2.get(0).getDeviceName()+"\","+"\"time\":\""+baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
+                        "HH:mm:ss"))+"\","+
+                        "\"alarmType\":\""+baseAlarmType.getTypeName()+"\","+"\"alarmContent\":\""+baseAlarm.getAlarmContent()+"\"}");
+                SendSmsResponse code = client.getAcsResponse(request);
+                baseAlarmNoticeResult.setNoticeType(4);
+                if(code.getCode() != null && code.getCode().equals("OK")) {
+                    //请求成功
+                    baseAlarmNoticeResult.setNoticeResult(1);
+                }else {
+                    baseAlarmNoticeResult.setNoticeResult(2);
+                }
+                saveAlarmResult = baseMapper.insert(baseAlarmNoticeResult);
+            }
+        }
+        return saveAlarmResult;
+    }
+}

+ 20 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmNoticeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.alarm.service.impl;
+
+import com.usky.alarm.domain.BaseAlarmNotice;
+import com.usky.alarm.mapper.BaseAlarmNoticeMapper;
+import com.usky.alarm.service.BaseAlarmNoticeService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 告警通知配置 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-25
+ */
+@Service
+public class BaseAlarmNoticeServiceImpl extends AbstractCrudService<BaseAlarmNoticeMapper, BaseAlarmNotice> implements BaseAlarmNoticeService {
+
+}

+ 133 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmServiceImpl.java

@@ -0,0 +1,133 @@
+package com.usky.alarm.service.impl;
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
+import com.aliyuncs.dyvmsapi.model.v20170525.SingleCallByTtsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.profile.DefaultProfile;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.alarm.domain.*;
+import com.usky.alarm.mapper.BaseAlarmMapper;
+import com.usky.alarm.mapper.BaseAlarmNoticeResultMapper;
+import com.usky.alarm.mapper.SysUserMapper;
+import com.usky.alarm.service.*;
+import com.usky.alarm.service.config.smsmessage.SmsMessage;
+import com.usky.alarm.service.config.voice.VoiceNotice;
+import com.usky.alarm.service.config.websocket.WebSocket;
+import com.usky.common.core.exception.BusinessException;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+/**
+ * <p>
+ * 统一告警表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Slf4j
+@Service
+public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, BaseAlarm> implements BaseAlarmService {
+
+    @Autowired
+    private DmpProductService dmpProductService;
+
+    @Autowired
+    private DmpDeviceService dmpDeviceInfoService;
+
+    @Autowired
+    private BaseFacilityDeviceService baseFacilityDeviceService;
+
+    @Autowired
+    private BaseAlarmNoticeService baseAlarmNoticeService;
+
+    @Autowired
+    private BaseAlarmNoticeResultService baseAlarmNoticeResultService;
+
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
+    @Autowired
+    private WebSocket webSocket;
+
+    @Autowired
+    private VoiceNotice voiceNotice;
+
+    @Autowired
+    private BaseAlarmNoticeResultMapper baseAlarmNoticeResultMapper;
+
+    @Override
+    public boolean add(BaseAlarm baseAlarm) throws ClientException {
+        baseAlarm.setHandleStatus(0);
+        if (StringUtils.isNotBlank(baseAlarm.getProductCode()) && StringUtils.isNotBlank(baseAlarm.getDeviceId()) && StringUtils.isNotBlank(baseAlarm.getAlarmType())){
+            LambdaQueryWrapper<DmpProduct> lambdaQuery = Wrappers.lambdaQuery();
+            lambdaQuery.eq(DmpProduct::getProductCode,baseAlarm.getProductCode())
+                    .eq(DmpProduct::getDeleteFlag,0);
+            List<DmpProduct> records = dmpProductService.list(lambdaQuery);
+            LambdaQueryWrapper<BaseFacilityDevice> lambdaQuery1 = Wrappers.lambdaQuery();
+            lambdaQuery1.eq(BaseFacilityDevice::getDeviceId,baseAlarm.getDeviceId());
+            List<BaseFacilityDevice> records1 = baseFacilityDeviceService.list(lambdaQuery1);
+            LambdaQueryWrapper<DmpDevice> lambdaQuery2 = Wrappers.lambdaQuery();
+            lambdaQuery2.eq(DmpDevice::getDeviceId,baseAlarm.getDeviceId())
+                    .eq(DmpDevice::getProductCode,baseAlarm.getProductCode())
+                    .eq(DmpDevice::getServiceStatus,2)
+                    .eq(DmpDevice::getDeleteFlag,0);
+            List<DmpDevice> records2 = dmpDeviceInfoService.list(lambdaQuery2);
+            BaseAlarmType baseAlarmType = baseMapper.getAlarmTypeOne(baseAlarm.getAlarmType());
+            if(records.size()>0 && baseAlarmType !=null && records2.size()>0){
+                baseAlarm.setTenantId(records.get(0).getTenantId());
+                if (StringUtils.isNotBlank(baseAlarm.getHandleBy()) || StringUtils.isNotBlank(baseAlarm.getHandlePhone())) {
+                    baseAlarm.setHandleStatus(1);
+                    LambdaQueryWrapper<BaseAlarm> queryWrapper = Wrappers.lambdaQuery();
+                    queryWrapper.eq(BaseAlarm::getDeviceId, baseAlarm.getDeviceId())
+                            .eq(BaseAlarm::getAlarmType, baseAlarm.getAlarmType())
+                            .eq(BaseAlarm::getAlarmAddress, baseAlarm.getAlarmAddress())
+                            .eq(BaseAlarm::getAlarmGrade, baseAlarm.getAlarmGrade());
+                    return this.update(baseAlarm, queryWrapper);
+                } else {
+                    boolean saveResult = this.save(baseAlarm);
+                    Integer alarmId = baseAlarm.getId();
+                    if (records1.size() > 0) {
+                        baseAlarm.setFacilityId(records1.get(0).getFacilityId());
+                    }
+                    baseAlarm.setDeviceName(records2.get(0).getDeviceName());
+                    baseAlarm.setTypeImg(baseAlarmType.getTypeImg());
+                    baseAlarm.setAlarmType(baseAlarmType.getTypeName());
+                    baseAlarm.setAlarmTime1(baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
+                            "HH:mm:ss")));
+                    webSocket.sendMessage(baseAlarm, records.get(0).getTenantId().toString());
+                    LambdaQueryWrapper<BaseAlarmNotice> lambdaQuery3 = Wrappers.lambdaQuery();
+                    lambdaQuery3.eq(BaseAlarmNotice::getProductCode,baseAlarm.getProductCode())
+                            .eq(BaseAlarmNotice::getTypeCode,baseAlarmType.getTypeCode())
+                            .eq(BaseAlarmNotice::getDeleteFlag,0);
+                    List<BaseAlarmNotice> records3 = baseAlarmNoticeService.list(lambdaQuery3);
+                    if (records3.size()>0){
+                        Integer saveAlarmResult = baseAlarmNoticeResultService.send(baseAlarm,records3,alarmId,records,baseAlarmType,records2);
+                    }
+                    return saveResult;
+                }
+            }else {
+                throw new BusinessException("告警数据投递失败,请检查产品编码、设备编号、告警类型,是否有误;设备是否激活");
+            }
+        }else {
+            throw new BusinessException("告警数据投递失败,请检查产品编码、设备编号、告警类型,不能为空");
+        }
+    }
+
+//    public SingleCallByTtsResponse sendCVoice(String phone,String visitorName,String gz,String bjsj) throws ClientException {
+//        SingleCallByTtsResponse code = voiceNotice.sendCVoice(phone,visitorName,gz,bjsj);
+//        return code;
+//    }
+}

+ 96 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmStatisticServiceImpl.java

@@ -0,0 +1,96 @@
+package com.usky.alarm.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.alarm.domain.BaseAlarm;
+import com.usky.alarm.domain.BaseAlarmStatistic;
+import com.usky.alarm.mapper.BaseAlarmStatisticMapper;
+import com.usky.alarm.service.BaseAlarmService;
+import com.usky.alarm.service.BaseAlarmStatisticService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.*;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalAdjusters;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 告警统计表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-11-24
+ */
+@Service
+public class BaseAlarmStatisticServiceImpl extends AbstractCrudService<BaseAlarmStatisticMapper, BaseAlarmStatistic> implements BaseAlarmStatisticService {
+    @Autowired
+    private BaseAlarmService baseAlarmService;
+
+    @Transactional
+    @Override
+    public void baseAlarmStatisticTask(Integer type) {
+        LocalDateTime now = LocalDateTime.now();
+        LocalDate currentDate = LocalDate.now();
+        LocalDate previousDate = currentDate.minusDays(1);
+        BaseAlarmStatistic baseAlarmStatistic = new BaseAlarmStatistic();
+        LocalDateTime startDateTime = LocalDateTime.of(previousDate, LocalTime.MIN);
+        LocalDateTime endDateTime = LocalDateTime.of(previousDate, LocalTime.MAX);
+        LocalDateTime startOfPreviousMonth = YearMonth.from(now).minusMonths(1).atDay(1).atTime(0, 0, 0);
+        LocalDateTime endOfPreviousMonth = YearMonth.from(now).minusMonths(1).atEndOfMonth().atTime(23, 59, 59);
+        QueryWrapper<BaseAlarm> queryWrapper = Wrappers.query();
+        if (type.equals(1)){
+            queryWrapper.select("COUNT(alarm_grade=1 or null) as alarmCount","COUNT(alarm_grade!=1 or" +
+                    " null) as hiddenCount")
+                    .between("alarm_time",startDateTime,endDateTime);
+            baseAlarmStatistic.setStatisticDimen(1);
+            baseAlarmStatistic.setStatisticTime(startDateTime);
+        }else {
+            queryWrapper.select("COUNT(alarm_grade=1 or null) as alarmCount","COUNT(alarm_grade!=1 or" +
+                    " null) as hiddenCount")
+                    .between("alarm_time",startOfPreviousMonth,endOfPreviousMonth);
+            baseAlarmStatistic.setStatisticDimen(2);
+            baseAlarmStatistic.setStatisticTime(startOfPreviousMonth);
+        }
+        List<Map<String,Object>> alarmStatisticList = baseAlarmService.listMaps(queryWrapper);
+        baseAlarmStatistic.setAlarmNum(Integer.valueOf(alarmStatisticList.get(0).get("alarmCount").toString()));
+        baseAlarmStatistic.setPitfallNum(Integer.valueOf(alarmStatisticList.get(0).get("hiddenCount").toString()));
+        baseAlarmStatistic.setCreateTime(now);
+        this.save(baseAlarmStatistic);
+    }
+
+    @Override
+    public List<Map<String, Object>> alarmStatistic(Integer deptId,Integer dateType) {
+        LocalDateTime currentDate = LocalDateTime.now();
+        LocalDateTime firstDayOfMonth = LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
+        LocalDateTime halfYearAgo = currentDate.minus(6, ChronoUnit.MONTHS);
+        LocalDateTime firstDayOfHalfYearAgo = halfYearAgo.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0);
+        LocalDateTime oneYearAgo = currentDate.minusYears(1);
+        LocalDateTime zeroTime = oneYearAgo.withHour(0).withMinute(0).withSecond(0);
+        QueryWrapper<BaseAlarmStatistic> queryWrapper = Wrappers.query();
+        if (dateType.equals(1)){
+            queryWrapper.select("alarm_num as alarmNum","pitfall_num as pitfallNum","DATE_FORMAT(statistic_time, '%m-%d') AS " +
+                    "statisticTime")
+                    .between("statistic_time",firstDayOfMonth,currentDate)
+                    .eq("statistic_dimen",1);
+        }else if (dateType.equals(2)){
+            queryWrapper.select("alarm_num as alarmNum","pitfall_num as pitfallNum","DATE_FORMAT(statistic_time, " +
+                    "'%Y-%m') AS " +
+                    "statisticTime")
+                    .between("statistic_time",firstDayOfHalfYearAgo,currentDate)
+                    .eq("statistic_dimen",2);
+        }else {
+            queryWrapper.select("alarm_num as alarmNum","pitfall_num as pitfallNum","DATE_FORMAT(statistic_time, " +
+                    "'%Y-%m') AS " +
+                    "statisticTime")
+                    .between("statistic_time",zeroTime,currentDate)
+                    .eq("statistic_dimen",2);
+        }
+        List<Map<String, Object>> list = this.listMaps(queryWrapper);
+        return list;
+    }
+}

+ 20 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmTypeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.alarm.service.impl;
+
+import com.usky.alarm.domain.BaseAlarmType;
+import com.usky.alarm.mapper.BaseAlarmTypeMapper;
+import com.usky.alarm.service.BaseAlarmTypeService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 告警类型表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Service
+public class BaseAlarmTypeServiceImpl extends AbstractCrudService<BaseAlarmTypeMapper, BaseAlarmType> implements BaseAlarmTypeService {
+
+}

+ 20 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseFacilityDeviceServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.alarm.service.impl;
+
+import com.usky.alarm.domain.BaseFacilityDevice;
+import com.usky.alarm.mapper.BaseFacilityDeviceMapper;
+import com.usky.alarm.service.BaseFacilityDeviceService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 地理设施设备关联表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Service
+public class BaseFacilityDeviceServiceImpl extends AbstractCrudService<BaseFacilityDeviceMapper, BaseFacilityDevice> implements BaseFacilityDeviceService {
+
+}

+ 20 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/DmpDeviceServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.alarm.service.impl;
+
+import com.usky.alarm.domain.DmpDevice;
+import com.usky.alarm.mapper.DmpDeviceMapper;
+import com.usky.alarm.service.DmpDeviceService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 设备信息表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Service
+public class DmpDeviceServiceImpl extends AbstractCrudService<DmpDeviceMapper, DmpDevice> implements DmpDeviceService {
+
+}

+ 20 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/DmpProductServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.alarm.service.impl;
+
+import com.usky.alarm.domain.DmpProduct;
+import com.usky.alarm.mapper.DmpProductMapper;
+import com.usky.alarm.service.DmpProductService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 产品信息表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-22
+ */
+@Service
+public class DmpProductServiceImpl extends AbstractCrudService<DmpProductMapper, DmpProduct> implements DmpProductService {
+
+}

+ 20 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/SysUserServiceImpl.java

@@ -0,0 +1,20 @@
+package com.usky.alarm.service.impl;
+
+import com.usky.alarm.domain.SysUser;
+import com.usky.alarm.mapper.SysUserMapper;
+import com.usky.alarm.service.SysUserService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 用户信息表 服务实现类
+ * </p>
+ *
+ * @author han
+ * @since 2023-09-26
+ */
+@Service
+public class SysUserServiceImpl extends AbstractCrudService<SysUserMapper, SysUser> implements SysUserService {
+
+}

+ 11 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/job/DmpDataOverviewJob.java

@@ -0,0 +1,11 @@
+package com.usky.alarm.service.job;
+
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class DmpDataOverviewJob {
+
+}

+ 69 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/listener/MqttListener.java

@@ -0,0 +1,69 @@
+package com.usky.alarm.service.listener;
+
+import com.usky.alarm.service.config.mqtt.MqttInConfig;
+import com.usky.alarm.service.enums.TopListener;
+import com.usky.alarm.service.mqtt.SimpleContext;
+import com.usky.alarm.service.vo.MqttBaseVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.integration.annotation.ServiceActivator;
+import org.springframework.messaging.MessageHandler;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author yq
+ * @date 2021/11/3 8:13
+ */
+@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+@Slf4j
+@Component
+public class MqttListener {
+
+    public static final String MESSAGE_NAME = "messageInput";
+
+    @Autowired
+    private SimpleContext simpleContext;
+
+    /**
+     * 处理消息-消费者
+     *
+     * @return
+     */
+    @Bean(MESSAGE_NAME)
+    @ServiceActivator(inputChannel = MqttInConfig.CHANNEL_NAME_INPUT)
+    public MessageHandler handler() {
+        return message -> {
+            String payload = message.getPayload().toString();
+            //进行接口推送
+            String[] code1 = TopListener.FIRE_ALERT.getCode().split("/");
+            String[] code2 = TopListener.WATER_ALERT.getCode().split("/");
+            String[] code3 = TopListener.RTU_ALERT.getCode().split("/");
+            String[] code4 = TopListener.VIDEO_ALERT.getCode().split("/");
+            String[] code5 = TopListener.SMOKE_ALERT.getCode().split("/");
+            String[] code6 = TopListener.ELECTRICAL_ALERT.getCode().split("/");
+            String[] code7 = TopListener.LIQUID_ALERT.getCode().split("/");
+            Object mqttReceivedTopic = message.getHeaders().get("mqtt_receivedTopic");
+            if (null != mqttReceivedTopic) {
+                String topic = mqttReceivedTopic.toString();
+                MqttBaseVO mqttBaseVO = new MqttBaseVO();
+                mqttBaseVO.setTopic(topic);
+                if ((topic.indexOf(code1[2]) != -1 && topic.indexOf(code1[5]) != -1) ||
+                        (topic.indexOf(code2[2]) != -1 && topic.indexOf(code2[5]) != -1) ||
+                        (topic.indexOf(code3[2]) != -1 && topic.indexOf(code3[5]) != -1) ||
+                        (topic.indexOf(code4[2]) != -1 && topic.indexOf(code4[5]) != -1) ||
+                        (topic.indexOf(code5[2]) != -1 && topic.indexOf(code5[5]) != -1) ||
+                        (topic.indexOf(code6[2]) != -1 && topic.indexOf(code6[5]) != -1) ||
+                        (topic.indexOf(code7[2]) != -1 && topic.indexOf(code7[5]) != -1)) {
+                    mqttBaseVO.setDescribe("alarm");
+                }else {
+                    mqttBaseVO.setDescribe("fireInfoAndAlarm");
+                }
+                mqttBaseVO.setData(payload);
+                //统一处理数据
+                simpleContext.getResource(mqttBaseVO);
+            }
+        };
+    }
+}

+ 26 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/MqttStrategy.java

@@ -0,0 +1,26 @@
+package com.usky.alarm.service.mqtt;
+
+
+import com.aliyuncs.exceptions.ClientException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.usky.alarm.service.vo.MqttBaseVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 策略类
+ *
+ * @author yq
+ * @date 2021/11/3 8:27
+ */
+public interface MqttStrategy {
+    /**
+     * 处理消息(策略模式由子类实现)
+     *
+     * @param mqttBaseVO
+     * @return
+     */
+    String disposeMessage(MqttBaseVO mqttBaseVO);
+
+}

+ 26 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/SimpleContext.java

@@ -0,0 +1,26 @@
+package com.usky.alarm.service.mqtt;
+
+
+import com.usky.alarm.service.vo.MqttBaseVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 中间处理消息转发
+ */
+@Service
+public class SimpleContext {
+    @Autowired
+    private final Map<String, MqttStrategy> strategyMap = new ConcurrentHashMap<>();
+
+    public SimpleContext(Map<String, MqttStrategy> strategyMap) {
+        strategyMap.forEach(this.strategyMap::put);
+    }
+
+    public String getResource(MqttBaseVO mqttBaseVO) {
+        return strategyMap.get(mqttBaseVO.getDescribe()).disposeMessage(mqttBaseVO);
+    }
+}

+ 93 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/alarm/Alarm.java

@@ -0,0 +1,93 @@
+package com.usky.alarm.service.mqtt.alarm;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.alarm.service.enums.TopListener;
+import com.usky.common.core.util.JsonUtils;
+import com.usky.alarm.domain.*;
+import com.usky.alarm.service.*;
+import com.usky.alarm.service.mqtt.MqttStrategy;
+import com.usky.alarm.service.vo.MqttBaseVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author yq
+ * @date 2022/3/4 15:07
+ */
+@Service("alarm")
+public class Alarm implements MqttStrategy {
+
+    @Autowired
+    private BaseAlarmService baseAlarmService;
+
+    @Autowired
+    private DmpDeviceService dmpDeviceService;
+
+    @Override
+    public String disposeMessage(MqttBaseVO mqttBaseVO) {
+        Map map = JsonUtils.fromJson(mqttBaseVO.getData().toString(), Map.class);
+        List<Map<String, Object>> alarams = (List) JSONObject.parseArray(JSONObject.toJSONString(map.get("alarams")));
+        List<Map<String, Object>> dp = (List) JSONObject.parseArray(JSONObject.toJSONString(alarams.get(0).get("dp")));
+        BaseAlarm baseAlarm = new BaseAlarm();
+        long timestamp = Long.valueOf(alarams.get(0).get("timeStamp").toString()).longValue();
+        LocalDateTime time2 = LocalDateTime.ofEpochSecond(timestamp, 0, ZoneOffset.ofHours(8));
+        String topic = mqttBaseVO.getTopic();
+        String[] code4 = TopListener.VIDEO_ALERT.getCode().split("/");
+        LambdaQueryWrapper<DmpDevice> queryWrapper1 = Wrappers.lambdaQuery();
+        queryWrapper1.select(DmpDevice::getProductCode)
+                .eq(DmpDevice::getDeviceId, map.get("devId").toString())
+                .eq(DmpDevice::getDeleteFlag, 0);
+        List<DmpDevice> list = dmpDeviceService.list(queryWrapper1);
+        baseAlarm.setDeviceId(alarams.get(0).get("devId").toString());
+        baseAlarm.setAlarmTime(time2);
+        baseAlarm.setAlarmType(dp.get(0).get("serial").toString());
+        baseAlarm.setAlarmObject(alarams.get(0).get("deviceName").toString());
+        baseAlarm.setAlarmData(dp.get(0).get("status").toString());
+        baseAlarm.setAlarmAttribute(dp.get(0).get("property").toString());
+        if (alarams.get(0).get("deviceType").equals("1")){
+            baseAlarm.setAlarmContent(dp.get(0).get("property").toString()+","+dp.get(0).get("value").toString());
+            baseAlarm.setAlarmGrade(1);
+            baseAlarm.setAlarmAddress(dp.get(0).get("value").toString());
+        }else if (alarams.get(0).get("deviceType").equals("2")){
+            baseAlarm.setAlarmContent(dp.get(0).get("property").toString()+","+dp.get(0).get("value").toString());
+            baseAlarm.setAlarmGrade(2);
+            baseAlarm.setAlarmAddress(alarams.get(0).get("deviceName").toString());
+        }else if (alarams.get(0).get("deviceType").equals("3")){
+            baseAlarm.setAlarmContent(dp.get(0).get("property").toString());
+            baseAlarm.setAlarmGrade(2);
+            baseAlarm.setAlarmAddress(alarams.get(0).get("deviceName").toString());
+        }else if (alarams.get(0).get("deviceType").equals("6")){
+            baseAlarm.setAlarmContent(dp.get(0).get("property").toString()+","+dp.get(0).get("stuname").toString());
+            baseAlarm.setAlarmGrade(2);
+            baseAlarm.setAlarmAddress(alarams.get(0).get("deviceName").toString());
+        }else if (alarams.get(0).get("deviceType").equals("7")){
+            baseAlarm.setAlarmContent(dp.get(0).get("property").toString());
+            baseAlarm.setAlarmGrade(2);
+            baseAlarm.setAlarmAddress(alarams.get(0).get("deviceName").toString());
+        }else if (topic.indexOf(code4[2]) != -1 && topic.indexOf(code4[5]) != -1){
+            baseAlarm.setAlarmContent(dp.get(0).get("property").toString());
+            baseAlarm.setAlarmGrade(2);
+            baseAlarm.setAlarmAddress(alarams.get(0).get("deviceName").toString());
+            baseAlarm.setSitePhoto(dp.get(0).get("value").toString());
+        }
+        if (CollectionUtils.isNotEmpty(list)) {
+            baseAlarm.setProductCode(list.get(0).getProductCode());
+            try {
+                Boolean addFlag = baseAlarmService.add(baseAlarm);
+            }catch (Exception a){
+
+            }
+        }
+        return null;
+    }
+
+
+}

+ 136 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/util/HttpClientUtils.java

@@ -0,0 +1,136 @@
+package com.usky.alarm.service.util;
+
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ 1. 跨域请求工具类
+ */
+public class HttpClientUtils {
+
+    public static String doGet(String url, Map<String, String> param) {
+
+        // 创建Httpclient对象
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+
+        String resultString = "";
+        CloseableHttpResponse response = null;
+        try {
+            // 创建uri
+            URIBuilder builder = new URIBuilder(url);
+            if (param != null) {
+                for (String key : param.keySet()) {
+                    builder.addParameter(key, param.get(key));
+                }
+            }
+            URI uri = builder.build();
+
+            // 创建http GET请求
+            HttpGet httpGet = new HttpGet(uri);
+
+            // 执行请求
+            response = httpclient.execute(httpGet);
+            // 判断返回状态是否为200
+            if (response.getStatusLine().getStatusCode() == 200) {
+                resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return resultString;
+    }
+
+    public static String doGet(String url) {
+        return doGet(url, null);
+    }
+
+    public static String doPost(String url, Map<String, String> param) {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpPost httpPost = new HttpPost(url);
+            // 创建参数列表
+            if (param != null) {
+                List<NameValuePair> paramList = new ArrayList<>();
+                for (String key : param.keySet()) {
+                    paramList.add(new BasicNameValuePair(key, param.get(key)));
+                }
+                // 模拟表单
+                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
+                httpPost.setEntity(entity);
+            }
+            // 执行http请求
+            response = httpClient.execute(httpPost);
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        return resultString;
+    }
+
+    public static String doPost(String url) {
+        return doPost(url, null);
+    }
+
+    public static String doPostJson(String url, String json) {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpPost httpPost = new HttpPost(url);
+            // 创建请求内容
+            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
+            httpPost.setEntity(entity);
+            // 执行http请求
+            response = httpClient.execute(httpPost);
+            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        return resultString;
+    }
+}

+ 21 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/vo/MqttBaseVO.java

@@ -0,0 +1,21 @@
+package com.usky.alarm.service.vo;
+
+import lombok.Data;
+
+/**
+ * @author yq
+ * @date 2021/11/3 8:32
+ */
+@Data
+public class MqttBaseVO {
+    /**
+     * 接口描述
+     */
+    private String describe;
+
+    private String topic;
+    /**
+     * 数据内容
+      */
+    private Object data;
+}

+ 35 - 0
service-agbox/service-alarm-biz/src/main/java/com/usky/alarm/service/vo/MqttDataVO.java

@@ -0,0 +1,35 @@
+package com.usky.alarm.service.vo;
+
+import lombok.Data;
+
+/**
+ * @author zyj
+ * @date 2023-01-11
+ */
+@Data
+public class MqttDataVO {
+    /**
+     * 设备编号
+     */
+    private String devId;
+
+    /**
+     * 设备类型
+     */
+    private Integer deviceType;
+
+    /**
+     * 单位编号
+     */
+    private String companyId;
+
+    /**
+     * 系统类型 (1.火灾自动报警系统 2.自动喷水灭火系统 3.消防给水及消火栓系统 4.防排烟系统 5.电气火灾系统 6.消防视频监控系统)
+     */
+    private Integer systemType;
+
+    /**
+     * 单位名称
+     */
+    private String companyName;
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است