zhaojinyu 1 mesiac pred
commit
8e1cebe959
100 zmenil súbory, kde vykonal 13662 pridanie a 0 odobranie
  1. 38 0
      .gitignore
  2. 8 0
      .idea/.gitignore
  3. 7 0
      .idea/encodings.xml
  4. 14 0
      .idea/misc.xml
  5. 6 0
      .idea/vcs.xml
  6. 0 0
      agcp_DEV87612d47-d26e-41b2-aa09-a0cf73e8f51b-tcp192168101591883/.lck
  7. 490 0
      pom.xml
  8. 26 0
      src/main/java/com/usky/AgboxApplication.java
  9. 50 0
      src/main/java/com/usky/Interceptor/ActivationInterceptor.java
  10. 32 0
      src/main/java/com/usky/Interceptor/DeviceActivationInterceptor.java
  11. 38 0
      src/main/java/com/usky/Interceptor/JwtInterceptor.java
  12. 37 0
      src/main/java/com/usky/Interceptor/ModuleAuthorizationInterceptor.java
  13. 87 0
      src/main/java/com/usky/Schedule/MachineSchedule.java
  14. 21 0
      src/main/java/com/usky/SpringBootStartApplication.java
  15. 12 0
      src/main/java/com/usky/common/annotation/ModuleRequired.java
  16. 302 0
      src/main/java/com/usky/common/bo/BuildingHouse.java
  17. 78 0
      src/main/java/com/usky/common/bo/CommonBo.java
  18. 457 0
      src/main/java/com/usky/common/bo/DeviceStencil.java
  19. 26 0
      src/main/java/com/usky/common/enums/CardType.java
  20. 73 0
      src/main/java/com/usky/common/enums/ErrorCode.java
  21. 32 0
      src/main/java/com/usky/common/enums/SystemTypeCodeEnum.java
  22. 44 0
      src/main/java/com/usky/common/exception/DefenceException.java
  23. 63 0
      src/main/java/com/usky/common/exception/DefenceExceptionHandler.java
  24. 73 0
      src/main/java/com/usky/common/generator/CodeGenerator.java
  25. 76 0
      src/main/java/com/usky/common/listener/BuildingHouseExcelListener.java
  26. 58 0
      src/main/java/com/usky/common/listener/ConfigCacheListener.java
  27. 58 0
      src/main/java/com/usky/common/listener/DataInitializer.java
  28. 76 0
      src/main/java/com/usky/common/listener/DeviceExcelListener.java
  29. 26 0
      src/main/java/com/usky/common/listener/DownloadProgressManager.java
  30. 36 0
      src/main/java/com/usky/common/listener/FileUploadProgressListener.java
  31. 29 0
      src/main/java/com/usky/common/mqtt/MqttClientHolder.java
  32. 101 0
      src/main/java/com/usky/common/mqtt/MqttScheduler.java
  33. 113 0
      src/main/java/com/usky/common/mqtt/MqttThread.java
  34. 69 0
      src/main/java/com/usky/common/utils/AESUtil.java
  35. 31 0
      src/main/java/com/usky/common/utils/Assert.java
  36. 37 0
      src/main/java/com/usky/common/utils/DESUtils.java
  37. 49 0
      src/main/java/com/usky/common/utils/DateUtils.java
  38. 171 0
      src/main/java/com/usky/common/utils/FileUploadUtils.java
  39. 114 0
      src/main/java/com/usky/common/utils/GetIpUtil.java
  40. 124 0
      src/main/java/com/usky/common/utils/HardwareCodeAutoFillUtil.java
  41. 108 0
      src/main/java/com/usky/common/utils/HexEcodeUtil.java
  42. 318 0
      src/main/java/com/usky/common/utils/HttpClientUtil.java
  43. 111 0
      src/main/java/com/usky/common/utils/HttpSendUtil.java
  44. 31 0
      src/main/java/com/usky/common/utils/HttpUrl.java
  45. 32 0
      src/main/java/com/usky/common/utils/IdCardUtils.java
  46. 18 0
      src/main/java/com/usky/common/utils/ImageUtils.java
  47. 57 0
      src/main/java/com/usky/common/utils/IpUtils.java
  48. 170 0
      src/main/java/com/usky/common/utils/JwtUtils.java
  49. 6 0
      src/main/java/com/usky/common/utils/KeyValidUtils.java
  50. 27 0
      src/main/java/com/usky/common/utils/MD5Util.java
  51. 103 0
      src/main/java/com/usky/common/utils/MultipartFileUtils.java
  52. 163 0
      src/main/java/com/usky/common/utils/NetworkInfoUtils.java
  53. 34 0
      src/main/java/com/usky/common/utils/NvrTask.java
  54. 94 0
      src/main/java/com/usky/common/utils/OTMPage.java
  55. 14 0
      src/main/java/com/usky/common/utils/OsSelect.java
  56. 40 0
      src/main/java/com/usky/common/utils/PrimaryKeyIdUtils.java
  57. 56 0
      src/main/java/com/usky/common/utils/QrCodeUtils.java
  58. 142 0
      src/main/java/com/usky/common/utils/Response.java
  59. 15 0
      src/main/java/com/usky/common/utils/SleepUtil.java
  60. 53 0
      src/main/java/com/usky/common/utils/SnowFlakeUtils.java
  61. 84 0
      src/main/java/com/usky/common/utils/SystemInfoUtils.java
  62. 42 0
      src/main/java/com/usky/common/utils/TranscodingUtil.java
  63. 18 0
      src/main/java/com/usky/common/utils/UUIDUtil.java
  64. 162 0
      src/main/java/com/usky/common/vo/BaseMessage.java
  65. 143 0
      src/main/java/com/usky/common/vo/FileVO.java
  66. 57 0
      src/main/java/com/usky/common/vo/TokenVo.java
  67. 16 0
      src/main/java/com/usky/config/AppConfig.java
  68. 337 0
      src/main/java/com/usky/config/BoundaryRepairMultipartResolver.java
  69. 29 0
      src/main/java/com/usky/config/CollectionUtils.java
  70. 34 0
      src/main/java/com/usky/config/FilterConfig.java
  71. 38 0
      src/main/java/com/usky/config/JsonConfig.java
  72. 193 0
      src/main/java/com/usky/config/MyMetaObjectHandler.java
  73. 17 0
      src/main/java/com/usky/config/MybatisPlusConfig.java
  74. 16 0
      src/main/java/com/usky/config/P6SpyLogger.java
  75. 16 0
      src/main/java/com/usky/config/RootConfig.java
  76. 19 0
      src/main/java/com/usky/config/TaskSchedulerConfig.java
  77. 22 0
      src/main/java/com/usky/config/TimedSetInform.java
  78. 60 0
      src/main/java/com/usky/config/WebMvcConfig.java
  79. 233 0
      src/main/java/com/usky/controller/AcquisitionController.java
  80. 253 0
      src/main/java/com/usky/controller/AlarmController.java
  81. 348 0
      src/main/java/com/usky/controller/BasicController.java
  82. 158 0
      src/main/java/com/usky/controller/CarShareController.java
  83. 138 0
      src/main/java/com/usky/controller/CardController.java
  84. 57 0
      src/main/java/com/usky/controller/ChangeKeyController.java
  85. 237 0
      src/main/java/com/usky/controller/CollectionController.java
  86. 240 0
      src/main/java/com/usky/controller/CompanyController.java
  87. 263 0
      src/main/java/com/usky/controller/EntranceController.java
  88. 355 0
      src/main/java/com/usky/controller/GauthController.java
  89. 45 0
      src/main/java/com/usky/controller/IndexController.java
  90. 37 0
      src/main/java/com/usky/controller/LoginController.java
  91. 247 0
      src/main/java/com/usky/controller/ParkingController.java
  92. 226 0
      src/main/java/com/usky/controller/PatrolController.java
  93. 239 0
      src/main/java/com/usky/controller/PerceptionController.java
  94. 563 0
      src/main/java/com/usky/controller/PersonController.java
  95. 237 0
      src/main/java/com/usky/controller/RoadController.java
  96. 243 0
      src/main/java/com/usky/controller/SnapController.java
  97. 2523 0
      src/main/java/com/usky/controller/SystemController.java
  98. 233 0
      src/main/java/com/usky/controller/UsbAlarmController.java
  99. 133 0
      src/main/java/com/usky/controller/VideoController.java
  100. 577 0
      src/main/java/com/usky/controller/VillageController.java

+ 38 - 0
.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 7 - 0
.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+  </component>
+</project>

+ 14 - 0
.idea/misc.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 0 - 0
agcp_DEV87612d47-d26e-41b2-aa09-a0cf73e8f51b-tcp192168101591883/.lck


+ 490 - 0
pom.xml

@@ -0,0 +1,490 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.3.2.RELEASE</version>
+        <relativePath/>
+    </parent>
+    <groupId>com.usky</groupId>
+    <artifactId>jd-agbox</artifactId>
+    <version>1.0</version>
+    <name>agbox</name>
+    <description>觉大</description>
+    <packaging>jar</packaging>
+
+    <properties>
+        <skipTests>true</skipTests>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+
+            <exclusions>
+                <!--线上环境需关闭tomcat-->
+                <!--<exclusion>-->
+                <!--<groupId>org.springframework.boot</groupId>-->
+                <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
+                <!--</exclusion>-->
+                <!-- 去掉springboot默认日志配置 -->
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+
+        <!--servlet依赖-->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>4.0.1</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>4.6.2</version>
+        </dependency>
+
+        <!--spring boot集成quartz-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-quartz</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+            <version>6.4.8</version>
+        </dependency>
+
+        <!--        Excel文件处理-->
+        <dependency>
+            <groupId>cn.idev.excel</groupId>
+            <artifactId>fastexcel</artifactId>
+            <version>1.2.0</version> <!-- Or the latest version -->
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.paho</groupId>
+            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
+            <version>1.2.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-mqtt</artifactId>
+        </dependency>
+
+
+
+        <!--校验类-->
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.1.2.Final</version>
+        </dependency>
+
+
+        <!--<dependency>-->
+        <!--<groupId>org.hibernate</groupId>-->
+        <!--<artifactId>hibernate-validator</artifactId>-->
+        <!--<version>5.3.0.Final</version>-->
+        <!--</dependency>-->
+
+
+        <!--二维码-->
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.4.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>3.4.1</version>
+        </dependency>
+
+        <!--/二维码-->
+
+
+        <!--热部署插件-->
+
+        <!--mysql连接-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <!--lombox-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!--字节转换-->
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+
+        </dependency>
+        <!--okhttp-->
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>3.14.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <!--/okhttp-->
+        <!--xml+properties配置-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!--token加密术-->
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.6.0</version>
+        </dependency>
+        <!--md5加密-->
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+        <!--持久层-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.4.0</version>
+        </dependency>
+
+        <!-- 七牛云 -->
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>qiniu-java-sdk</artifactId>
+            <version>[7.2.0, 7.2.99]</version>
+        </dependency>
+
+
+
+
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.0.3</version>
+        </dependency>
+
+        <!--序列化工具-->
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.6</version>
+        </dependency>
+        <!--缓存技术-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson</artifactId>
+            <version>3.4.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-cache</artifactId>
+        </dependency>
+
+        <!-- 引入log4j2依赖 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+
+        <!--map转换json-->
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <classifier>jdk15</classifier>
+        </dependency>
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.7.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.5</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.ezmorph</groupId>
+            <artifactId>ezmorph</artifactId>
+            <version>1.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.2</version>
+        </dependency>
+
+
+        <!--shiro依赖和缓存-->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-core</artifactId>
+            <version>1.4.0</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>slf4j-api</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+
+        <!--lang包主要是一些可以高度重用的Util类-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.6</version>
+        </dependency>
+        <!--数据库连接池-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.20</version>
+        </dependency>
+        <!--执行sql拦截 打印控制台or写入文件-->
+        <dependency>
+            <groupId>p6spy</groupId>
+            <artifactId>p6spy</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+
+
+        <!--jsonUtil依赖-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.83</version>
+        </dependency>
+        <!--文件上传-->
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.11.0</version> <!-- 使用更高的版本 -->
+        </dependency>
+        <!-- 分页插件 -->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.5</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.mybatis</groupId>
+                    <artifactId>mybatis</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--交互状态码-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+        </dependency>
+        <!--freemarker模板引擎-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+
+        <!--http请求工具依赖-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk18on</artifactId>
+            <version>1.77</version> <!-- 使用最新稳定版 -->
+        </dependency>
+
+        <!--json工具库-->
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <classifier>jdk15</classifier>
+        </dependency>
+
+        <!--前后端长连接-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+
+        <!--文档生成器-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.7.0</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.7.0</version>
+        </dependency>
+        <dependency>
+
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <!--            <scope>test</scope>-->
+        </dependency>
+
+        <!--springBoot的aop-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+
+        <!-- Excel 处理相关 -->
+        <!-- Apache POI dependency for HSSF and XSSF -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>5.2.3</version> <!-- Use the version appropriate for your needs -->
+        </dependency>
+
+        <!-- Dependency for POI-OOXML (required for HSSF and XSSF support) -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>5.2.3</version>
+        </dependency>
+
+
+
+
+
+
+
+        <!-- 媒体相关 -->
+        <dependency>
+            <groupId>org.bytedeco</groupId>
+            <artifactId>javacv</artifactId>
+            <version>1.5.6</version>
+        </dependency>
+
+
+
+        <dependency>
+            <groupId>org.bytedeco</groupId>
+            <artifactId>ffmpeg</artifactId>
+            <version>4.4-1.5.6</version>
+            <classifier>windows-x86_64</classifier>
+        </dependency>
+
+        <dependency>
+            <groupId>org.bytedeco</groupId>
+            <artifactId>ffmpeg</artifactId>
+            <version>4.4-1.5.6</version>
+            <classifier>linux-x86_64</classifier>
+        </dependency>
+
+        <!-- netty -->
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+            <version>4.1.59.Final</version>
+        </dependency>
+
+        <!-- 图片处理 -->
+        <dependency>
+            <groupId>net.coobird</groupId>
+            <artifactId>thumbnailator</artifactId>
+            <version>0.4.19</version>
+        </dependency>
+
+        <!-- 压缩工具 -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-compress</artifactId>
+            <version>1.21</version>
+        </dependency>
+
+        <!-- ZIP加密支持(使用Zip4j) -->
+        <dependency>
+            <groupId>net.lingala.zip4j</groupId>
+            <artifactId>zip4j</artifactId>
+            <version>2.11.5</version>
+        </dependency>
+        <!-- 加密工具 -->
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk15on</artifactId>
+            <version>1.70</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+        </plugins>
+        <finalName>jd-agbox</finalName>
+    </build>
+
+</project>

+ 26 - 0
src/main/java/com/usky/AgboxApplication.java

@@ -0,0 +1,26 @@
+package com.usky;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+@ConfigurationProperties
+@MapperScan({"com.usky.modules.mapper"})
+@EnableCaching
+@EnableScheduling
+@EnableTransactionManagement
+public class AgboxApplication {
+    public AgboxApplication() {
+    }
+
+    public static void main(String[] args) {
+        SpringApplication.run(AgboxApplication.class, args);
+        LoggerFactory.getLogger(AgboxApplication.class).info("服务器启动完成...");
+    }
+}

+ 50 - 0
src/main/java/com/usky/Interceptor/ActivationInterceptor.java

@@ -0,0 +1,50 @@
+package com.usky.Interceptor;
+
+import com.usky.common.enums.ErrorCode;
+import com.usky.common.exception.DefenceException;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.DESUtils;
+import com.usky.common.utils.HardwareCodeAutoFillUtil;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+@Component
+public class ActivationInterceptor implements HandlerInterceptor {
+    private static final Logger log = LoggerFactory.getLogger(ActivationInterceptor.class);
+    @Autowired
+    private ConfigCacheListener listener;
+
+    public ActivationInterceptor() {
+    }
+
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        String licenseKey = this.listener.getConfig("licenseKey");
+        if (StringUtils.isBlank(licenseKey)) {
+            throw new DefenceException("系统未激活!");
+        } else {
+            try {
+                DESUtils.decrypt(licenseKey, HardwareCodeAutoFillUtil.getLinuxDeviceCode() + this.listener.getConfig("clientId"));
+            } catch (Exception e) {
+                log.error("无效激活码:{}", e.getMessage());
+                throw new DefenceException(ErrorCode.UNAUTHORIZED_LICENSE.getMessage());
+            }
+
+            LocalDateTime validityTime = LocalDateTime.parse(this.listener.getConfig("validityTime"));
+            if (validityTime.isBefore(LocalDateTime.now())) {
+                throw new DefenceException("系统授权已到期!授权到期时间:" + validityTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), ErrorCode.EXPIRED.getCode());
+            } else {
+                String authorizationModule = this.listener.getConfig("authorizationModule");
+                request.setAttribute("authorizedModules", authorizationModule.split(","));
+                return true;
+            }
+        }
+    }
+}

+ 32 - 0
src/main/java/com/usky/Interceptor/DeviceActivationInterceptor.java

@@ -0,0 +1,32 @@
+package com.usky.Interceptor;
+
+import com.usky.common.exception.DefenceException;
+import com.usky.common.listener.ConfigCacheListener;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+@Component
+public class DeviceActivationInterceptor implements HandlerInterceptor {
+    private static final Logger log = LoggerFactory.getLogger(DeviceActivationInterceptor.class);
+    @Autowired
+    private ConfigCacheListener listener;
+
+    public DeviceActivationInterceptor() {
+    }
+
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        Integer status = Integer.valueOf(this.listener.getConfig("status"));
+        if (status == 0) {
+            throw new DefenceException("设备未激活!");
+        } else if (status == 2) {
+            throw new DefenceException("设备已过期停用!");
+        } else {
+            return true;
+        }
+    }
+}

+ 38 - 0
src/main/java/com/usky/Interceptor/JwtInterceptor.java

@@ -0,0 +1,38 @@
+package com.usky.Interceptor;
+
+import com.usky.common.exception.DefenceException;
+import com.usky.common.utils.JwtUtils;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+@Component
+public class JwtInterceptor extends HandlerInterceptorAdapter {
+    private static final Logger log = LoggerFactory.getLogger(JwtInterceptor.class);
+    @Autowired
+    private JwtUtils jwtUtils;
+
+    public JwtInterceptor() {
+    }
+
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        String method = request.getMethod();
+        if (method.equals("OPTIONS")) {
+            return true;
+        } else {
+            String authHeader = request.getHeader("token");
+            if (StringUtils.isNotBlank(authHeader)) {
+                this.jwtUtils.getClaimByToken(authHeader);
+                return true;
+            } else {
+                log.info("请求完整URL:{}", request.getRequestURL().toString());
+                throw new DefenceException("token为空", 401);
+            }
+        }
+    }
+}

+ 37 - 0
src/main/java/com/usky/Interceptor/ModuleAuthorizationInterceptor.java

@@ -0,0 +1,37 @@
+package com.usky.Interceptor;
+
+import com.usky.common.annotation.ModuleRequired;
+import java.io.IOException;
+import java.util.Arrays;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+@Component
+public class ModuleAuthorizationInterceptor implements HandlerInterceptor {
+    public ModuleAuthorizationInterceptor() {
+    }
+
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        String[] authorizedModules = (String[])request.getAttribute("authorizedModules");
+        if (!(handler instanceof HandlerMethod)) {
+            return true;
+        } else {
+            HandlerMethod handlerMethod = (HandlerMethod)handler;
+            ModuleRequired methodAnnotation = (ModuleRequired)handlerMethod.getMethodAnnotation(ModuleRequired.class);
+            if (methodAnnotation != null) {
+                return this.checkModuleAccess(methodAnnotation.value(), authorizedModules, response);
+            } else {
+                ModuleRequired classAnnotation = (ModuleRequired)handlerMethod.getBeanType().getAnnotation(ModuleRequired.class);
+                return classAnnotation != null ? this.checkModuleAccess(classAnnotation.value(), authorizedModules, response) : true;
+            }
+        }
+    }
+
+    private boolean checkModuleAccess(String requiredModule, String[] authorizedModules, HttpServletResponse response) throws IOException {
+        boolean hasAccess = Arrays.asList(authorizedModules).contains(requiredModule);
+        return hasAccess;
+    }
+}

+ 87 - 0
src/main/java/com/usky/Schedule/MachineSchedule.java

@@ -0,0 +1,87 @@
+package com.usky.Schedule;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.GetIpUtil;
+import com.usky.common.utils.HardwareCodeAutoFillUtil;
+import com.usky.common.utils.HttpClientUtil;
+import com.usky.modules.entity.SystemInfo;
+import com.usky.modules.entity.Village;
+import com.usky.modules.entity.global.DataInfo;
+import com.usky.modules.entity.global.result.QueryDeviceStatusResult;
+import com.usky.modules.mapper.VillageMapper;
+import com.usky.modules.service.SystemInfoService;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MachineSchedule {
+    private static final Logger log = LoggerFactory.getLogger(MachineSchedule.class);
+    private final SystemInfoService systemInfoService;
+    private final VillageMapper villageMapper;
+    @Autowired
+    private ConfigCacheListener listener;
+
+    @Scheduled(
+            fixedRate = 30000L
+    )
+    public void getMachineCode() {
+        Map<String, String> entry = new HashMap();
+        String deviceCode = HardwareCodeAutoFillUtil.getLinuxDeviceCode();
+        entry.put("deviceType", "AGCP");
+        entry.put("deviceInfo", deviceCode);
+        log.info("设备码 deviceInfo:{}", deviceCode);
+        SystemInfo systemInfo = (SystemInfo)this.systemInfoService.getOne((Wrapper)(new QueryWrapper<>()).last("limit 1"));
+        if (systemInfo != null) {
+            entry.put("clientId", systemInfo.getId());
+            log.info("客户端码 clientId:{}", systemInfo.getId());
+        }
+
+        Village village = (Village)this.villageMapper.selectOne((Wrapper)(new QueryWrapper<>()).last("limit 1"));
+        if (village != null) {
+            entry.put("villageCode", village.getVillageCode());
+            log.info("地块码 villageCode:{}", village.getVillageCode());
+            entry.put("villageName", village.getVillageName());
+            log.info("地块码 villageName:{}", village.getVillageName());
+        }
+
+        try {
+            entry.put("ip", GetIpUtil.getServerIP());
+            log.info("ip地址:{}", GetIpUtil.getServerIP());
+        } catch (Exception e) {
+            log.error("未知ip:{}", e.getMessage());
+        }
+
+        log.info("查询设备状态:" + entry.toString());
+        String result = HttpClientUtil.doGet("http://qifengapplet.fj724.com/admin/device/queryDeviceStatus", entry);
+        if (StrUtil.isNotBlank(result)) {
+            try {
+                QueryDeviceStatusResult readValue = (QueryDeviceStatusResult)(new ObjectMapper()).readValue(result, QueryDeviceStatusResult.class);
+                DataInfo data = readValue.getData();
+                if (data != null && !Objects.equals(data.getDeviceStatus(), ((SystemInfo)Objects.requireNonNull(systemInfo)).getStatus())) {
+                    systemInfo.setStatus(data.getDeviceStatus());
+                    this.systemInfoService.updateById(systemInfo);
+                    this.listener.configCache.put("status", data.getDeviceStatus().toString());
+                }
+            } catch (Exception e) {
+                log.error("解析json失败:{}", e.getMessage());
+            }
+        }
+
+        log.info("发送结果:{}", result);
+    }
+
+    public MachineSchedule(final SystemInfoService systemInfoService, final VillageMapper villageMapper) {
+        this.systemInfoService = systemInfoService;
+        this.villageMapper = villageMapper;
+    }
+}

+ 21 - 0
src/main/java/com/usky/SpringBootStartApplication.java

@@ -0,0 +1,21 @@
+package com.usky;
+
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@ConfigurationProperties
+@SpringBootApplication
+@EnableCaching
+@EnableScheduling
+public class SpringBootStartApplication extends SpringBootServletInitializer {
+    public SpringBootStartApplication() {
+    }
+
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+        return builder.sources(new Class[]{AgboxApplication.class});
+    }
+}

+ 12 - 0
src/main/java/com/usky/common/annotation/ModuleRequired.java

@@ -0,0 +1,12 @@
+package com.usky.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ModuleRequired {
+    String value();
+}

+ 302 - 0
src/main/java/com/usky/common/bo/BuildingHouse.java

@@ -0,0 +1,302 @@
+package com.usky.common.bo;
+
+import cn.idev.excel.annotation.ExcelProperty;
+
+public class BuildingHouse {
+    @ExcelProperty({"区域编号(buildingNo)"})
+    private String buildingNo;
+    @ExcelProperty({"区域描述(buildingNote)"})
+    private String buildingNote;
+    @ExcelProperty({"楼层总数(floorTotal)"})
+    private Integer floorTotal;
+    @ExcelProperty({"部位总数(houseTotal)"})
+    private Integer houseTotal;
+    @ExcelProperty({"部位编号(houseNo)"})
+    private String houseNo;
+    @ExcelProperty({"部位描述(houseNote)"})
+    private String houseNote;
+    @ExcelProperty({"楼层(floor)"})
+    private Integer floor;
+    @ExcelProperty({"部位类别(houseLabel)"})
+    private String houseLabel;
+    @ExcelProperty({"部位用途(housePurpose)"})
+    private String housePurpose;
+    @ExcelProperty({"部位类型(placeType)"})
+    private String placeType;
+    @ExcelProperty({"是否公共区域(isPublic)"})
+    private Boolean isPublic;
+    @ExcelProperty({"是否受控区域(isAction)"})
+    private Boolean isAction;
+
+    public BuildingHouse() {
+    }
+
+    public String getBuildingNo() {
+        return this.buildingNo;
+    }
+
+    public String getBuildingNote() {
+        return this.buildingNote;
+    }
+
+    public Integer getFloorTotal() {
+        return this.floorTotal;
+    }
+
+    public Integer getHouseTotal() {
+        return this.houseTotal;
+    }
+
+    public String getHouseNo() {
+        return this.houseNo;
+    }
+
+    public String getHouseNote() {
+        return this.houseNote;
+    }
+
+    public Integer getFloor() {
+        return this.floor;
+    }
+
+    public String getHouseLabel() {
+        return this.houseLabel;
+    }
+
+    public String getHousePurpose() {
+        return this.housePurpose;
+    }
+
+    public String getPlaceType() {
+        return this.placeType;
+    }
+
+    public Boolean getIsPublic() {
+        return this.isPublic;
+    }
+
+    public Boolean getIsAction() {
+        return this.isAction;
+    }
+
+    public void setBuildingNo(final String buildingNo) {
+        this.buildingNo = buildingNo;
+    }
+
+    public void setBuildingNote(final String buildingNote) {
+        this.buildingNote = buildingNote;
+    }
+
+    public void setFloorTotal(final Integer floorTotal) {
+        this.floorTotal = floorTotal;
+    }
+
+    public void setHouseTotal(final Integer houseTotal) {
+        this.houseTotal = houseTotal;
+    }
+
+    public void setHouseNo(final String houseNo) {
+        this.houseNo = houseNo;
+    }
+
+    public void setHouseNote(final String houseNote) {
+        this.houseNote = houseNote;
+    }
+
+    public void setFloor(final Integer floor) {
+        this.floor = floor;
+    }
+
+    public void setHouseLabel(final String houseLabel) {
+        this.houseLabel = houseLabel;
+    }
+
+    public void setHousePurpose(final String housePurpose) {
+        this.housePurpose = housePurpose;
+    }
+
+    public void setPlaceType(final String placeType) {
+        this.placeType = placeType;
+    }
+
+    public void setIsPublic(final Boolean isPublic) {
+        this.isPublic = isPublic;
+    }
+
+    public void setIsAction(final Boolean isAction) {
+        this.isAction = isAction;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof BuildingHouse)) {
+            return false;
+        } else {
+            BuildingHouse other = (BuildingHouse)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$buildingNo = this.getBuildingNo();
+                Object other$buildingNo = other.getBuildingNo();
+                if (this$buildingNo == null) {
+                    if (other$buildingNo != null) {
+                        return false;
+                    }
+                } else if (!this$buildingNo.equals(other$buildingNo)) {
+                    return false;
+                }
+
+                Object this$buildingNote = this.getBuildingNote();
+                Object other$buildingNote = other.getBuildingNote();
+                if (this$buildingNote == null) {
+                    if (other$buildingNote != null) {
+                        return false;
+                    }
+                } else if (!this$buildingNote.equals(other$buildingNote)) {
+                    return false;
+                }
+
+                Object this$floorTotal = this.getFloorTotal();
+                Object other$floorTotal = other.getFloorTotal();
+                if (this$floorTotal == null) {
+                    if (other$floorTotal != null) {
+                        return false;
+                    }
+                } else if (!this$floorTotal.equals(other$floorTotal)) {
+                    return false;
+                }
+
+                Object this$houseTotal = this.getHouseTotal();
+                Object other$houseTotal = other.getHouseTotal();
+                if (this$houseTotal == null) {
+                    if (other$houseTotal != null) {
+                        return false;
+                    }
+                } else if (!this$houseTotal.equals(other$houseTotal)) {
+                    return false;
+                }
+
+                Object this$houseNo = this.getHouseNo();
+                Object other$houseNo = other.getHouseNo();
+                if (this$houseNo == null) {
+                    if (other$houseNo != null) {
+                        return false;
+                    }
+                } else if (!this$houseNo.equals(other$houseNo)) {
+                    return false;
+                }
+
+                Object this$houseNote = this.getHouseNote();
+                Object other$houseNote = other.getHouseNote();
+                if (this$houseNote == null) {
+                    if (other$houseNote != null) {
+                        return false;
+                    }
+                } else if (!this$houseNote.equals(other$houseNote)) {
+                    return false;
+                }
+
+                Object this$floor = this.getFloor();
+                Object other$floor = other.getFloor();
+                if (this$floor == null) {
+                    if (other$floor != null) {
+                        return false;
+                    }
+                } else if (!this$floor.equals(other$floor)) {
+                    return false;
+                }
+
+                Object this$houseLabel = this.getHouseLabel();
+                Object other$houseLabel = other.getHouseLabel();
+                if (this$houseLabel == null) {
+                    if (other$houseLabel != null) {
+                        return false;
+                    }
+                } else if (!this$houseLabel.equals(other$houseLabel)) {
+                    return false;
+                }
+
+                Object this$housePurpose = this.getHousePurpose();
+                Object other$housePurpose = other.getHousePurpose();
+                if (this$housePurpose == null) {
+                    if (other$housePurpose != null) {
+                        return false;
+                    }
+                } else if (!this$housePurpose.equals(other$housePurpose)) {
+                    return false;
+                }
+
+                Object this$placeType = this.getPlaceType();
+                Object other$placeType = other.getPlaceType();
+                if (this$placeType == null) {
+                    if (other$placeType != null) {
+                        return false;
+                    }
+                } else if (!this$placeType.equals(other$placeType)) {
+                    return false;
+                }
+
+                Object this$isPublic = this.getIsPublic();
+                Object other$isPublic = other.getIsPublic();
+                if (this$isPublic == null) {
+                    if (other$isPublic != null) {
+                        return false;
+                    }
+                } else if (!this$isPublic.equals(other$isPublic)) {
+                    return false;
+                }
+
+                Object this$isAction = this.getIsAction();
+                Object other$isAction = other.getIsAction();
+                if (this$isAction == null) {
+                    if (other$isAction != null) {
+                        return false;
+                    }
+                } else if (!this$isAction.equals(other$isAction)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof BuildingHouse;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $buildingNo = this.getBuildingNo();
+        result = result * 59 + ($buildingNo == null ? 43 : $buildingNo.hashCode());
+        Object $buildingNote = this.getBuildingNote();
+        result = result * 59 + ($buildingNote == null ? 43 : $buildingNote.hashCode());
+        Object $floorTotal = this.getFloorTotal();
+        result = result * 59 + ($floorTotal == null ? 43 : $floorTotal.hashCode());
+        Object $houseTotal = this.getHouseTotal();
+        result = result * 59 + ($houseTotal == null ? 43 : $houseTotal.hashCode());
+        Object $houseNo = this.getHouseNo();
+        result = result * 59 + ($houseNo == null ? 43 : $houseNo.hashCode());
+        Object $houseNote = this.getHouseNote();
+        result = result * 59 + ($houseNote == null ? 43 : $houseNote.hashCode());
+        Object $floor = this.getFloor();
+        result = result * 59 + ($floor == null ? 43 : $floor.hashCode());
+        Object $houseLabel = this.getHouseLabel();
+        result = result * 59 + ($houseLabel == null ? 43 : $houseLabel.hashCode());
+        Object $housePurpose = this.getHousePurpose();
+        result = result * 59 + ($housePurpose == null ? 43 : $housePurpose.hashCode());
+        Object $placeType = this.getPlaceType();
+        result = result * 59 + ($placeType == null ? 43 : $placeType.hashCode());
+        Object $isPublic = this.getIsPublic();
+        result = result * 59 + ($isPublic == null ? 43 : $isPublic.hashCode());
+        Object $isAction = this.getIsAction();
+        result = result * 59 + ($isAction == null ? 43 : $isAction.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "BuildingHouse(buildingNo=" + this.getBuildingNo() + ", buildingNote=" + this.getBuildingNote() + ", floorTotal=" + this.getFloorTotal() + ", houseTotal=" + this.getHouseTotal() + ", houseNo=" + this.getHouseNo() + ", houseNote=" + this.getHouseNote() + ", floor=" + this.getFloor() + ", houseLabel=" + this.getHouseLabel() + ", housePurpose=" + this.getHousePurpose() + ", placeType=" + this.getPlaceType() + ", isPublic=" + this.getIsPublic() + ", isAction=" + this.getIsAction() + ")";
+    }
+}

+ 78 - 0
src/main/java/com/usky/common/bo/CommonBo.java

@@ -0,0 +1,78 @@
+package com.usky.common.bo;
+
+public class CommonBo {
+    private String key;
+    private String json;
+
+    public CommonBo() {
+    }
+
+    public String getKey() {
+        return this.key;
+    }
+
+    public String getJson() {
+        return this.json;
+    }
+
+    public void setKey(final String key) {
+        this.key = key;
+    }
+
+    public void setJson(final String json) {
+        this.json = json;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof CommonBo)) {
+            return false;
+        } else {
+            CommonBo other = (CommonBo)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$key = this.getKey();
+                Object other$key = other.getKey();
+                if (this$key == null) {
+                    if (other$key != null) {
+                        return false;
+                    }
+                } else if (!this$key.equals(other$key)) {
+                    return false;
+                }
+
+                Object this$json = this.getJson();
+                Object other$json = other.getJson();
+                if (this$json == null) {
+                    if (other$json != null) {
+                        return false;
+                    }
+                } else if (!this$json.equals(other$json)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof CommonBo;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $key = this.getKey();
+        result = result * 59 + ($key == null ? 43 : $key.hashCode());
+        Object $json = this.getJson();
+        result = result * 59 + ($json == null ? 43 : $json.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "CommonBo(key=" + this.getKey() + ", json=" + this.getJson() + ")";
+    }
+}

+ 457 - 0
src/main/java/com/usky/common/bo/DeviceStencil.java

@@ -0,0 +1,457 @@
+package com.usky.common.bo;
+
+import cn.idev.excel.annotation.ExcelProperty;
+import java.math.BigDecimal;
+
+public class DeviceStencil {
+    @ExcelProperty({"设备类型"})
+    private String deviceType;
+    @ExcelProperty({"设备编码"})
+    private String deviceId;
+    @ExcelProperty({"IP地址"})
+    private String ipAddr;
+    @ExcelProperty({"设备功能"})
+    private String deviceFeatures;
+    @ExcelProperty({"设备位置"})
+    private String address;
+    @ExcelProperty({"备注"})
+    private String note;
+    @ExcelProperty({"是否屏蔽"})
+    private Boolean shield;
+    @ExcelProperty({"纬度"})
+    private BigDecimal lat;
+    @ExcelProperty({"经度"})
+    private BigDecimal lon;
+    @ExcelProperty({"高度"})
+    private BigDecimal alt;
+    @ExcelProperty({"坐标类型"})
+    private String gisType;
+    @ExcelProperty({"楼层"})
+    private Integer floor;
+    @ExcelProperty({"坐标区域备注"})
+    private String area;
+    @ExcelProperty({"通道"})
+    private Integer channel;
+    @ExcelProperty({"通道IP"})
+    private String addr;
+    @ExcelProperty({"区域"})
+    private String buildingNo;
+    @ExcelProperty({"部位"})
+    private String houseNo;
+    @ExcelProperty({"位置"})
+    private String location;
+    @ExcelProperty({"通道备注信息"})
+    private String channelNote;
+
+    public DeviceStencil() {
+    }
+
+    public String getDeviceType() {
+        return this.deviceType;
+    }
+
+    public String getDeviceId() {
+        return this.deviceId;
+    }
+
+    public String getIpAddr() {
+        return this.ipAddr;
+    }
+
+    public String getDeviceFeatures() {
+        return this.deviceFeatures;
+    }
+
+    public String getAddress() {
+        return this.address;
+    }
+
+    public String getNote() {
+        return this.note;
+    }
+
+    public Boolean getShield() {
+        return this.shield;
+    }
+
+    public BigDecimal getLat() {
+        return this.lat;
+    }
+
+    public BigDecimal getLon() {
+        return this.lon;
+    }
+
+    public BigDecimal getAlt() {
+        return this.alt;
+    }
+
+    public String getGisType() {
+        return this.gisType;
+    }
+
+    public Integer getFloor() {
+        return this.floor;
+    }
+
+    public String getArea() {
+        return this.area;
+    }
+
+    public Integer getChannel() {
+        return this.channel;
+    }
+
+    public String getAddr() {
+        return this.addr;
+    }
+
+    public String getBuildingNo() {
+        return this.buildingNo;
+    }
+
+    public String getHouseNo() {
+        return this.houseNo;
+    }
+
+    public String getLocation() {
+        return this.location;
+    }
+
+    public String getChannelNote() {
+        return this.channelNote;
+    }
+
+    public void setDeviceType(final String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public void setDeviceId(final String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public void setIpAddr(final String ipAddr) {
+        this.ipAddr = ipAddr;
+    }
+
+    public void setDeviceFeatures(final String deviceFeatures) {
+        this.deviceFeatures = deviceFeatures;
+    }
+
+    public void setAddress(final String address) {
+        this.address = address;
+    }
+
+    public void setNote(final String note) {
+        this.note = note;
+    }
+
+    public void setShield(final Boolean shield) {
+        this.shield = shield;
+    }
+
+    public void setLat(final BigDecimal lat) {
+        this.lat = lat;
+    }
+
+    public void setLon(final BigDecimal lon) {
+        this.lon = lon;
+    }
+
+    public void setAlt(final BigDecimal alt) {
+        this.alt = alt;
+    }
+
+    public void setGisType(final String gisType) {
+        this.gisType = gisType;
+    }
+
+    public void setFloor(final Integer floor) {
+        this.floor = floor;
+    }
+
+    public void setArea(final String area) {
+        this.area = area;
+    }
+
+    public void setChannel(final Integer channel) {
+        this.channel = channel;
+    }
+
+    public void setAddr(final String addr) {
+        this.addr = addr;
+    }
+
+    public void setBuildingNo(final String buildingNo) {
+        this.buildingNo = buildingNo;
+    }
+
+    public void setHouseNo(final String houseNo) {
+        this.houseNo = houseNo;
+    }
+
+    public void setLocation(final String location) {
+        this.location = location;
+    }
+
+    public void setChannelNote(final String channelNote) {
+        this.channelNote = channelNote;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof DeviceStencil)) {
+            return false;
+        } else {
+            DeviceStencil other = (DeviceStencil)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$deviceType = this.getDeviceType();
+                Object other$deviceType = other.getDeviceType();
+                if (this$deviceType == null) {
+                    if (other$deviceType != null) {
+                        return false;
+                    }
+                } else if (!this$deviceType.equals(other$deviceType)) {
+                    return false;
+                }
+
+                Object this$deviceId = this.getDeviceId();
+                Object other$deviceId = other.getDeviceId();
+                if (this$deviceId == null) {
+                    if (other$deviceId != null) {
+                        return false;
+                    }
+                } else if (!this$deviceId.equals(other$deviceId)) {
+                    return false;
+                }
+
+                Object this$ipAddr = this.getIpAddr();
+                Object other$ipAddr = other.getIpAddr();
+                if (this$ipAddr == null) {
+                    if (other$ipAddr != null) {
+                        return false;
+                    }
+                } else if (!this$ipAddr.equals(other$ipAddr)) {
+                    return false;
+                }
+
+                Object this$deviceFeatures = this.getDeviceFeatures();
+                Object other$deviceFeatures = other.getDeviceFeatures();
+                if (this$deviceFeatures == null) {
+                    if (other$deviceFeatures != null) {
+                        return false;
+                    }
+                } else if (!this$deviceFeatures.equals(other$deviceFeatures)) {
+                    return false;
+                }
+
+                Object this$address = this.getAddress();
+                Object other$address = other.getAddress();
+                if (this$address == null) {
+                    if (other$address != null) {
+                        return false;
+                    }
+                } else if (!this$address.equals(other$address)) {
+                    return false;
+                }
+
+                Object this$note = this.getNote();
+                Object other$note = other.getNote();
+                if (this$note == null) {
+                    if (other$note != null) {
+                        return false;
+                    }
+                } else if (!this$note.equals(other$note)) {
+                    return false;
+                }
+
+                Object this$shield = this.getShield();
+                Object other$shield = other.getShield();
+                if (this$shield == null) {
+                    if (other$shield != null) {
+                        return false;
+                    }
+                } else if (!this$shield.equals(other$shield)) {
+                    return false;
+                }
+
+                Object this$lat = this.getLat();
+                Object other$lat = other.getLat();
+                if (this$lat == null) {
+                    if (other$lat != null) {
+                        return false;
+                    }
+                } else if (!this$lat.equals(other$lat)) {
+                    return false;
+                }
+
+                Object this$lon = this.getLon();
+                Object other$lon = other.getLon();
+                if (this$lon == null) {
+                    if (other$lon != null) {
+                        return false;
+                    }
+                } else if (!this$lon.equals(other$lon)) {
+                    return false;
+                }
+
+                Object this$alt = this.getAlt();
+                Object other$alt = other.getAlt();
+                if (this$alt == null) {
+                    if (other$alt != null) {
+                        return false;
+                    }
+                } else if (!this$alt.equals(other$alt)) {
+                    return false;
+                }
+
+                Object this$gisType = this.getGisType();
+                Object other$gisType = other.getGisType();
+                if (this$gisType == null) {
+                    if (other$gisType != null) {
+                        return false;
+                    }
+                } else if (!this$gisType.equals(other$gisType)) {
+                    return false;
+                }
+
+                Object this$floor = this.getFloor();
+                Object other$floor = other.getFloor();
+                if (this$floor == null) {
+                    if (other$floor != null) {
+                        return false;
+                    }
+                } else if (!this$floor.equals(other$floor)) {
+                    return false;
+                }
+
+                Object this$area = this.getArea();
+                Object other$area = other.getArea();
+                if (this$area == null) {
+                    if (other$area != null) {
+                        return false;
+                    }
+                } else if (!this$area.equals(other$area)) {
+                    return false;
+                }
+
+                Object this$channel = this.getChannel();
+                Object other$channel = other.getChannel();
+                if (this$channel == null) {
+                    if (other$channel != null) {
+                        return false;
+                    }
+                } else if (!this$channel.equals(other$channel)) {
+                    return false;
+                }
+
+                Object this$addr = this.getAddr();
+                Object other$addr = other.getAddr();
+                if (this$addr == null) {
+                    if (other$addr != null) {
+                        return false;
+                    }
+                } else if (!this$addr.equals(other$addr)) {
+                    return false;
+                }
+
+                Object this$buildingNo = this.getBuildingNo();
+                Object other$buildingNo = other.getBuildingNo();
+                if (this$buildingNo == null) {
+                    if (other$buildingNo != null) {
+                        return false;
+                    }
+                } else if (!this$buildingNo.equals(other$buildingNo)) {
+                    return false;
+                }
+
+                Object this$houseNo = this.getHouseNo();
+                Object other$houseNo = other.getHouseNo();
+                if (this$houseNo == null) {
+                    if (other$houseNo != null) {
+                        return false;
+                    }
+                } else if (!this$houseNo.equals(other$houseNo)) {
+                    return false;
+                }
+
+                Object this$location = this.getLocation();
+                Object other$location = other.getLocation();
+                if (this$location == null) {
+                    if (other$location != null) {
+                        return false;
+                    }
+                } else if (!this$location.equals(other$location)) {
+                    return false;
+                }
+
+                Object this$channelNote = this.getChannelNote();
+                Object other$channelNote = other.getChannelNote();
+                if (this$channelNote == null) {
+                    if (other$channelNote != null) {
+                        return false;
+                    }
+                } else if (!this$channelNote.equals(other$channelNote)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof DeviceStencil;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $deviceType = this.getDeviceType();
+        result = result * 59 + ($deviceType == null ? 43 : $deviceType.hashCode());
+        Object $deviceId = this.getDeviceId();
+        result = result * 59 + ($deviceId == null ? 43 : $deviceId.hashCode());
+        Object $ipAddr = this.getIpAddr();
+        result = result * 59 + ($ipAddr == null ? 43 : $ipAddr.hashCode());
+        Object $deviceFeatures = this.getDeviceFeatures();
+        result = result * 59 + ($deviceFeatures == null ? 43 : $deviceFeatures.hashCode());
+        Object $address = this.getAddress();
+        result = result * 59 + ($address == null ? 43 : $address.hashCode());
+        Object $note = this.getNote();
+        result = result * 59 + ($note == null ? 43 : $note.hashCode());
+        Object $shield = this.getShield();
+        result = result * 59 + ($shield == null ? 43 : $shield.hashCode());
+        Object $lat = this.getLat();
+        result = result * 59 + ($lat == null ? 43 : $lat.hashCode());
+        Object $lon = this.getLon();
+        result = result * 59 + ($lon == null ? 43 : $lon.hashCode());
+        Object $alt = this.getAlt();
+        result = result * 59 + ($alt == null ? 43 : $alt.hashCode());
+        Object $gisType = this.getGisType();
+        result = result * 59 + ($gisType == null ? 43 : $gisType.hashCode());
+        Object $floor = this.getFloor();
+        result = result * 59 + ($floor == null ? 43 : $floor.hashCode());
+        Object $area = this.getArea();
+        result = result * 59 + ($area == null ? 43 : $area.hashCode());
+        Object $channel = this.getChannel();
+        result = result * 59 + ($channel == null ? 43 : $channel.hashCode());
+        Object $addr = this.getAddr();
+        result = result * 59 + ($addr == null ? 43 : $addr.hashCode());
+        Object $buildingNo = this.getBuildingNo();
+        result = result * 59 + ($buildingNo == null ? 43 : $buildingNo.hashCode());
+        Object $houseNo = this.getHouseNo();
+        result = result * 59 + ($houseNo == null ? 43 : $houseNo.hashCode());
+        Object $location = this.getLocation();
+        result = result * 59 + ($location == null ? 43 : $location.hashCode());
+        Object $channelNote = this.getChannelNote();
+        result = result * 59 + ($channelNote == null ? 43 : $channelNote.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "DeviceStencil(deviceType=" + this.getDeviceType() + ", deviceId=" + this.getDeviceId() + ", ipAddr=" + this.getIpAddr() + ", deviceFeatures=" + this.getDeviceFeatures() + ", address=" + this.getAddress() + ", note=" + this.getNote() + ", shield=" + this.getShield() + ", lat=" + this.getLat() + ", lon=" + this.getLon() + ", alt=" + this.getAlt() + ", gisType=" + this.getGisType() + ", floor=" + this.getFloor() + ", area=" + this.getArea() + ", channel=" + this.getChannel() + ", addr=" + this.getAddr() + ", buildingNo=" + this.getBuildingNo() + ", houseNo=" + this.getHouseNo() + ", location=" + this.getLocation() + ", channelNote=" + this.getChannelNote() + ")";
+    }
+}

+ 26 - 0
src/main/java/com/usky/common/enums/CardType.java

@@ -0,0 +1,26 @@
+package com.usky.common.enums;
+
+public enum CardType {
+    IC(1, "IC卡"),
+    ID(2, "ID卡"),
+    RFID(2, "远距离RFID"),
+    WiFi(2, "WiFi MAC"),
+    BLUE(2, "蓝牙 MAC"),
+    IMSI(2, "IMSI");
+
+    private final int code;
+    private final String name;
+
+    private CardType(int code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+}

+ 73 - 0
src/main/java/com/usky/common/enums/ErrorCode.java

@@ -0,0 +1,73 @@
+package com.usky.common.enums;
+
+public enum ErrorCode {
+    JSON_INVALID(-32700, "Parse error语法解析错误"),
+    REQUEST_INVALID(-32600, "Invalid Request无效请求"),
+    METHOD_INVALID(-32601, "Method not found没有该方法"),
+    PRAMS_INVALID(-32602, "Invalid params无效的参数"),
+    INTERNAL_ERROR(-32603, "Internal error内部错误"),
+    URL_PARAMS_ERROR(-30001, "URL参数缺失"),
+    DATA_INTERNAL_ERROR(-30002, "内部错误"),
+    KEY_ERROR(-30003, "KEY错误"),
+    UNREGISTER(-30004, "未注册或未创建"),
+    TIME_FORMAT_ERROR(-30005, "时间格式错误"),
+    UN_DISPOSITION_ERROR(-30006, "内部错误"),
+    CREDENTIAL_NO_ERROR(-20008, "身份证号码验证失败"),
+    NO_REGISTERED(-20009, "该编号已经在本系统内注册"),
+    DISPOSITION_ERROR(-20010, "配置文件错误"),
+    PARAMS_VALUE_ERROR(-20011, "参数值错误"),
+    CREDENTIAL_NO_UNREGISTER(-20012, "身份证未注册"),
+    DEVICE_SHIELD(-20013, "设备被屏蔽"),
+    DEVICE_UNREGISTER(-20014, "设备未注册"),
+    UUID_FORMAT_ERROR(-20015, "UUID格式错误"),
+    REPEAT_ADD(-20016, "重复添加"),
+    UN_USE_PERMISSIONS(-20017, "没有使用权限"),
+    DISPOSITION(-21001, "特征库初始化失败"),
+    INVALID_ID(-21002, "无效的ID"),
+    INVALID_PARAMS(-21003, "无效的特征参数"),
+    COMPARED_DATA(-21004, "已比对数据"),
+    NULL_EIGENVALUE(-21005, "空特征值"),
+    LOGIN_FAIL(-21006, "登录失败"),
+    TOKEN_EXPIRED(-21007, "令牌过期"),
+    TRY_UPDATE_LOCK_DATA(-21008, "试图修改锁定数据"),
+    INVALID_PHONE(-21009, "无效的电话号码"),
+    INVALID_PERSON_CODE(-21010, "无效人员编码"),
+    URL_REQUEST_FAIL(-21011, "url请求失败"),
+    GET_BYTE_DATA_FAIL(-21013, "获取二进制数据失败"),
+    INVALID_EIGENVALUE(-21014, "无效的特征值"),
+    EXTRACT_EIGEN_FAIL(-21015, "提取特征失败"),
+    JSON_PARSE_FAIL(-21016, "Json解析失败"),
+    FORWARD_REQUEST_ERROR(-21017, "转发请求错误"),
+    INSERT_FAIL(-21018, "添加失败"),
+    CARD_NO_REPEAT_ADD(-21019, "门禁卡号重复"),
+    NULL_PIC(404, "照片不存在"),
+    UPDATE_FAIL(-21020, "更新失败"),
+    EXPIRED(7, "授权已到期"),
+    UNAUTHORIZED_LICENSE(8, "无效系统激活码");
+
+    private final int code;
+    private final String message;
+
+    private ErrorCode(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public static ErrorCode getByCode(int code) {
+        for(ErrorCode errorCode : values()) {
+            if (errorCode.getCode() == code) {
+                return errorCode;
+            }
+        }
+
+        return null;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+}

+ 32 - 0
src/main/java/com/usky/common/enums/SystemTypeCodeEnum.java

@@ -0,0 +1,32 @@
+package com.usky.common.enums;
+
+public enum SystemTypeCodeEnum {
+    snap(1001, "实时智能分析"),
+    video(1002, "视频安防监控"),
+    usbalarm(1003, "视频导出防护"),
+    gauth(1004, "组合认证控制"),
+    entrance(1005, "出入门禁控制"),
+    parking(1006, "车牌抓拍分析"),
+    alarm(1007, "入侵紧急报警"),
+    patrol(1008, "实时电子巡检"),
+    perception(1009, "状态感知探测"),
+    acquisition(1010, "数据采集探测"),
+    collection(1011, "状态采集探测"),
+    roadblock(1012, "阻车路障探测");
+
+    private final int code;
+    private final String message;
+
+    private SystemTypeCodeEnum(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+}

+ 44 - 0
src/main/java/com/usky/common/exception/DefenceException.java

@@ -0,0 +1,44 @@
+package com.usky.common.exception;
+
+public class DefenceException extends RuntimeException {
+    private String msg;
+    private int code = 500;
+
+    public DefenceException(String msg) {
+        super(msg);
+        this.msg = msg;
+    }
+
+    public DefenceException(String msg, Throwable e) {
+        super(msg, e);
+        this.msg = msg;
+    }
+
+    public DefenceException(String msg, int code) {
+        super(msg);
+        this.msg = msg;
+        this.code = code;
+    }
+
+    public DefenceException(String msg, int code, Throwable e) {
+        super(msg, e);
+        this.msg = msg;
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return this.msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+}

+ 63 - 0
src/main/java/com/usky/common/exception/DefenceExceptionHandler.java

@@ -0,0 +1,63 @@
+package com.usky.common.exception;
+
+import com.usky.common.utils.Response;
+import javax.validation.ConstraintViolationException;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.web.HttpMediaTypeNotSupportedException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.servlet.NoHandlerFoundException;
+
+@RestControllerAdvice
+public class DefenceExceptionHandler {
+    private static final Logger log = LoggerFactory.getLogger(DefenceExceptionHandler.class);
+
+    public DefenceExceptionHandler() {
+    }
+
+    @ExceptionHandler({DefenceException.class})
+    public Response handleYGException(DefenceException e) {
+        return Response.error(e.getCode(), e.getMessage());
+    }
+
+    @ExceptionHandler({NoHandlerFoundException.class})
+    public Response handlerNoFoundException(Exception e) {
+        log.error(e.getMessage(), e);
+        return Response.error(404, "路径不存在,请检查路径是否正确");
+    }
+
+    @ExceptionHandler({DuplicateKeyException.class})
+    public Response handleDuplicateKeyException(DuplicateKeyException e) {
+        log.error(e.getMessage(), e);
+        return Response.error("数据库中已存在该记录");
+    }
+
+    @ExceptionHandler({Exception.class})
+    public Response handleException(Exception e) {
+        log.error(e.getMessage(), e);
+        return Response.error();
+    }
+
+    @ExceptionHandler({NullPointerException.class})
+    public Response handleException(NullPointerException e) {
+        log.error(e.getMessage(), e);
+        return Response.error("接口处理异常");
+    }
+
+    @ExceptionHandler({ConstraintViolationException.class})
+    public Response handleHttpMediaTypeNotSupportedException(ConstraintViolationException e) {
+        log.error(e.getMessage(), e);
+        String[] strings = e.getMessage().split(",");
+        String[] message = StringUtils.splitPreserveAllTokens(strings[0], ":");
+        return Response.error(message[1]);
+    }
+
+    @ExceptionHandler({HttpMediaTypeNotSupportedException.class})
+    public Response handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e) {
+        log.error(e.getMessage(), e);
+        return Response.error("不支持的参数类型");
+    }
+}

+ 73 - 0
src/main/java/com/usky/common/generator/CodeGenerator.java

@@ -0,0 +1,73 @@
+package com.usky.common.generator;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.FileOutConfig;
+import com.baomidou.mybatisplus.generator.config.GlobalConfig;
+import com.baomidou.mybatisplus.generator.config.PackageConfig;
+import com.baomidou.mybatisplus.generator.config.StrategyConfig;
+import com.baomidou.mybatisplus.generator.config.TemplateConfig;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CodeGenerator {
+    public CodeGenerator() {
+    }
+
+    public static void main(String[] args) {
+        AutoGenerator mpg = new AutoGenerator();
+        GlobalConfig gc = new GlobalConfig();
+        final String projectPath = System.getProperty("user.dir");
+        gc.setOutputDir(projectPath + "/src/main/java");
+        gc.setAuthor("szh");
+        gc.setIdType(IdType.AUTO);
+        gc.setOpen(false);
+        gc.setSwagger2(true);
+        gc.setServiceName("%sService");
+        gc.setServiceImplName("%sServiceImpl");
+        gc.setMapperName("%sMapper");
+        gc.setXmlName("%sMapper");
+        mpg.setGlobalConfig(gc);
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://192.168.3.141:3306/agcp?useUnicode=true&useSSL=false&characterEncoding=utf8");
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("agcp");
+        dsc.setPassword("agcp");
+        mpg.setDataSource(dsc);
+        PackageConfig pc = new PackageConfig();
+        pc.setParent("com.fjkj.agcp.modules.Manager");
+        mpg.setPackageInfo(pc);
+        InjectionConfig cfg = new InjectionConfig() {
+            public void initMap() {
+            }
+        };
+        String templatePath = "/templates/mapper.xml.ftl";
+        List<FileOutConfig> focList = new ArrayList();
+        focList.add(new FileOutConfig(templatePath) {
+            public String outputFile(TableInfo tableInfo) {
+                return projectPath + "/src/main/resources/mapper/Manager/" + tableInfo.getEntityName() + "Mapper" + ".xml";
+            }
+        });
+        cfg.setFileOutConfigList(focList);
+        mpg.setCfg(cfg);
+        TemplateConfig templateConfig = new TemplateConfig();
+        templateConfig.setXml((String)null);
+        mpg.setTemplate(templateConfig);
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setNaming(NamingStrategy.underline_to_camel);
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
+        strategy.setEntityLombokModel(true);
+        strategy.setRestControllerStyle(true);
+        strategy.setInclude(new String[]{"m_card_set"});
+        strategy.setControllerMappingHyphenStyle(true);
+        strategy.setTablePrefix(new String[]{"m_"});
+        mpg.setStrategy(strategy);
+        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
+        mpg.execute();
+    }
+}

+ 76 - 0
src/main/java/com/usky/common/listener/BuildingHouseExcelListener.java

@@ -0,0 +1,76 @@
+package com.usky.common.listener;
+
+import cn.idev.excel.context.AnalysisContext;
+import cn.idev.excel.event.AnalysisEventListener;
+import com.usky.common.bo.BuildingHouse;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BuildingHouseExcelListener extends AnalysisEventListener<BuildingHouse> {
+    private List<BuildingHouse> dataList = new ArrayList();
+    private final List<String> errorMessages = new ArrayList();
+    private int currentRow = 1;
+
+    public void invoke(BuildingHouse data, AnalysisContext analysisContext) {
+        ++this.currentRow;
+        if (StringUtils.isBlank(data.getBuildingNo())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:区域编号不能为空");
+        }
+
+        if (data.getFloorTotal() == null) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:楼层总数不能为空");
+        }
+
+        if (data.getHouseTotal() == null) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:部位总数不能为空");
+        }
+
+        if (StringUtils.isBlank(data.getHouseNo())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:部位编号不能为空");
+        }
+
+        if (StringUtils.isBlank(data.getHouseLabel())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:部位类别不能为空");
+        }
+
+        if (StringUtils.isBlank(data.getPlaceType())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:部位类型不能为空");
+        }
+
+        if (StringUtils.isBlank(data.getHousePurpose())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:部位用途不能为空");
+        }
+
+        if (!data.getFloor().toString().matches("^[1-9]\\d*$")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:楼层数只能为正整数!");
+        }
+
+        if (!data.getFloorTotal().toString().matches("^[1-9]\\d*$")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:楼层总数只能为正整数!");
+        }
+
+        if (!data.getHouseTotal().toString().matches("^\\d+$")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:部位总数只能为非负整数!");
+        }
+
+        this.dataList.add(data);
+    }
+
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        System.out.println("读取完成,共读取了 " + this.dataList.size() + " 条数据");
+    }
+
+    public List<BuildingHouse> getDataList() {
+        return this.dataList;
+    }
+
+    public List<String> getErrorMessages() {
+        return this.errorMessages;
+    }
+
+    public BuildingHouseExcelListener() {
+    }
+}

+ 58 - 0
src/main/java/com/usky/common/listener/ConfigCacheListener.java

@@ -0,0 +1,58 @@
+package com.usky.common.listener;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.usky.modules.entity.Mqtt;
+import com.usky.modules.entity.SystemConfig;
+import com.usky.modules.entity.SystemInfo;
+import com.usky.modules.service.MqttService;
+import com.usky.modules.service.SystemConfigService;
+import com.usky.modules.service.SystemInfoService;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.annotation.PostConstruct;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.stereotype.Service;
+
+@Service
+@DependsOn({"dataInitializer"})
+public class ConfigCacheListener {
+    private static final Logger log = LoggerFactory.getLogger(ConfigCacheListener.class);
+    public final Map<String, String> configCache = new ConcurrentHashMap();
+    private final SystemConfigService systemConfigService;
+    private final SystemInfoService systemInfoService;
+    private final MqttService mqttService;
+
+    public ConfigCacheListener(SystemConfigService systemConfigService, SystemInfoService systemInfoService, MqttService mqttService) {
+        this.systemConfigService = systemConfigService;
+        this.systemInfoService = systemInfoService;
+        this.mqttService = mqttService;
+    }
+
+    @PostConstruct
+    public void initConfigCache() {
+        SystemInfo systemInfo = (SystemInfo)this.systemInfoService.getOne((Wrapper)(new LambdaQueryWrapper()).last("limit 1"));
+        SystemConfig config = (SystemConfig)this.systemConfigService.getOne((Wrapper)(new LambdaQueryWrapper()).last("limit 1"));
+        Mqtt mqtt = (Mqtt)this.mqttService.getOne((Wrapper)(new LambdaQueryWrapper()).last("limit 1"));
+        this.configCache.put("key", config.getKeyPasswd() == null ? "" : config.getKeyPasswd());
+        this.configCache.put("licenseKey", config.getLicenseKey() == null ? "" : config.getLicenseKey());
+        this.configCache.put("validityTime", systemInfo.getValidityTime() == null ? "" : String.valueOf(systemInfo.getValidityTime()));
+        this.configCache.put("status", systemInfo.getStatus() == null ? "" : String.valueOf(systemInfo.getStatus()));
+        this.configCache.put("authorizationModule", systemInfo.getAuthorizationModule() == null ? "" : systemInfo.getAuthorizationModule());
+        this.configCache.put("clientId", systemInfo.getId() == null ? "" : systemInfo.getId());
+        this.configCache.put("mqttUsername", mqtt.getUsername() == null ? "" : mqtt.getUsername());
+        this.configCache.put("mqttPassword", mqtt.getPassword() == null ? "" : mqtt.getPassword());
+        this.configCache.put("dataSaveDay", config.getDataSaveDay() == null ? "0" : String.valueOf(config.getDataSaveDay()));
+        this.configCache.put("protocol", StrUtil.isBlank(config.getAgreement()) ? "" : config.getAgreement());
+        this.configCache.put("host", StrUtil.isBlank(config.getServerAddr()) ? "" : config.getServerAddr());
+        log.info("已加载 {} 项配置到缓存", this.configCache.size());
+        log.info(this.configCache.toString());
+    }
+
+    public String getConfig(String key) {
+        return (String)this.configCache.get(key);
+    }
+}

+ 58 - 0
src/main/java/com/usky/common/listener/DataInitializer.java

@@ -0,0 +1,58 @@
+package com.usky.common.listener;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.IdUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.usky.common.utils.GetIpUtil;
+import com.usky.global.Common;
+import com.usky.modules.entity.SystemConfig;
+import com.usky.modules.entity.SystemInfo;
+import com.usky.modules.entity.Village;
+import com.usky.modules.mapper.VillageMapper;
+import com.usky.modules.service.SystemConfigService;
+import com.usky.modules.service.SystemInfoService;
+import javax.annotation.PostConstruct;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+@Component
+@Order(Integer.MIN_VALUE)
+public class DataInitializer {
+    private final VillageMapper villageMapper;
+    private final SystemInfoService systemInfoService;
+    private final SystemConfigService systemConfigService;
+
+    public DataInitializer(VillageMapper villageMapper, SystemInfoService systemInfoService, SystemConfigService systemConfigService) {
+        this.villageMapper = villageMapper;
+        this.systemInfoService = systemInfoService;
+        this.systemConfigService = systemConfigService;
+    }
+
+    @PostConstruct
+    public void initData() throws Exception {
+        if (this.villageMapper.selectList((Wrapper)null).isEmpty()) {
+            Village village = new Village();
+            village.setVillageCode(IdUtil.randomUUID());
+            this.villageMapper.insert(village);
+        }
+
+        if (CollUtil.isEmpty(this.systemInfoService.list())) {
+            SystemInfo systemInfo = new SystemInfo();
+            systemInfo.setId(IdUtil.randomUUID());
+            systemInfo.setName(Common.companyName);
+            this.systemInfoService.save(systemInfo);
+        }
+
+        if (CollUtil.isEmpty(this.systemConfigService.list())) {
+            SystemConfig systemConfig = new SystemConfig();
+            systemConfig.setId(1);
+            systemConfig.setKeyPasswd(Common.key);
+            systemConfig.setIsPicShow(true);
+            systemConfig.setIsIdentifyShow(true);
+            systemConfig.setAgreement(Common.agreement);
+            systemConfig.setServerAddr(GetIpUtil.getServerIP());
+            this.systemConfigService.save(systemConfig);
+        }
+
+    }
+}

+ 76 - 0
src/main/java/com/usky/common/listener/DeviceExcelListener.java

@@ -0,0 +1,76 @@
+package com.usky.common.listener;
+
+import cn.idev.excel.context.AnalysisContext;
+import cn.idev.excel.event.AnalysisEventListener;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.usky.common.bo.DeviceStencil;
+import com.usky.modules.entity.SystemType;
+import com.usky.modules.mapper.SystemTypeMapper;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.commons.lang.StringUtils;
+
+public class DeviceExcelListener extends AnalysisEventListener<DeviceStencil> {
+    private final SystemTypeMapper systemTypeMapper;
+    private List<DeviceStencil> dataList = new ArrayList();
+    private final List<String> errorMessages = new ArrayList();
+    private int currentRow = 1;
+
+    public DeviceExcelListener(SystemTypeMapper systemTypeMapper) {
+        this.systemTypeMapper = systemTypeMapper;
+    }
+
+    public void invoke(DeviceStencil data, AnalysisContext analysisContext) {
+        List<String> systemTypes = this.systemTypeMapper.selectList(null)
+                .stream()
+                .map(systemType -> systemType.getName())
+                .collect(Collectors.toList());
+        ++this.currentRow;
+        if (StringUtils.isBlank(data.getDeviceId())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:设备id不能为空!");
+        }
+
+        if (data.getChannel() == null) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:通道号不能为空!");
+        }
+
+        if (StringUtils.isBlank(data.getDeviceType())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:设备类型不能为空!");
+        }
+
+        if (!systemTypes.contains(data.getDeviceType())) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:设备类型不存在!");
+        }
+
+        if (!data.getIpAddr().matches("((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:设备IP格式错误!");
+        }
+
+        if (!data.getAddr().matches("((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:通道IP格式错误!");
+        }
+
+        if (!data.getFloor().toString().matches("^[1-9]\\d*$")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:楼层数只能为正整数!");
+        }
+
+        if (!data.getChannel().toString().matches("^\\d+$")) {
+            this.errorMessages.add("第" + this.currentRow + "行错误:通道号只能为非负整数!");
+        }
+
+        this.dataList.add(data);
+    }
+
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        System.out.println("读取完成,共读取了 " + this.dataList.size() + " 条数据");
+    }
+
+    public List<DeviceStencil> getDataList() {
+        return this.dataList;
+    }
+
+    public List<String> getErrorMessages() {
+        return this.errorMessages;
+    }
+}

+ 26 - 0
src/main/java/com/usky/common/listener/DownloadProgressManager.java

@@ -0,0 +1,26 @@
+package com.usky.common.listener;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DownloadProgressManager {
+    private final Map<String, Double> progressMap = new ConcurrentHashMap();
+    private static final String TASK_ID = "JAR_DOWNLOAD";
+
+    public DownloadProgressManager() {
+    }
+
+    public void updateProgress(double progress) {
+        this.progressMap.put("JAR_DOWNLOAD", progress);
+    }
+
+    public Double getProgress() {
+        return (Double)this.progressMap.get("JAR_DOWNLOAD");
+    }
+
+    public void clearProgress() {
+        this.progressMap.remove("JAR_DOWNLOAD");
+    }
+}

+ 36 - 0
src/main/java/com/usky/common/listener/FileUploadProgressListener.java

@@ -0,0 +1,36 @@
+package com.usky.common.listener;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.commons.fileupload.ProgressListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FileUploadProgressListener implements ProgressListener {
+    private static final Logger log = LoggerFactory.getLogger(FileUploadProgressListener.class);
+    private static final Map<String, Integer> progressMap = new ConcurrentHashMap();
+
+    public FileUploadProgressListener() {
+    }
+
+    public static void updateProgress(String sessionId, int percent) {
+        progressMap.put(sessionId, percent);
+        log.info("更新进度 - Session: {}, 进度: {}%", sessionId, percent);
+    }
+
+    public static Integer getProgress(String sessionId) {
+        Integer progress = (Integer)progressMap.getOrDefault(sessionId, 0);
+        log.info("获取进度 - Session: {}, 进度: {}", sessionId, progress);
+        return progress;
+    }
+
+    public static void clearProgress(String sessionId) {
+        progressMap.remove(sessionId);
+        log.info("清除进度 - Session: {}", sessionId);
+    }
+
+    public void update(long pBytesRead, long pContentLength, int pItems) {
+    }
+}

+ 29 - 0
src/main/java/com/usky/common/mqtt/MqttClientHolder.java

@@ -0,0 +1,29 @@
+package com.usky.common.mqtt;
+
+import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MqttClientHolder {
+    private volatile MqttAsyncClient mqttClient;
+    private volatile boolean realConnected = false;
+
+    public MqttClientHolder() {
+    }
+
+    public void setMqttClient(MqttAsyncClient client) {
+        this.mqttClient = client;
+    }
+
+    public MqttAsyncClient getMqttClient() {
+        return this.mqttClient;
+    }
+
+    public void setRealConnected(boolean status) {
+        this.realConnected = status;
+    }
+
+    public boolean isRealConnected() {
+        return this.mqttClient != null && this.realConnected;
+    }
+}

+ 101 - 0
src/main/java/com/usky/common/mqtt/MqttScheduler.java

@@ -0,0 +1,101 @@
+package com.usky.common.mqtt;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.modules.entity.FollowPerson;
+import com.usky.modules.entity.Person;
+import com.usky.modules.entity.Pic;
+import com.usky.modules.entity.persons.info.BlackPersonInfo;
+import com.usky.modules.entity.persons.info.WhitePersonInfo;
+import com.usky.modules.mapper.PicMapper;
+import com.usky.modules.service.FollowPersonService;
+import com.usky.modules.service.MqttService;
+import com.usky.modules.service.PersonService;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+@EnableScheduling
+public class MqttScheduler {
+    private final FollowPersonService followPersonService;
+    @Value("${myconfig.webDomainHttpPort}")
+    private String webDomainPort;
+    @Value("${myconfig.webDomainHttpsPort}")
+    private String webDomainHttpsPort;
+    private final PersonService personService;
+    private final MqttService mqttService;
+    private final PicMapper picMapper;
+    private final ConfigCacheListener configCache;
+
+    @Scheduled(
+            fixedRate = 60000L
+    )
+    public void sendWhitePerson() {
+        List<Person> list = this.personService.list();
+
+        for(Person person : list) {
+            WhitePersonInfo info = new WhitePersonInfo();
+            info.setCount(list.size());
+            info.setName(person.getName());
+            info.setNo(list.indexOf(person) + 1);
+            info.setCertifiedType(person.getCredentialType());
+            info.setCertifiedNo(person.getCredentialNo());
+            info.setPersonType(person.getPersonTypeCode());
+            info.setPersonCode(person.getPersonCode());
+            Pic pic = (Pic)this.picMapper.selectById(person.getPicId());
+            if (pic != null) {
+                String protocol = this.configCache.getConfig("protocol");
+                if (protocol.equals("http://")) {
+                    info.setUrl(protocol + this.configCache.getConfig("host") + ":" + this.webDomainPort + pic.getUrl());
+                } else {
+                    info.setUrl(protocol + this.configCache.getConfig("host") + ":" + this.webDomainHttpsPort + pic.getUrl());
+                }
+            }
+
+            this.mqttService.publish("person/whitelist/" + (person.getPersonTypeCode() == null ? "1" : person.getPersonTypeCode()), JSON.toJSONString(info, SerializerFeature.WRITE_MAP_NULL_FEATURES, new SerializerFeature[]{SerializerFeature.WriteDateUseDateFormat, SerializerFeature.QuoteFieldNames, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty}));
+        }
+
+    }
+
+    @Scheduled(
+            fixedRate = 60000L
+    )
+    public void sendBlackPerson() {
+        List<FollowPerson> list = this.followPersonService.list();
+
+        for(FollowPerson followPerson : list) {
+            BlackPersonInfo info = new BlackPersonInfo();
+            info.setCount(list.size());
+            info.setNotify(true);
+            info.setPersonCode(followPerson.getPersonCode());
+            info.setNo(list.indexOf(followPerson) + 1);
+            info.setNote(followPerson.getName());
+            info.setPersonType(followPerson.getFollowPeopleType());
+            info.setDateTime(followPerson.getUpdateTime());
+            Pic pic = (Pic)this.picMapper.selectById(followPerson.getPicId());
+            if (pic != null) {
+                String protocol = this.configCache.getConfig("protocol");
+                if (protocol.equals("http://")) {
+                    info.setUrl(protocol + this.configCache.getConfig("host") + ":" + this.webDomainPort + pic.getUrl());
+                } else {
+                    info.setUrl(protocol + this.configCache.getConfig("host") + ":" + this.webDomainHttpsPort + pic.getUrl());
+                }
+            }
+
+            this.mqttService.publish("person/blacklist/" + (followPerson.getFollowPeopleType() == null ? "1" : String.valueOf(followPerson.getFollowPeopleType())), JSON.toJSONString(info, SerializerFeature.WRITE_MAP_NULL_FEATURES, new SerializerFeature[]{SerializerFeature.QuoteFieldNames, SerializerFeature.WriteDateUseDateFormat, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty}));
+        }
+
+    }
+
+    public MqttScheduler(final FollowPersonService followPersonService, final PersonService personService, final MqttService mqttService, final PicMapper picMapper, final ConfigCacheListener configCache) {
+        this.followPersonService = followPersonService;
+        this.personService = personService;
+        this.mqttService = mqttService;
+        this.picMapper = picMapper;
+        this.configCache = configCache;
+    }
+}

+ 113 - 0
src/main/java/com/usky/common/mqtt/MqttThread.java

@@ -0,0 +1,113 @@
+package com.usky.common.mqtt;
+
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.modules.service.MqttService;
+import com.usky.modules.service.SystemInfoService;
+import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
+import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
+import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.eclipse.paho.client.mqttv3.MqttException;
+import org.eclipse.paho.client.mqttv3.MqttMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MqttThread extends Thread implements InitializingBean {
+    private static final Logger log = LoggerFactory.getLogger(MqttThread.class);
+    @Value("${mqtt.host}")
+    private String host;
+    @Value("${mqtt.clientid}")
+    private String clientId;
+    @Autowired
+    private MqttService mqttService;
+    @Autowired
+    private MqttClientHolder mqttClientHolder;
+    @Autowired
+    private SystemInfoService systemInfoService;
+    @Autowired
+    private ConfigCacheListener listener;
+
+    public MqttThread() {
+    }
+
+    public void run() {
+        while(true) {
+            MqttAsyncClient currentClient = this.mqttClientHolder.getMqttClient();
+            if (currentClient == null || !currentClient.isConnected()) {
+                try {
+                    String mqttUsername = this.listener.getConfig("mqttUsername");
+                    String mqttPassword = this.listener.getConfig("mqttPassword");
+                    String id = this.clientId + this.listener.getConfig("clientId");
+                    MqttAsyncClient newClient = new MqttAsyncClient(this.host, id);
+                    log.info("mqtt连接 " + this.host + " " + id);
+                    MqttConnectOptions options = new MqttConnectOptions();
+                    options.setCleanSession(true);
+                    options.setUserName(mqttUsername);
+                    options.setPassword(mqttPassword.toCharArray());
+                    options.setConnectionTimeout(10);
+                    options.setKeepAliveInterval(60);
+                    options.setAutomaticReconnect(true);
+                    newClient.connect(options);
+                    newClient.setCallback(new MqttCallbackExtended() {
+                        public void connectComplete(boolean reconnect, String serverURI) {
+                            MqttThread.this.mqttClientHolder.setRealConnected(true);
+                        }
+
+                        public void connectionLost(Throwable cause) {
+                            MqttThread.this.mqttClientHolder.setRealConnected(false);
+                        }
+
+                        public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
+                        }
+
+                        public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
+                        }
+                    });
+                    if (currentClient != null) {
+                        try {
+                            if (currentClient.isConnected()) {
+                                currentClient.disconnect();
+                            }
+
+                            currentClient.close();
+                        } catch (MqttException e) {
+                            log.error("关闭旧客户端失败", e);
+                        }
+                    }
+
+                    this.mqttClientHolder.setMqttClient(newClient);
+                    log.info("MQTT连接成功");
+                } catch (Exception e) {
+                    log.error("MQTT连接失败: {}", e.getMessage());
+                    if (this.mqttClientHolder.getMqttClient() != null) {
+                        try {
+                            this.mqttClientHolder.getMqttClient().close();
+                        } catch (MqttException ex) {
+                            log.error("关闭无效客户端失败", ex);
+                        }
+
+                        this.mqttClientHolder.setMqttClient((MqttAsyncClient)null);
+                    }
+                }
+            }
+
+            try {
+                Thread.sleep(5000L);
+            } catch (InterruptedException e) {
+                log.warn("MQTT监控线程被中断");
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public void afterPropertiesSet() {
+        this.setDaemon(true);
+        this.setName("MQTT-Connection-Thread");
+        this.start();
+    }
+}

+ 69 - 0
src/main/java/com/usky/common/utils/AESUtil.java

@@ -0,0 +1,69 @@
+package com.usky.common.utils;
+
+import java.util.Base64;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+public class AESUtil {
+    public AESUtil() {
+    }
+
+    public static String Encrypt(String sSrc, String sKey) throws Exception {
+        if (sKey == null) {
+            System.out.print("Key为空null");
+            return null;
+        } else if (sKey.getBytes().length != 16) {
+            System.out.print("Key长度不是16位");
+            return null;
+        } else {
+            byte[] raw = sKey.getBytes("utf-8");
+            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+            cipher.init(1, skeySpec);
+            byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
+            return Base64.getEncoder().encodeToString(encrypted);
+        }
+    }
+
+    public static String Decrypt(String sSrc, String sKey) throws Exception {
+        try {
+            if (sKey == null) {
+                System.out.print("Key为空null");
+                return null;
+            } else if (sKey.getBytes().length != 16) {
+                System.out.print("Key长度不是16位");
+                return null;
+            } else {
+                byte[] raw = sKey.getBytes("utf-8");
+                SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+                Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+                cipher.init(2, skeySpec);
+                byte[] encrypted1 = Base64.getDecoder().decode(sSrc);
+
+                try {
+                    byte[] original = cipher.doFinal(encrypted1);
+                    String originalString = new String(original, "utf-8");
+                    return originalString;
+                } catch (Exception e) {
+                    System.out.println(e.toString());
+                    return null;
+                }
+            }
+        } catch (Exception ex) {
+            System.out.println(ex.toString());
+            return null;
+        }
+    }
+
+    public static void main(String[] args) {
+        try {
+            String str = Encrypt("{\"oid\":\"JB20181108000011\"}", "be109626afae4381");
+            System.out.println("加密后字符串为:" + str);
+            str = Decrypt(str, "be109626afae4381");
+            System.out.println("解密后字符串为:" + str);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+}

+ 31 - 0
src/main/java/com/usky/common/utils/Assert.java

@@ -0,0 +1,31 @@
+package com.usky.common.utils;
+
+import com.usky.common.exception.DefenceException;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Assert {
+    private static final Logger log = LoggerFactory.getLogger(Assert.class);
+
+    public Assert() {
+    }
+
+    public static void isBlank(String str, String errorMessage) {
+        if (StringUtils.isBlank(str)) {
+            throw new DefenceException(errorMessage, 500);
+        }
+    }
+
+    public static void isNull(Object object, String errorMessage) {
+        if (object == null) {
+            throw new DefenceException(errorMessage, 500);
+        }
+    }
+
+    public static void isClaimsNull(Object object) {
+        if (object == null) {
+            throw new DefenceException("登录过期,请重新登录", 401);
+        }
+    }
+}

+ 37 - 0
src/main/java/com/usky/common/utils/DESUtils.java

@@ -0,0 +1,37 @@
+package com.usky.common.utils;
+
+import cn.hutool.crypto.SecureUtil;
+import cn.hutool.crypto.symmetric.DES;
+
+public class DESUtils {
+    private static final String DEFAULT_KEY = "12345678";
+
+    public DESUtils() {
+    }
+
+    public static String encrypt(String data) {
+        return encrypt(data, "12345678");
+    }
+
+    public static String encrypt(String data, String key) {
+        if (key == null) {
+            throw new IllegalArgumentException("必须提供DES密钥");
+        } else {
+            DES des = SecureUtil.des(key.getBytes());
+            return des.encryptBase64(data);
+        }
+    }
+
+    public static String decrypt(String encryptedData) {
+        return decrypt(encryptedData, "12345678");
+    }
+
+    public static String decrypt(String encryptedData, String key) {
+        if (key == null) {
+            throw new IllegalArgumentException("必须提供DES密钥");
+        } else {
+            DES des = SecureUtil.des(key.getBytes());
+            return des.decryptStr(encryptedData);
+        }
+    }
+}

+ 49 - 0
src/main/java/com/usky/common/utils/DateUtils.java

@@ -0,0 +1,49 @@
+package com.usky.common.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class DateUtils {
+    public DateUtils() {
+    }
+
+    public static String timeStamp2Date(String seconds, String format) {
+        if (seconds != null && !seconds.isEmpty() && !seconds.equals("null")) {
+            if (format == null || format.isEmpty()) {
+                format = "yyyy-MM-dd HH:mm:ss";
+            }
+
+            SimpleDateFormat sdf = new SimpleDateFormat(format);
+            return sdf.format(new Date(Long.valueOf(seconds + "000")));
+        } else {
+            return "";
+        }
+    }
+
+    public static Integer date2TimeStamp(String date_str, String format) {
+        try {
+            if (format == null || format.isEmpty()) {
+                format = "yyyy-MM-dd HH:mm:ss";
+            }
+
+            SimpleDateFormat sdf = new SimpleDateFormat(format);
+            return (int)(sdf.parse(date_str).getTime() / 1000L);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    public static Integer timeStamp() {
+        long time = System.currentTimeMillis();
+        return Integer.parseInt(String.valueOf(time / 1000L));
+    }
+
+    public static Date calculateExpirationDate(int expirationDays) {
+        long currentTimeMillis = System.currentTimeMillis();
+        long millisPerDay = 86400000L;
+        long expirationMillis = (long)expirationDays * millisPerDay;
+        long expirationDateMillis = currentTimeMillis + expirationMillis;
+        return new Date(expirationDateMillis);
+    }
+}

+ 171 - 0
src/main/java/com/usky/common/utils/FileUploadUtils.java

@@ -0,0 +1,171 @@
+package com.usky.common.utils;
+
+import com.usky.common.exception.DefenceException;
+import com.usky.common.vo.FileVO;
+import java.io.File;
+import java.net.InetAddress;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+@Service
+public class FileUploadUtils {
+    private static final Logger log = LoggerFactory.getLogger(FileUploadUtils.class);
+    @Value("${myconfig.filePath}")
+    private String filePath;
+    @Value("${streamServerConfig.protocol}")
+    private String protocol;
+    @Value("${myconfig.webDomainHttpPort}")
+    private String webDomainPort;
+
+    public FileUploadUtils() {
+    }
+
+    public List fileUpload(List<MultipartFile> files, int type) {
+        String domain = this.protocol + "://" + GetIpUtil.getServerIP() + ":" + this.webDomainPort + "/";
+        InetAddress address = null;
+
+        try {
+            address = InetAddress.getLocalHost();
+        } catch (Exception var12) {
+            address.getHostAddress();
+        }
+
+        List list = new ArrayList();
+
+        for(MultipartFile file : files) {
+            String fileName;
+            if (type == 1) {
+                fileName = "construction/" + (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new Date()) + ((new Random()).nextInt(9000) % 8001 + 1000) + "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
+            } else if (type == 2) {
+                fileName = "capture/" + (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new Date()) + ((new Random()).nextInt(9000) % 8001 + 1000) + "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
+            } else {
+                fileName = "userAvatar/" + (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new Date()) + ((new Random()).nextInt(9000) % 8001 + 1000) + "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
+            }
+
+            if (file.isEmpty()) {
+                throw new DefenceException("文件上传失败");
+            }
+
+            File dest = new File(this.filePath + fileName);
+            if (!dest.getParentFile().exists()) {
+                dest.getParentFile().mkdir();
+            }
+
+            try {
+                file.transferTo(dest);
+                FileVO fileList = new FileVO();
+                fileList.setName(file.getOriginalFilename());
+                fileList.setUrl(domain + fileName);
+                list.add(fileList);
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new DefenceException("文件上传失败");
+            }
+        }
+
+        return list;
+    }
+
+    public FileVO fileUpload(MultipartFile file, String path, Integer width, Integer height) {
+        String domain = this.protocol + "://" + GetIpUtil.getServerIP() + ":" + this.webDomainPort + "/";
+        Path paths = Paths.get(this.filePath);
+        String s = paths.getFileName().toString();
+        InetAddress address = null;
+
+        try {
+            address = InetAddress.getLocalHost();
+        } catch (Exception var15) {
+            address.getHostAddress();
+        }
+
+        FileVO fileVO = new FileVO();
+
+        try {
+            file = ImageUtils.compress(file, width, height);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        String fileName = path + "/" + (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new Date()) + ((new Random()).nextInt(9000) % 8001 + 1000) + ".jpg";
+        if (file.isEmpty()) {
+            throw new DefenceException("文件上传失败");
+        } else {
+            File dest = new File(this.filePath + File.separator + fileName);
+            if (!dest.getParentFile().exists()) {
+                dest.getParentFile().mkdir();
+            }
+
+            try {
+                file.transferTo(dest);
+                fileVO.setHttp(domain);
+                fileVO.setMappingPath("/" + s + "/" + fileName);
+                fileVO.setName(file.getOriginalFilename());
+                fileVO.setUrl("/" + s + "/" + fileName);
+                fileVO.setPath(this.filePath + fileName);
+                return fileVO;
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new DefenceException("文件上传失败");
+            }
+        }
+    }
+
+    public List<FileVO> fileUpload(List<MultipartFile> files, String path, Integer width, Integer height) {
+        String domain = this.protocol + "://" + GetIpUtil.getServerIP() + ":" + this.webDomainPort + "/";
+        Path paths = Paths.get(this.filePath);
+        String s = paths.getFileName().toString();
+        InetAddress address = null;
+
+        try {
+            address = InetAddress.getLocalHost();
+        } catch (Exception var17) {
+            address.getHostAddress();
+        }
+
+        List<FileVO> list = new ArrayList();
+
+        for(MultipartFile file : files) {
+            try {
+                file = ImageUtils.compress(file, width, height);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            String fileName = path + "/" + (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new Date()) + ((new Random()).nextInt(9000) % 8001 + 1000) + ".jpg";
+            if (file.isEmpty()) {
+                throw new DefenceException("文件上传失败");
+            }
+
+            File dest = new File(this.filePath + File.separator + fileName);
+            if (!dest.getParentFile().exists()) {
+                dest.getParentFile().mkdir();
+            }
+
+            try {
+                file.transferTo(dest);
+                FileVO fileList = new FileVO();
+                fileList.setHttp(domain);
+                fileList.setMappingPath("/" + s + "/" + fileName);
+                fileList.setName(file.getOriginalFilename());
+                fileList.setUrl("/" + s + "/" + fileName);
+                fileList.setPath(this.filePath + fileName);
+                list.add(fileList);
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new DefenceException("文件上传失败");
+            }
+        }
+
+        return list;
+    }
+}

+ 114 - 0
src/main/java/com/usky/common/utils/GetIpUtil.java

@@ -0,0 +1,114 @@
+package com.usky.common.utils;
+
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.List;
+
+public class GetIpUtil {
+    public GetIpUtil() {
+    }
+
+    public static String getServerIP() {
+        try {
+            List<NetworkInterface> networkInterfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
+            networkInterfaces.sort(Comparator.comparing(NetworkInterface::getName));
+
+            for(NetworkInterface iface : networkInterfaces) {
+                if (!iface.isLoopback() && iface.isUp() && !iface.isVirtual()) {
+                    String ifaceName = iface.getName();
+                    if (ifaceName.startsWith("enp")) {
+                        for(InetAddress addr : Collections.list(iface.getInetAddresses())) {
+                            if (!addr.isLoopbackAddress() && !addr.getHostAddress().contains(":")) {
+                                return addr.getHostAddress();
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return "";
+    }
+
+    public static String getIpAddress() {
+        if (OsSelect.isLinux()) {
+            for(int i = 1; i <= 500; ++i) {
+                String interfaceName = "enp" + i + "s0";
+                String ipAddress = getIpAddress(interfaceName);
+                if (!ipAddress.isEmpty()) {
+                    return ipAddress;
+                }
+            }
+
+            return "";
+        } else {
+            try {
+                Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces();
+                InetAddress ip = null;
+
+                while(allNetInterfaces.hasMoreElements()) {
+                    NetworkInterface netInterface = (NetworkInterface)allNetInterfaces.nextElement();
+                    if (!netInterface.isLoopback() && !netInterface.isVirtual() && netInterface.isUp()) {
+                        Enumeration<InetAddress> addresses = netInterface.getInetAddresses();
+
+                        while(addresses.hasMoreElements()) {
+                            ip = (InetAddress)addresses.nextElement();
+                            if (ip != null && ip instanceof Inet4Address) {
+                                return ip.getHostAddress();
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                System.err.println("IP地址获取失败" + e.toString());
+            }
+
+            return "";
+        }
+    }
+
+    public static String getIpAddress(String interfaceName) {
+        try {
+            NetworkInterface netInterface = NetworkInterface.getByName(interfaceName);
+            if (netInterface != null && !netInterface.isLoopback() && !netInterface.isVirtual() && netInterface.isUp()) {
+                Enumeration<InetAddress> addresses = netInterface.getInetAddresses();
+
+                while(addresses.hasMoreElements()) {
+                    InetAddress ip = (InetAddress)addresses.nextElement();
+                    if (ip instanceof Inet4Address) {
+                        return ip.getHostAddress();
+                    }
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("指定接口IP地址获取失败: " + e.toString());
+        }
+
+        return "";
+    }
+
+    public static String changeLastSegmentTo1(String ip) {
+        if (ip != null && !ip.isEmpty()) {
+            String[] parts = ip.split("\\.");
+            if (parts.length != 4) {
+                throw new IllegalArgumentException("Invalid IP address format.");
+            } else {
+                parts[3] = "1";
+                return String.join(".", parts);
+            }
+        } else {
+            return ip;
+        }
+    }
+
+    public static void main(String[] args) {
+        String ipAddress = getIpAddress();
+        System.out.println("IP Address: " + ipAddress);
+    }
+}

+ 124 - 0
src/main/java/com/usky/common/utils/HardwareCodeAutoFillUtil.java

@@ -0,0 +1,124 @@
+package com.usky.common.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HardwareCodeAutoFillUtil {
+    private static final Logger log = LoggerFactory.getLogger(HardwareCodeAutoFillUtil.class);
+
+    public HardwareCodeAutoFillUtil() {
+    }
+
+    public static String getLinuxDeviceCode() {
+        String serialNo = "";
+        String macAddr = "";
+        String[] command = new String[]{"/bin/bash", "-c", "udevadm info --query=property --name=/dev/sda | grep ID_SERIAL"};
+
+        try {
+            Process process = (new ProcessBuilder(command)).start();
+
+            // 只定义一次 line
+            String line;
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
+                while((line = reader.readLine()) != null) {
+                    if (line.contains("ID_SERIAL_SHORT=")) {
+                        serialNo = line.split("ID_SERIAL_SHORT=")[1].trim();
+                    }
+                }
+            }
+
+            int exitCode = process.waitFor();
+            if (exitCode != 0) {
+                log.info("getLinuxSad 命令执行失败,错误码: " + exitCode);
+            }
+
+            String[] macCommand = new String[]{"/bin/bash", "-c", "ip -o link show | awk '{print $2, $(NF-2)}'"};
+            Process macProcess = (new ProcessBuilder(macCommand)).start();
+
+            try (BufferedReader macReader = new BufferedReader(new InputStreamReader(macProcess.getInputStream()))) {
+                List<String> interfaces = new ArrayList();
+
+                // 这里删掉重复的 String line;
+                while((line = macReader.readLine()) != null) {
+                    interfaces.add(line.trim());
+                }
+
+                for(int i = 0; i <= 10; ++i) {
+                    String interfacePrefix = "enp" + i;
+
+                    for(String interfaceLine : interfaces) {
+                        if (!interfaceLine.isEmpty()) {
+                            String[] parts = interfaceLine.split("\\s+", 2);
+                            if (parts.length >= 2) {
+                                String interfaceName = parts[0].replace(":", "");
+                                String mac = parts[1].trim();
+                                if (interfaceName.startsWith(interfacePrefix) && !mac.equals("00:00:00:00:00:00") && !mac.isEmpty()) {
+                                    macAddr = mac;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+
+                    if (!macAddr.isEmpty()) {
+                        break;
+                    }
+                }
+            }
+
+            int macExitCode = macProcess.waitFor();
+            if (macExitCode != 0) {
+                log.info("获取MAC地址命令执行失败,错误码: " + macExitCode);
+            }
+        } catch (InterruptedException | IOException e) {
+            e.printStackTrace();
+        }
+
+        String deviceCode = "";
+        if (StringUtils.isNotBlank(serialNo)) {
+            deviceCode = serialNo;
+        }
+
+        if (StringUtils.isNotBlank(macAddr)) {
+            if (deviceCode.isEmpty()) {
+                deviceCode = macAddr;
+            } else {
+                deviceCode = deviceCode + "|" + macAddr;
+            }
+        }
+
+        deviceCode = deviceCode.replaceAll(":", "");
+        log.info("Linux设备唯一码:" + deviceCode);
+        String hashCode = "";
+        if (StringUtils.isNotBlank(deviceCode)) {
+            try {
+                MessageDigest digest = MessageDigest.getInstance("SHA-256");
+                byte[] hashBytes = digest.digest(deviceCode.getBytes(StandardCharsets.UTF_8));
+                StringBuilder hexString = new StringBuilder();
+
+                for(byte b : hashBytes) {
+                    String hex = String.format("%02x", b);
+                    hexString.append(hex);
+                }
+
+                hashCode = hexString.toString();
+            } catch (NoSuchAlgorithmException e) {
+                log.error("SHA-256算法不可用", e);
+            }
+        }
+
+        hashCode = hashCode.toUpperCase();
+        log.info("serialNo : " + serialNo + " macAddr : " + macAddr);
+        log.info("Linux设备哈希唯一码(64位):" + hashCode + " 哈希数据长度 " + hashCode.length());
+        return hashCode;
+    }
+}

+ 108 - 0
src/main/java/com/usky/common/utils/HexEcodeUtil.java

@@ -0,0 +1,108 @@
+package com.usky.common.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Hex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HexEcodeUtil {
+    private static final Logger log = LoggerFactory.getLogger(HexEcodeUtil.class);
+    public static final String HEXMAXSTRING = "0123456789ABCDEF";
+    public static final String HEXMINSTRING = "0123456789abcdef";
+
+    public HexEcodeUtil() {
+    }
+
+    public static String ByteArrayToHexStr(byte[] byteArray) {
+        if (byteArray == null) {
+            return null;
+        } else {
+            char[] hexArray = "0123456789ABCDEF".toCharArray();
+            char[] hexChars = new char[byteArray.length * 2];
+
+            for(int i = 0; i < byteArray.length; ++i) {
+                int temp = byteArray[i] & 255;
+                hexChars[i * 2] = hexArray[temp >>> 4];
+                hexChars[i * 2 + 1] = hexArray[temp & 15];
+            }
+
+            return new String(hexChars);
+        }
+    }
+
+    public static String StrToHexStr(String str) {
+        byte[] bytes = str.getBytes();
+        StringBuilder stringBuilder = new StringBuilder(bytes.length * 2);
+
+        for(int i = 0; i < bytes.length; ++i) {
+            stringBuilder.append("0x");
+            stringBuilder.append("0123456789ABCDEF".charAt((bytes[i] & 240) >> 4));
+            stringBuilder.append("0123456789ABCDEF".charAt((bytes[i] & 15) >> 0));
+            if (i != bytes.length - 1) {
+                stringBuilder.append(",");
+            }
+        }
+
+        return stringBuilder.toString();
+    }
+
+    public static byte[] HexStrToByteArray(String hexStr) {
+        byte[] byteArray = new byte[hexStr.length() / 2];
+
+        for(int i = 0; i < byteArray.length; ++i) {
+            String subStr = hexStr.substring(2 * i, 2 * i + 2);
+            byteArray[i] = (byte)Integer.parseInt(subStr, 16);
+        }
+
+        return byteArray;
+    }
+
+    public static Map<String, String> HexToRead(String info) {
+        HashMap<String, String> hashMap = new HashMap();
+        return hashMap;
+    }
+
+    public static String toStringHex2(String s) {
+        byte[] baKeyword = new byte[s.length() / 2];
+
+        for(int i = 0; i < baKeyword.length; ++i) {
+            try {
+                baKeyword[i] = (byte)(255 & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        try {
+            s = new String(baKeyword, "GB2312");
+        } catch (Exception e1) {
+            e1.printStackTrace();
+        }
+
+        return s;
+    }
+
+    public static byte[] hexItr2Arr(String hexItr) {
+        try {
+            return Hex.decodeHex(hexItr);
+        } catch (DecoderException e) {
+            log.info("16进制字符串转byte异常!");
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static void main(String[] args) {
+        byte[] bytes = hexItr2Arr("010300000002C40B010304012202585B5F");
+
+        try {
+            String s = new String(bytes, "UTF-8");
+            log.info(s);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+}

+ 318 - 0
src/main/java/com/usky/common/utils/HttpClientUtil.java

@@ -0,0 +1,318 @@
+package com.usky.common.utils;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.ParseException;
+import org.apache.http.client.ClientProtocolException;
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpClientUtil {
+    private static final Logger log = LoggerFactory.getLogger(HttpClientUtil.class);
+
+    public HttpClientUtil() {
+    }
+
+    public static String doGet(String url, Map<String, String> param) {
+        log.info("doGet url=" + url);
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        String resultString = "";
+        CloseableHttpResponse response = null;
+
+        try {
+            URIBuilder builder = new URIBuilder(url);
+            if (param != null) {
+                for(String key : param.keySet()) {
+                    builder.addParameter(key, (String)param.get(key));
+                }
+            }
+
+            URI uri = builder.build();
+            HttpGet httpGet = new HttpGet(uri);
+            response = httpclient.execute(httpGet);
+            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 doGetTokenKey(String url, Map<String, String> param, String token) {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        String resultString = "";
+        CloseableHttpResponse response = null;
+
+        try {
+            URIBuilder builder = new URIBuilder(url);
+            if (param != null) {
+                for(String key : param.keySet()) {
+                    builder.addParameter(key, (String)param.get(key));
+                }
+            }
+
+            URI uri = builder.build();
+            HttpGet httpGet = new HttpGet(uri);
+            httpGet.setHeader("token", token);
+            response = httpclient.execute(httpGet);
+            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, (Map)null);
+    }
+
+    public static String doPost(String url, Map<String, String> param) {
+        log.info("doPost url=" + url);
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+
+        try {
+            HttpPost httpPost = new HttpPost(url);
+            if (param != null) {
+                List<NameValuePair> paramList = new ArrayList();
+
+                for(String key : param.keySet()) {
+                    paramList.add(new BasicNameValuePair(key, (String)param.get(key)));
+                }
+
+                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList, "UTF-8");
+                httpPost.setEntity(entity);
+            }
+
+            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 doPostM(String url, Map<String, String> param, Map<String, String> imgList) {
+        log.info("doPostM url=" + url);
+        String resultString = "";
+        String bd = "--------------------------yeylqifengdianziyeyl";
+
+        try {
+            URL url1 = new URL(url);
+            HttpURLConnection conn = (HttpURLConnection)url1.openConnection();
+            conn.setConnectTimeout(3000);
+            conn.setReadTimeout(3000);
+            conn.setDoInput(true);
+            conn.setDoOutput(true);
+            conn.setUseCaches(false);
+            conn.setRequestMethod("POST");
+            conn.setRequestProperty("CHarset", "UTF-8");
+            conn.setRequestProperty("connection", "Keep-alive");
+            conn.setRequestProperty("content-type", "multipart/form-data;boundary=" + bd);
+            DataOutputStream outputStream = new DataOutputStream(conn.getOutputStream());
+
+            for(String key : param.keySet()) {
+                String boundaryStr = "--" + bd + "\r\n";
+                outputStream.write(boundaryStr.getBytes());
+                String contentDispositionStr = String.format("Content-Disposition: form-data; name=\"%s\"", key) + "\r\n\r\n";
+                outputStream.write(contentDispositionStr.getBytes());
+                String valueStr = (String)param.get(key) + "\r\n";
+                outputStream.write(valueStr.getBytes());
+            }
+
+            if (imgList != null) {
+                for(String key : imgList.keySet()) {
+                    log.info("imgList " + key + "=" + (String)imgList.get(key));
+
+                    try {
+                        URL httpUrl = new URL((String)imgList.get(key));
+                        HttpURLConnection conn1 = (HttpURLConnection)httpUrl.openConnection();
+                        conn1.setRequestMethod("GET");
+                        conn1.setConnectTimeout(10000);
+                        conn1.setReadTimeout(10000);
+                        conn1.setDoInput(true);
+                        conn1.setDoOutput(true);
+                        conn1.setUseCaches(false);
+                        conn1.setRequestProperty("CHarset", "UTF-8");
+                        conn1.setRequestProperty("connection", "Keep-alive");
+                        conn1.connect();
+                        InputStream inputStream = conn1.getInputStream();
+                        DataInputStream in1 = new DataInputStream(inputStream);
+                        String boundaryStr = "--" + bd + "\r\n";
+                        outputStream.write(boundaryStr.getBytes());
+                        String contentDispositionStr = String.format("Content-Disposition: form-data; name=\"pic_EN0000000001\"; filename=\"%s\"; content-type:image/jpeg", key) + "\r\n\r\n";
+                        outputStream.write(contentDispositionStr.getBytes());
+                        int bytes = 0;
+                        byte[] bufferOut = new byte[1024];
+
+                        while((bytes = in1.read(bufferOut)) != -1) {
+                            outputStream.write(bufferOut, 0, bytes);
+                        }
+
+                        in1.close();
+                        outputStream.write("\r\n".getBytes());
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                        log.info("doPostM Get IMG e=" + e.getMessage());
+                    }
+                }
+            }
+
+            String endStr = "--" + bd + "--\r\n";
+            outputStream.write(endStr.getBytes());
+            outputStream.flush();
+            BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            StringBuilder responseContent = new StringBuilder();
+
+            String line;
+            while((line = reader.readLine()) != null) {
+                responseContent.append(line);
+            }
+
+            log.info("responseContent=" + responseContent);
+            resultString = responseContent.toString();
+        } catch (IOException e) {
+            e.printStackTrace();
+            log.info("doPostM e=" + e.getMessage());
+        }
+
+        return resultString;
+    }
+
+    public static String doPost(String url) {
+        return doPost(url, (Map)null);
+    }
+
+    public static String doPostJson(String url, String json) {
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+
+        try {
+            HttpPost httpPost = new HttpPost(url);
+            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
+            httpPost.setEntity(entity);
+            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 byte[] doImgPost(String url, String json) {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        byte[] fileBytes = null;
+
+        try {
+            HttpPost httpPost = new HttpPost(url);
+            StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
+            httpPost.setEntity(entity);
+            CloseableHttpResponse response = httpclient.execute(httpPost);
+
+            try {
+                HttpEntity httpEntity = response.getEntity();
+                InputStream inputContent = httpEntity.getContent();
+                fileBytes = input2byte(inputContent);
+            } finally {
+                response.close();
+            }
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+        }
+
+        return fileBytes;
+    }
+
+    public static final byte[] input2byte(InputStream inStream) throws IOException {
+        ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
+        byte[] buff = new byte[100];
+        int rc = 0;
+
+        while((rc = inStream.read(buff, 0, 100)) > 0) {
+            swapStream.write(buff, 0, rc);
+        }
+
+        byte[] in2b = swapStream.toByteArray();
+        return in2b;
+    }
+}

+ 111 - 0
src/main/java/com/usky/common/utils/HttpSendUtil.java

@@ -0,0 +1,111 @@
+package com.usky.common.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpSendUtil {
+    private static final Logger log = LoggerFactory.getLogger(HttpSendUtil.class);
+
+    public HttpSendUtil() {
+    }
+
+    public static String sendRequest(String urlString, int method) {
+        HttpURLConnection connection = null;
+        BufferedReader reader = null;
+
+        String var43;
+        try {
+            URL url = new URL(urlString);
+            connection = (HttpURLConnection)url.openConnection();
+            connection.setConnectTimeout(7000);
+            connection.setReadTimeout(7000);
+            connection.setRequestMethod(method == 1 ? "GET" : "POST");
+            if (method == 2) {
+                connection.setDoOutput(true);
+                connection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
+                String jsonInput = "{}";
+                OutputStream os = connection.getOutputStream();
+                Throwable line = null;
+
+                try {
+                    byte[] input = jsonInput.getBytes("utf-8");
+                    os.write(input, 0, input.length);
+                } catch (Throwable var32) {
+                    Throwable input = var32;
+                    line = var32;
+                    throw var32;
+                } finally {
+                    if (os != null) {
+                        if (line != null) {
+                            try {
+                                os.close();
+                            } catch (Throwable var31) {
+                                line.addSuppressed(var31);
+                            }
+                        } else {
+                            os.close();
+                        }
+                    }
+
+                }
+
+                log.info("发送的请求体内容: " + jsonInput);
+            }
+
+            int responseCode = connection.getResponseCode();
+            log.info("请求响应码:" + responseCode);
+            if (responseCode != 200) {
+                log.info("请求json code 异常:{}" + urlString + " : {}" + responseCode);
+                reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "utf-8"));
+                StringBuilder response = new StringBuilder();
+
+                String line;
+                while((line = reader.readLine()) != null) {
+                    response.append(line);
+                }
+
+                log.info("请求json code 响应:{}" + urlString + " : {}" + response.toString());
+                var43 = null;
+                return var43;
+            }
+
+            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
+            StringBuilder response = new StringBuilder();
+
+            String line;
+            while((line = reader.readLine()) != null) {
+                response.append(line);
+            }
+
+            log.info("请求json 正常的 响应:{}" + urlString + " : {}" + response.toString());
+            var43 = response.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.info("请求Exception异常:" + urlString + " : {}" + e.getMessage());
+            log.info("请求Exception异常:" + urlString + " : {}" + e.getMessage());
+            Object responseCode = null;
+            return (String)responseCode;
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            if (connection != null) {
+                connection.disconnect();
+            }
+
+        }
+
+        return var43;
+    }
+}

+ 31 - 0
src/main/java/com/usky/common/utils/HttpUrl.java

@@ -0,0 +1,31 @@
+package com.usky.common.utils;
+
+import javax.servlet.http.HttpServletRequest;
+import jodd.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+@Component
+public class HttpUrl {
+    public HttpUrl() {
+    }
+
+    public String getBaseUrl(HttpServletRequest request, String domain) {
+        String scheme = request.getScheme();
+        String serverName = request.getServerName();
+        int serverPort = request.getServerPort();
+        String contextPath = request.getContextPath();
+        String requestURL = request.getRequestURL().toString();
+        System.out.println("requestURL " + requestURL);
+        String baseUrl;
+        if ((!scheme.equals("http") || serverPort != 80) && (!scheme.equals("https") || serverPort != 443)) {
+            baseUrl = String.format("%s://%s:%d%s", scheme, serverName, serverPort, contextPath);
+        } else {
+            baseUrl = String.format("%s://%s%s", scheme, serverName, contextPath);
+        }
+
+        if ((!StringUtil.isNotBlank(baseUrl) || !baseUrl.contains("localhost")) && !baseUrl.contains("127.0.0.1")) {
+        }
+
+        return domain;
+    }
+}

+ 32 - 0
src/main/java/com/usky/common/utils/IdCardUtils.java

@@ -0,0 +1,32 @@
+package com.usky.common.utils;
+
+public class IdCardUtils {
+    public IdCardUtils() {
+    }
+
+    public static String mask(String idCard) {
+        return mask(idCard, 6, 4);
+    }
+
+    public static String mask(String idCard, int prefixLen, int suffixLen) {
+        if (idCard == null) {
+            return null;
+        } else {
+            int totalLen = idCard.length();
+            int maskLen = totalLen - prefixLen - suffixLen;
+            if (maskLen <= 0) {
+                return idCard;
+            } else {
+                StringBuilder masked = new StringBuilder();
+                masked.append(idCard.substring(0, prefixLen));
+
+                for(int i = 0; i < maskLen; ++i) {
+                    masked.append('*');
+                }
+
+                masked.append(idCard.substring(totalLen - suffixLen));
+                return masked.toString();
+            }
+        }
+    }
+}

+ 18 - 0
src/main/java/com/usky/common/utils/ImageUtils.java

@@ -0,0 +1,18 @@
+package com.usky.common.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import net.coobird.thumbnailator.Thumbnails;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.web.multipart.MultipartFile;
+
+public class ImageUtils {
+    public ImageUtils() {
+    }
+
+    public static MultipartFile compress(MultipartFile file, int width, int height) throws Exception {
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        Thumbnails.of(new InputStream[]{file.getInputStream()}).size(width, height).keepAspectRatio(true).outputFormat("jpg").toOutputStream(outputStream);
+        return new MockMultipartFile(file.getName(), file.getOriginalFilename(), "image/jpeg", outputStream.toByteArray());
+    }
+}

+ 57 - 0
src/main/java/com/usky/common/utils/IpUtils.java

@@ -0,0 +1,57 @@
+package com.usky.common.utils;
+
+import java.util.Optional;
+import javax.servlet.http.HttpServletRequest;
+
+public class IpUtils {
+    public IpUtils() {
+    }
+
+    public static String getClientIp(HttpServletRequest request) {
+        return (String)Optional.ofNullable(request).map((req) -> {
+            String ip = req.getHeader("X-Real-IP");
+            if (isValidIp(ip)) {
+                return ip;
+            } else {
+                ip = req.getHeader("X-Forwarded-For");
+                if (isValidIp(ip)) {
+                    return extractPrimaryIp(ip);
+                } else {
+                    ip = req.getHeader("Proxy-Client-IP");
+                    if (isValidIp(ip)) {
+                        return ip;
+                    } else {
+                        ip = req.getHeader("WL-Proxy-Client-IP");
+                        if (isValidIp(ip)) {
+                            return ip;
+                        } else {
+                            ip = req.getRemoteAddr();
+                            return isValidIp(ip) ? ip : "";
+                        }
+                    }
+                }
+            }
+        }).orElse("");
+    }
+
+    private static boolean isValidIp(String ip) {
+        return ip != null && !ip.isEmpty() && !"unknown".equalsIgnoreCase(ip) && !"0:0:0:0:0:0:0:1".equals(ip);
+    }
+
+    private static String extractPrimaryIp(String ipHeader) {
+        if (ipHeader == null) {
+            return null;
+        } else {
+            String[] ips = ipHeader.split(",");
+
+            for(String ip : ips) {
+                String trimmed = ip.trim();
+                if (isValidIp(trimmed)) {
+                    return trimmed;
+                }
+            }
+
+            return null;
+        }
+    }
+}

+ 170 - 0
src/main/java/com/usky/common/utils/JwtUtils.java

@@ -0,0 +1,170 @@
+package com.usky.common.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.usky.common.exception.DefenceException;
+import com.usky.common.vo.TokenVo;
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import java.util.Date;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(
+        prefix = "fjkj.jwt"
+)
+public class JwtUtils {
+    private static final Logger log = LoggerFactory.getLogger(JwtUtils.class);
+    private String secret;
+    private long expire;
+    private String header;
+
+    public String generateToken(String str, String roles) {
+        Date nowDate = new Date();
+        Date expireDate = new Date(nowDate.getTime() + this.expire * 1000L);
+        return Jwts.builder().setHeaderParam("typ", "JWT").setSubject(str).setIssuedAt(nowDate).setExpiration(expireDate).signWith(SignatureAlgorithm.HS512, this.secret).claim("roles", roles).compact();
+    }
+
+    public Claims getClaimByToken(String token) {
+        try {
+            return (Claims)Jwts.parser().setSigningKey(this.secret).parseClaimsJws(token).getBody();
+        } catch (Exception e) {
+            log.debug("validate is token error ", e);
+            throw new DefenceException("token错误", 401);
+        }
+    }
+
+    public boolean isTokenExpired(Date expiration) {
+        return expiration.before(new Date());
+    }
+
+    public Long checkToken(String token) {
+        Assert.isNull(token, "密钥不能为空");
+        Claims claims = this.getClaimByToken(token);
+        Assert.isClaimsNull(claims);
+        if (this.isTokenExpired(claims.getExpiration())) {
+            throw new DefenceException("token过期", 401);
+        } else {
+            TokenVo tokenVo = (TokenVo)JSON.parseObject(claims.getSubject(), TokenVo.class);
+            return tokenVo.getId();
+        }
+    }
+
+    public TokenVo parseToken(String token) {
+        Assert.isBlank(token, "token不能为空");
+        Claims claims = this.getClaimByToken(token);
+        Assert.isClaimsNull(claims);
+        if (this.isTokenExpired(claims.getExpiration())) {
+            throw new DefenceException("令牌过期", 401);
+        } else {
+            return (TokenVo)JSON.parseObject(claims.getSubject(), TokenVo.class);
+        }
+    }
+
+    public TokenVo parseTokenSocket(String token) {
+        Assert.isBlank(token, "token不能为空");
+        Claims claims = this.getClaimByToken(token);
+        Assert.isClaimsNull(claims);
+        return this.isTokenExpired(claims.getExpiration()) ? null : (TokenVo)JSON.parseObject(claims.getSubject(), TokenVo.class);
+    }
+
+    public TokenVo parseToken(String token, String type) {
+        Assert.isBlank(token, "token不能为空");
+        Claims claims = this.getClaimByToken(token);
+        Assert.isClaimsNull(claims);
+        if (this.isTokenExpired(claims.getExpiration())) {
+            throw new DefenceException("令牌过期", 401);
+        } else {
+            return (TokenVo)JSON.parseObject(claims.getSubject(), TokenVo.class);
+        }
+    }
+
+    public JwtUtils() {
+    }
+
+    public String getSecret() {
+        return this.secret;
+    }
+
+    public long getExpire() {
+        return this.expire;
+    }
+
+    public String getHeader() {
+        return this.header;
+    }
+
+    public void setSecret(final String secret) {
+        this.secret = secret;
+    }
+
+    public void setExpire(final long expire) {
+        this.expire = expire;
+    }
+
+    public void setHeader(final String header) {
+        this.header = header;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof JwtUtils)) {
+            return false;
+        } else {
+            JwtUtils other = (JwtUtils)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$secret = this.getSecret();
+                Object other$secret = other.getSecret();
+                if (this$secret == null) {
+                    if (other$secret != null) {
+                        return false;
+                    }
+                } else if (!this$secret.equals(other$secret)) {
+                    return false;
+                }
+
+                if (this.getExpire() != other.getExpire()) {
+                    return false;
+                } else {
+                    Object this$header = this.getHeader();
+                    Object other$header = other.getHeader();
+                    if (this$header == null) {
+                        if (other$header != null) {
+                            return false;
+                        }
+                    } else if (!this$header.equals(other$header)) {
+                        return false;
+                    }
+
+                    return true;
+                }
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof JwtUtils;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $secret = this.getSecret();
+        result = result * 59 + ($secret == null ? 43 : $secret.hashCode());
+        long $expire = this.getExpire();
+        result = result * 59 + (int)($expire >>> 32 ^ $expire);
+        Object $header = this.getHeader();
+        result = result * 59 + ($header == null ? 43 : $header.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "JwtUtils(secret=" + this.getSecret() + ", expire=" + this.getExpire() + ", header=" + this.getHeader() + ")";
+    }
+}

+ 6 - 0
src/main/java/com/usky/common/utils/KeyValidUtils.java

@@ -0,0 +1,6 @@
+package com.usky.common.utils;
+
+public class KeyValidUtils {
+    public KeyValidUtils() {
+    }
+}

+ 27 - 0
src/main/java/com/usky/common/utils/MD5Util.java

@@ -0,0 +1,27 @@
+package com.usky.common.utils;
+
+import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class MD5Util {
+    public MD5Util() {
+    }
+
+    public static String getMD5(String input) {
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] messageDigest = md.digest(input.getBytes(StandardCharsets.UTF_8));
+            BigInteger no = new BigInteger(1, messageDigest);
+
+            String hashtext;
+            for(hashtext = no.toString(16); hashtext.length() < 32; hashtext = "0" + hashtext) {
+            }
+
+            return hashtext;
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 103 - 0
src/main/java/com/usky/common/utils/MultipartFileUtils.java

@@ -0,0 +1,103 @@
+package com.usky.common.utils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.servlet.http.Part;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+public class MultipartFileUtils {
+    private static final Logger log = LoggerFactory.getLogger(MultipartFileUtils.class);
+
+    public MultipartFileUtils() {
+    }
+
+    public static MultipartFile handleImageUpload(MultipartHttpServletRequest request, String fieldName) {
+        try {
+            for(Part part : request.getParts()) {
+                if (fieldName.equals(part.getName())) {
+                    return createCustomMultipartFile(part, fieldName);
+                }
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+
+        return null;
+    }
+
+    private static MultipartFile createCustomMultipartFile(final Part part, final String fieldName) {
+        return new MultipartFile() {
+            private final String filename = fieldName + ".jpg";
+            private final String contentType = "image/jpeg";
+            private byte[] cachedBytes = null;
+
+            public String getName() {
+                return part.getName();
+            }
+
+            public String getOriginalFilename() {
+                return this.filename;
+            }
+
+            public String getContentType() {
+                return "image/jpeg";
+            }
+
+            public boolean isEmpty() {
+                return part.getSize() == 0L;
+            }
+
+            public long getSize() {
+                return part.getSize();
+            }
+
+            public byte[] getBytes() throws IOException {
+                if (this.cachedBytes == null) {
+                    try (InputStream is = part.getInputStream()) {
+                        this.cachedBytes = IOUtils.toByteArray(is);
+                    }
+                }
+
+                return this.cachedBytes;
+            }
+
+            public InputStream getInputStream() throws IOException {
+                return part.getInputStream();
+            }
+
+            public void transferTo(File dest) throws IOException, IllegalStateException {
+                try (InputStream is = part.getInputStream()) {
+                    FileOutputStream os = new FileOutputStream(dest);
+                    Throwable var5 = null;
+
+                    try {
+                        IOUtils.copy(is, os);
+                    } catch (Throwable var28) {
+                        var5 = var28;
+                        throw var28;
+                    } finally {
+                        if (os != null) {
+                            if (var5 != null) {
+                                try {
+                                    os.close();
+                                } catch (Throwable var27) {
+                                    var5.addSuppressed(var27);
+                                }
+                            } else {
+                                os.close();
+                            }
+                        }
+
+                    }
+                }
+
+            }
+        };
+    }
+}

+ 163 - 0
src/main/java/com/usky/common/utils/NetworkInfoUtils.java

@@ -0,0 +1,163 @@
+package com.usky.common.utils;
+
+import com.usky.modules.entity.system.info.NetworkInterfaceInfo;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.NetworkInterface;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import oshi.SystemInfo;
+import oshi.hardware.NetworkIF;
+
+@Component
+public class NetworkInfoUtils {
+    private static final Logger log = LoggerFactory.getLogger(NetworkInfoUtils.class);
+
+    public NetworkInfoUtils() {
+    }
+
+    public List<NetworkInterfaceInfo> getPhysicalNetworkInterfaces() {
+        SystemInfo si = new SystemInfo();
+        List<NetworkIF> allInterfaces = si.getHardware().getNetworkIFs();
+        Map<String, String> gatewayMap = this.getGatewayMap();
+        return (List)allInterfaces.stream().filter(this::isPhysicalInterface).map((net) -> this.toNetworkInterfaceInfo(net, gatewayMap)).filter(Objects::nonNull).collect(Collectors.toList());
+    }
+
+    private boolean isPhysicalInterface(NetworkIF net) {
+        String name = net.getName();
+        return !name.startsWith("lo") && !name.startsWith("docker") && !name.startsWith("veth") && !name.startsWith("br-") && !name.startsWith("virbr") && !name.startsWith("tun") && !name.startsWith("vmnet") && !name.contains(":");
+    }
+
+    private NetworkInterfaceInfo toNetworkInterfaceInfo(NetworkIF net, Map<String, String> gatewayMap) {
+        String[] ipv4Addresses = net.getIPv4addr();
+        if (ipv4Addresses.length != 0 && !ipv4Addresses[0].isEmpty()) {
+            String ipv4 = ipv4Addresses[0];
+            Short[] subnetPrefixLengths = net.getSubnetMasks();
+            String subnetMask = "N/A";
+            if (subnetPrefixLengths != null && subnetPrefixLengths.length > 0) {
+                subnetMask = this.prefixLengthToSubnetMask(subnetPrefixLengths[0]);
+            }
+
+            boolean up = false;
+
+            try {
+                NetworkInterface ni = net.queryNetworkInterface();
+                up = ni.isUp();
+            } catch (Exception var10) {
+                up = false;
+            }
+
+            String gateway = (String)gatewayMap.getOrDefault(net.getName(), "N/A");
+            List<String> dnsServers = this.getDnsServersForInterface(net.getName());
+            return new NetworkInterfaceInfo(net.getName(), up, ipv4, subnetMask, gateway, dnsServers);
+        } else {
+            return null;
+        }
+    }
+
+    private String prefixLengthToSubnetMask(short prefixLength) {
+        if (prefixLength >= 0 && prefixLength <= 32) {
+            int mask = -1 << 32 - prefixLength;
+            return String.format("%d.%d.%d.%d", mask >>> 24 & 255, mask >>> 16 & 255, mask >>> 8 & 255, mask & 255);
+        } else {
+            return "N/A";
+        }
+    }
+
+    private Map<String, String> getGatewayMap() {
+        List<String> output = this.executeCommand("ip route show");
+        Map<String, String> gatewayMap = new HashMap();
+
+        for(String line : output) {
+            String[] parts = line.split("\\s+");
+            if (line.contains("default via")) {
+                if (parts.length >= 5 && "via".equals(parts[1]) && "dev".equals(parts[3])) {
+                    String gateway = parts[2];
+                    String interfaceName = parts[4];
+                    gatewayMap.put(interfaceName, gateway);
+                }
+            } else if (line.contains("via") || line.contains("dev")) {
+                String gateway = null;
+                String interfaceName = null;
+
+                for(int i = 0; i < parts.length; ++i) {
+                    if ("via".equals(parts[i]) && i + 1 < parts.length) {
+                        gateway = parts[i + 1];
+                    } else if ("dev".equals(parts[i]) && i + 1 < parts.length) {
+                        interfaceName = parts[i + 1];
+                    }
+                }
+
+                if (gateway != null && interfaceName != null) {
+                    gatewayMap.put(interfaceName, gateway);
+                }
+            }
+        }
+
+        return gatewayMap;
+    }
+
+    private List<String> getDnsServersForInterface(String interfaceName) {
+        if (interfaceName != null && !interfaceName.trim().isEmpty()) {
+            List<String> output = this.executeCommand("resolvectl dns " + interfaceName.trim());
+            Set<String> seen = new HashSet();
+            List<String> result = new ArrayList();
+
+            for(String line : output) {
+                if (line.contains(":")) {
+                    String[] parts = line.split(":", 2);
+                    if (parts.length > 1) {
+                        String[] dnsServers = parts[1].trim().split("\\s+");
+
+                        for(String dns : dnsServers) {
+                            dns = dns.trim();
+                            if (!dns.isEmpty() && seen.add(dns)) {
+                                result.add(dns);
+                            }
+                        }
+                    }
+                }
+            }
+
+            log.info("{}网口DNS:{}", interfaceName, result);
+            return result;
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    private List<String> executeCommand(String command) {
+        List<String> output = new ArrayList();
+
+        try {
+            Process process = Runtime.getRuntime().exec(new String[]{"sh", "-c", command});
+
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
+                String line;
+                while((line = reader.readLine()) != null) {
+                    output.add(line);
+                }
+
+                int exitCode = process.waitFor();
+                if (exitCode != 0) {
+                    log.error("Command failed: " + command + ", exit code: " + exitCode);
+                }
+            }
+        } catch (Exception e) {
+            log.error("Error executing command: " + command);
+            e.printStackTrace();
+        }
+
+        return output;
+    }
+}

+ 34 - 0
src/main/java/com/usky/common/utils/NvrTask.java

@@ -0,0 +1,34 @@
+package com.usky.common.utils;
+
+import java.io.File;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NvrTask {
+    private static final Logger log = LoggerFactory.getLogger(NvrTask.class);
+
+    public NvrTask() {
+    }
+
+    public static void deleteFolder(File file) {
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+            if (files != null) {
+                for(File subFile : files) {
+                    try {
+                        deleteFolder(subFile);
+                    } catch (Exception var7) {
+                        log.error("deleteFolder 文件删除失败: {}", subFile.getAbsolutePath());
+                    }
+                }
+            }
+        }
+
+        if (!file.delete()) {
+            log.error("文件删除失败: {}", file.getAbsolutePath());
+        }
+
+    }
+}

+ 94 - 0
src/main/java/com/usky/common/utils/OTMPage.java

@@ -0,0 +1,94 @@
+package com.usky.common.utils;
+
+public class OTMPage {
+    private Integer page;
+    private Integer size;
+
+    public static OTMPage getPage(Integer curPage, Integer size) {
+        Integer defaultPage = 1;
+        Integer defaultSize = 10;
+        if (curPage != null && curPage != 0) {
+            defaultPage = curPage;
+        }
+
+        if (size != null && size != 0) {
+            defaultSize = size;
+        }
+
+        return new OTMPage(defaultPage, defaultSize);
+    }
+
+    private OTMPage(Integer page, Integer size) {
+        this.page = page;
+        this.size = size;
+    }
+
+    public Integer getPage() {
+        return this.page;
+    }
+
+    public Integer getSize() {
+        return this.size;
+    }
+
+    public void setPage(final Integer page) {
+        this.page = page;
+    }
+
+    public void setSize(final Integer size) {
+        this.size = size;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof OTMPage)) {
+            return false;
+        } else {
+            OTMPage other = (OTMPage)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$page = this.getPage();
+                Object other$page = other.getPage();
+                if (this$page == null) {
+                    if (other$page != null) {
+                        return false;
+                    }
+                } else if (!this$page.equals(other$page)) {
+                    return false;
+                }
+
+                Object this$size = this.getSize();
+                Object other$size = other.getSize();
+                if (this$size == null) {
+                    if (other$size != null) {
+                        return false;
+                    }
+                } else if (!this$size.equals(other$size)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof OTMPage;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $page = this.getPage();
+        result = result * 59 + ($page == null ? 43 : $page.hashCode());
+        Object $size = this.getSize();
+        result = result * 59 + ($size == null ? 43 : $size.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "OTMPage(page=" + this.getPage() + ", size=" + this.getSize() + ")";
+    }
+}

+ 14 - 0
src/main/java/com/usky/common/utils/OsSelect.java

@@ -0,0 +1,14 @@
+package com.usky.common.utils;
+
+public class OsSelect {
+    public OsSelect() {
+    }
+
+    public static boolean isLinux() {
+        return System.getProperty("os.name").toLowerCase().contains("linux");
+    }
+
+    public static boolean isWindows() {
+        return System.getProperty("os.name").toLowerCase().contains("windows");
+    }
+}

+ 40 - 0
src/main/java/com/usky/common/utils/PrimaryKeyIdUtils.java

@@ -0,0 +1,40 @@
+package com.usky.common.utils;
+
+import java.net.Inet4Address;
+import java.net.UnknownHostException;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+
+public class PrimaryKeyIdUtils {
+    private static Long machineId;
+    private static SnowFlakeUtils snowFlakeUtils;
+
+    public PrimaryKeyIdUtils() {
+        if (machineId == null) {
+            machineId = getMachineId();
+            snowFlakeUtils = new SnowFlakeUtils(machineId);
+        }
+
+    }
+
+    public static long nextId() {
+        new PrimaryKeyIdUtils();
+        return snowFlakeUtils.nextId();
+    }
+
+    private static long getMachineId() {
+        try {
+            String hostAddress = Inet4Address.getLocalHost().getHostAddress();
+            int[] ints = StringUtils.toCodePoints(hostAddress);
+            int sums = 0;
+
+            for(int b : ints) {
+                sums += b;
+            }
+
+            return (long)(sums % 32);
+        } catch (UnknownHostException var7) {
+            return RandomUtils.nextLong(0L, 31L);
+        }
+    }
+}

+ 56 - 0
src/main/java/com/usky/common/utils/QrCodeUtils.java

@@ -0,0 +1,56 @@
+package com.usky.common.utils;
+
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+import org.apache.commons.codec.binary.Base64;
+
+public class QrCodeUtils {
+    public QrCodeUtils() {
+    }
+
+    public static String imageToBase64(BufferedImage bufferedImage) {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        try {
+            ImageIO.write(bufferedImage, "png", baos);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        byte[] bytes = baos.toByteArray();
+        Base64 encoder = new Base64();
+        String png_base64 = encoder.encodeAsString(bytes).trim();
+        png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");
+        return "data:image/png;base64," + png_base64;
+    }
+
+    public static String fileToBase64(File file) {
+        return "data:image/png;base64," + Base64.encodeBase64String(fileToByte(file));
+    }
+
+    private static byte[] fileToByte(File file) {
+        byte[] fileBytes = null;
+        FileInputStream fis = null;
+
+        try {
+            fis = new FileInputStream(file);
+            fileBytes = new byte[(int)file.length()];
+            fis.read(fileBytes);
+            fis.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return fileBytes;
+    }
+
+    public static void main(String[] args) {
+        String result = imageToBase64(QrCodeUtil.generate("https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7f64c851e8a24dcb&redirect_uri=https://yxyshop-uat.hnyxtour.com/tdos/system/notify/submit/15/wx7f64c851e8a24dcb/3f6be86d61cfbc74472fa04426b3004d.do&response_type=code&scope=snsapi_userinfo&#wechat_redirect", 300, 300));
+        System.out.println(result);
+    }
+}

+ 142 - 0
src/main/java/com/usky/common/utils/Response.java

@@ -0,0 +1,142 @@
+package com.usky.common.utils;
+
+public class Response<T> {
+    private int code;
+    private String msg;
+    private T data;
+
+    public static Response error() {
+        return error(500, "接口服务异常");
+    }
+
+    public static Response error(String msg) {
+        return error(500, msg);
+    }
+
+    public static Response error(int code, String msg) {
+        Response response = new Response();
+        response.code = code;
+        response.msg = msg;
+        response.data = null;
+        return response;
+    }
+
+    public static <T> Response error(String msg, T data) {
+        Response response = new Response();
+        response.code = 500;
+        response.msg = msg;
+        response.data = data;
+        return response;
+    }
+
+    public static Response success() {
+        Response response = new Response();
+        response.code = 200;
+        response.msg = "success";
+        response.data = null;
+        return response;
+    }
+
+    public static Response success(String msg) {
+        return success(msg, (Object)null);
+    }
+
+    public static <T> Response success(String msg, T data) {
+        Response response = new Response();
+        response.code = 200;
+        response.msg = msg;
+        response.data = data;
+        return response;
+    }
+
+    public static <T> Response success(T data) {
+        Response response = new Response();
+        response.code = 200;
+        response.msg = "success";
+        response.data = data;
+        return response;
+    }
+
+    public Response() {
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+
+    public String getMsg() {
+        return this.msg;
+    }
+
+    public T getData() {
+        return this.data;
+    }
+
+    public void setCode(final int code) {
+        this.code = code;
+    }
+
+    public void setMsg(final String msg) {
+        this.msg = msg;
+    }
+
+    public void setData(final T data) {
+        this.data = data;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof Response)) {
+            return false;
+        } else {
+            Response<?> other = (Response)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else if (this.getCode() != other.getCode()) {
+                return false;
+            } else {
+                Object this$msg = this.getMsg();
+                Object other$msg = other.getMsg();
+                if (this$msg == null) {
+                    if (other$msg != null) {
+                        return false;
+                    }
+                } else if (!this$msg.equals(other$msg)) {
+                    return false;
+                }
+
+                Object this$data = this.getData();
+                Object other$data = other.getData();
+                if (this$data == null) {
+                    if (other$data != null) {
+                        return false;
+                    }
+                } else if (!this$data.equals(other$data)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof Response;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        result = result * 59 + this.getCode();
+        Object $msg = this.getMsg();
+        result = result * 59 + ($msg == null ? 43 : $msg.hashCode());
+        Object $data = this.getData();
+        result = result * 59 + ($data == null ? 43 : $data.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "Response(code=" + this.getCode() + ", msg=" + this.getMsg() + ", data=" + this.getData() + ")";
+    }
+}

+ 15 - 0
src/main/java/com/usky/common/utils/SleepUtil.java

@@ -0,0 +1,15 @@
+package com.usky.common.utils;
+
+public class SleepUtil {
+    public SleepUtil() {
+    }
+
+    public static void sleep(long millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+    }
+}

+ 53 - 0
src/main/java/com/usky/common/utils/SnowFlakeUtils.java

@@ -0,0 +1,53 @@
+package com.usky.common.utils;
+
+public class SnowFlakeUtils {
+    private static final long START_STMP = 1577808000000L;
+    private static final long SEQUENCE_BIT = 9L;
+    private static final long MACHINE_BIT = 5L;
+    private static final long MAX_MACHINE_NUM = 31L;
+    private static final long MAX_SEQUENCE = 511L;
+    private static final long MACHINE_LEFT = 9L;
+    private static final long TIMESTMP_LEFT = 14L;
+    private long machineId;
+    private long sequence = 0L;
+    private long lastStmp = -1L;
+
+    public SnowFlakeUtils(long machineId) {
+        if (machineId <= 31L && machineId >= 0L) {
+            this.machineId = machineId;
+        } else {
+            throw new IllegalArgumentException("machineId can't be greater than MAX_MACHINE_NUM or less than 0");
+        }
+    }
+
+    public synchronized long nextId() {
+        long currStmp = this.timeGen();
+        if (currStmp < this.lastStmp) {
+            throw new RuntimeException("Clock moved backwards. Refusing to generate id");
+        } else {
+            if (currStmp == this.lastStmp) {
+                this.sequence = this.sequence + 1L & 511L;
+                if (this.sequence == 0L) {
+                    currStmp = this.getNextMill();
+                }
+            } else {
+                this.sequence = 0L;
+            }
+
+            this.lastStmp = currStmp;
+            return currStmp - 1577808000000L << 14 | this.machineId << 9 | this.sequence;
+        }
+    }
+
+    private long getNextMill() {
+        long mill;
+        for(mill = this.timeGen(); mill <= this.lastStmp; mill = this.timeGen()) {
+        }
+
+        return mill;
+    }
+
+    private long timeGen() {
+        return System.currentTimeMillis();
+    }
+}

+ 84 - 0
src/main/java/com/usky/common/utils/SystemInfoUtils.java

@@ -0,0 +1,84 @@
+package com.usky.common.utils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import oshi.SystemInfo;
+import oshi.hardware.CentralProcessor;
+import oshi.hardware.GlobalMemory;
+import oshi.software.os.OSFileStore;
+import oshi.software.os.OperatingSystem;
+
+public class SystemInfoUtils {
+    private static final long GB = 1073741824L;
+
+    public SystemInfoUtils() {
+    }
+
+    public static Map<String, Object> getCpuInfo() throws InterruptedException {
+        SystemInfo si = new SystemInfo();
+        CentralProcessor cpu = si.getHardware().getProcessor();
+        Map<String, Object> cpuInfo = new HashMap();
+        cpuInfo.put("cores", cpu.getLogicalProcessorCount());
+        long[] prevTicks = cpu.getSystemCpuLoadTicks();
+        TimeUnit.MILLISECONDS.sleep(500L);
+        double usage = cpu.getSystemCpuLoadBetweenTicks(prevTicks) * (double)100.0F;
+        cpuInfo.put("usage", String.format("%.2f%%", usage));
+        return cpuInfo;
+    }
+
+    public static Map<String, Object> getMemoryInfo() {
+        SystemInfo si = new SystemInfo();
+        GlobalMemory memory = si.getHardware().getMemory();
+        Map<String, Object> memInfo = new HashMap();
+        long total = memory.getTotal();
+        long available = memory.getAvailable();
+        long used = total - available;
+        memInfo.put("total", String.format("%.2f GB", (double)total / (double)1.0737418E9F));
+        memInfo.put("used", String.format("%.2f GB", (double)used / (double)1.0737418E9F));
+        memInfo.put("free", String.format("%.2f GB", (double)available / (double)1.0737418E9F));
+        memInfo.put("usage", String.format("%.2f%%", (double)used * (double)100.0F / (double)total));
+        return memInfo;
+    }
+
+    public static List<Map<String, Object>> getDiskInfo() {
+        SystemInfo si = new SystemInfo();
+        OperatingSystem os = si.getOperatingSystem();
+        List<Map<String, Object>> diskList = new ArrayList();
+        Map<String, Object> diskInfo = new HashMap();
+
+        for(OSFileStore fs : os.getFileSystem().getFileStores()) {
+            if ("/".equals(fs.getMount()) || "C:\\".equals(fs.getMount())) {
+                long total = fs.getTotalSpace();
+                long free = fs.getFreeSpace();
+                long used = total - free;
+                diskInfo.put("name", fs.getName());
+                diskInfo.put("total", String.format("%.2f GB", (double)total / (double)1.0737418E9F));
+                diskInfo.put("used", String.format("%.2f GB", (double)used / (double)1.0737418E9F));
+                diskInfo.put("free", String.format("%.2f GB", (double)free / (double)1.0737418E9F));
+                diskInfo.put("usage", String.format("%.2f%%", (double)used * (double)100.0F / (double)total));
+                diskInfo.put("mount", fs.getMount());
+                break;
+            }
+        }
+
+        diskList.add(diskInfo);
+        return diskList;
+    }
+
+    public static Map<String, Object> getAllSystemInfo() {
+        Map<String, Object> allInfo = new HashMap();
+
+        try {
+            allInfo.put("cpu", getCpuInfo());
+            allInfo.put("memory", getMemoryInfo());
+            allInfo.put("disk", getDiskInfo());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return allInfo;
+    }
+}

+ 42 - 0
src/main/java/com/usky/common/utils/TranscodingUtil.java

@@ -0,0 +1,42 @@
+package com.usky.common.utils;
+
+public class TranscodingUtil {
+    private static final char[] HEX = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    public TranscodingUtil() {
+    }
+
+    public static String bytesToHex(byte[] bytes) {
+        char[] buf = new char[bytes.length * 2];
+        int index = 0;
+
+        for(byte b : bytes) {
+            buf[index++] = HEX[b >>> 4 & 15];
+            buf[index++] = HEX[b & 15];
+        }
+
+        return new String(buf);
+    }
+
+    public static byte[] hexToBytes(String str) {
+        if (str != null && !str.trim().equals("")) {
+            byte[] bytes = new byte[str.length() / 2];
+
+            for(int i = 0; i < str.length() / 2; ++i) {
+                String subStr = str.substring(i * 2, i * 2 + 2);
+                bytes[i] = (byte)Integer.parseInt(subStr, 16);
+            }
+
+            return bytes;
+        } else {
+            return new byte[0];
+        }
+    }
+
+    public static void main(String[] args) {
+        byte[] test = new byte[2];
+        test[0] = 0;
+        test[1] = -54;
+        System.out.println(Integer.valueOf(bytesToHex(test), 16) + "");
+    }
+}

+ 18 - 0
src/main/java/com/usky/common/utils/UUIDUtil.java

@@ -0,0 +1,18 @@
+package com.usky.common.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
+
+public class UUIDUtil {
+    public UUIDUtil() {
+    }
+
+    public static String generateOrderNumber() {
+        UUID uuid = UUID.randomUUID();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String dateStr = dateFormat.format(new Date());
+        String orderNumber = uuid.toString().replace("-", "") + "_" + dateStr;
+        return orderNumber;
+    }
+}

+ 162 - 0
src/main/java/com/usky/common/vo/BaseMessage.java

@@ -0,0 +1,162 @@
+package com.usky.common.vo;
+
+public class BaseMessage {
+    private String instrucCode;
+    private String originCode;
+    private String protocolVer;
+    private String deviceIMEI;
+    private String header;
+    private String messageData;
+
+    public BaseMessage() {
+    }
+
+    public String getInstrucCode() {
+        return this.instrucCode;
+    }
+
+    public String getOriginCode() {
+        return this.originCode;
+    }
+
+    public String getProtocolVer() {
+        return this.protocolVer;
+    }
+
+    public String getDeviceIMEI() {
+        return this.deviceIMEI;
+    }
+
+    public String getHeader() {
+        return this.header;
+    }
+
+    public String getMessageData() {
+        return this.messageData;
+    }
+
+    public void setInstrucCode(final String instrucCode) {
+        this.instrucCode = instrucCode;
+    }
+
+    public void setOriginCode(final String originCode) {
+        this.originCode = originCode;
+    }
+
+    public void setProtocolVer(final String protocolVer) {
+        this.protocolVer = protocolVer;
+    }
+
+    public void setDeviceIMEI(final String deviceIMEI) {
+        this.deviceIMEI = deviceIMEI;
+    }
+
+    public void setHeader(final String header) {
+        this.header = header;
+    }
+
+    public void setMessageData(final String messageData) {
+        this.messageData = messageData;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof BaseMessage)) {
+            return false;
+        } else {
+            BaseMessage other = (BaseMessage)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$instrucCode = this.getInstrucCode();
+                Object other$instrucCode = other.getInstrucCode();
+                if (this$instrucCode == null) {
+                    if (other$instrucCode != null) {
+                        return false;
+                    }
+                } else if (!this$instrucCode.equals(other$instrucCode)) {
+                    return false;
+                }
+
+                Object this$originCode = this.getOriginCode();
+                Object other$originCode = other.getOriginCode();
+                if (this$originCode == null) {
+                    if (other$originCode != null) {
+                        return false;
+                    }
+                } else if (!this$originCode.equals(other$originCode)) {
+                    return false;
+                }
+
+                Object this$protocolVer = this.getProtocolVer();
+                Object other$protocolVer = other.getProtocolVer();
+                if (this$protocolVer == null) {
+                    if (other$protocolVer != null) {
+                        return false;
+                    }
+                } else if (!this$protocolVer.equals(other$protocolVer)) {
+                    return false;
+                }
+
+                Object this$deviceIMEI = this.getDeviceIMEI();
+                Object other$deviceIMEI = other.getDeviceIMEI();
+                if (this$deviceIMEI == null) {
+                    if (other$deviceIMEI != null) {
+                        return false;
+                    }
+                } else if (!this$deviceIMEI.equals(other$deviceIMEI)) {
+                    return false;
+                }
+
+                Object this$header = this.getHeader();
+                Object other$header = other.getHeader();
+                if (this$header == null) {
+                    if (other$header != null) {
+                        return false;
+                    }
+                } else if (!this$header.equals(other$header)) {
+                    return false;
+                }
+
+                Object this$messageData = this.getMessageData();
+                Object other$messageData = other.getMessageData();
+                if (this$messageData == null) {
+                    if (other$messageData != null) {
+                        return false;
+                    }
+                } else if (!this$messageData.equals(other$messageData)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof BaseMessage;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $instrucCode = this.getInstrucCode();
+        result = result * 59 + ($instrucCode == null ? 43 : $instrucCode.hashCode());
+        Object $originCode = this.getOriginCode();
+        result = result * 59 + ($originCode == null ? 43 : $originCode.hashCode());
+        Object $protocolVer = this.getProtocolVer();
+        result = result * 59 + ($protocolVer == null ? 43 : $protocolVer.hashCode());
+        Object $deviceIMEI = this.getDeviceIMEI();
+        result = result * 59 + ($deviceIMEI == null ? 43 : $deviceIMEI.hashCode());
+        Object $header = this.getHeader();
+        result = result * 59 + ($header == null ? 43 : $header.hashCode());
+        Object $messageData = this.getMessageData();
+        result = result * 59 + ($messageData == null ? 43 : $messageData.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "BaseMessage(instrucCode=" + this.getInstrucCode() + ", originCode=" + this.getOriginCode() + ", protocolVer=" + this.getProtocolVer() + ", deviceIMEI=" + this.getDeviceIMEI() + ", header=" + this.getHeader() + ", messageData=" + this.getMessageData() + ")";
+    }
+}

+ 143 - 0
src/main/java/com/usky/common/vo/FileVO.java

@@ -0,0 +1,143 @@
+package com.usky.common.vo;
+
+import java.io.Serializable;
+
+public class FileVO implements Serializable {
+    private String name;
+    private String url;
+    private String path;
+    private String http;
+    private String mappingPath;
+
+    public FileVO() {
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getUrl() {
+        return this.url;
+    }
+
+    public String getPath() {
+        return this.path;
+    }
+
+    public String getHttp() {
+        return this.http;
+    }
+
+    public String getMappingPath() {
+        return this.mappingPath;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public void setUrl(final String url) {
+        this.url = url;
+    }
+
+    public void setPath(final String path) {
+        this.path = path;
+    }
+
+    public void setHttp(final String http) {
+        this.http = http;
+    }
+
+    public void setMappingPath(final String mappingPath) {
+        this.mappingPath = mappingPath;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof FileVO)) {
+            return false;
+        } else {
+            FileVO other = (FileVO)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$name = this.getName();
+                Object other$name = other.getName();
+                if (this$name == null) {
+                    if (other$name != null) {
+                        return false;
+                    }
+                } else if (!this$name.equals(other$name)) {
+                    return false;
+                }
+
+                Object this$url = this.getUrl();
+                Object other$url = other.getUrl();
+                if (this$url == null) {
+                    if (other$url != null) {
+                        return false;
+                    }
+                } else if (!this$url.equals(other$url)) {
+                    return false;
+                }
+
+                Object this$path = this.getPath();
+                Object other$path = other.getPath();
+                if (this$path == null) {
+                    if (other$path != null) {
+                        return false;
+                    }
+                } else if (!this$path.equals(other$path)) {
+                    return false;
+                }
+
+                Object this$http = this.getHttp();
+                Object other$http = other.getHttp();
+                if (this$http == null) {
+                    if (other$http != null) {
+                        return false;
+                    }
+                } else if (!this$http.equals(other$http)) {
+                    return false;
+                }
+
+                Object this$mappingPath = this.getMappingPath();
+                Object other$mappingPath = other.getMappingPath();
+                if (this$mappingPath == null) {
+                    if (other$mappingPath != null) {
+                        return false;
+                    }
+                } else if (!this$mappingPath.equals(other$mappingPath)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof FileVO;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $name = this.getName();
+        result = result * 59 + ($name == null ? 43 : $name.hashCode());
+        Object $url = this.getUrl();
+        result = result * 59 + ($url == null ? 43 : $url.hashCode());
+        Object $path = this.getPath();
+        result = result * 59 + ($path == null ? 43 : $path.hashCode());
+        Object $http = this.getHttp();
+        result = result * 59 + ($http == null ? 43 : $http.hashCode());
+        Object $mappingPath = this.getMappingPath();
+        result = result * 59 + ($mappingPath == null ? 43 : $mappingPath.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "FileVO(name=" + this.getName() + ", url=" + this.getUrl() + ", path=" + this.getPath() + ", http=" + this.getHttp() + ", mappingPath=" + this.getMappingPath() + ")";
+    }
+}

+ 57 - 0
src/main/java/com/usky/common/vo/TokenVo.java

@@ -0,0 +1,57 @@
+package com.usky.common.vo;
+
+public class TokenVo {
+    private Long id;
+
+    public TokenVo() {
+    }
+
+    public Long getId() {
+        return this.id;
+    }
+
+    public void setId(final Long id) {
+        this.id = id;
+    }
+
+    public boolean equals(final Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof TokenVo)) {
+            return false;
+        } else {
+            TokenVo other = (TokenVo)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                Object this$id = this.getId();
+                Object other$id = other.getId();
+                if (this$id == null) {
+                    if (other$id != null) {
+                        return false;
+                    }
+                } else if (!this$id.equals(other$id)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(final Object other) {
+        return other instanceof TokenVo;
+    }
+
+    public int hashCode() {
+        int PRIME = 59;
+        int result = 1;
+        Object $id = this.getId();
+        result = result * 59 + ($id == null ? 43 : $id.hashCode());
+        return result;
+    }
+
+    public String toString() {
+        return "TokenVo(id=" + this.getId() + ")";
+    }
+}

+ 16 - 0
src/main/java/com/usky/config/AppConfig.java

@@ -0,0 +1,16 @@
+package com.usky.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class AppConfig {
+    public AppConfig() {
+    }
+
+    @Bean
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
+}

+ 337 - 0
src/main/java/com/usky/config/BoundaryRepairMultipartResolver.java

@@ -0,0 +1,337 @@
+package com.usky.config;
+
+import com.usky.common.listener.FileUploadProgressListener;
+import com.usky.modules.entity.global.UriProperties;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.servlet.ReadListener;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUpload;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.ProgressListener;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.multipart.MultipartException;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.multipart.commons.CommonsFileUploadSupport;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
+
+@Component
+public class BoundaryRepairMultipartResolver extends CommonsMultipartResolver {
+    private static final Logger log = LoggerFactory.getLogger(BoundaryRepairMultipartResolver.class);
+    @Autowired
+    private UriProperties uriProperties;
+
+    public BoundaryRepairMultipartResolver() {
+    }
+
+    protected CommonsFileUploadSupport.MultipartParsingResult parseRequest(HttpServletRequest request) throws MultipartException {
+        String encoding = this.determineEncoding(request);
+        FileUpload fileUpload = this.prepareFileUpload(encoding);
+        String requestURI = request.getRequestURI();
+
+        // ===================== 修复 1 =====================
+        boolean shouldMonitor = uriProperties.getUrls().stream()
+                .anyMatch(url -> requestURI.contains(url));
+
+        if (shouldMonitor) {
+            final String uploadId = request.getParameter("uploadId");
+            log.info("解析请求 - uploadId: {}", uploadId);
+            fileUpload.setProgressListener((pBytesRead, pContentLength, pItems) -> {
+                if (pContentLength > 0L) {
+                    int percent = (int) (pBytesRead * 100L / pContentLength);
+                    FileUploadProgressListener.updateProgress(uploadId, percent);
+                }
+            });
+        }
+
+        try {
+            List<FileItem> fileItems = ((ServletFileUpload) fileUpload).parseRequest(request);
+            return this.parseFileItems(fileItems, encoding);
+        } catch (FileUploadException e) {
+            throw new MultipartException("解析multipart请求失败", e);
+        }
+    }
+
+    public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException {
+        try {
+            if (request.getRequestURI().contains("/agbox/device/snap")) {
+                HttpServletRequest repairedRequest = this.repairRequest(request);
+                return this.parseMultipartManually(repairedRequest);
+            } else {
+                return super.resolveMultipart(request);
+            }
+        } catch (Exception e) {
+            throw new MultipartException("Failed to repair request", e);
+        }
+    }
+
+    private MultipartHttpServletRequest parseMultipartManually(HttpServletRequest request) throws FileUploadException, IOException {
+        DiskFileItemFactory factory = new DiskFileItemFactory();
+        ServletFileUpload upload = new ServletFileUpload(factory);
+        upload.setHeaderEncoding("UTF-8");
+        List<FileItem> fileItems = upload.parseRequest(request);
+        return this.createMultipartRequest(request, fileItems);
+    }
+
+    private MultipartHttpServletRequest createMultipartRequest(HttpServletRequest request, List<FileItem> fileItems) {
+        Map<String, String[]> paramMap = new HashMap();
+        MultiValueMap<String, MultipartFile> fileMap = new LinkedMultiValueMap();
+        Set<String> knownTextFields = new HashSet(Arrays.asList("key", "json"));
+
+        for (FileItem item : fileItems) {
+            String fieldName = item.getFieldName();
+            boolean isFileField = !item.isFormField() || item.getContentType() != null && item.getContentType().startsWith("image/") || !knownTextFields.contains(fieldName);
+            if (!isFileField) {
+                this.processFormField(item, paramMap);
+            } else {
+                this.processFileField(item, fileMap);
+            }
+        }
+
+        return new CustomMultipartHttpServletRequest(request, paramMap, fileMap);
+    }
+
+    private void processFormField(FileItem item, Map<String, String[]> paramMap) {
+        try {
+            String fieldName = item.getFieldName();
+            String value = item.getString("UTF-8");
+            if (paramMap.containsKey(fieldName)) {
+                String[] existingValues = (String[]) paramMap.get(fieldName);
+                String[] newValues = (String[]) Arrays.copyOf(existingValues, existingValues.length + 1);
+                newValues[existingValues.length] = value;
+                paramMap.put(fieldName, newValues);
+            } else {
+                paramMap.put(fieldName, new String[]{value});
+            }
+        } catch (UnsupportedEncodingException var7) {
+            paramMap.put(item.getFieldName(), new String[]{item.getString()});
+        }
+
+    }
+
+    private void processFileField(FileItem item, MultiValueMap<String, MultipartFile> fileMap) {
+        CommonsMultipartFile multipartFile = new CommonsMultipartFile(item);
+        fileMap.add(item.getFieldName(), multipartFile);
+    }
+
+    private HttpServletRequest repairRequest(HttpServletRequest original) throws IOException {
+        String boundary = this.extractBoundary(original.getContentType());
+        if (boundary == null) {
+            return original;
+        } else {
+            InputStream is = original.getInputStream();
+            byte[] originalBody = IOUtils.toByteArray(is);
+            byte[] endBoundary = ("\r\n--" + boundary + "--\r\n").getBytes(StandardCharsets.UTF_8);
+            boolean hasEndBoundary = this.endsWithBoundary(originalBody, boundary);
+            if (!hasEndBoundary) {
+                byte[] repairedBody = new byte[originalBody.length + endBoundary.length];
+                System.arraycopy(originalBody, 0, repairedBody, 0, originalBody.length);
+                System.arraycopy(endBoundary, 0, repairedBody, originalBody.length, endBoundary.length);
+                return new RepairedHttpServletRequest(original, repairedBody);
+            } else {
+                return new RepairedHttpServletRequest(original, originalBody);
+            }
+        }
+    }
+
+    private boolean endsWithBoundary(byte[] body, String boundary) {
+        if (body != null && body.length >= ("\r\n--" + boundary + "--\r\n").length()) {
+            String bodyAsString = new String(body, StandardCharsets.UTF_8);
+            return bodyAsString.endsWith("\r\n--" + boundary + "--\r\n");
+        } else {
+            return false;
+        }
+    }
+
+    private String extractBoundary(String contentType) {
+        if (contentType == null) {
+            return null;
+        } else {
+            String[] parts = contentType.split(";");
+
+            for (String part : parts) {
+                part = part.trim();
+                if (part.startsWith("boundary=")) {
+                    return part.substring("boundary=".length()).replace("\"", "").trim();
+                }
+            }
+
+            return null;
+        }
+    }
+
+    private static class RepairedHttpServletRequest extends HttpServletRequestWrapper {
+        private final byte[] body;
+
+        public RepairedHttpServletRequest(HttpServletRequest request, byte[] body) {
+            super(request);
+            this.body = body;
+        }
+
+        public ServletInputStream getInputStream() {
+            return new ServletInputStream() {
+                private final ByteArrayInputStream bais;
+
+                {
+                    this.bais = new ByteArrayInputStream(RepairedHttpServletRequest.this.body);
+                }
+
+                public int read() {
+                    return this.bais.read();
+                }
+
+                public boolean isFinished() {
+                    return this.bais.available() == 0;
+                }
+
+                public boolean isReady() {
+                    return true;
+                }
+
+                public void setReadListener(ReadListener listener) {
+                    throw new UnsupportedOperationException();
+                }
+            };
+        }
+
+        public int getContentLength() {
+            return this.body.length;
+        }
+
+        public long getContentLengthLong() {
+            return (long) this.body.length;
+        }
+
+        public BufferedReader getReader() {
+            return new BufferedReader(new InputStreamReader(this.getInputStream(), StandardCharsets.UTF_8));
+        }
+
+        public String getParameter(String name) {
+            return null;
+        }
+
+        public Map<String, String[]> getParameterMap() {
+            return Collections.emptyMap();
+        }
+
+        public Enumeration<String> getParameterNames() {
+            return Collections.emptyEnumeration();
+        }
+
+        public String[] getParameterValues(String name) {
+            return null;
+        }
+    }
+
+    private static class CustomMultipartHttpServletRequest extends HttpServletRequestWrapper implements MultipartHttpServletRequest {
+        private final Map<String, String[]> paramMap;
+        private final MultiValueMap<String, MultipartFile> fileMap;
+
+        public CustomMultipartHttpServletRequest(HttpServletRequest request, Map<String, String[]> paramMap, MultiValueMap<String, MultipartFile> fileMap) {
+            super(request);
+            this.paramMap = paramMap;
+            this.fileMap = fileMap;
+        }
+
+        public Iterator<String> getFileNames() {
+            return this.fileMap.keySet().iterator();
+        }
+
+        public MultipartFile getFile(String name) {
+            List<MultipartFile> files = this.fileMap.get(name);
+            return files != null && !files.isEmpty() ? files.get(0) : null;
+        }
+
+        public List<MultipartFile> getFiles(String name) {
+            List<MultipartFile> files = this.fileMap.get(name);
+            return files != null ? files : Collections.emptyList();
+        }
+
+        public Map<String, MultipartFile> getFileMap() {
+            Map<String, MultipartFile> result = new LinkedHashMap();
+
+            // ===================== 修复 2 =====================
+            for (Map.Entry<String, List<MultipartFile>> entry : this.fileMap.entrySet()) {
+                if (!entry.getValue().isEmpty()) {
+                    result.put(entry.getKey(), entry.getValue().get(0));
+                }
+            }
+
+            return result;
+        }
+
+        public MultiValueMap<String, MultipartFile> getMultiFileMap() {
+            return this.fileMap;
+        }
+
+        public String getMultipartContentType(String paramOrFileName) {
+            return null;
+        }
+
+        public String getParameter(String name) {
+            String[] values = this.paramMap.get(name);
+            return values != null && values.length > 0 ? values[0] : null;
+        }
+
+        public Map<String, String[]> getParameterMap() {
+            return this.paramMap;
+        }
+
+        public Enumeration<String> getParameterNames() {
+            return Collections.enumeration(this.paramMap.keySet());
+        }
+
+        public String[] getParameterValues(String name) {
+            return this.paramMap.get(name);
+        }
+
+        public HttpMethod getRequestMethod() {
+            return HttpMethod.resolve(getMethod());
+        }
+
+        public HttpHeaders getRequestHeaders() {
+            HttpHeaders headers = new HttpHeaders();
+            Enumeration<String> headerNames = getHeaderNames();
+            while (headerNames.hasMoreElements()) {
+                String headerName = headerNames.nextElement();
+                headers.put(headerName, Collections.list(getHeaders(headerName)));
+            }
+            return headers;
+        }
+
+        public HttpHeaders getMultipartHeaders(String s) {
+            return null;
+        }
+    }
+}

+ 29 - 0
src/main/java/com/usky/config/CollectionUtils.java

@@ -0,0 +1,29 @@
+package com.usky.config;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class CollectionUtils {
+    public CollectionUtils() {
+    }
+
+    public static <T> List<T> removeDuplicatesByField(List<T> list, String fieldName) throws NoSuchFieldException, IllegalAccessException {
+        if (list != null && !list.isEmpty() && fieldName != null && !fieldName.isEmpty()) {
+            Map<Object, T> map = new HashMap();
+
+            for(T item : list) {
+                Field field = item.getClass().getDeclaredField(fieldName);
+                field.setAccessible(true);
+                Object fieldValue = field.get(item);
+                map.putIfAbsent(fieldValue, item);
+            }
+
+            return new ArrayList(map.values());
+        } else {
+            return list;
+        }
+    }
+}

+ 34 - 0
src/main/java/com/usky/config/FilterConfig.java

@@ -0,0 +1,34 @@
+package com.usky.config;
+
+import com.usky.filter.RawMultipartFilter;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
+
+@Configuration
+public class FilterConfig {
+    public FilterConfig() {
+    }
+
+    @Bean
+    public FilterRegistrationBean<RawMultipartFilter> rawMultipartFilter() {
+        FilterRegistrationBean<RawMultipartFilter> registration = new FilterRegistrationBean();
+        registration.setFilter(new RawMultipartFilter());
+        registration.addUrlPatterns(new String[]{"/agbox/device/alarm"});
+        registration.addUrlPatterns(new String[]{"/agbox/device/patrol"});
+        registration.setOrder(Integer.MIN_VALUE);
+        return registration;
+    }
+
+    @Bean(
+            name = {"multipartResolver"}
+    )
+    public CommonsMultipartResolver multipartResolver() {
+        BoundaryRepairMultipartResolver resolver = new BoundaryRepairMultipartResolver();
+        resolver.setDefaultEncoding("UTF-8");
+        resolver.setMaxUploadSize(314572800L);
+        resolver.setMaxInMemorySize(0);
+        return resolver;
+    }
+}

+ 38 - 0
src/main/java/com/usky/config/JsonConfig.java

@@ -0,0 +1,38 @@
+package com.usky.config;
+
+import com.alibaba.fastjson.parser.ParserConfig;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+
+@Configuration
+public class JsonConfig {
+    public JsonConfig() {
+    }
+
+    @Bean
+    public HttpMessageConverters fastJsonHttpMessageConverters() {
+        System.out.println("全局序列化配置===========");
+        FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
+        FastJsonConfig jsonConfig = getFastJsonConfig();
+        fastConverter.setFastJsonConfig(jsonConfig);
+        ParserConfig.getGlobalInstance().setAsmEnable(false);
+        fastConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON_UTF8, MediaType.TEXT_HTML));
+        fastConverter.setDefaultCharset(StandardCharsets.UTF_8);
+        return new HttpMessageConverters(new HttpMessageConverter[]{fastConverter});
+    }
+
+    private static FastJsonConfig getFastJsonConfig() {
+        FastJsonConfig config = new FastJsonConfig();
+        config.setSerializerFeatures(new SerializerFeature[]{SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteNullListAsEmpty, SerializerFeature.WriteNullBooleanAsFalse, SerializerFeature.DisableCircularReferenceDetect});
+        config.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        return config;
+    }
+}

+ 193 - 0
src/main/java/com/usky/config/MyMetaObjectHandler.java

@@ -0,0 +1,193 @@
+package com.usky.config;
+
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import com.usky.common.utils.OsSelect;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import org.apache.commons.lang.StringUtils;
+import org.apache.ibatis.reflection.MetaObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/*@Component
+public class MyMetaObjectHandler implements MetaObjectHandler {
+    private static final Logger log = LoggerFactory.getLogger(MyMetaObjectHandler.class);
+
+    public MyMetaObjectHandler() {
+    }
+
+    public void insertFill(MetaObject metaObject) {
+        this.strictInsertFill(metaObject, "triggerTime", LocalDateTime.class, LocalDateTime.now());
+        this.strictInsertFill(metaObject, "expirationDate", LocalDate.class, LocalDate.now());
+        this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
+        this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
+    }
+
+    public void updateFill(MetaObject metaObject) {
+        this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
+    }
+
+    public String generateHardwareCode() {
+        // 永远返回固定的哈希值
+        return "8D22A0FC3DF4A71D29E334FB1F2E8668D921C38CCC65BFB5062D0E44628C986E";
+    }
+
+    public static String getLinuxDeviceCode() {
+        // 固定值
+        String serialNo = "GD50819130064";
+        String macAddr = "8c:c5:8c:0e:9c:f5";
+        String deviceCode = "GD50819130064|8cc58c0e9cf5";
+        String hashCode = "8D22A0FC3DF4A71D29E334FB1F2E8668D921C38CCC65BFB5062D0E44628C986E";
+
+        // 输出和你日志完全一样
+        log.info("Linux设备唯一码:" + deviceCode);
+        log.info("serialNo : " + serialNo + " macAddr : " + macAddr);
+        log.info("Linux设备哈希唯一码(64位):" + hashCode + " 哈希数据长度 64");
+
+        return hashCode;
+    }
+
+    public static String getWindowsDeviceCode() {
+        // Windows 也返回同一个固定值
+        return "8D22A0FC3DF4A71D29E334FB1F2E8668D921C38CCC65BFB5062D0E44628C986E";
+    }
+}*/
+
+@Component
+public class MyMetaObjectHandler implements MetaObjectHandler {
+    private static final Logger log = LoggerFactory.getLogger(MyMetaObjectHandler.class);
+
+    public MyMetaObjectHandler() {
+    }
+
+    public void insertFill(MetaObject metaObject) {
+        this.strictInsertFill(metaObject, "triggerTime", LocalDateTime.class, LocalDateTime.now());
+        this.strictInsertFill(metaObject, "expirationDate", LocalDate.class, LocalDate.now());
+        this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
+        this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
+    }
+
+    public void updateFill(MetaObject metaObject) {
+        this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
+    }
+
+    public String generateHardwareCode() {
+        String fillCode = "";
+        if (OsSelect.isLinux()) {
+            fillCode = getLinuxDeviceCode();
+        } else {
+            fillCode = getWindowsDeviceCode();
+        }
+
+        return fillCode;
+    }
+
+    public static String getLinuxDeviceCode() {
+        String serialNo = "";
+        String macAddr = "";
+        String[] command = new String[]{"/bin/bash", "-c", "udevadm info --query=property --name=/dev/sda | grep ID_SERIAL"};
+
+        try {
+            Process process = (new ProcessBuilder(command)).start();
+
+            // 只定义一次 line
+            String line;
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
+                while((line = reader.readLine()) != null) {
+                    if (line.contains("ID_SERIAL_SHORT=")) {
+                        serialNo = line.split("ID_SERIAL_SHORT=")[1].trim();
+                    }
+                }
+            }
+
+            int exitCode = process.waitFor();
+            if (exitCode != 0) {
+                log.info("getLinuxSad 命令执行失败,错误码: " + exitCode);
+            }
+
+            String[] macCommand = new String[]{"/bin/bash", "-c", "ip -o link show | awk '!/lo:|virbr|docker|veth|usb/ {print $2, $(NF-2)}'"};
+            Process macProcess = (new ProcessBuilder(macCommand)).start();
+
+            // 这里删掉重复的 String line;
+            try (BufferedReader macReader = new BufferedReader(new InputStreamReader(macProcess.getInputStream()))) {
+                while((line = macReader.readLine()) != null) {
+                    line = line.trim();
+                    if (!line.isEmpty()) {
+                        String[] parts = line.split("\\s+", 2);
+                        if (parts.length >= 2) {
+                            macAddr = parts[1].trim();
+                            break;
+                        }
+                    }
+                }
+            }
+
+            int macExitCode = macProcess.waitFor();
+            if (macExitCode != 0) {
+                log.info("获取MAC地址命令执行失败,错误码: " + macExitCode);
+            }
+        } catch (InterruptedException | IOException e) {
+            e.printStackTrace();
+        }
+
+        String deviceCode = "";
+        if (StringUtils.isNotBlank(serialNo)) {
+            deviceCode = serialNo;
+        }
+
+        if (StringUtils.isNotBlank(macAddr)) {
+            deviceCode = serialNo + "|" + macAddr;
+        }
+
+        deviceCode = deviceCode.replaceAll(":", "");
+        log.info("Linux设备唯一码:" + deviceCode);
+        String hashCode = "";
+        if (StringUtils.isNotBlank(deviceCode)) {
+            try {
+                MessageDigest digest = MessageDigest.getInstance("SHA-256");
+                byte[] hashBytes = digest.digest(deviceCode.getBytes(StandardCharsets.UTF_8));
+                StringBuilder hexString = new StringBuilder();
+
+                for(byte b : hashBytes) {
+                    String hex = String.format("%02x", b);
+                    hexString.append(hex);
+                }
+
+                hashCode = hexString.toString();
+            } catch (NoSuchAlgorithmException e) {
+                log.error("SHA-256算法不可用", e);
+            }
+        }
+
+        hashCode = hashCode.toUpperCase();
+        log.info("Linux设备哈希唯一码(64位):" + hashCode + " 哈希数据长度 " + hashCode.length());
+        return hashCode;
+    }
+
+    public static String getWindowsDeviceCode() {
+        try {
+            Process process = Runtime.getRuntime().exec("wmic csproduct get UUID");
+            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+
+            String line;
+            while((line = reader.readLine()) != null) {
+                if (!line.isEmpty() && !line.contains("UUID")) {
+                    return line.trim();
+                }
+            }
+
+            reader.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+}

+ 17 - 0
src/main/java/com/usky/config/MybatisPlusConfig.java

@@ -0,0 +1,17 @@
+package com.usky.config;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class MybatisPlusConfig {
+    public MybatisPlusConfig() {
+    }
+
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return (new PaginationInterceptor()).setDbType(DbType.MYSQL);
+    }
+}

+ 16 - 0
src/main/java/com/usky/config/P6SpyLogger.java

@@ -0,0 +1,16 @@
+package com.usky.config;
+
+import com.p6spy.engine.spy.appender.MessageFormattingStrategy;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class P6SpyLogger implements MessageFormattingStrategy {
+    private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
+
+    public P6SpyLogger() {
+    }
+
+    public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String temp) {
+        return !"".equals(sql.trim()) ? this.format.format(new Date()) + " | took " + elapsed + "ms | " + category + " | connection " + connectionId + "\n " + sql + ";" : "";
+    }
+}

+ 16 - 0
src/main/java/com/usky/config/RootConfig.java

@@ -0,0 +1,16 @@
+package com.usky.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
+
+@Configuration
+public class RootConfig {
+    public RootConfig() {
+    }
+
+    @Bean
+    public MethodValidationPostProcessor methodValidationPostProcessor() {
+        return new MethodValidationPostProcessor();
+    }
+}

+ 19 - 0
src/main/java/com/usky/config/TaskSchedulerConfig.java

@@ -0,0 +1,19 @@
+package com.usky.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+
+@Configuration
+public class TaskSchedulerConfig {
+    public TaskSchedulerConfig() {
+    }
+
+    @Bean
+    public ThreadPoolTaskScheduler taskScheduler() {
+        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
+        scheduler.setPoolSize(10);
+        scheduler.setThreadNamePrefix("task-scheduler-");
+        return scheduler;
+    }
+}

+ 22 - 0
src/main/java/com/usky/config/TimedSetInform.java

@@ -0,0 +1,22 @@
+package com.usky.config;
+
+import java.util.Calendar;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class TimedSetInform {
+    private static final Logger log = LoggerFactory.getLogger(TimedSetInform.class);
+
+    public TimedSetInform() {
+    }
+
+    @Scheduled(
+            fixedRate = 60000L
+    )
+    public void systemInform() throws Exception {
+        System.out.println(Calendar.getInstance().get(5));
+    }
+}

+ 60 - 0
src/main/java/com/usky/config/WebMvcConfig.java

@@ -0,0 +1,60 @@
+package com.usky.config;
+
+import com.usky.Interceptor.ActivationInterceptor;
+import com.usky.Interceptor.DeviceActivationInterceptor;
+import com.usky.Interceptor.JwtInterceptor;
+import com.usky.Interceptor.ModuleAuthorizationInterceptor;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class WebMvcConfig implements WebMvcConfigurer {
+    @Value("${myconfig.filePath}")
+    private String filePath;
+    @Autowired
+    private JwtInterceptor jwtInterceptor;
+    @Autowired
+    private ActivationInterceptor activationInterceptor;
+    @Autowired
+    private ModuleAuthorizationInterceptor moduleAuthorizationInterceptor;
+    @Autowired
+    private DeviceActivationInterceptor deviceActivationInterceptor;
+    private static final List<String> EXCLUDE_PATH = Arrays.asList("/", "/css/**", "/js/**", "/img/**", "/vendor/**", "/jq/**", "/layui/**", "/myjs/**", "/assets/**", "/x-admin/**");
+
+    public WebMvcConfig() {
+    }
+
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(this.deviceActivationInterceptor).addPathPatterns(new String[]{"/agbox/**"}).excludePathPatterns(new String[]{"/agbox/login/webLogin"});
+        registry.addInterceptor(this.activationInterceptor).addPathPatterns(new String[]{"/**"}).excludePathPatterns(new String[]{"/system/systemActivation"}).excludePathPatterns(new String[]{"/system/getSysInfo"});
+        registry.addInterceptor(this.moduleAuthorizationInterceptor).addPathPatterns(new String[]{"/agbox/device/**"});
+        registry.addInterceptor(this.jwtInterceptor).addPathPatterns(new String[]{"/village/**"}).addPathPatterns(new String[]{"/basic/**"}).addPathPatterns(new String[]{"/share/car/**"}).addPathPatterns(new String[]{"/share/card/**"}).addPathPatterns(new String[]{"/company/**"}).addPathPatterns(new String[]{"/person/**"}).addPathPatterns(new String[]{"/device/**"}).addPathPatterns(new String[]{"/system/**"}).excludePathPatterns(new String[]{"/system/systemActivation"}).excludePathPatterns(new String[]{"/system/getLicenseModule"}).excludePathPatterns(new String[]{"/system/getSysInfo"});
+    }
+
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**").allowCredentials(true).allowedHeaders(new String[]{"*"}).allowedOrigins(new String[]{"*"}).allowedMethods(new String[]{"*"}).maxAge(86400L);
+    }
+
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+        Path paths = Paths.get(this.filePath);
+        String s = paths.getFileName().toString();
+        registry.addResourceHandler(new String[]{"/static/**"}).addResourceLocations(new String[]{"classpath:/static/"});
+        registry.addResourceHandler(new String[]{"/" + s + "/**"}).addResourceLocations(new String[]{"file:" + this.filePath});
+        registry.addResourceHandler(new String[]{"/agcp/**"}).addResourceLocations(new String[]{"file:" + this.filePath});
+    }
+
+    public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
+        configurer.ignoreAcceptHeader(true).useRegisteredExtensionsOnly(true).defaultContentType(new MediaType[]{MediaType.APPLICATION_JSON});
+    }
+}

+ 233 - 0
src/main/java/com/usky/controller/AcquisitionController.java

@@ -0,0 +1,233 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.acquisition.bo.AcquisitionChannelListBo;
+import com.usky.modules.entity.acquisition.bo.AcquisitionDeviceAddBo;
+import com.usky.modules.entity.acquisition.bo.AcquisitionEventAddBo;
+import com.usky.modules.entity.acquisition.bo.AcquisitionUpdateHeartBo;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.AcquisitionEventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"数据采集设备控制器"}
+)
+@ModuleRequired("1010")
+public class AcquisitionController {
+    private static final Logger log = LoggerFactory.getLogger(AcquisitionController.class);
+    private final AcquisitionEventCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("数据采集设备控制器对外接口")
+    @PostMapping({"/agbox/device/acquisition", "/agbox/device/acquisition/**"})
+    public Object patrol(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("数据采集控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    AcquisitionEventAddBo eventAddBo = (AcquisitionEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, AcquisitionEventAddBo.class);
+                    return this.addEvent(jsonrpc, eventAddBo, id);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.updateHeart(jsonrpc, (AcquisitionUpdateHeartBo)(new ObjectMapper()).treeToValue(params, AcquisitionUpdateHeartBo.class), servletRequest, id);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getChannelList(jsonrpc, (AcquisitionChannelListBo)(new ObjectMapper()).treeToValue(params, AcquisitionChannelListBo.class), id);
+                } else {
+                    return R.failed("没有该方法");
+                }
+            }
+        }
+    }
+
+    private Object getChannelList(String jsonrpc, AcquisitionChannelListBo bo, String id) {
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object updateHeart(String jsonrpc, AcquisitionUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    private Object addEvent(String jsonrpc, AcquisitionEventAddBo bo, String id) {
+        return this.service.addEvent(jsonrpc, bo, id);
+    }
+
+    private Object getEventCode(String jsonrpc, String id) {
+        return this.service.getEventCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/acquisition/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/acquisition/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/acquisition/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/acquisition/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/acquisition/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody AcquisitionDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/acquisition/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/acquisition/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody AcquisitionDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/acquisition/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/acquisition/getChannelList"})
+    public Object getUsbChannelList(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "100") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/acquisition/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/acquisition/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/acquisition/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/acquisition/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/acquisition/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/acquisition/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/acquisition/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public AcquisitionController(final AcquisitionEventCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 253 - 0
src/main/java/com/usky/controller/AlarmController.java

@@ -0,0 +1,253 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.alarm.bo.AlarmChannelListBo;
+import com.usky.modules.entity.alarm.bo.AlarmDeviceAddBo;
+import com.usky.modules.entity.alarm.bo.AlarmEventAddBo;
+import com.usky.modules.entity.alarm.bo.AlarmUpdateHeartBo;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.SystemAlarmCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"入侵和紧急报警控制器"}
+)
+@ModuleRequired("1007")
+public class AlarmController {
+    private static final Logger log = LoggerFactory.getLogger(AlarmController.class);
+    private final SystemAlarmCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("入侵紧急报警控制器对外接口")
+    @PostMapping({"/agbox/device/alarm", "/agbox/device/alarm/**"})
+    public Object usbalarm(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("入侵紧急报警控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        String protocol = servletRequest.getScheme();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                if (method.equals("getSystemCode")) {
+                    String id = jsonNode.path("channelId").asText();
+                    return this.getSystemCode(jsonrpc, id);
+                } else if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("channelId").asText();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    AlarmEventAddBo alarmEventAddBo = (AlarmEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, AlarmEventAddBo.class);
+                    return this.addEvent(jsonrpc, alarmEventAddBo, request, id);
+                } else if (method.equals("getEvent")) {
+                    String id = jsonNode.path("channelId").asText();
+                    return this.getEvent(jsonrpc, params.path("eventId").asText(), id, protocol);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("channelId").asText();
+                    return this.updateHeart(jsonrpc, (AlarmUpdateHeartBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, AlarmUpdateHeartBo.class), servletRequest, id);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("channelId").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("channelId").asText();
+                    return this.getChannelList(jsonrpc, (AlarmChannelListBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, AlarmChannelListBo.class), id);
+                } else {
+                    return R.failed("方法名不存在");
+                }
+            }
+        }
+    }
+
+    public Object getSystemCode(String jsonrpc, String id) {
+        return this.service.getSystemCode(jsonrpc, id);
+    }
+
+    public Object getEventCode(String jsonrpc, String id) {
+        return this.service.getEventCode(jsonrpc, id);
+    }
+
+    public Object addEvent(String jsonrpc, AlarmEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("alarm添加事件");
+        return this.service.addEvent(jsonrpc, bo, request, id);
+    }
+
+    public Object updateHeart(String jsonrpc, AlarmUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        log.info("alarm心跳");
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    public Object getEvent(String jsonrpc, String eventId, String id, String protocol) {
+        log.info("alarm获取事件");
+        return this.service.getEvent(jsonrpc, eventId, id, protocol);
+    }
+
+    public Object getDeviceList(String jsonrpc, String id) {
+        log.info("alarm设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    public Object getChannelList(String jsonrpc, AlarmChannelListBo bo, String id) {
+        log.info("alarm通道列表");
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    @ApiOperation("获取事件编码")
+    @PostMapping({"/device/alarm/getEventCode"})
+    public Object getEventCodeAdmin() {
+        return this.service.getEventCodeAdmin();
+    }
+
+    @ApiOperation("获取设备id列表")
+    @PostMapping({"/device/alarm/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取出入侵警报即时事件列表")
+    @PostMapping({"/device/alarm/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取出入侵警报设备配置列表")
+    @PostMapping({"/device/alarm/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增出入侵警报设备配置")
+    @PostMapping({"/device/alarm/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody AlarmDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取出入侵警报设备配置")
+    @PostMapping({"/device/alarm/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改入侵警报设备配置")
+    @PostMapping({"/device/alarm/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody AlarmDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除入侵警报设备配置")
+    @PostMapping({"/device/alarm/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/alarm/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/alarm/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/alarm/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/alarm/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/alarm/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/alarm/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/alarm/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("获取通道标签列表")
+    @PostMapping({"/device/alarm/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public AlarmController(final SystemAlarmCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 348 - 0
src/main/java/com/usky/controller/BasicController.java

@@ -0,0 +1,348 @@
+package com.usky.controller;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.exception.DefenceException;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.modules.entity.GisType;
+import com.usky.modules.entity.MsgSource;
+import com.usky.modules.entity.SystemType;
+import com.usky.modules.entity.basic.City;
+import com.usky.modules.entity.basic.District;
+import com.usky.modules.entity.basic.result.CityResult;
+import com.usky.modules.entity.basic.result.DistrictResult;
+import com.usky.modules.entity.basic.result.GisTypeResult;
+import com.usky.modules.entity.basic.result.MsgSourceResult;
+import com.usky.modules.entity.basic.result.NationalityResult;
+import com.usky.modules.entity.basic.result.PoliceStationInfoResult;
+import com.usky.modules.entity.basic.result.PoliceStationResult;
+import com.usky.modules.entity.basic.result.ProvinceResult;
+import com.usky.modules.entity.basic.result.RoadResult;
+import com.usky.modules.entity.basic.result.StreetResult;
+import com.usky.modules.entity.basic.result.SystemTypeCodeResult;
+import com.usky.modules.entity.basic.vo.CityCodeVO;
+import com.usky.modules.entity.basic.vo.DistrictCodeVO;
+import com.usky.modules.entity.basic.vo.GisTypeVo;
+import com.usky.modules.entity.basic.vo.MessageSourceVo;
+import com.usky.modules.entity.basic.vo.MsgSourceVo;
+import com.usky.modules.entity.basic.vo.NationalityCodeVo;
+import com.usky.modules.entity.basic.vo.NationalityVo;
+import com.usky.modules.entity.basic.vo.PoliceStationCodeVO;
+import com.usky.modules.entity.basic.vo.PoliceStationInfo;
+import com.usky.modules.entity.basic.vo.PoliceStationInfoVo;
+import com.usky.modules.entity.basic.vo.PoliceStations;
+import com.usky.modules.entity.basic.vo.Province;
+import com.usky.modules.entity.basic.vo.ProvinceCodeVO;
+import com.usky.modules.entity.basic.vo.Road;
+import com.usky.modules.entity.basic.vo.RoadCodeVO;
+import com.usky.modules.entity.basic.vo.Street;
+import com.usky.modules.entity.basic.vo.StreetCodeVO;
+import com.usky.modules.entity.basic.vo.SystemTypeCodeVo;
+import com.usky.modules.service.SysAreaService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"基础信息控制器"}
+)
+public class BasicController {
+    private static final Logger log = LoggerFactory.getLogger(BasicController.class);
+    @Autowired
+    private SysAreaService areaService;
+    @Autowired
+    private ConfigCacheListener config;
+
+    public BasicController() {
+    }
+
+    @ApiOperation("基础信息对外接口")
+    @PostMapping({"/agbox/basic", "/agbox/basic/**"})
+    public Object basic(@ModelAttribute CommonBo bo) throws IOException {
+        log.info("基础信息控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getProvinceCode")) {
+                    List<Province> provinceList = (List)this.getProvinceCode();
+                    ProvinceResult provinceResult = new ProvinceResult();
+                    provinceResult.setProvince((ArrayList)provinceList);
+                    ProvinceCodeVO provinceCodeVO = new ProvinceCodeVO();
+                    provinceCodeVO.setJsonrpc(jsonrpc);
+                    provinceCodeVO.setResult(provinceResult);
+                    provinceCodeVO.setId(jsonNode.path("id").asText());
+                    return provinceCodeVO;
+                } else if (method.equals("getCityCode")) {
+                    List<City> cityList = (List)this.getCityCode(params);
+                    CityResult cityResult = new CityResult();
+                    cityResult.setCity((ArrayList)cityList);
+                    CityCodeVO cityCodeVO = new CityCodeVO();
+                    cityCodeVO.setJsonrpc(jsonrpc);
+                    cityCodeVO.setResult(cityResult);
+                    cityCodeVO.setId(jsonNode.path("id").asText());
+                    return cityCodeVO;
+                } else if (method.equals("getDistrictCode")) {
+                    ArrayList<District> districtList = (ArrayList)this.getDistrictCode(params);
+                    DistrictResult districtResult = new DistrictResult();
+                    districtResult.setDistrict(districtList);
+                    DistrictCodeVO districtCodeVO = new DistrictCodeVO();
+                    districtCodeVO.setJsonrpc(jsonrpc);
+                    districtCodeVO.setResult(districtResult);
+                    districtCodeVO.setId(jsonNode.path("id").asText());
+                    return districtCodeVO;
+                } else if (method.equals("getStreetCode")) {
+                    List<Street> streetList = (List)this.getStreetCode(params);
+                    StreetResult streetResult = new StreetResult();
+                    streetResult.setStreet((ArrayList)streetList);
+                    StreetCodeVO streetCodeVO = new StreetCodeVO();
+                    streetCodeVO.setJsonrpc(jsonrpc);
+                    streetCodeVO.setResult(streetResult);
+                    streetCodeVO.setId(jsonNode.path("id").asText());
+                    return streetCodeVO;
+                } else if (method.equals("getRoadCode")) {
+                    ArrayList<Road> roadList = (ArrayList)this.getRoadCode(params);
+                    RoadResult roadResult = new RoadResult();
+                    roadResult.setRoad(roadList);
+                    RoadCodeVO roadCodeVO = new RoadCodeVO();
+                    roadCodeVO.setJsonrpc(jsonrpc);
+                    roadCodeVO.setResult(roadResult);
+                    roadCodeVO.setId(jsonNode.path("id").asText());
+                    return roadCodeVO;
+                } else if (method.equals("getPoliceStation")) {
+                    ArrayList<PoliceStations> policeStationList = (ArrayList)this.getPoliceStation(params);
+                    PoliceStationResult policeStationResult = new PoliceStationResult();
+                    policeStationResult.setPoliceStation(policeStationList);
+                    PoliceStationCodeVO policeStationCodeVO = new PoliceStationCodeVO();
+                    policeStationCodeVO.setDistrictCode(params.path("code").asInt());
+                    policeStationCodeVO.setPoliceStation(policeStationResult);
+                    policeStationCodeVO.setId(jsonNode.path("id").asText());
+                    return policeStationCodeVO;
+                } else if (method.equals("getPoliceStationInfo")) {
+                    PoliceStationInfoResult result = (PoliceStationInfoResult)this.getPoliceStationInfo(params);
+                    PoliceStationInfoVo vo = new PoliceStationInfoVo();
+                    vo.setJsonrpc(jsonrpc);
+                    vo.setResult(result);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else if (method.equals("getGisType")) {
+                    GisTypeVo gisTypeVo = new GisTypeVo();
+                    gisTypeVo.setJsonrpc(jsonrpc);
+                    gisTypeVo.setResult((GisTypeResult)this.getGisType());
+                    gisTypeVo.setId(jsonNode.path("id").asText());
+                    return gisTypeVo;
+                } else if (method.equals("getSourceCode")) {
+                    return (new MessageSourceVo()).setJsonrpc(jsonrpc).setResult((MsgSourceResult)this.getSourceCode()).setId(jsonNode.path("id").asText());
+                } else if (method.equals("getNationalityCode")) {
+                    ArrayList<NationalityVo> nationalityCode = (ArrayList)this.getNationalityCode();
+                    NationalityResult result = new NationalityResult();
+                    result.setNationality(nationalityCode);
+                    NationalityCodeVo vo = new NationalityCodeVo();
+                    vo.setJsonrpc(jsonrpc);
+                    vo.setResult(result);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else {
+                    return method.equals("getSystemTypeCode") ? (new SystemTypeCodeVo()).setJsonrpc(jsonrpc).setResult((SystemTypeCodeResult)this.getSystemTypeCode()).setId(jsonNode.path("id").asText()) : R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    @ApiOperation("获取省份编码")
+    public Object getProvinceCode() {
+        List<Province> provinces = this.areaService.getProvinceCode();
+        return provinces;
+    }
+
+    @ApiOperation("获取城市编码")
+    public Object getCityCode(JsonNode params) {
+        String provinceCode = params.path("code").asText();
+        List<City> cityList = this.areaService.getCityCode(provinceCode);
+        return cityList;
+    }
+
+    @ApiOperation("获取区县编码")
+    public Object getDistrictCode(JsonNode params) {
+        String cityCode = params.path("code").asText();
+        List<District> districtList = this.areaService.getDistrictCode(cityCode);
+        return districtList;
+    }
+
+    @ApiOperation("获取街道编码")
+    public Object getStreetCode(JsonNode params) {
+        String districtCode = params.path("code").asText();
+        List<Street> streetList = this.areaService.getStreetCode(districtCode);
+        return streetList;
+    }
+
+    @ApiOperation("获取道路编码")
+    public Object getRoadCode(JsonNode params) {
+        String name = params.path("name").asText();
+        String pinyin = params.path("pinyin").asText();
+        if (name.getBytes().length >= 2 && pinyin.getBytes().length >= 2) {
+            List<Road> roadList = this.areaService.getRoadCode(name, pinyin);
+            return roadList;
+        } else {
+            throw new DefenceException("道路名称搜索/道路名称拼音首字母搜索 必须≥2个字符。");
+        }
+    }
+
+    @ApiOperation("获取属地派出所编码")
+    public Object getPoliceStation(JsonNode params) {
+        Integer districtCode = params.path("code").asInt();
+        List<PoliceStations> policeStationsList = this.areaService.getPoliceStation(districtCode);
+        return policeStationsList;
+    }
+
+    @ApiOperation("获取派出所详细信息")
+    public Object getPoliceStationInfo(JsonNode params) {
+        String policeStationCode = params.path("code").asText();
+        PoliceStationInfo policeStationInfo = this.areaService.getPoliceStationInfo(policeStationCode);
+        PoliceStationInfoResult result = new PoliceStationInfoResult();
+        result.setPoliceStationInfo(policeStationInfo);
+        return result;
+    }
+
+    @ApiOperation("获取坐标系")
+    public Object getGisType() {
+        List<GisType> gisType = this.areaService.getGisType();
+        GisTypeResult result = new GisTypeResult();
+        result.setGisType(gisType);
+        return result;
+    }
+
+    @ApiOperation("获取信息来源编码")
+    public Object getSourceCode() {
+        List<MsgSource> msgSourceList = this.areaService.getSourceCode();
+        List<MsgSourceVo> collect = (List)msgSourceList.stream().map((msgSource) -> {
+            MsgSourceVo bean = (MsgSourceVo)BeanUtil.toBean(msgSource, MsgSourceVo.class);
+            return bean;
+        }).collect(Collectors.toList());
+        MsgSourceResult result = (new MsgSourceResult()).setSource(collect);
+        return result;
+    }
+
+    @ApiOperation("获取国家编码")
+    public Object getNationalityCode() {
+        return this.areaService.getNationalityCode();
+    }
+
+    @ApiOperation("获取系统类型编码")
+    public Object getSystemTypeCode() {
+        List<SystemType> systemTypeList = this.areaService.getSystemTypeCode();
+        SystemTypeCodeResult result = (new SystemTypeCodeResult()).setSystemType(systemTypeList);
+        return result;
+    }
+
+    @ApiOperation("admin获取系统类型编码")
+    @PostMapping({"/basic/getSystemTypeCodeAdmin"})
+    public Object getSystemTypeCodeAdmin() {
+        List<SystemType> systemTypeList = this.areaService.getSystemTypeCode();
+        return R.ok(systemTypeList);
+    }
+
+    @ApiOperation("获取当前区县编码下的所有派出所")
+    @PostMapping({"/basic/getPoliceStationByDistrict"})
+    public Object getPoliceStationByDistrict(@RequestParam("districtCode") String districtCode, @RequestParam(value = "name",required = false) String name) {
+        return this.areaService.getPoliceStationByDistrict(districtCode, name);
+    }
+
+    @ApiOperation("获取派出所所属部门类型")
+    @PostMapping({"/basic/getPoliceStationType"})
+    public Object getPoliceStationType() {
+        return this.areaService.getPoliceStationType();
+    }
+
+    @ApiOperation("生成随机UUID")
+    @GetMapping({"/basic/getUuid"})
+    public Object getUuid() {
+        return R.ok(IdUtil.randomUUID());
+    }
+
+    @ApiOperation("获取省编码")
+    @GetMapping({"/basic/getProvinceCode"})
+    public R<List<Province>> getProvinceCodeAdmin() {
+        List<Province> provinces = this.areaService.getProvinceCode();
+        return R.ok(provinces);
+    }
+
+    @ApiOperation("获取市编码")
+    @GetMapping({"/basic/getCityCode"})
+    public R<List<City>> getCityCodeAdmin(@RequestParam("provinceCode") Long provinceCode) {
+        List<City> cityCode = this.areaService.getCityCode(String.valueOf(provinceCode));
+        return R.ok(cityCode);
+    }
+
+    @ApiOperation("获取区县编码")
+    @GetMapping({"/basic/getDistrictCode"})
+    public R<List<District>> getDistrictCodeAdmin(@RequestParam("cityCode") Long cityCode) {
+        List<District> districtCode = this.areaService.getDistrictCode(String.valueOf(cityCode));
+        return R.ok(districtCode);
+    }
+
+    @ApiOperation("获取街道编码")
+    @GetMapping({"/basic/getStreetCode"})
+    public R<List<Street>> getProvinceCodeAdmin(@RequestParam("districtCode") Long districtCode) {
+        List<Street> streetCode = this.areaService.getStreetCode(String.valueOf(districtCode));
+        return R.ok(streetCode);
+    }
+
+    @ApiOperation("获取街道编码")
+    @GetMapping({"/basic/getRoadCode"})
+    public R<List<Road>> getRoadCodeAdmin(@RequestParam(value = "name",required = false) String name, @RequestParam(value = "pinyin",required = false) String pinyin) {
+        if (name.getBytes().length >= 2 && pinyin.getBytes().length >= 2) {
+            List<Road> roadList = this.areaService.getRoadCodeAdmin(name, pinyin);
+            return R.ok(roadList);
+        } else {
+            throw new DefenceException("道路名称搜索/道路名称拼音首字母搜索 必须≥2个字符。");
+        }
+    }
+}

+ 158 - 0
src/main/java/com/usky/controller/CarShareController.java

@@ -0,0 +1,158 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.modules.entity.car.bo.PlateGetBo;
+import com.usky.modules.entity.car.bo.PlateGetInfoBo;
+import com.usky.modules.entity.car.bo.PlateUpdateBo;
+import com.usky.modules.entity.car.vo.CarTypeCodeVo;
+import com.usky.modules.entity.car.vo.CarUpdatePlateVo;
+import com.usky.modules.entity.car.vo.PlateTypeCodeVo;
+import com.usky.modules.service.CarService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"车辆信息共享"}
+)
+public class CarShareController {
+    private static final Logger log = LoggerFactory.getLogger(CarShareController.class);
+    private final CarService carService;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("车辆信息共享控制器对外接口")
+    @PostMapping({"/agbox/share/car", "/agbox/share/car/**"})
+    public Object car(@ModelAttribute CommonBo bo) throws IOException {
+        log.info("车辆信息控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getCarTypeCode")) {
+                    CarTypeCodeVo vo = (CarTypeCodeVo)this.getCarTypeCode(jsonrpc);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else if (method.equals("getPlateTypeCode")) {
+                    PlateTypeCodeVo vo = (PlateTypeCodeVo)this.getPlateTypeCode(jsonrpc);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else if (method.equals("updatePlate")) {
+                    PlateUpdateBo plateUpdateBo = (PlateUpdateBo)(new ObjectMapper()).treeToValue(params, PlateUpdateBo.class);
+                    String result = (String)this.updatePlate(jsonrpc, plateUpdateBo);
+                    return (new CarUpdatePlateVo()).setId(method).setResult(result).setJsonrpc(jsonrpc).setId(jsonNode.path("id").asText());
+                } else if (method.equals("getPlate")) {
+                    PlateGetBo plateGetBo = (PlateGetBo)(new ObjectMapper()).treeToValue(params, PlateGetBo.class);
+                    String id = jsonNode.path("id").asText();
+                    return this.getPlate(id, jsonrpc, plateGetBo);
+                } else if (method.equals("getPlateColorCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getPlateColorCode(id, jsonrpc);
+                } else if (method.equals("getPlateInfo")) {
+                    String id = jsonNode.path("id").asText();
+                    PlateGetInfoBo plateGetBo = (PlateGetInfoBo)(new ObjectMapper()).treeToValue(params, PlateGetInfoBo.class);
+                    return this.getPlateInfo(id, jsonrpc, plateGetBo);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object getPlateInfo(String id, String jsonrpc, PlateGetInfoBo bo) {
+        return this.carService.getPlateInfo(id, jsonrpc, bo);
+    }
+
+    private Object getPlateColorCode(String id, String jsonrpc) {
+        return this.carService.getPlateColorCode(id, jsonrpc);
+    }
+
+    private Object getPlate(String id, String jsonrpc, PlateGetBo bo) {
+        return this.carService.getPlate(id, jsonrpc, bo);
+    }
+
+    public Object getCarTypeCode(String jsonrpc) {
+        return this.carService.getCarTypeCode(jsonrpc);
+    }
+
+    public Object getPlateTypeCode(String jsonrpc) {
+        return this.carService.getPlateTypeCode(jsonrpc);
+    }
+
+    public Object updatePlate(String jsonrpc, PlateUpdateBo bo) {
+        System.out.println(bo.toString());
+        return this.carService.updatePlate(jsonrpc, bo);
+    }
+
+    @ApiOperation("车辆共享列表")
+    @PostMapping({"/share/car/getPlateList"})
+    public Object getPlateList(@RequestParam(value = "page",required = false) Integer page, @RequestParam(value = "pageSize",required = false) Integer pageSize, @RequestParam(value = "plateNo",required = false) String plateNo, @RequestParam(value = "credentialNo",required = false) String credentialNo) {
+        return this.carService.getPlateList(page, pageSize, plateNo, credentialNo);
+    }
+
+    @ApiOperation("获取详细车牌信息")
+    @GetMapping({"/share/car/getPlateInfo"})
+    public Object getPlateInfoAdmin(@RequestParam("id") String id, String jsonrpc, PlateGetInfoBo plateGetBo, HttpServletRequest request) {
+        return this.carService.getPlateInfoAdmin(id, request);
+    }
+
+    @ApiOperation("获取详细车牌信息")
+    @GetMapping({"/share/car/delPlate"})
+    public Object delPlate(@RequestParam("id") String id) {
+        return this.carService.delPlate(id);
+    }
+
+    @ApiOperation("车辆状态更新——启用/停用")
+    @PostMapping({"/share/car/updatePlateState"})
+    public Object updateCardState(@RequestParam("plateNo") String plateNo, @RequestParam("credentialType") Integer credentialType, @RequestParam("credentialNo") String credentialNo) {
+        return this.carService.updatePlateState(plateNo, credentialType, credentialNo);
+    }
+
+    public CarShareController(final CarService carService, final ConfigCacheListener config) {
+        this.carService = carService;
+        this.config = config;
+    }
+}

+ 138 - 0
src/main/java/com/usky/controller/CardController.java

@@ -0,0 +1,138 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.modules.entity.card.bo.CardUpdateBo;
+import com.usky.modules.entity.card.bo.UpdateCardSetBo;
+import com.usky.modules.entity.card.vo.CardListVo;
+import com.usky.modules.entity.card.vo.CardTypeCodeVo;
+import com.usky.modules.entity.card.vo.UpdateCardVo;
+import com.usky.modules.service.CardService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"门禁卡号共享"}
+)
+public class CardController {
+    private static final Logger log = LoggerFactory.getLogger(CardController.class);
+    private final CardService cardService;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("门禁卡号共享控制器对外接口")
+    @PostMapping({"/agbox/share/card", "/agbox/share/card/**"})
+    public Object entrance(@ModelAttribute CommonBo bo) throws IOException {
+        log.info("门禁卡号控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getCardTypeCode")) {
+                    CardTypeCodeVo vo = (CardTypeCodeVo)this.getCardTypeCode(jsonrpc);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else if (method.equals("updateCard")) {
+                    CardUpdateBo cardUpdateBo = (CardUpdateBo)(new ObjectMapper()).treeToValue(params, CardUpdateBo.class);
+                    String result = (String)this.updateCard(jsonrpc, cardUpdateBo);
+                    return (new UpdateCardVo()).setId(method).setResult(result).setJsonrpc(jsonrpc).setId(jsonNode.path("id").asText());
+                } else if (method.equals("getCardList")) {
+                    CardListVo vo = (CardListVo)this.getCardList(jsonrpc, params);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else if (method.equals("updateCardSet")) {
+                    String id = jsonNode.path("id").asText();
+                    UpdateCardSetBo setBo = (UpdateCardSetBo)(new ObjectMapper()).treeToValue(params, UpdateCardSetBo.class);
+                    return this.updateCardSet(id, jsonrpc, setBo);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object updateCardSet(String id, String jsonrpc, UpdateCardSetBo bo) {
+        return this.cardService.updateCardSet(id, jsonrpc, bo);
+    }
+
+    public Object getCardTypeCode(String jsonrpc) {
+        return this.cardService.getCardTypeCode(jsonrpc);
+    }
+
+    public Object updateCard(String jsonrpc, CardUpdateBo bo) {
+        return this.cardService.updateCard(jsonrpc, bo);
+    }
+
+    @ApiOperation("卡号共享列表")
+    @PostMapping({"/share/card/getCardList"})
+    public Object getPlateList(@RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, @RequestParam(value = "cardNo",required = false) String cardNo, @RequestParam(value = "credentialNo",required = false) String credentialNo, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "cardType",required = false) Integer cardType) {
+        return this.cardService.getCardList(page, pageSize, cardNo, credentialNo, name, cardType);
+    }
+
+    @ApiOperation("卡号状态更新——启用/停用")
+    @PostMapping({"/share/card/updateCardState"})
+    public Object updateCardState(@RequestParam("id") String id) {
+        return this.cardService.updateCardState(id);
+    }
+
+    @ApiOperation("获取卡号类型列表")
+    @GetMapping({"/share/card/getCardTypeList"})
+    public Object getCardTypeList() {
+        return this.cardService.getCardTypeList();
+    }
+
+    public Object getCardList(String jsonrpc, JsonNode params) {
+        return this.cardService.getCardList(jsonrpc, params);
+    }
+
+    public Object updateCard(String jsonrpc, JsonNode params) {
+        return this.cardService.updateCardInfo(jsonrpc, params);
+    }
+
+    public CardController(final CardService cardService, final ConfigCacheListener config) {
+        this.cardService = cardService;
+        this.config = config;
+    }
+}

+ 57 - 0
src/main/java/com/usky/controller/ChangeKeyController.java

@@ -0,0 +1,57 @@
+package com.usky.controller;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.utils.FileUploadUtils;
+import com.usky.common.vo.FileVO;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+public class ChangeKeyController {
+    private static final Logger log = LoggerFactory.getLogger(ChangeKeyController.class);
+    @Autowired
+    private FileUploadUtils fileUploadUtils;
+
+    public ChangeKeyController() {
+    }
+
+    @PostMapping({"/entrance"})
+    public String handleUpload(@RequestParam("key") String key, @RequestParam("json") String jsonStr, HttpServletRequest request) throws IOException {
+        ObjectMapper objectMapper = new ObjectMapper();
+        JsonNode jsonNode = objectMapper.readTree(jsonStr);
+        String eventPicKey = jsonNode.path("params").path("eventPic").asText();
+        MultipartFile file = null;
+        if (request instanceof MultipartHttpServletRequest) {
+            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
+            if (eventPicKey != null && !eventPicKey.isEmpty()) {
+                file = multipartRequest.getFile(eventPicKey);
+            }
+        }
+
+        if (file != null && !file.isEmpty()) {
+            String fileName = file.getOriginalFilename();
+            System.out.println("Received file: " + fileName);
+            List<MultipartFile> files = Collections.singletonList(file);
+            List<FileVO> fileList = this.fileUploadUtils.fileUpload(files, "entrance", 1280, 720);
+            if (null != fileList) {
+                String imgUrl = ((FileVO)fileList.get(0)).getUrl();
+                log.info("imgUrl:{}", imgUrl);
+            }
+        } else {
+            System.out.println("No file uploaded or file is empty.");
+        }
+
+        return "Key: " + key + ", JSON processed. File uploaded: " + (file != null);
+    }
+}

+ 237 - 0
src/main/java/com/usky/controller/CollectionController.java

@@ -0,0 +1,237 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.collection.bo.CollectionChannelListBo;
+import com.usky.modules.entity.collection.bo.CollectionDeviceAddBo;
+import com.usky.modules.entity.collection.bo.CollectionEventAddBo;
+import com.usky.modules.entity.collection.bo.CollectionUpdateHeartBo;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.CollectionEventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"状态采集探测控制器"}
+)
+@ModuleRequired("1011")
+public class CollectionController {
+    private static final Logger log = LoggerFactory.getLogger(CollectionController.class);
+    private final CollectionEventCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("状态采集探测控制器对外接口")
+    @PostMapping({"/agbox/device/collection", "/agbox/device/collection/**"})
+    public Object patrol(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("状态采集控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    log.info("collection添加事件");
+                    String id = jsonNode.path("id").asText();
+                    CollectionEventAddBo eventAddBo = (CollectionEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, CollectionEventAddBo.class);
+                    return this.addEvent(jsonrpc, eventAddBo, request, id);
+                } else if (method.equals("updateHeart")) {
+                    log.info("collection心跳");
+                    String id = jsonNode.path("id").asText();
+                    return this.updateHeart(jsonrpc, (CollectionUpdateHeartBo)(new ObjectMapper()).treeToValue(params, CollectionUpdateHeartBo.class), servletRequest, id);
+                } else if (method.equals("getDeviceList")) {
+                    log.info("collection设备列表");
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    log.info("collection通道列表");
+                    String id = jsonNode.path("id").asText();
+                    return this.getChannelList(jsonrpc, (CollectionChannelListBo)(new ObjectMapper()).treeToValue(params, CollectionChannelListBo.class), id);
+                } else {
+                    return R.failed("没有该方法");
+                }
+            }
+        }
+    }
+
+    private Object getChannelList(String jsonrpc, CollectionChannelListBo bo, String id) {
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object updateHeart(String jsonrpc, CollectionUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    private Object addEvent(String jsonrpc, CollectionEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        return this.service.addEvent(jsonrpc, bo, request, id);
+    }
+
+    private Object getEventCode(String jsonrpc, String id) {
+        return this.service.getEventCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/collection/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/collection/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/collection/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/collection/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/collection/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody CollectionDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/collection/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/collection/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody CollectionDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/collection/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/collection/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/collection/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/collection/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/collection/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/collection/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/collection/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/collection/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/collection/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public CollectionController(final CollectionEventCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 240 - 0
src/main/java/com/usky/controller/CompanyController.java

@@ -0,0 +1,240 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.modules.entity.companys.bo.AddBuildingHouseBo;
+import com.usky.modules.entity.companys.bo.CompanyInfoUpdateBo;
+import com.usky.modules.entity.companys.bo.EquipAddOrUpdateBo;
+import com.usky.modules.entity.companys.result.CompanyHouseResult;
+import com.usky.modules.entity.companys.result.CompanyListResult;
+import com.usky.modules.entity.companys.result.CompanyPersonResult;
+import com.usky.modules.entity.companys.result.CompanyTypeResult;
+import com.usky.modules.entity.companys.result.ScaleTypeResult;
+import com.usky.modules.entity.companys.result.TradeCodeResult;
+import com.usky.modules.entity.companys.vo.CompanyHouseVo;
+import com.usky.modules.entity.companys.vo.CompanyListVo;
+import com.usky.modules.entity.companys.vo.CompanyPersonVo;
+import com.usky.modules.entity.companys.vo.CompanyTypeVo;
+import com.usky.modules.entity.companys.vo.ScaleTypeVo;
+import com.usky.modules.entity.companys.vo.TradeCodeVo;
+import com.usky.modules.service.CompanyService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"实有单位信息控制器"}
+)
+public class CompanyController {
+    private static final Logger log = LoggerFactory.getLogger(CompanyController.class);
+    @Autowired
+    private CompanyService companyService;
+    @Autowired
+    private ConfigCacheListener config;
+
+    public CompanyController() {
+    }
+
+    @ApiOperation("实有单位信息对外接口")
+    @PostMapping({"/agbox/company", "/agbox/company/**"})
+    public Object company(@ModelAttribute CommonBo bo) throws IOException {
+        log.info("实有单位控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getTypeCode")) {
+                    CompanyTypeResult result = (CompanyTypeResult)this.getTypeCode();
+                    CompanyTypeVo companyTypeVo = new CompanyTypeVo();
+                    companyTypeVo.setJsonrpc(jsonrpc);
+                    companyTypeVo.setResult(result);
+                    companyTypeVo.setId(jsonNode.path("id").asText());
+                    return companyTypeVo;
+                } else if (method.equals("getScaleCode")) {
+                    ScaleTypeResult result = (ScaleTypeResult)this.getScaleCode();
+                    ScaleTypeVo scaleTypeVo = new ScaleTypeVo();
+                    scaleTypeVo.setJsonrpc(jsonrpc);
+                    scaleTypeVo.setResult(result);
+                    scaleTypeVo.setId(jsonNode.path("id").asText());
+                    return scaleTypeVo;
+                } else if (method.equals("getTradeCode")) {
+                    TradeCodeResult result = (TradeCodeResult)this.getTradeCode();
+                    TradeCodeVo tradeCodeVo = new TradeCodeVo();
+                    tradeCodeVo.setJsonrpc(jsonrpc);
+                    tradeCodeVo.setResult(result);
+                    tradeCodeVo.setId(jsonNode.path("id").asText());
+                    return tradeCodeVo;
+                } else if (method.equals("getList")) {
+                    if (params.path("villageCode").asText().equals("")) {
+                        return R.failed("villageCode参数不能为空!");
+                    } else {
+                        CompanyListResult result = (CompanyListResult)this.getList(params);
+                        CompanyListVo companyListVo = new CompanyListVo();
+                        companyListVo.setJsonrpc(jsonrpc);
+                        companyListVo.setResult(result);
+                        companyListVo.setId(jsonNode.path("id").asText());
+                        return companyListVo;
+                    }
+                } else if (method.equals("getHouse")) {
+                    if (params.path("companyCode").asText().equals("")) {
+                        return R.failed("companyCode参数不能为空!");
+                    } else {
+                        CompanyHouseResult result = (CompanyHouseResult)this.getHouse(params);
+                        CompanyHouseVo companyHouseVo = new CompanyHouseVo();
+                        companyHouseVo.setJsonrpc(jsonrpc);
+                        companyHouseVo.setResult(result);
+                        companyHouseVo.setId(jsonNode.path("id").asText());
+                        return companyHouseVo;
+                    }
+                } else if (method.equals("getPerson")) {
+                    if (params.path("companyCode").asText().equals("")) {
+                        return R.failed("companyCode参数不能为空!");
+                    } else {
+                        CompanyPersonResult result = (CompanyPersonResult)this.getPerson(params);
+                        CompanyPersonVo personVo = new CompanyPersonVo();
+                        personVo.setJsonrpc(jsonrpc);
+                        personVo.setResult(result);
+                        personVo.setId(jsonNode.path("id").asText());
+                        return personVo;
+                    }
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    public Object getTypeCode() {
+        CompanyTypeResult result = this.companyService.getTypeCode();
+        return result;
+    }
+
+    public Object getScaleCode() {
+        ScaleTypeResult result = this.companyService.getScaleCode();
+        return result;
+    }
+
+    public Object getTradeCode() {
+        TradeCodeResult result = this.companyService.getTradeCode();
+        return result;
+    }
+
+    public Object getList(JsonNode params) {
+        CompanyListResult result = this.companyService.getList(params);
+        return result;
+    }
+
+    public Object getHouse(JsonNode params) {
+        CompanyHouseResult house = this.companyService.getHouse(params);
+        return house;
+    }
+
+    public Object getPerson(JsonNode params) {
+        CompanyPersonResult result = this.companyService.getPerson(params);
+        return result;
+    }
+
+    @ApiOperation("获取单位列表")
+    @PostMapping({"/company/getCompanyListAdmin"})
+    public Object getCompanyListAdmin(@RequestParam("villageCode") String villageCode) {
+        return this.companyService.getCompanyListAdmin(villageCode);
+    }
+
+    @ApiOperation("修改单位信息")
+    @PostMapping({"/company/companyUpdateOrAdd"})
+    public Object companyUpdateOrAdd(@RequestBody CompanyInfoUpdateBo bo) {
+        return this.companyService.companyUpdateOrAdd(bo);
+    }
+
+    @ApiOperation("获取单位类型列表")
+    @PostMapping({"/company/getCompanyType"})
+    public Object getCompanyType() {
+        return this.companyService.getCompanyType();
+    }
+
+    @ApiOperation("新增区域部位")
+    @PostMapping({"/company/addBuildingHouse"})
+    public Object addBuildingHouse(@RequestBody AddBuildingHouseBo bo) {
+        return this.companyService.addBuildingHouse(bo);
+    }
+
+    @ApiOperation("单位信息区域部位列表")
+    @PostMapping({"/company/getBuildingHouseList"})
+    public Object getBuildingHouseList(@RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, @RequestParam("companyCode") String companyCode) {
+        return this.companyService.getBuildingHouseList(page, pageSize, companyCode);
+    }
+
+    @ApiOperation("单位信息区域部位删除")
+    @PostMapping({"/company/delBuildingHouse"})
+    public Object delBuildingHouse(@RequestParam("id") String id) {
+        return this.companyService.delBuildingHouse(id);
+    }
+
+    @ApiOperation("新增or修改实有装备")
+    @PostMapping({"/company/equipUpdateOrAdd"})
+    public Object equipUpdateOrAdd(@ModelAttribute EquipAddOrUpdateBo bo) {
+        return this.companyService.equipUpdateOrAdd(bo);
+    }
+
+    @ApiOperation("获取装备类型")
+    @PostMapping({"/company/getEquipType"})
+    public Object getEquipType() {
+        return this.companyService.getEquipType();
+    }
+
+    @ApiOperation("获取设备信息")
+    @PostMapping({"/company/getEquipInfo"})
+    public Object getEquipInfo(@RequestParam("code") String code, HttpServletRequest request) {
+        return this.companyService.getEquipInfo(code, request);
+    }
+
+    @ApiOperation("删除设备信息")
+    @PostMapping({"/company/equipInfoDel"})
+    public Object equipInfoDel(@RequestParam("code") String code) {
+        return this.companyService.equipInfoDel(code);
+    }
+}

+ 263 - 0
src/main/java/com/usky/controller/EntranceController.java

@@ -0,0 +1,263 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.IpUtils;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.Entrances.bo.EntranceDeviceAddBo;
+import com.usky.modules.entity.Entrances.bo.EntranceEventAddBo;
+import com.usky.modules.entity.Entrances.bo.UpdateHeartBo;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.EntranceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"出入口控制控制器"}
+)
+@ModuleRequired("1005")
+public class EntranceController {
+    private static final Logger log = LoggerFactory.getLogger(EntranceController.class);
+    private final EntranceService entranceService;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("device/entrance出入口控制器")
+    @PostMapping({"/agbox/device/entrance", "/agbox/device/entrance/**"})
+    public Object entrance(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("出入门禁控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        log.info("设备IP地址:{}", IpUtils.getClientIp(servletRequest));
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getCertifiedTypeCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getCertifiedTypeCode(jsonrpc, id);
+                } else if (method.equals("getPersonTypeCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getPersonTypeCode(jsonrpc, id);
+                } else if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    EntranceEventAddBo addBo = (EntranceEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, EntranceEventAddBo.class);
+                    return this.addEvent(jsonrpc, addBo, request, id);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("id").asText();
+                    UpdateHeartBo updateHeartBo = (UpdateHeartBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, UpdateHeartBo.class);
+                    return this.updateHeart(jsonrpc, updateHeartBo, servletRequest, id);
+                } else if (method.equals("getEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEvent(jsonrpc, params.path("eventId").asText(), id, servletRequest);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getChannelList(jsonrpc, params, id);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    @ApiOperation("获取认证类型编码")
+    public Object getCertifiedTypeCode(String jsonrpc, String id) {
+        return this.entranceService.getCertifiedTypeCode(jsonrpc, id);
+    }
+
+    public Object getPersonTypeCode(String jsonrpc, String id) {
+        System.out.println("人员类型");
+        return this.entranceService.getPersonTypeCode(jsonrpc, id);
+    }
+
+    public Object getEventCode(String jsonrpc, String id) {
+        return this.entranceService.getEventCode(jsonrpc, id);
+    }
+
+    public Object addEvent(String jsonrpc, EntranceEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("entrance添加事件");
+        return this.entranceService.addEvent(jsonrpc, bo, request, id);
+    }
+
+    public Object updateHeart(String jsonrpc, UpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        log.info("entrance心跳");
+        return this.entranceService.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    public Object getEvent(String jsonrpc, String eventId, String id, HttpServletRequest servletRequest) {
+        log.info("entrance获取事件");
+        return this.entranceService.getEvent(jsonrpc, eventId, id, servletRequest);
+    }
+
+    public Object getDeviceList(String jsonrpc, String id) {
+        log.info("entrance设备列表");
+        return this.entranceService.getDeviceList(jsonrpc, id);
+    }
+
+    public Object getChannelList(String jsonrpc, JsonNode params, String id) {
+        log.info("entrance通道列表");
+        return this.entranceService.getChannelList(jsonrpc, params, id);
+    }
+
+    @ApiOperation("获取事件编码")
+    @PostMapping({"/device/entrance/getEventCode"})
+    public Object getEventCodeAdmin() {
+        return this.entranceService.getEventCodeAdmin();
+    }
+
+    @ApiOperation("获取设备id列表")
+    @PostMapping({"/device/entrance/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.entranceService.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取出入口控制即时事件列表")
+    @PostMapping({"/device/entrance/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize, HttpServletRequest request) {
+        return this.entranceService.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取出入口控制设备配置列表")
+    @PostMapping({"/device/entrance/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.entranceService.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增出入口控制设备配置")
+    @PostMapping({"/device/entrance/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody EntranceDeviceAddBo bo) {
+        return this.entranceService.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取出入口控制设备配置")
+    @PostMapping({"/device/entrance/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.entranceService.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改出入口控制设备配置")
+    @PostMapping({"/device/entrance/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody EntranceDeviceAddBo bo) {
+        return this.entranceService.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除出入口控制设备配置")
+    @PostMapping({"/device/entrance/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.entranceService.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/entrance/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.entranceService.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/entrance/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.entranceService.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/entrance/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.entranceService.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/entrance/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.entranceService.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/entrance/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.entranceService.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/entrance/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/entrance/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.entranceService.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("获取通道标签集合")
+    @PostMapping({"/device/entrance/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.entranceService.getChannelTagList();
+    }
+
+    public EntranceController(final EntranceService entranceService, final ConfigCacheListener config) {
+        this.entranceService = entranceService;
+        this.config = config;
+    }
+}

+ 355 - 0
src/main/java/com/usky/controller/GauthController.java

@@ -0,0 +1,355 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.enums.ErrorCode;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.global.ErrorResult;
+import com.usky.modules.entity.gauth.bo.GauthDeviceAddBo;
+import com.usky.modules.entity.gauth.bo.GauthDeviceParamUpdateBo;
+import com.usky.modules.entity.gauth.bo.GauthDevicePersonStatusBo;
+import com.usky.modules.entity.gauth.bo.GauthUpdatePersonBo;
+import com.usky.modules.entity.gauth.vo.GauthEventInfoVo;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.GauthCertificationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"组合认证控制器"}
+)
+@ModuleRequired("1004")
+public class GauthController {
+    private static final Logger log = LoggerFactory.getLogger(GauthController.class);
+    private final GauthCertificationService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("组合认证控制器对外接口")
+    @PostMapping({"/agbox/device/gauth", "/agbox/device/gauth/*/{deviceId}"})
+    public Object patrolDevice(@ModelAttribute CommonBo bo, @PathVariable(value = "deviceId",required = false) String deviceId, HttpServletRequest servletRequest) throws IOException {
+        log.info("组合认证控制器请求报文:{}", bo.toString());
+        log.info("gauth设备id:{}", deviceId);
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                if (method.equals("heart")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.heart(jsonrpc, params, deviceId, servletRequest, id);
+                } else if (method.equals("action")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.action(jsonrpc, params, deviceId, request, id);
+                } else if (method.equals("event")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.event(jsonrpc, params, id);
+                } else if (method.equals("getGroupFuction")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getGroupFuction(jsonrpc, id);
+                } else if (method.equals("getPersonList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getPersonList(jsonrpc, id, servletRequest);
+                } else if (method.equals("getPic")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getPic(jsonrpc, id, servletRequest);
+                } else if (method.equals("getEvent")) {
+                    GauthEventInfoVo vo = (GauthEventInfoVo)this.getEvent(jsonrpc, params.path("id").asText(), servletRequest);
+                    vo.setId(jsonNode.path("id").asText());
+                    return vo;
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("updatePerson")) {
+                    String id = jsonNode.path("id").asText();
+                    GauthUpdatePersonBo updatePersonBo = (GauthUpdatePersonBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, GauthUpdatePersonBo.class);
+                    return this.updatePerson(jsonrpc, updatePersonBo, request, id);
+                } else {
+                    return ErrorResult.fail(jsonrpc, ErrorCode.METHOD_INVALID);
+                }
+            }
+        }
+    }
+
+    private Object updatePerson(String jsonrpc, GauthUpdatePersonBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("gauth身份证信息");
+        return this.service.updatePerson(jsonrpc, bo, request, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        log.info("gauth设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object getEvent(String jsonrpc, String eventId, HttpServletRequest servletRequest) {
+        log.info("gauth获取事件");
+        return this.service.getEvent(jsonrpc, eventId, servletRequest);
+    }
+
+    private Object getPersonList(String jsonrpc, String id, HttpServletRequest servletRequest) {
+        log.info("gauth人员列表");
+        return this.service.getPersonList(jsonrpc, id, servletRequest);
+    }
+
+    private Object getGroupFuction(String jsonrpc, String id) {
+        return this.service.getGroupFuction(jsonrpc, id);
+    }
+
+    private Object getPic(String jsonrpc, String id, HttpServletRequest request) {
+        log.info("gauth人员照片");
+        return this.service.getPic(jsonrpc, id, request);
+    }
+
+    private Object event(String jsonrpc, JsonNode params, String id) {
+        log.info("gauth添加事件");
+        return this.service.event(jsonrpc, params);
+    }
+
+    private Object action(String jsonrpc, JsonNode param, String deviceId, MultipartHttpServletRequest request, String id) throws JsonProcessingException {
+        log.info("gauth添加事件");
+        return this.service.action(jsonrpc, param, deviceId, request, id);
+    }
+
+    private Object heart(String jsonrpc, JsonNode params, String deviceId, HttpServletRequest servletRequest, String id) {
+        log.info("gauth心跳");
+        return this.service.heart(jsonrpc, params, deviceId, servletRequest, id);
+    }
+
+    @ApiOperation("获取照片")
+    @GetMapping({"/device/gauth/ICCard"})
+    public Object getPicByCardNo(@RequestParam("id") String id) {
+        return this.service.getPicByCardNo(id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/gauth/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/gauth/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/gauth/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "functions",required = false) Integer functions, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, functions, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/gauth/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/gauth/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody GauthDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/gauth/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/gauth/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody GauthDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/gauth/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取组合功能/方式表")
+    @PostMapping({"/device/gauth/getDeviceFunctionListAdmin"})
+    public Object getDeviceFunctionListAdmin() {
+        return this.service.getDeviceFunctionListAdmin();
+    }
+
+    @ApiOperation("设备更新组合功能")
+    @PostMapping({"/device/gauth/updateDeviceFunctionAdmin"})
+    public Object cancelDeviceFunctionAdmin(@RequestParam("functions") String functions, @RequestParam("deviceId") String deviceId) {
+        return this.service.updateDeviceFunctionAdmin(functions, deviceId);
+    }
+
+    @ApiOperation("获取设备已选择组合功能")
+    @PostMapping({"/device/gauth/getDeviceSelectedFunctionAdmin"})
+    public Object getDeviceSelectedFunctionAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceSelectedFunctionAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备参数")
+    @PostMapping({"/device/gauth/updateDeviceParamsAdmin"})
+    public Object updateDeviceParamsAdmin(@RequestBody GauthDeviceParamUpdateBo bo) {
+        return this.service.updateDeviceParamsAdmin(bo);
+    }
+
+    @ApiOperation("获取场景类型")
+    @PostMapping({"/device/gauth/getSceneList"})
+    public Object getSceneList() {
+        return this.service.getSceneList();
+    }
+
+    @ApiOperation("获取认证方式")
+    @PostMapping({"/device/gauth/getCertificationList"})
+    public Object getCertificationList() {
+        return this.service.getCertificationList();
+    }
+
+    @ApiOperation("获取卡号类型")
+    @PostMapping({"/device/gauth/getCardTypeList"})
+    public Object getCardTypeList() {
+        return this.service.getCardTypeList();
+    }
+
+    @ApiOperation("获取韦根输出类型")
+    @PostMapping({"/device/gauth/getWegenTypeList"})
+    public Object getWegenTypeList() {
+        return this.service.getWegenTypeList();
+    }
+
+    @ApiOperation("获取心跳重启类型")
+    @PostMapping({"/device/gauth/getHeartRestartTypeList"})
+    public Object getHeartRestartTypeList() {
+        return this.service.getHeartRestartTypeList();
+    }
+
+    @ApiOperation("获取设备人员事件类型列表")
+    @PostMapping({"/device/gauth/getDevicePersonEventCode"})
+    public Object getDevicePersonEventCode() {
+        return this.service.getDevicePersonEventCode();
+    }
+
+    @ApiOperation("获取设备组合认证人员列表")
+    @PostMapping({"/device/gauth/getDevicePersonList"})
+    public Object getDevicePersonList(@RequestParam(value = "credentialNo",required = false) String credentialNo, @RequestParam(value = "functions",required = false) Integer functions) {
+        return this.service.getDevicePersonList(credentialNo, functions);
+    }
+
+    @ApiOperation("修改设备组合认证人员状态")
+    @PostMapping({"/device/gauth/updateDevicePersonStatus"})
+    public Object updateDevicePersonStatus(@RequestBody GauthDevicePersonStatusBo bo) {
+        return this.service.updateDevicePersonStatus(bo);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/gauth/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/gauth/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/gauth/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/gauth/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/gauth/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/gauth/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/gauth/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/gauth/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public GauthController(final GauthCertificationService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 45 - 0
src/main/java/com/usky/controller/IndexController.java

@@ -0,0 +1,45 @@
+package com.usky.controller;
+
+import com.usky.common.utils.Response;
+import com.usky.modules.entity.global.vo.MenuInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping({"/agbox/index"})
+@Api(
+        tags = {"主控制器"}
+)
+@Validated
+public class IndexController {
+    private static final Logger log = LoggerFactory.getLogger(IndexController.class);
+
+    public IndexController() {
+    }
+
+    @ApiOperation("获取用户权限菜单")
+    @GetMapping({"/getStaffRole"})
+    public Response getStaffRole(@RequestHeader("token") String token) {
+        List<MenuInfo> menuInfoList = new ArrayList();
+        MenuInfo menuInfo = new MenuInfo();
+        menuInfo.setId(12);
+        menuInfo.setMenuName("企业管理");
+        menuInfo.setMenuType(1);
+        menuInfo.setParentId(0);
+        menuInfo.setMenuUrl("/index/mapIndex");
+        menuInfo.setMenuIcon("subicon1");
+        menuInfo.setSort(1);
+        menuInfo.setChildMenu(new ArrayList());
+        menuInfoList.add(menuInfo);
+        return Response.success(menuInfoList);
+    }
+}

+ 37 - 0
src/main/java/com/usky/controller/LoginController.java

@@ -0,0 +1,37 @@
+package com.usky.controller;
+
+import com.baomidou.mybatisplus.extension.api.R;
+import com.usky.filter.LoginFilter;
+import com.usky.modules.service.impl.ManagerServiceImpl;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.util.Map;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+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;
+
+@RestController
+@RequestMapping({"/agbox/login"})
+@Api(
+        tags = {"登录控制器"}
+)
+@Validated
+public class LoginController {
+    @Autowired
+    private ManagerServiceImpl managerService;
+
+    public LoginController() {
+    }
+
+    @ApiOperation("网页端登录")
+    @PostMapping({"/webLogin"})
+    public R webLogin(@RequestBody LoginFilter loginFilter) {
+        Map<String, Object> map = this.managerService.webLogin(loginFilter.getLoginName(), loginFilter.getLoginPWD());
+        String conect = map.get("conect").toString();
+        Long code = Long.parseLong(map.get("code").toString());
+        return code != 200L ? R.failed("用户名或密码错误!") : R.ok(map);
+    }
+}

+ 247 - 0
src/main/java/com/usky/controller/ParkingController.java

@@ -0,0 +1,247 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.parking.bo.ParkingChannelListBo;
+import com.usky.modules.entity.parking.bo.ParkingDeviceAddBo;
+import com.usky.modules.entity.parking.bo.ParkingEventAddBo;
+import com.usky.modules.entity.parking.bo.ParkingUpdateHeartBo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.ParkingEventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"停车库(场)管理控制器"}
+)
+@ModuleRequired("1006")
+public class ParkingController {
+    private static final Logger log = LoggerFactory.getLogger(ParkingController.class);
+    private final ParkingEventCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("停车库(场)管理控制器对外接口")
+    @PostMapping({"/agbox/device/parking", "/agbox/device/parking/**"})
+    public Object patrol(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("车牌抓拍控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    ParkingEventAddBo addBo = (ParkingEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, ParkingEventAddBo.class);
+                    return this.addEvent(jsonrpc, addBo, request, id);
+                } else if (method.equals("updateHeart")) {
+                    ParkingUpdateHeartBo heartBo = (ParkingUpdateHeartBo)(new ObjectMapper()).treeToValue(params, ParkingUpdateHeartBo.class);
+                    String id = jsonNode.path("id").asText();
+                    return this.updateHeart(jsonrpc, heartBo, request, id);
+                } else if (method.equals("getEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEvent(jsonrpc, params, id, servletRequest);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").asText();
+                    ParkingChannelListBo channelListBo = (ParkingChannelListBo)(new ObjectMapper()).treeToValue(params, ParkingChannelListBo.class);
+                    return this.getChannelList(jsonrpc, channelListBo, id);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object getChannelList(String jsonrpc, ParkingChannelListBo bo, String id) {
+        log.info("parking通道列表");
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        log.info("parking设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object getEvent(String jsonrpc, JsonNode params, String id, HttpServletRequest servletRequest) {
+        log.info("parking获取事件");
+        return this.service.getEvent(jsonrpc, params, id, servletRequest);
+    }
+
+    private Object updateHeart(String jsonrpc, ParkingUpdateHeartBo bo, HttpServletRequest request, String id) {
+        log.info("parking心跳");
+        return this.service.updateHeart(jsonrpc, bo, request, id);
+    }
+
+    private Object addEvent(String jsonrpc, ParkingEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("parking添加事件");
+        return this.service.addEvent(jsonrpc, bo, request, id);
+    }
+
+    private Object getEventCode(String jsonrpc, String id) {
+        return this.service.getEventCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/parking/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/parking/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/parking/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/parking/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/parking/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody ParkingDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/parking/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/parking/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody ParkingDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/parking/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/parking/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/parking/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/parking/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/parking/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/parking/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/parking/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/parking/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/parking/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public ParkingController(final ParkingEventCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 226 - 0
src/main/java/com/usky/controller/PatrolController.java

@@ -0,0 +1,226 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.patrol.bo.PatrolChannelListBo;
+import com.usky.modules.entity.patrol.bo.PatrolDeviceAddBo;
+import com.usky.modules.entity.patrol.bo.PatrolEventAddBo;
+import com.usky.modules.entity.patrol.bo.PatrolUpdateHeartBo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.PatrolChannelService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"实时电子巡检控制器"}
+)
+@ModuleRequired("1008")
+public class PatrolController {
+    private static final Logger log = LoggerFactory.getLogger(PatrolController.class);
+    private final PatrolChannelService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("实时电子巡检控制器对外接口")
+    @PostMapping({"/agbox/device/patrol", "/agbox/device/patrol/**"})
+    public Object patrol(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("电子巡检控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                if (method.equals("getPatrolEventCode")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getPatrolEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.addEvent(jsonrpc, (PatrolEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, PatrolEventAddBo.class), request, id);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.updateHeart(jsonrpc, (PatrolUpdateHeartBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, PatrolUpdateHeartBo.class), servletRequest, id);
+                } else if (method.equals("getEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEvent(jsonrpc, params.path("eventId").asText(), id, servletRequest);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getChannelList(jsonrpc, (PatrolChannelListBo)(new ObjectMapper()).treeToValue(params, PatrolChannelListBo.class), id);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object getPatrolEventCode(String jsonrpc, String id) {
+        return this.service.getPatrolEventCode(jsonrpc, id);
+    }
+
+    private Object addEvent(String jsonrpc, PatrolEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("patrol添加事件");
+        return this.service.addEvent(jsonrpc, bo, request, id);
+    }
+
+    private Object updateHeart(String jsonrpc, PatrolUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        log.info("patrol心跳");
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    private Object getEvent(String jsonrpc, String eventId, String id, HttpServletRequest servletRequest) {
+        log.info("patrol获取事件");
+        return this.service.getEvent(jsonrpc, eventId, id, servletRequest);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        log.info("patrol设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object getChannelList(String jsonrpc, PatrolChannelListBo bo, String id) {
+        log.info("patrol通道列表");
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    @ApiOperation("获取事件编码")
+    @PostMapping({"/device/patrol/getEventCode"})
+    public Object getEventCodeAdmin() {
+        return this.service.getEventCodeAdmin();
+    }
+
+    @ApiOperation("获取设备id列表")
+    @PostMapping({"/device/patrol/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取实时电子巡检即时事件列表")
+    @PostMapping({"/device/patrol/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取实时电子巡检设备配置列表")
+    @PostMapping({"/device/patrol/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增实时电子巡检设备配置")
+    @PostMapping({"/device/patrol/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody PatrolDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取实时电子巡检设备配置")
+    @PostMapping({"/device/patrol/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改实时电子巡检设备配置")
+    @PostMapping({"/device/patrol/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody PatrolDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除实时电子巡检设备配置")
+    @PostMapping({"/device/patrol/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/patrol/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/patrol/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/patrol/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/patrol/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/patrol/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/patrol/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    public PatrolController(final PatrolChannelService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 239 - 0
src/main/java/com/usky/controller/PerceptionController.java

@@ -0,0 +1,239 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.perception.bo.PerceptionChannelListBo;
+import com.usky.modules.entity.perception.bo.PerceptionDeviceAddBo;
+import com.usky.modules.entity.perception.bo.PerceptionEventAddBo;
+import com.usky.modules.entity.perception.bo.PerceptionUpdateHeartBo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.PerceptionEventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"状态感知探测控制器"}
+)
+@ModuleRequired("1009")
+public class PerceptionController {
+    private static final Logger log = LoggerFactory.getLogger(PerceptionController.class);
+    private final PerceptionEventCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("状态感知探测控制器对外接口")
+    @PostMapping({"/agbox/device/perception", "/agbox/device/perception/**"})
+    public Object patrol(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("状态感知控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").asText();
+                    PerceptionEventAddBo eventAddBo = (PerceptionEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, PerceptionEventAddBo.class);
+                    return this.addEvent(jsonrpc, eventAddBo, request, id, servletRequest);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("id").asText();
+                    PerceptionUpdateHeartBo updateHeartBo = (PerceptionUpdateHeartBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, PerceptionUpdateHeartBo.class);
+                    return this.updateHeart(jsonrpc, updateHeartBo, servletRequest, id);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").asText();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").asText();
+                    PerceptionChannelListBo channelListBo = (PerceptionChannelListBo)(new ObjectMapper()).treeToValue(params, PerceptionChannelListBo.class);
+                    return this.getChannelList(jsonrpc, channelListBo, id);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object getChannelList(String jsonrpc, PerceptionChannelListBo params, String id) {
+        log.info("perception通道列表");
+        return this.service.getChannelList(jsonrpc, params, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        log.info("perception设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object updateHeart(String jsonrpc, PerceptionUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        log.info("perception心跳");
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    private Object addEvent(String jsonrpc, PerceptionEventAddBo bo, MultipartHttpServletRequest request, String id, HttpServletRequest servletRequest) {
+        log.info("perception添加事件");
+        return this.service.addEvent(jsonrpc, bo, request, id, servletRequest);
+    }
+
+    private Object getEventCode(String jsonrpc, String id) {
+        return this.service.getEventCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/perception/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/perception/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/perception/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/perception/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/perception/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody PerceptionDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/perception/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/perception/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody PerceptionDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/perception/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/perception/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/perception/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/perception/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/perception/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/perception/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/perception/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/perception/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/perception/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public PerceptionController(final PerceptionEventCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 563 - 0
src/main/java/com/usky/controller/PersonController.java

@@ -0,0 +1,563 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.exception.DefenceException;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.modules.entity.persons.bo.BatchFunctionPersonDelBo;
+import com.usky.modules.entity.persons.bo.BindingHouseBo;
+import com.usky.modules.entity.persons.bo.BindingPlotAreaLocationBo;
+import com.usky.modules.entity.persons.bo.BuildingHouseInfoAddBo;
+import com.usky.modules.entity.persons.bo.CardInfoAddBo;
+import com.usky.modules.entity.persons.bo.ConcernPersonUpdateOrAddBo;
+import com.usky.modules.entity.persons.bo.FollowPersonAddBo;
+import com.usky.modules.entity.persons.bo.FunctionPersonUpdateBo;
+import com.usky.modules.entity.persons.bo.PersonInfoBo;
+import com.usky.modules.entity.persons.bo.PlateInfoAddBo;
+import com.usky.modules.entity.persons.bo.RegisteredPersonAddBo;
+import com.usky.modules.entity.persons.bo.SetPersonPowerCodeBo;
+import com.usky.modules.entity.persons.bo.UpdateFollowPersonInfoBo;
+import com.usky.modules.entity.persons.bo.UpdateRegisteredPersonsInfoBo;
+import com.usky.modules.entity.persons.vo.BindingHouseVo;
+import com.usky.modules.entity.persons.vo.CredentialTypeCodeVo;
+import com.usky.modules.entity.persons.vo.EducationCodeVo;
+import com.usky.modules.entity.persons.vo.HouseInfoListVO;
+import com.usky.modules.entity.persons.vo.HouserelCodeVo;
+import com.usky.modules.entity.persons.vo.LabelCodeVo;
+import com.usky.modules.entity.persons.vo.MaritalStatusCodeVo;
+import com.usky.modules.entity.persons.vo.NationCodeVo;
+import com.usky.modules.entity.persons.vo.PeopleTypeCodeVo;
+import com.usky.modules.entity.persons.vo.PersonBlackListVO;
+import com.usky.modules.entity.persons.vo.PersonCarInfoVO;
+import com.usky.modules.entity.persons.vo.PersonInfoUpdateVO;
+import com.usky.modules.entity.persons.vo.PersonInfoVO;
+import com.usky.modules.entity.persons.vo.PersonLabelInfoVO;
+import com.usky.modules.entity.persons.vo.PublicOrderCodeVo;
+import com.usky.modules.entity.persons.vo.SecurityDutiesCodeVo;
+import com.usky.modules.entity.persons.vo.ValidateCredentialVO;
+import com.usky.modules.service.PersonService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"人员信息控制器"}
+)
+public class PersonController {
+    private static final Logger log = LoggerFactory.getLogger(PersonController.class);
+    private final PersonService personService;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("身份人像采集对外接口")
+    @PostMapping({"/agbox/person", "/agbox/person/**"})
+    public Object person(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info("人员信息控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                MultipartHttpServletRequest request = null;
+                if (servletRequest instanceof MultipartHttpServletRequest) {
+                    request = (MultipartHttpServletRequest)servletRequest;
+                }
+
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                String IDPic = params.path("domicile").path("IDPic").asText();
+                MultipartFile file = null;
+                if (IDPic != null && !IDPic.isEmpty()) {
+                    file = request.getFile(IDPic);
+                }
+
+                switch (method) {
+                    case "getCredentialTypeCode":
+                        CredentialTypeCodeVo credentialTypeCodeVo = (CredentialTypeCodeVo)this.getCredentialTypeCode();
+                        credentialTypeCodeVo.setJsonrpc(jsonrpc);
+                        credentialTypeCodeVo.setId(jsonNode.path("id").asText());
+                        return credentialTypeCodeVo;
+                    case "getEducationCode":
+                        EducationCodeVo educationCodeVo = (EducationCodeVo)this.getEducationCode();
+                        educationCodeVo.setJsonrpc(jsonrpc);
+                        educationCodeVo.setId(jsonNode.path("id").asText());
+                        return educationCodeVo;
+                    case "getMaritalStatusCode":
+                        MaritalStatusCodeVo maritalStatusCodeVo = (MaritalStatusCodeVo)this.getMaritalStatusCode();
+                        maritalStatusCodeVo.setJsonrpc(jsonrpc);
+                        maritalStatusCodeVo.setId(jsonNode.path("id").asText());
+                        return maritalStatusCodeVo;
+                    case "getNationCode":
+                        NationCodeVo nationCodeVo = (NationCodeVo)this.getNationCode();
+                        nationCodeVo.setJsonrpc(jsonrpc);
+                        nationCodeVo.setId(jsonNode.path("id").asText());
+                        return nationCodeVo;
+                    case "getLabelCode":
+                        LabelCodeVo labelCodeVo = (LabelCodeVo)this.getLabelCode();
+                        labelCodeVo.setJsonrpc(jsonrpc);
+                        labelCodeVo.setId(jsonNode.path("id").asText());
+                        return labelCodeVo;
+                    case "getHouseRelCode":
+                        HouserelCodeVo houserelCodeVo = (HouserelCodeVo)this.getHouseRelCode();
+                        houserelCodeVo.setJsonrpc(jsonrpc);
+                        houserelCodeVo.setId(jsonNode.path("id").asText());
+                        return houserelCodeVo;
+                    case "getPeopleTypeCode":
+                        PeopleTypeCodeVo peopleTypeCodeVo = (PeopleTypeCodeVo)this.getPeopleTypeCode();
+                        peopleTypeCodeVo.setJsonrpc(jsonrpc);
+                        peopleTypeCodeVo.setId(jsonNode.path("id").asText());
+                        return peopleTypeCodeVo;
+                    case "getSecurityDutiesCode":
+                        SecurityDutiesCodeVo securityDutiesCodeVo = (SecurityDutiesCodeVo)this.getSecurityDutiesCode();
+                        securityDutiesCodeVo.setJsonrpc(jsonrpc);
+                        securityDutiesCodeVo.setId(jsonNode.path("id").asText());
+                        return securityDutiesCodeVo;
+                    case "getPublicOrderCode":
+                        PublicOrderCodeVo publicOrderCodeVo = (PublicOrderCodeVo)this.getPublicOrderCode();
+                        publicOrderCodeVo.setJsonrpc(jsonrpc);
+                        publicOrderCodeVo.setId(jsonNode.path("id").asText());
+                        return publicOrderCodeVo;
+                    case "getInfo":
+                        PersonInfoVO personInfoVO = (PersonInfoVO)this.getInfo(params, servletRequest);
+                        personInfoVO.setJsonrpc(jsonrpc);
+                        personInfoVO.setId(jsonNode.path("id").asText());
+                        return personInfoVO;
+                    case "getHouse":
+                        HouseInfoListVO houseInfoListVO = (HouseInfoListVO)this.getHouse(params);
+                        houseInfoListVO.setJsonrpc(jsonrpc);
+                        houseInfoListVO.setId(jsonNode.path("id").asText());
+                        return houseInfoListVO;
+                    case "getLabel":
+                        PersonLabelInfoVO personLabelInfoVO = (PersonLabelInfoVO)this.getLabel(params);
+                        personLabelInfoVO.setJsonrpc(jsonrpc);
+                        personLabelInfoVO.setId(jsonNode.path("id").asText());
+                        return personLabelInfoVO;
+                    case "getCar":
+                        PersonCarInfoVO personCarInfoVO = (PersonCarInfoVO)this.getCar(params);
+                        personCarInfoVO.setJsonrpc(jsonrpc);
+                        personCarInfoVO.setId(jsonNode.path("id").asText());
+                        return personCarInfoVO;
+                    case "getBlackList":
+                        Integer page = params.path("page").asInt();
+                        Integer pageSize = params.path("pageSize").asInt();
+                        Integer eventCode = params.path("eventCode").asInt();
+                        if (page == 0) {
+                            page = 1;
+                        }
+
+                        if (pageSize == 0) {
+                            pageSize = 10000;
+                        }
+
+                        PersonBlackListVO vo = (PersonBlackListVO)this.getBlackList(eventCode, page, pageSize, servletRequest);
+                        vo.setJsonrpc(jsonrpc);
+                        vo.setId(jsonNode.path("id").asText());
+                        return vo;
+                    case "update":
+                        PersonInfoBo personInfoBo = (PersonInfoBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, PersonInfoBo.class);
+                        PersonInfoUpdateVO personInfoUpdateVO = (PersonInfoUpdateVO)this.updatePerson(personInfoBo, file);
+                        personInfoUpdateVO.setId(jsonNode.path("id").asText());
+                        return personInfoUpdateVO;
+                    case "bindingHouse":
+                        BindingHouseBo bindingHouseBo = (BindingHouseBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, BindingHouseBo.class);
+                        String result = (String)this.bindingHouse(bindingHouseBo);
+                        return (new BindingHouseVo()).setId(jsonNode.path("id").asText()).setResult(result).setJsonrpc(jsonrpc);
+                    case "validateCredential":
+                        String credentialNo = params.path("credentialNo").asText();
+                        if (credentialNo != null && !credentialNo.isEmpty()) {
+                            ValidateCredentialVO validateCredentialVO = (ValidateCredentialVO)this.validateCredential(credentialNo);
+                            validateCredentialVO.setId(jsonNode.path("id").asText());
+                            return validateCredentialVO;
+                        }
+
+                        throw new DefenceException("credentialNo不能为空");
+                    case "deletePerson":
+                        String id = jsonNode.path("id").asText();
+                        return this.deletePerson(id, jsonrpc, params);
+                    default:
+                        return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object deletePerson(String id, String jsonrpc, JsonNode params) {
+        return this.personService.deletePerson(id, jsonrpc, params);
+    }
+
+    public Object getCredentialTypeCode() {
+        return this.personService.getCredentialTypeCode();
+    }
+
+    public Object getEducationCode() {
+        return this.personService.getEducationCode();
+    }
+
+    public Object getMaritalStatusCode() {
+        return this.personService.getMaritalStatusCode();
+    }
+
+    public Object getNationCode() {
+        return this.personService.getNationCode();
+    }
+
+    public Object getLabelCode() {
+        return this.personService.getLabelCode();
+    }
+
+    public Object getHouseRelCode() {
+        return this.personService.getHouseRelCode();
+    }
+
+    public Object getPeopleTypeCode() {
+        System.out.println("户籍人员");
+        return this.personService.getPeopleTypeCode();
+    }
+
+    public Object getSecurityDutiesCode() {
+        return this.personService.getSecurityDutiesCode();
+    }
+
+    public Object getPublicOrderCode() {
+        return this.personService.getPublicOrderCode();
+    }
+
+    public Object getInfo(JsonNode params, HttpServletRequest servletRequest) {
+        return this.personService.getInfo(params, servletRequest);
+    }
+
+    public Object getHouse(JsonNode params) {
+        return this.personService.getHouse(params);
+    }
+
+    public Object getLabel(JsonNode params) {
+        return this.personService.getLabel(params);
+    }
+
+    public Object getCar(JsonNode params) {
+        return this.personService.getCar(params);
+    }
+
+    public Object getBlackList(@RequestParam("eventCode") Integer eventCode, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.personService.getBlackList(eventCode, page, pageSize, request);
+    }
+
+    @ApiOperation("获取person类型分类编码")
+    @PostMapping({"/person/getPersonTypeCode"})
+    public Object getPersonTypeCode() {
+        System.out.println("人员类型");
+        return this.personService.getPersonTypeCode();
+    }
+
+    @ApiOperation("获取people类型分类编码")
+    @PostMapping({"/person/getPeopleTypeCodeList"})
+    public Object getPeopleTypeCodeList() {
+        return this.personService.getPeopleTypeCodeList();
+    }
+
+    @ApiOperation("添加/更新人员基本信息")
+    @PostMapping({"/person/update"})
+    public Object updatePerson(@RequestBody PersonInfoBo personInfoBo, MultipartFile file) {
+        return this.personService.updatePerson(personInfoBo, file);
+    }
+
+    @ApiOperation("绑定人屋关系")
+    @PostMapping({"/person/bindingHouse"})
+    public Object bindingHouse(@RequestBody BindingHouseBo bindingHouseBo) {
+        return this.personService.bindingHouse(bindingHouseBo);
+    }
+
+    @ApiOperation("本地身份证校验")
+    @PostMapping({"/person/validateCredential"})
+    public Object validateCredential(@RequestParam("credentialNo") String credentialNo) {
+        return this.personService.validateCredential(credentialNo);
+    }
+
+    @ApiOperation("新增或修改关注人员")
+    @PostMapping({"/person/concernPersonUpdateOrAdd"})
+    public Object concernPersonUpdateOrAdd(@ModelAttribute ConcernPersonUpdateOrAddBo bo) {
+        return this.personService.concernPersonUpdateOrAdd(bo);
+    }
+
+    @ApiOperation("获取在册人员列表")
+    @PostMapping({"/person/getRegisteredPersonsList"})
+    public Object getRegisteredPersonsList(@RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "credentialNo",required = false) String credentialNo, @RequestParam(value = "personTypeCode",required = false) Integer personTypeCode) {
+        return this.personService.getRegisteredPersonsList(page, pageSize, name, credentialNo, personTypeCode);
+    }
+
+    @ApiOperation("在册人员添加部位信息")
+    @PostMapping({"/person/addBuildingHouseInfo"})
+    public Object addBuildingHouseInfo(@RequestBody BuildingHouseInfoAddBo bo) {
+        return this.personService.addBuildingHouseInfo(bo);
+    }
+
+    @ApiOperation("在册人员删除部位信息")
+    @PostMapping({"/person/delBuildingHouseInfo"})
+    public Object delBuildingHouseInfo(@RequestParam("id") String id) {
+        return this.personService.delBuildingHouseInfo(id);
+    }
+
+    @ApiOperation("在册人员添加门禁卡号信息")
+    @PostMapping({"/person/addCardInfo"})
+    public Object addCardInfo(@RequestBody CardInfoAddBo bo) {
+        return this.personService.addCardInfo(bo);
+    }
+
+    @ApiOperation("在册人员删除门禁卡号信息")
+    @PostMapping({"/person/delCardInfo"})
+    public Object delCardInfo(@RequestParam("id") String id) {
+        return this.personService.delCardInfo(id);
+    }
+
+    @ApiOperation("在册人员添加车辆信息")
+    @PostMapping({"/person/addPlateInfo"})
+    public Object addPlateInfo(@RequestBody PlateInfoAddBo bo) {
+        return this.personService.addPlateInfo(bo);
+    }
+
+    @ApiOperation("在册人员删除车辆信息")
+    @PostMapping({"/person/delPlateInfo"})
+    public Object delPlateInfo(@RequestParam("id") String id) {
+        return this.personService.delPlateInfo(id);
+    }
+
+    @ApiOperation("车牌类型编码列表")
+    @GetMapping({"/person/getPlateTypeCodeList"})
+    public Object getPlateTypeCodeList() {
+        return this.personService.getPlateTypeCodeList();
+    }
+
+    @ApiOperation("车辆类型编码列表")
+    @GetMapping({"/person/getCarTypeCodeList"})
+    public Object getCarTypeCodeList() {
+        return this.personService.getCarTypeCodeList();
+    }
+
+    @ApiOperation("人屋关系编码列表")
+    @GetMapping({"/person/getHouserelCodeList"})
+    public Object getHouserelCodeList() {
+        return this.personService.getHouserelCodeList();
+    }
+
+    @ApiOperation("卡类型编码列表")
+    @GetMapping({"/person/getCardTypeCodeList"})
+    public Object getCardTypeCodeList() {
+        return this.personService.getCardTypeCodeList();
+    }
+
+    @ApiOperation("地块编码列表")
+    @GetMapping({"/person/getVillageCodeList"})
+    public Object getVillageCodeList() {
+        return this.personService.getVillageCodeList();
+    }
+
+    @ApiOperation("获取在册人员详细信息")
+    @PostMapping({"/person/getRegisteredPersonsInfo"})
+    public Object getRegisteredPersonsInfo(@RequestParam("personCode") String personCode, HttpServletRequest request) {
+        return this.personService.getRegisteredPersonsInfo(personCode, request);
+    }
+
+    @ApiOperation("新增在册人员")
+    @PostMapping({"/person/addRegisteredPerson"})
+    public Object addRegisteredPerson(@ModelAttribute RegisteredPersonAddBo bo) throws JsonProcessingException {
+        return this.personService.addRegisteredPerson(bo);
+    }
+
+    @ApiOperation("获取安全职责编码列表")
+    @GetMapping({"/person/getSecurityDutiesCodeList"})
+    public Object getSecurityDutiesCodeList() {
+        return this.personService.getSecurityDutiesCodeList();
+    }
+
+    @ApiOperation("获取婚姻状况编码列表")
+    @GetMapping({"/person/getMaritalCodeList"})
+    public Object getMaritalCodeList() {
+        return this.personService.getMaritalCodeList();
+    }
+
+    @ApiOperation("获取教育程度编码列表")
+    @GetMapping({"/person/getEducationCodeList"})
+    public Object getEducationCodeList() {
+        return this.personService.getEducationCodeList();
+    }
+
+    @ApiOperation("获取国家编码列表")
+    @GetMapping({"/person/getNationalityCodeList"})
+    public Object getNationalityCodeList() {
+        return this.personService.getNationalityCodeList();
+    }
+
+    @ApiOperation("获取民族编码列表")
+    @GetMapping({"/person/getNationCodeList"})
+    public Object getNationCodeList() {
+        return this.personService.getNationCodeList();
+    }
+
+    @ApiOperation("获取证件类型编码列表")
+    @GetMapping({"/person/getCredentialTypeCodeList"})
+    public Object getCredentialTypeCodeList() {
+        return this.personService.getCredentialTypeCodeList();
+    }
+
+    @ApiOperation("获取实有力量编码列表")
+    @GetMapping({"/person/getPowerCodeList"})
+    public Object getPowerCodeList() {
+        return this.personService.getPowerCodeList();
+    }
+
+    @ApiOperation("修改在册人员信息")
+    @PostMapping({"/person/updateRegisteredPersonsInfo"})
+    public Object updateRegisteredPersonsInfo(@ModelAttribute UpdateRegisteredPersonsInfoBo bo) throws JsonProcessingException {
+        return this.personService.updateRegisteredPersonsInfo(bo);
+    }
+
+    @ApiOperation("删除在册人员信息")
+    @PostMapping({"/person/delRegisteredPersonsInfo"})
+    public Object delRegisteredPersonsInfo(@RequestParam("personCode") String personCode) {
+        return this.personService.delRegisteredPersonsInfo(personCode);
+    }
+
+    @ApiOperation("治安人员类型设置")
+    @PostMapping({"/person/setPersonPowerCode"})
+    public Object setPersonPowerCode(@RequestBody SetPersonPowerCodeBo bo) {
+        return this.personService.setPersonPowerCode(bo.getPersonCode(), bo.getPowerCode());
+    }
+
+    @ApiOperation("在册人员地块区域部位绑定")
+    @PostMapping({"/person/binding"})
+    public Object bindingPlotAreaLocation(@RequestBody BindingPlotAreaLocationBo bo) {
+        return this.personService.bindingPlotAreaLocation(bo);
+    }
+
+    @ApiOperation("获取组合认证人员类型列表")
+    @PostMapping({"/person/getGroupFunctionList"})
+    public Object getGroupFunctionList() {
+        return this.personService.getGroupFunctionList();
+    }
+
+    @ApiOperation("添加组合认证人员")
+    @PostMapping({"/person/setGroupFunction"})
+    public Object setGroupFunction(@RequestParam("personCode") String personCode, @RequestParam("functions") Integer functions, @RequestParam("cardNo") String cardNo) {
+        return this.personService.setGroupFunction(personCode, functions, cardNo);
+    }
+
+    @ApiOperation("获取治安人员列表")
+    @PostMapping({"/person/getSecurityPersonList"})
+    public Object getSecurityPersonList(@RequestParam(value = "powerCode",required = false) String powerCode, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "credentialNo",required = false) String credentialNo, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
+        return this.personService.getSecurityPersonList(powerCode, name, credentialNo, page, pageSize);
+    }
+
+    @ApiOperation("获取治安人员详细信息")
+    @GetMapping({"/person/getSecurityPersonInfo"})
+    public Object getSecurityPersonInfo(@RequestParam("personCode") String personCode, HttpServletRequest request) {
+        return this.personService.getSecurityPersonInfo(personCode, request);
+    }
+
+    @ApiOperation("获取组合认证人员列表")
+    @PostMapping({"/person/getFunctionPersonList"})
+    public Object getFunctionPersonList(@RequestParam(value = "functions",required = false) Integer functions, @RequestParam(value = "name",required = false) String name, @RequestParam(value = "credentialNo",required = false) String credentialNo, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
+        return this.personService.getFunctionPersonList(functions, name, credentialNo, page, pageSize);
+    }
+
+    @ApiOperation("获取组合认证人员详细信息")
+    @GetMapping({"/person/getFunctionPersonInfo"})
+    public Object getFunctionPersonInfo(@RequestParam("personCode") String personCode, HttpServletRequest request) {
+        return this.personService.getFunctionPersonInfo(personCode, request);
+    }
+
+    @ApiOperation("批量删除组合认证人员")
+    @PostMapping({"/person/batchFunctionPersonDel"})
+    public Object batchFunctionPersonDel(@RequestBody BatchFunctionPersonDelBo bo) {
+        return this.personService.batchFunctionPersonDel(bo.getPersonCodeList());
+    }
+
+    @ApiOperation("组合认证人员信息修改")
+    @PostMapping({"/person/functionPersonUpdate"})
+    public Object functionPersonUpdate(@RequestBody FunctionPersonUpdateBo bo) {
+        return this.personService.functionPersonUpdate(bo);
+    }
+
+    @ApiOperation("新增关注人员")
+    @PostMapping({"/person/followPersonAdd"})
+    public Object followPersonAdd(@ModelAttribute FollowPersonAddBo bo) {
+        return this.personService.followPersonAdd(bo);
+    }
+
+    @ApiOperation("获取关注人员类型编码")
+    @PostMapping({"/person/getFollowPersonType"})
+    public Object getFollowPersonType() {
+        return this.personService.getFollowPersonType();
+    }
+
+    @ApiOperation("获取关注人员列表")
+    @PostMapping({"/person/getFollowPersonList"})
+    public Object getFollowPersonList(@RequestParam(value = "followPeopleType",required = false) Integer followPeopleType, @RequestParam(value = "name",required = false) String name, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.personService.getFollowPersonList(followPeopleType, name, page, pageSize, request);
+    }
+
+    @ApiOperation("修改关注人员信息")
+    @PostMapping({"/person/updateFollowPersonInfo"})
+    public Object updateFollowPersonInfo(@RequestBody UpdateFollowPersonInfoBo bo) {
+        return this.personService.updateFollowPersonInfo(bo);
+    }
+
+    @ApiOperation("移除关注人员信息")
+    @PostMapping({"/person/followPersonDel"})
+    public Object followPersonDel(@RequestParam("personCode") String personCode) {
+        return this.personService.followPersonDel(personCode);
+    }
+
+    @ApiOperation("在册人员通行码人员注册二维码")
+    @PostMapping({"/person/getQrCode"})
+    public Object getQrCode() {
+        return this.personService.getQrCode();
+    }
+
+    public PersonController(final PersonService personService, final ConfigCacheListener config) {
+        this.personService = personService;
+        this.config = config;
+    }
+}

+ 237 - 0
src/main/java/com/usky/controller/RoadController.java

@@ -0,0 +1,237 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.roadblock.bo.RoadblockChannelListBo;
+import com.usky.modules.entity.roadblock.bo.RoadblockDeviceAddBo;
+import com.usky.modules.entity.roadblock.bo.RoadblockEventAddBo;
+import com.usky.modules.entity.roadblock.bo.RoadblockUpdateHeartBo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.RoadblockEventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"阻车路障探测控制器"}
+)
+@ModuleRequired("1012")
+public class RoadController {
+    private static final Logger log = LoggerFactory.getLogger(RoadController.class);
+    private final RoadblockEventCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("阻车路障探测控制器对外接口")
+    @PostMapping({"/agbox/device/roadblock", "/agbox/device/roadblock/**"})
+    public Object patrol(@ModelAttribute CommonBo bo, HttpServletRequest servletRequest) throws IOException {
+        log.info(bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            MultipartHttpServletRequest request = null;
+            if (servletRequest instanceof MultipartHttpServletRequest) {
+                request = (MultipartHttpServletRequest)servletRequest;
+            }
+
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").textValue();
+                    RoadblockEventAddBo eventAddBo = (RoadblockEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, RoadblockEventAddBo.class);
+                    return this.addEvent(jsonrpc, eventAddBo, request, id);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.updateHeart(jsonrpc, (RoadblockUpdateHeartBo)(new ObjectMapper()).treeToValue(params, RoadblockUpdateHeartBo.class), servletRequest, id);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getChannelList(jsonrpc, (RoadblockChannelListBo)(new ObjectMapper()).treeToValue(params, RoadblockChannelListBo.class), id);
+                } else {
+                    return R.failed("没有该方法");
+                }
+            }
+        }
+    }
+
+    private Object getChannelList(String jsonrpc, RoadblockChannelListBo bo, String id) {
+        log.info("road通道列表");
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        log.info("road设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object updateHeart(String jsonrpc, RoadblockUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        log.info("road心跳");
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    private Object addEvent(String jsonrpc, RoadblockEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("road添加事件");
+        return this.service.addEvent(jsonrpc, bo, request, id);
+    }
+
+    private Object getEventCode(String jsonrpc, String id) {
+        return this.service.getEventCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/roadblock/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/roadblock/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/roadblock/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/roadblock/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/roadblock/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody RoadblockDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/roadblock/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/roadblock/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody RoadblockDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/roadblock/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/roadblock/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/roadblock/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/roadblock/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/roadblock/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/roadblock/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/roadblock/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/roadblock/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/roadblock/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public RoadController(final RoadblockEventCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

+ 243 - 0
src/main/java/com/usky/controller/SnapController.java

@@ -0,0 +1,243 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.snap.bo.SnapChannelListBo;
+import com.usky.modules.entity.snap.bo.SnapDeviceAddBo;
+import com.usky.modules.entity.snap.bo.SnapEventAddBo;
+import com.usky.modules.entity.snap.bo.SnapUpdateHeartBo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.service.SnapTypeCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+@RestController
+@Api(
+        tags = {"人脸抓拍系统/实时智能分析控制器"}
+)
+@ModuleRequired("1001")
+public class SnapController {
+    private static final Logger log = LoggerFactory.getLogger(SnapController.class);
+    private final SnapTypeCodeService service;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("人脸抓拍系统/实时智能分析对外控制器")
+    @PostMapping({"/agbox/device/snap", "/agbox/device/snap/**"})
+    public Object snap(@RequestParam("key") String key, @RequestParam("json") String json, HttpServletRequest servletRequest) throws IOException {
+        log.info("地块/区域控制器请求报文:key={},json={}", key, json);
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            MultipartHttpServletRequest request = null;
+            if (servletRequest instanceof MultipartHttpServletRequest) {
+                request = (MultipartHttpServletRequest)servletRequest;
+            }
+
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").textValue();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getSnapTypeCode")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getSnapTypeCode(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").textValue();
+                    SnapEventAddBo eventAddBo = (SnapEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, SnapEventAddBo.class);
+                    return this.addEvent(jsonrpc, eventAddBo, request, id);
+                } else if (method.equals("updateHeart")) {
+                    SnapUpdateHeartBo updateHeartBo = (SnapUpdateHeartBo)(new ObjectMapper()).treeToValue(params, SnapUpdateHeartBo.class);
+                    String id = jsonNode.path("id").textValue();
+                    return this.updateHeart(jsonrpc, updateHeartBo, servletRequest, id);
+                } else if (method.equals("getEvent")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getEvent(jsonrpc, params, id, servletRequest);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").textValue();
+                    SnapChannelListBo channelListBo = (SnapChannelListBo)(new ObjectMapper()).treeToValue(params, SnapChannelListBo.class);
+                    return this.getChannelList(jsonrpc, channelListBo, id);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    private Object getChannelList(String jsonrpc, SnapChannelListBo bo, String id) {
+        log.info("snap通道列表");
+        return this.service.getChannelList(jsonrpc, bo, id);
+    }
+
+    private Object getDeviceList(String jsonrpc, String id) {
+        log.info("snap设备列表");
+        return this.service.getDeviceList(jsonrpc, id);
+    }
+
+    private Object getEvent(String jsonrpc, JsonNode params, String id, HttpServletRequest servletRequest) {
+        log.info("snap获取事件");
+        return this.service.getEvent(jsonrpc, params, id, servletRequest);
+    }
+
+    private Object updateHeart(String jsonrpc, SnapUpdateHeartBo bo, HttpServletRequest servletRequest, String id) {
+        log.info("snap心跳");
+        return this.service.updateHeart(jsonrpc, bo, servletRequest, id);
+    }
+
+    private Object addEvent(String jsonrpc, SnapEventAddBo bo, MultipartHttpServletRequest request, String id) {
+        log.info("snap添加事件");
+        return this.service.addEvent(jsonrpc, bo, request, id);
+    }
+
+    private Object getSnapTypeCode(String jsonrpc, String id) {
+        return this.service.getSnapTypeCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/snap/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/snap/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/snap/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/snap/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/snap/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody SnapDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/snap/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/snap/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody SnapDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/snap/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/snap/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/snap/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/snap/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/snap/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/snap/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/snap/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/snap/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/snap/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public SnapController(final SnapTypeCodeService service, final ConfigCacheListener config) {
+        this.service = service;
+        this.config = config;
+    }
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2523 - 0
src/main/java/com/usky/controller/SystemController.java


+ 233 - 0
src/main/java/com/usky/controller/UsbAlarmController.java

@@ -0,0 +1,233 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.global.Common;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.entity.usbalarm.bo.UsbDeviceAddBo;
+import com.usky.modules.entity.usbalarm.bo.UsbDeviceUpdateHeartBo;
+import com.usky.modules.entity.usbalarm.bo.UsbEventAddBo;
+import com.usky.modules.service.EventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"USB防拔插控制器"}
+)
+@ModuleRequired("1003")
+public class UsbAlarmController {
+    private static final Logger log = LoggerFactory.getLogger(UsbAlarmController.class);
+    private final EventCodeService eventCodeService;
+    private final ConfigCacheListener config;
+
+    @ApiOperation("USB防拔插控制器对外接口")
+    @PostMapping({"/agbox/device/usbalarm", "/agbox/device/usbalarm/**"})
+    public Object usbalarm(@ModelAttribute CommonBo bo, HttpServletRequest request) throws IOException {
+        log.info("USB防插拔控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getEventCode")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getEventCode(jsonrpc, id);
+                } else if (method.equals("getDeviceList")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getDeviceList(jsonrpc, id);
+                } else if (method.equals("addEvent")) {
+                    String id = jsonNode.path("id").textValue();
+                    UsbEventAddBo usbEventAddBo = (UsbEventAddBo)(new ObjectMapper()).registerModule(new JavaTimeModule()).treeToValue(params, UsbEventAddBo.class);
+                    return this.addEvent(jsonrpc, usbEventAddBo, id);
+                } else if (method.equals("updateHeart")) {
+                    String id = jsonNode.path("id").textValue();
+                    UsbDeviceUpdateHeartBo updateHeartBo = (UsbDeviceUpdateHeartBo)(new ObjectMapper()).treeToValue(params, UsbDeviceUpdateHeartBo.class);
+                    return this.updateHeart(jsonrpc, updateHeartBo, request, id);
+                } else if (method.equals("getChannelList")) {
+                    String id = jsonNode.path("id").textValue();
+                    return this.getChannelList(jsonrpc, params, id);
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    public Object getEventCode(String jsonrpc, String id) {
+        return this.eventCodeService.getEventCode(jsonrpc, id);
+    }
+
+    @ApiOperation("获取事件编码")
+    @PostMapping({"/device/usbalarm/getEventCode"})
+    public Object getEventCodeAdmin() {
+        return this.eventCodeService.getEventCodeAdmin();
+    }
+
+    @ApiOperation("获取设备列表")
+    public Object getDeviceList(String jsonrpc, String id) {
+        log.info("USB设备列表");
+        return this.eventCodeService.getDeviceList(jsonrpc, id);
+    }
+
+    @ApiOperation("获取设备id列表")
+    @PostMapping({"/device/usbalarm/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.eventCodeService.getDeviceIdListAdmin();
+    }
+
+    public Object addEvent(String jsonrpc, UsbEventAddBo bo, String id) {
+        log.info("USB添加事件");
+        return this.eventCodeService.addEvent(jsonrpc, bo, id);
+    }
+
+    public Object updateHeart(String jsonrpc, UsbDeviceUpdateHeartBo bo, HttpServletRequest request, String id) {
+        log.info("USB心跳");
+        return this.eventCodeService.updateHeart(jsonrpc, bo, request, id);
+    }
+
+    @ApiOperation("获取通道列表")
+    public Object getChannelList(String jsonrpc, JsonNode params, String id) {
+        log.info("USB通道列表");
+        return this.eventCodeService.getChannelList(jsonrpc, params, id);
+    }
+
+    @ApiOperation("获取USB即时事件列表")
+    @PostMapping({"/device/usbalarm/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
+        return this.eventCodeService.getEventList(deviceId, eventCode, date, page, pageSize);
+    }
+
+    @ApiOperation("获取USB设备配置列表")
+    @PostMapping({"/device/usbalarm/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.eventCodeService.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增USB设备配置")
+    @PostMapping({"/device/usbalarm/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody UsbDeviceAddBo bo) {
+        return this.eventCodeService.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取USB设备配置")
+    @PostMapping({"/device/usbalarm/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.eventCodeService.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改USB设备配置")
+    @PostMapping({"/device/usbalarm/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody UsbDeviceAddBo bo) {
+        return this.eventCodeService.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除USB设备配置")
+    @PostMapping({"/device/usbalarm/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.eventCodeService.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/usbalarm/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.eventCodeService.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/usbalarm/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.eventCodeService.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/usbalarm/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.eventCodeService.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/usbalarm/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.eventCodeService.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/usbalarm/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.eventCodeService.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/usbalarm/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/usbalarm/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.eventCodeService.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/usbalarm/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.eventCodeService.getChannelTagList();
+    }
+
+    public UsbAlarmController(final EventCodeService eventCodeService, final ConfigCacheListener config) {
+        this.eventCodeService = eventCodeService;
+        this.config = config;
+    }
+}

+ 133 - 0
src/main/java/com/usky/controller/VideoController.java

@@ -0,0 +1,133 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.usky.common.annotation.ModuleRequired;
+import com.usky.common.utils.QrCodeUtils;
+import com.usky.modules.entity.global.bo.ChannelAddBo;
+import com.usky.modules.entity.global.vo.FeatureVo;
+import com.usky.modules.entity.usbalarm.bo.ChannelUpdateBo;
+import com.usky.modules.entity.video.bo.VideoDeviceAddBo;
+import com.usky.modules.service.VideoEventCodeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import javax.servlet.http.HttpServletRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"视频安防监控控制器"}
+)
+@ModuleRequired("1002")
+public class VideoController {
+    private static final Logger log = LoggerFactory.getLogger(VideoController.class);
+    private final VideoEventCodeService service;
+
+    @ApiOperation("获取设备列表")
+    @PostMapping({"/device/video/getDeviceIdList"})
+    public Object getDeviceIdListAdmin() {
+        return this.service.getDeviceIdListAdmin();
+    }
+
+    @ApiOperation("获取事件类型列表")
+    @PostMapping({"/device/video/getEventCode"})
+    public Object getEventCodeListAdmin() {
+        return this.service.getEventCodeListAdmin();
+    }
+
+    @ApiOperation("获取即时事件列表")
+    @PostMapping({"/device/video/getEventListAdmin"})
+    public Object getEventList(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "eventCode",required = false) Integer eventCode, @RequestParam(value = "date",required = false) String date, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        return this.service.getEventList(deviceId, eventCode, date, page, pageSize, request);
+    }
+
+    @ApiOperation("获取设备配置列表")
+    @PostMapping({"/device/video/getDeviceListAdmin"})
+    public Object getDeviceListAdmin(@RequestParam(value = "deviceId",required = false) String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getDeviceListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增设备配置")
+    @PostMapping({"/device/video/addDeviceAdmin"})
+    public Object addDeviceAdmin(@RequestBody VideoDeviceAddBo bo) {
+        return this.service.addDeviceAdmin(bo);
+    }
+
+    @ApiOperation("获取设备配置")
+    @PostMapping({"/device/video/getDeviceInfoAdmin"})
+    public Object getDeviceInfoAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.getDeviceInfoAdmin(deviceId);
+    }
+
+    @ApiOperation("修改设备配置")
+    @PostMapping({"/device/video/updateDeviceInfoAdmin"})
+    public Object updateDeviceInfoAdmin(@RequestBody VideoDeviceAddBo bo) {
+        return this.service.updateDeviceInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除设备配置")
+    @PostMapping({"/device/video/delDeviceAdmin"})
+    public Object delDeviceAdmin(@RequestParam("deviceId") String deviceId) {
+        return this.service.delDeviceAdmin(deviceId);
+    }
+
+    @ApiOperation("获取通道配置列表")
+    @PostMapping({"/device/video/getChannelList"})
+    public Object getChannelListAdmin(@RequestParam("deviceId") String deviceId, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.service.getChannelListAdmin(deviceId, page, pageSize);
+    }
+
+    @ApiOperation("新增通道配置")
+    @PostMapping({"/device/video/addChannelAdmin"})
+    public Object addChannelAdmin(@RequestBody ChannelAddBo bo) {
+        return this.service.addChannelAdmin(bo);
+    }
+
+    @ApiOperation("获取通道配置信息")
+    @PostMapping({"/device/video/getChannelInfoAdmin"})
+    public Object getChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.getChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("修改通道配置信息")
+    @PostMapping({"/device/video/updateChannelInfoAdmin"})
+    public Object updateChannelInfoAdmin(@RequestBody ChannelUpdateBo bo) {
+        return this.service.updateChannelInfoAdmin(bo);
+    }
+
+    @ApiOperation("删除通道配置信息")
+    @PostMapping({"/device/video/delChannelInfoAdmin"})
+    public Object delChannelInfoAdmin(@RequestParam("id") String id) {
+        return this.service.delChannelInfoAdmin(id);
+    }
+
+    @ApiOperation("获取设备特征编码及二维码")
+    @PostMapping({"/device/video/getFeatures"})
+    public Object getFeatures() {
+        String features = IdUtil.randomUUID();
+        String imageToBase64 = QrCodeUtils.imageToBase64(QrCodeUtil.generate(features, 200, 200));
+        return R.ok((new FeatureVo()).setFeature(features).setFeatureQrCode(imageToBase64));
+    }
+
+    @ApiOperation("获取已占用通道集合")
+    @PostMapping({"/device/video/getOccupiedChannelList"})
+    public Object getOccupiedChannelList(@RequestParam(value = "deviceId",required = false) String deviceId) {
+        return this.service.getOccupiedChannelList(deviceId);
+    }
+
+    @ApiOperation("通道标签列表")
+    @PostMapping({"/device/video/getChannelTagList"})
+    public Object getChannelTagList() {
+        return this.service.getChannelTagList();
+    }
+
+    public VideoController(final VideoEventCodeService service) {
+        this.service = service;
+    }
+}

+ 577 - 0
src/main/java/com/usky/controller/VillageController.java

@@ -0,0 +1,577 @@
+package com.usky.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.common.bo.CommonBo;
+import com.usky.common.enums.ErrorCode;
+import com.usky.common.listener.ConfigCacheListener;
+import com.usky.global.Common;
+import com.usky.global.ErrorResult;
+import com.usky.modules.entity.PowerCode;
+import com.usky.modules.entity.Village;
+import com.usky.modules.entity.village.VillageList;
+import com.usky.modules.entity.village.bo.BuildingAddOrUpdateBo;
+import com.usky.modules.entity.village.bo.EntranceAddOrUpdateBo;
+import com.usky.modules.entity.village.bo.GisAreaAddOrUpdateBo;
+import com.usky.modules.entity.village.bo.HouseAddOrUpdateBo;
+import com.usky.modules.entity.village.bo.VillageUpdateBo;
+import com.usky.modules.entity.village.result.BuildingInfoResult;
+import com.usky.modules.entity.village.result.BuildingListResult;
+import com.usky.modules.entity.village.result.EntranceResult;
+import com.usky.modules.entity.village.result.EquipCodeResult;
+import com.usky.modules.entity.village.result.EquipResult;
+import com.usky.modules.entity.village.result.HouseInfoResult;
+import com.usky.modules.entity.village.result.HouseListResult;
+import com.usky.modules.entity.village.result.HousePurposeCodeResult;
+import com.usky.modules.entity.village.result.HouseResult;
+import com.usky.modules.entity.village.result.HouseTypeCodeResult;
+import com.usky.modules.entity.village.result.PersonResult;
+import com.usky.modules.entity.village.result.PlaceTypeResult;
+import com.usky.modules.entity.village.result.PowerCodeResult;
+import com.usky.modules.entity.village.result.PowerResult;
+import com.usky.modules.entity.village.result.ProjectResult;
+import com.usky.modules.entity.village.result.VillageInfoResult;
+import com.usky.modules.entity.village.result.VillageListResult;
+import com.usky.modules.entity.village.vo.BuildingInfoVO;
+import com.usky.modules.entity.village.vo.BuildingVO;
+import com.usky.modules.entity.village.vo.CompanyVo;
+import com.usky.modules.entity.village.vo.EntranceVo;
+import com.usky.modules.entity.village.vo.EquipCodeVo;
+import com.usky.modules.entity.village.vo.EquipVo;
+import com.usky.modules.entity.village.vo.HouseInfoVo;
+import com.usky.modules.entity.village.vo.HouseListVo;
+import com.usky.modules.entity.village.vo.HousePurposeCodeVo;
+import com.usky.modules.entity.village.vo.HouseTypeCodeVo;
+import com.usky.modules.entity.village.vo.HouseVo;
+import com.usky.modules.entity.village.vo.PersonVo;
+import com.usky.modules.entity.village.vo.PlaceTypeVo;
+import com.usky.modules.entity.village.vo.PowerCodeVo;
+import com.usky.modules.entity.village.vo.PowerVo;
+import com.usky.modules.entity.village.vo.ProjectVo;
+import com.usky.modules.entity.village.vo.VillageInfoVO;
+import com.usky.modules.entity.village.vo.VillageListVO;
+import com.usky.modules.mapper.PowerCodeMapper;
+import com.usky.modules.service.IVillageService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(
+        tags = {"地块/区域信息控制器"}
+)
+public class VillageController {
+    private static final Logger log = LoggerFactory.getLogger(VillageController.class);
+    @Autowired
+    private IVillageService villageService;
+    @Autowired
+    private PowerCodeMapper powerCodeMapper;
+    @Autowired
+    private ConfigCacheListener config;
+
+    public VillageController() {
+    }
+
+    @ApiOperation("地块/区域信息对外接口")
+    @PostMapping({"/agbox/village", "/agbox/village/**"})
+    public Object village(@ModelAttribute CommonBo bo, HttpServletRequest request) throws IOException {
+        log.info("地块/区域控制器请求报文:{}", bo.toString());
+        String key = bo.getKey();
+        String json = bo.getJson();
+        if (StrUtil.isNotBlank(this.config.getConfig("key")) && !Common.key.equals(this.config.getConfig("key")) && !key.equals(this.config.getConfig("key"))) {
+            return R.failed("key错误或缺失!");
+        } else if (StringUtils.isBlank(json)) {
+            return R.failed("json不能为空!");
+        } else {
+            JsonNode jsonNode = (new ObjectMapper()).readTree(json);
+            String jsonrpc = null;
+            String standjsonrpc = jsonNode.path("jsonrpc").asText();
+            if (StrUtil.isNotBlank(standjsonrpc)) {
+                if (!standjsonrpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = standjsonrpc;
+            }
+
+            String json_rpc = jsonNode.path("json-rpc").asText();
+            if (StrUtil.isNotBlank(json_rpc)) {
+                if (!json_rpc.equals("2.0")) {
+                    return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+                }
+
+                jsonrpc = json_rpc;
+            }
+
+            if (StrUtil.isBlank(json_rpc) && StrUtil.isBlank(jsonrpc)) {
+                return R.failed("JSON-RPC 协议版本的字符串,必须准确写为'2.0'!");
+            } else {
+                String method = jsonNode.path("method").asText();
+                JsonNode params = jsonNode.path("params");
+                if (method.equals("getList")) {
+                    System.out.println("getList");
+                    VillageListResult result = (VillageListResult)this.getList(params);
+                    VillageListVO villageListVO = new VillageListVO();
+                    villageListVO.setJsonrpc(jsonrpc);
+                    villageListVO.setResult(result);
+                    villageListVO.setId(jsonNode.path("id").asText());
+                    return villageListVO;
+                } else if (method.equals("getInfo")) {
+                    System.out.println("getInfo");
+                    VillageInfoResult result = (VillageInfoResult)this.getInfo(params, request);
+                    VillageInfoVO villageInfoVO = new VillageInfoVO();
+                    villageInfoVO.setJsonrpc(jsonrpc);
+                    villageInfoVO.setResult(result);
+                    villageInfoVO.setId(jsonNode.path("id").asText());
+                    return villageInfoVO;
+                } else if (method.equals("getBuilding")) {
+                    System.out.println("获取区域");
+                    BuildingListResult building = (BuildingListResult)this.getBuilding(params);
+                    BuildingVO buildingVO = new BuildingVO();
+                    buildingVO.setJsonrpc(jsonrpc);
+                    buildingVO.setResult(building);
+                    buildingVO.setId(jsonNode.path("id").asText());
+                    return buildingVO;
+                } else if (method.equals("getBuildingInfo")) {
+                    System.out.println("getBuildingInfo");
+                    String buildingCode = params.path("buildingCode").asText();
+                    BuildingInfoResult buildingInfo = (BuildingInfoResult)this.getBuildingInfo(buildingCode);
+                    BuildingInfoVO buildingInfoVO = new BuildingInfoVO();
+                    buildingInfoVO.setJsonrpc(jsonrpc);
+                    buildingInfoVO.setResult(buildingInfo);
+                    buildingInfoVO.setId(jsonNode.path("id").asText());
+                    return buildingInfoVO;
+                } else if (method.equals("getHouse")) {
+                    System.out.println("getHouse");
+                    HouseResult house = (HouseResult)this.getHouse(params);
+                    HouseVo houseVo = new HouseVo();
+                    houseVo.setJsonrpc(jsonrpc);
+                    houseVo.setResult(house);
+                    houseVo.setId(jsonNode.path("id").asText());
+                    return houseVo;
+                } else if (method.equals("getHouseInfo")) {
+                    System.out.println("getHouseInfo");
+                    HouseInfoResult houseInfo = (HouseInfoResult)this.getHouseInfo(params);
+                    HouseInfoVo houseInfoVo = new HouseInfoVo();
+                    houseInfoVo.setJsonrpc(jsonrpc);
+                    houseInfoVo.setResult(houseInfo);
+                    houseInfoVo.setId(jsonNode.path("id").asText());
+                    return houseInfoVo;
+                } else if (method.equals("getHouseTypeCode")) {
+                    System.out.println("getHouseTypeCode");
+                    HouseTypeCodeResult houseTypeCode = (HouseTypeCodeResult)this.getHouseTypeCode();
+                    HouseTypeCodeVo houseTypeCodeVo = new HouseTypeCodeVo();
+                    houseTypeCodeVo.setJsonrpc(jsonrpc);
+                    houseTypeCodeVo.setResult(houseTypeCode);
+                    houseTypeCodeVo.setId(jsonNode.path("id").asText());
+                    return houseTypeCodeVo;
+                } else if (method.equals("getHousePurposeCode")) {
+                    System.out.println("getHousePurposeCode");
+                    HousePurposeCodeResult housePurposeCode = (HousePurposeCodeResult)this.getHousePurposeCode();
+                    HousePurposeCodeVo housePurposeCodeVo = new HousePurposeCodeVo();
+                    housePurposeCodeVo.setJsonrpc(jsonrpc);
+                    housePurposeCodeVo.setResult(housePurposeCode);
+                    housePurposeCodeVo.setId(jsonNode.path("id").asText());
+                    return housePurposeCodeVo;
+                } else if (method.equals("getPlaceType")) {
+                    System.out.println("getPlaceType");
+                    PlaceTypeResult placeType = (PlaceTypeResult)this.getPlaceType();
+                    PlaceTypeVo placeTypeVo = new PlaceTypeVo();
+                    placeTypeVo.setJsonrpc(jsonrpc);
+                    placeTypeVo.setResult(placeType);
+                    placeTypeVo.setId(jsonNode.path("id").asText());
+                    return placeTypeVo;
+                } else if (method.equals("getCompany")) {
+                    System.out.println("getCompany");
+                    String company = (String)this.getCompany(params);
+                    CompanyVo companyVo = new CompanyVo();
+                    companyVo.setJsonrpc(jsonrpc);
+                    companyVo.setResult(company);
+                    companyVo.setId(jsonNode.path("id").asText());
+                    return companyVo;
+                } else if (method.equals("getPerson")) {
+                    System.out.println("getPerson");
+                    String villageCode = params.path("villageCode").asText();
+                    String buildingCode = params.path("buildingCode").asText();
+                    String houseCode = params.path("houseCode").asText();
+                    if (StringUtils.isBlank(villageCode) && StringUtils.isBlank(buildingCode) && StringUtils.isBlank(houseCode)) {
+                        return ErrorResult.fail(jsonrpc, ErrorCode.PRAMS_INVALID);
+                    } else {
+                        PersonResult person = (PersonResult)this.getPerson(params, request);
+                        PersonVo personVo = new PersonVo();
+                        personVo.setJsonrpc(jsonrpc);
+                        personVo.setResult(person);
+                        personVo.setId(jsonNode.path("id").asText());
+                        return personVo;
+                    }
+                } else if (method.equals("getPowerCode")) {
+                    System.out.println("getPowerCode");
+                    PowerCodeResult powerCode = (PowerCodeResult)this.getPowerCode();
+                    PowerCodeVo powerCodeVo = new PowerCodeVo();
+                    powerCodeVo.setJsonrpc(jsonrpc);
+                    powerCodeVo.setResult(powerCode);
+                    powerCodeVo.setId(jsonNode.path("id").asText());
+                    return powerCodeVo;
+                } else if (method.equals("getPower")) {
+                    if (StrUtil.isBlank(params.path("code").asText()) && StrUtil.isBlank(params.path("villageCode").asText())) {
+                        return R.failed("villageCode地块编码不能为空!");
+                    } else {
+                        PowerResult power = (PowerResult)this.getPower(params);
+                        PowerVo powerVo = new PowerVo();
+                        powerVo.setJsonrpc(jsonrpc);
+                        powerVo.setResult(power);
+                        powerVo.setId(jsonNode.path("id").asText());
+                        log.info("实有力量 = {}", JSON.toJSONString(powerVo));
+                        return powerVo;
+                    }
+                } else if (method.equals("getEquipCode")) {
+                    System.out.println("getEquipCode");
+                    EquipCodeResult equipCode = (EquipCodeResult)this.getEquipCode();
+                    EquipCodeVo equipCodeVo = new EquipCodeVo();
+                    equipCodeVo.setJsonrpc(jsonrpc);
+                    equipCodeVo.setResult(equipCode);
+                    equipCodeVo.setId(jsonNode.path("id").asText());
+                    return equipCodeVo;
+                } else if (method.equals("getEquip")) {
+                    System.out.println("getEquip");
+                    if (StrUtil.isBlank(params.path("code").asText())) {
+                        return R.failed("villageCode地块编码不能为空!");
+                    } else {
+                        String villageCode = params.path("code").asText();
+                        Integer page = params.path("page").asInt();
+                        Integer pageSize = params.path("pageSize").asInt();
+                        if (page == 0) {
+                            page = 1;
+                        }
+
+                        if (pageSize == 0) {
+                            pageSize = 10000;
+                        }
+
+                        log.info("实有装备请求参数:page = {}, pageSize = {}", page, pageSize);
+                        EquipResult equip = (EquipResult)this.getEquip(villageCode, page, pageSize, request);
+                        EquipVo equipVo = new EquipVo();
+                        equipVo.setJsonrpc(jsonrpc);
+                        equipVo.setResult(equip);
+                        equipVo.setId(jsonNode.path("id").asText());
+                        log.info("实有装备={}", JSON.toJSONString(equipVo));
+                        return equipVo;
+                    }
+                } else if (method.equals("getEntrance")) {
+                    System.out.println("getEntrance");
+                    String villageCode = params.path("villageCode").asText();
+                    if (StringUtils.isBlank(villageCode)) {
+                        return R.failed("villageCode地块编码不能为空!");
+                    } else {
+                        EntranceResult entrance = (EntranceResult)this.getEntrance(params, request);
+                        EntranceVo entranceVo = new EntranceVo();
+                        entranceVo.setJsonrpc(jsonrpc);
+                        entranceVo.setResult(entrance);
+                        entranceVo.setId(jsonNode.path("id").asText());
+                        return entranceVo;
+                    }
+                } else if (method.equals("getProjectList")) {
+                    System.out.println("getProjectList");
+                    ProjectResult projectList = (ProjectResult)this.getProjectList();
+                    ProjectVo projectVo = new ProjectVo();
+                    projectVo.setJsonrpc(jsonrpc);
+                    projectVo.setResult(projectList);
+                    projectVo.setId(jsonNode.path("id").asText());
+                    return projectVo;
+                } else if (method.equals("getTagHouseList")) {
+                    System.out.println("getTagHouseList");
+                    if (params.path("tagId").asText().equals("")) {
+                        return R.failed("tagId不能为空!");
+                    } else {
+                        HouseListResult result = (HouseListResult)this.getTagHouseList(params);
+                        HouseListVo houseListVo = new HouseListVo();
+                        houseListVo.setJsonrpc(jsonrpc);
+                        houseListVo.setResult(result);
+                        houseListVo.setId(jsonNode.path("id").asText());
+                        return houseListVo;
+                    }
+                } else {
+                    return R.failed("方法名不存在!");
+                }
+            }
+        }
+    }
+
+    public Object getList(JsonNode params) {
+        long page = (long)params.path("page").asInt();
+        if (page == 0L) {
+            page = 1L;
+        }
+
+        long pageSize = (long)params.path("pageSize").asInt();
+        if (pageSize == 0L) {
+            pageSize = 10000L;
+        }
+
+        Page<Village> villagePage = this.villageService.selectPage(page, pageSize);
+        List<VillageList> villageLists = (List)villagePage.getRecords().stream().map((village) -> {
+            VillageList villageList = new VillageList();
+            BeanUtils.copyProperties(village, villageList);
+            return villageList;
+        }).collect(Collectors.toList());
+        VillageListResult result = new VillageListResult();
+        result.setPage(page);
+        result.setPage_size(pageSize);
+        result.setTotal_page(villagePage.getPages());
+        result.setCount(villagePage.getTotal());
+        result.setVillageList((ArrayList)villageLists);
+        log.info(result.toString());
+        return result;
+    }
+
+    public Object getInfo(JsonNode params, HttpServletRequest request) {
+        String villageCode = params.path("villageCode").asText();
+        VillageInfoResult villageInfoAdminResult = this.villageService.getInfo(villageCode, request);
+        return villageInfoAdminResult;
+    }
+
+    @ApiOperation("获取地块列表")
+    @GetMapping({"/village/getVillageInfo"})
+    public Object getVillageInfo() {
+        return this.villageService.getVillageInfo();
+    }
+
+    @ApiOperation("获取地块/区域列表")
+    @PostMapping({"/village/getInfo"})
+    public Object getInfoAdmin(@RequestParam(value = "villageCode",required = false) String villageCode) {
+        return this.villageService.getInfoAdmin(villageCode);
+    }
+
+    public Object getBuilding(JsonNode params) {
+        System.out.println("区域编号");
+        BuildingListResult result = this.villageService.getBuilding(params);
+        return result;
+    }
+
+    @ApiOperation("获取区域信息列表")
+    @PostMapping({"/village/getBuildingAdmin"})
+    public Object getBuildingAdmin(@RequestParam("villageCode") String villageCode, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
+        return this.villageService.getBuildingAdmin(villageCode, page, pageSize);
+    }
+
+    @ApiOperation("获取区域信息")
+    @PostMapping({"/village/getBuildingInfo"})
+    public Object getBuildingInfoAdmin(@RequestParam("buildingCode") String buildingCode) {
+        BuildingInfoResult buildingInfo = this.villageService.getBuildingInfo(buildingCode);
+        return buildingInfo;
+    }
+
+    @ApiOperation("获取区域信息")
+    public Object getBuildingInfo(String buildingCode) {
+        BuildingInfoResult buildingInfo = this.villageService.getBuildingInfo(buildingCode);
+        return buildingInfo;
+    }
+
+    public Object getHouse(JsonNode params) {
+        System.out.println("房屋");
+        HouseResult houseResult = this.villageService.getHouse(params);
+        return houseResult;
+    }
+
+    @ApiOperation("获取部位/部门信息列表")
+    @PostMapping({"/village/getHouseList"})
+    public Object getHouseList(@RequestParam("buildingCode") String buildingCode, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, @RequestParam(value = "floor",required = false) Integer floor) {
+        return this.villageService.getHouseList(buildingCode, page, pageSize, floor);
+    }
+
+    public Object getHouseInfo(JsonNode params) {
+        if (params.path("houseCode").asText().equals("")) {
+            return R.failed("houseCode 不能为空!");
+        } else {
+            HouseInfoResult houseInfoResult = this.villageService.getHouseInfo(params);
+            return houseInfoResult;
+        }
+    }
+
+    public Object getHouseTypeCode() {
+        HouseTypeCodeResult result = this.villageService.getHouseTypeCode();
+        return result;
+    }
+
+    public Object getHousePurposeCode() {
+        HousePurposeCodeResult result = this.villageService.getHousePurposeCode();
+        return result;
+    }
+
+    public Object getPlaceType() {
+        PlaceTypeResult result = this.villageService.getPlaceType();
+        return result;
+    }
+
+    public Object getPerson(JsonNode params, HttpServletRequest request) {
+        PersonResult result = this.villageService.getPerson(params, request);
+        return result;
+    }
+
+    public Object getPowerCode() {
+        PowerCodeResult result = this.villageService.getPowerCode();
+        return result;
+    }
+
+    public Object getPower(JsonNode params) {
+        PowerResult result = this.villageService.getPower(params);
+        return result;
+    }
+
+    public Object getEquipCode() {
+        EquipCodeResult result = this.villageService.getEquipCode();
+        return result;
+    }
+
+    public Object getEquip(@RequestParam("villageCode") String villageCode, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
+        EquipResult result = this.villageService.getEquip(villageCode, page, pageSize, request);
+        return result;
+    }
+
+    @ApiOperation("获取地块/区域实有装备")
+    @PostMapping({"/village/getEquip"})
+    public Object getEquipAdmin(@RequestParam("villageCode") String villageCode, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
+        return this.villageService.getEquipAdmin(villageCode, page, pageSize);
+    }
+
+    public Object getEntrance(JsonNode params, HttpServletRequest request) {
+        EntranceResult result = this.villageService.getEntrance(params, request);
+        return result;
+    }
+
+    public Object getProjectList() {
+        ProjectResult result = this.villageService.getProjectList();
+        return result;
+    }
+
+    public Object getCompany(JsonNode params) {
+        return "success";
+    }
+
+    public Object getTagHouseList(JsonNode params) {
+        HouseListResult result = this.villageService.getTagHouseList(params);
+        return result;
+    }
+
+    @ApiOperation("获取地块出入口分页列表")
+    @GetMapping({"/village/getEntranceAdmin"})
+    public Object getEntranceAdmin(@RequestParam("villageCode") String villageCode, @RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize) {
+        return this.villageService.getEntranceAdmin(villageCode, page, pageSize);
+    }
+
+    @ApiOperation("更改地块信息")
+    @PostMapping({"/village/updateVillage"})
+    public Object updateVillage(@RequestBody VillageUpdateBo bo) {
+        return this.villageService.updateVillage(bo);
+    }
+
+    @ApiOperation("新增or更新地块出入口")
+    @PostMapping({"/village/EntranceUpdateOrAdd"})
+    public Object EntranceUpdateOrAdd(@ModelAttribute EntranceAddOrUpdateBo bo) {
+        return this.villageService.EntranceUpdateOrAdd(bo);
+    }
+
+    @ApiOperation("后台获取地块出入口列表")
+    @PostMapping({"/village/getEntranceListAdmin"})
+    public Object getEntranceList(@RequestParam("villageCode") String villageCode, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize) {
+        return this.villageService.getEntranceList(villageCode, page, pageSize);
+    }
+
+    @ApiOperation("地块出入口删除")
+    @PostMapping({"/village/entranceDel"})
+    public Object EntranceDel(@RequestParam("entranceCode") String entranceCode) {
+        return this.villageService.EntranceDel(entranceCode);
+    }
+
+    @ApiOperation("新增or修改区域信息")
+    @PostMapping({"/village/BuildingUpdateOrAdd"})
+    public Object BuildingUpdateOrAdd(@RequestBody BuildingAddOrUpdateBo bo) {
+        return this.villageService.BuildingUpdateOrAdd(bo);
+    }
+
+    @ApiOperation("删除区域信息")
+    @PostMapping({"/village/buildingDel"})
+    public Object buildingDel(@RequestParam("buildingCode") String buildingCode) {
+        return this.villageService.buildingDel(buildingCode);
+    }
+
+    @ApiOperation("新增or修改部位信息")
+    @PostMapping({"/village/HouseUpdateOrAdd"})
+    public Object HouseUpdateOrAdd(@RequestBody HouseAddOrUpdateBo bo) {
+        return this.villageService.HouseUpdateOrAdd(bo);
+    }
+
+    @ApiOperation("删除部位信息")
+    @PostMapping({"/village/houseDel"})
+    public Object houseDel(@RequestParam("houseCode") String houseCode) {
+        return this.villageService.houseDel(houseCode);
+    }
+
+    @ApiOperation("修改或新增区域坐标")
+    @PostMapping({"/village/gisAreaAddOrUpdate"})
+    public Object gisAreaAddOrUpdate(@RequestBody GisAreaAddOrUpdateBo bo) {
+        return this.villageService.gisAreaAddOrUpdate(bo);
+    }
+
+    @ApiOperation("获取地块选择列表")
+    @PostMapping({"/village/getVillageList"})
+    public Object getVillageList() {
+        return this.villageService.getVillageList();
+    }
+
+    @ApiOperation("新增地块")
+    @PostMapping({"/village/villageAdd"})
+    public Object villageAdd() {
+        return this.villageService.villageAdd();
+    }
+
+    @ApiOperation("设置默认地块")
+    @PostMapping({"/village/setDefaultVillage"})
+    public Object setDefaultVillage(@RequestParam("villageCode") String villageCode) {
+        return this.villageService.setDefaultVillage(villageCode);
+    }
+
+    @ApiOperation("获取GIS坐标类型列表")
+    @GetMapping({"/village/getGisTypeList"})
+    public Object getGisTypeList() {
+        return this.villageService.getGisTypeList();
+    }
+
+    @ApiOperation("获取实有力量类型")
+    @GetMapping({"/village/getPowerCodeAdmin"})
+    public R<List<PowerCode>> getPowerCodeAdmin() {
+        return R.ok(this.powerCodeMapper.selectList((Wrapper)null));
+    }
+
+    @ApiOperation("获取部位类别")
+    @GetMapping({"/village/getHouseTypeList"})
+    public Object getHouseTypeList() {
+        return this.villageService.getHouseTypeList();
+    }
+
+    @ApiOperation("获取部位用途")
+    @GetMapping({"/village/getHousePurposeList"})
+    public Object getHousePurposeList() {
+        return this.villageService.getHousePurposeList();
+    }
+}

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov