Kaynağa Gözat

校园安全

liu 2 yıl önce
ebeveyn
işleme
469c250a3c
40 değiştirilmiş dosya ile 3566 ekleme ve 138 silme
  1. 2 0
      .idea/encodings.xml
  2. 45 120
      .idea/workspace.xml
  3. 13 0
      pom.xml
  4. 18 0
      src/main/java/com/template/annotation/ExcelExport.java
  5. 20 0
      src/main/java/com/template/annotation/ExcelImport.java
  6. 29 0
      src/main/java/com/template/api/HikvisionAPI.java
  7. 44 1
      src/main/java/com/template/api/SmartWarningControllerAPI.java
  8. 1 0
      src/main/java/com/template/common/result/ResponseStatusEnum.java
  9. 23 0
      src/main/java/com/template/common/utils/AccessToken.java
  10. 75 0
      src/main/java/com/template/common/utils/ExcelClassField.java
  11. 1008 0
      src/main/java/com/template/common/utils/ExcelUtils2.java
  12. 84 0
      src/main/java/com/template/common/utils/GetCameraPreviewURL.java
  13. 530 0
      src/main/java/com/template/common/utils/HttpsClient.java
  14. 548 0
      src/main/java/com/template/common/utils/Message.java
  15. 76 0
      src/main/java/com/template/common/utils/Message2.java
  16. 23 0
      src/main/java/com/template/common/utils/MyX509TrustManager.java
  17. 42 0
      src/main/java/com/template/common/utils/SHA1.java
  18. 52 0
      src/main/java/com/template/common/utils/WxConfig.java
  19. 53 0
      src/main/java/com/template/common/utils/WxConstants.java
  20. 385 0
      src/main/java/com/template/common/utils/WxUtil.java
  21. 34 0
      src/main/java/com/template/controller/HikvisionController.java
  22. 250 8
      src/main/java/com/template/controller/SmartWarningController.java
  23. 1 1
      src/main/java/com/template/core/JwtlnterceptorConfig.java
  24. 6 0
      src/main/java/com/template/mapper/SmartUserMapper.java
  25. 5 0
      src/main/java/com/template/mapper/SmartWarningMapper.java
  26. 10 0
      src/main/java/com/template/model/dto/OperationWarningDto.java
  27. 11 0
      src/main/java/com/template/model/dto/WarningSavePushDto.java
  28. 6 0
      src/main/java/com/template/model/pojo/SmartUser.java
  29. 5 2
      src/main/java/com/template/model/pojo/SmartWarning.java
  30. 4 1
      src/main/java/com/template/services/SmartUserService.java
  31. 10 1
      src/main/java/com/template/services/SmartWarningService.java
  32. 4 0
      src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java
  33. 14 0
      src/main/java/com/template/services/impl/SmartUserServiceImpl.java
  34. 35 3
      src/main/java/com/template/services/impl/SmartWarningServiceImpl.java
  35. 19 0
      src/main/resources/mapper/template/SmartUserMapper.xml
  36. 3 0
      src/main/resources/mapper/template/SmartWarningMapper.xml
  37. 14 1
      target/classes/mapper/template/SmartAuthorGroupMapper.xml
  38. 19 0
      target/classes/mapper/template/SmartUserMapper.xml
  39. 42 0
      target/classes/mapper/template/SmartVisitorMapper.xml
  40. 3 0
      target/classes/mapper/template/SmartWarningMapper.xml

+ 2 - 0
.idea/encodings.xml

@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="Encoding">
+    <file url="file://D:/soft/maven-repository/org/springframework/boot/spring-boot-starter-parent/2.4.0/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
   </component>
 </project>

+ 45 - 120
.idea/workspace.xml

@@ -1,35 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
   <component name="ChangeListManager">
     <list default="true" id="9931dd54-c6ba-4f79-99b0-d746475b8903" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/api/SmartClassControllerAPI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/api/SmartClassControllerAPI.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/api/SmartVisitorControllerAPI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/api/SmartVisitorControllerAPI.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/common/utils/AesTestOne.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/common/utils/AesTestOne.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/config/ControlConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/config/ControlConfig.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/config/ParkConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/config/ParkConfig.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartClassController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartClassController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDepartmentController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDepartmentController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartGradeController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartGradeController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartAuthorGroupMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartAuthorGroupMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartVisitorMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartVisitorMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartAuthorGroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartAuthorGroup.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartAuthorGroupService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartAuthorGroupService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/api/SmartWarningControllerAPI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/api/SmartWarningControllerAPI.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/common/result/ResponseStatusEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/common/result/ResponseStatusEnum.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartWarningController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartWarningController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartUserMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartUserMapper.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartWarningMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartWarningMapper.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartUser.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartWarning.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartWarning.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartUserService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartVisitorService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartVisitorService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartWarningService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartWarningService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application-dev.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartAuthorGroupMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartAuthorGroupMapper.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartVisitorMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartVisitorMapper.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/classes/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/application-dev.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" beforeDir="false" afterPath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartWarningServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartWarningServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartUserMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartUserMapper.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartWarningMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/template/SmartWarningMapper.xml" afterDir="false" />
     </list>
-    <ignored path="$PROJECT_DIR$/classes/" />
-    <ignored path="$PROJECT_DIR$/target/" />
-    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -71,67 +61,6 @@
       </content>
     </window>
   </component>
-  <component name="FileEditorManager">
-    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="157">
-              <caret line="377" column="7" lean-forward="true" selection-start-line="377" selection-start-column="7" selection-end-line="377" selection-end-column="7" />
-              <folding>
-                <element signature="imports" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/mapper/SmartVisitorMapper.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="414">
-              <caret line="25" column="180" selection-start-line="25" selection-start-column="87" selection-end-line="25" selection-end-column="180" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartVisitorService.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="667">
-              <caret line="36" column="4" lean-forward="true" selection-start-line="36" selection-start-column="4" selection-end-line="36" selection-end-column="27" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="617">
-              <caret line="87" column="56" selection-start-line="87" selection-start-column="35" selection-end-line="87" selection-end-column="56" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/resources/mapper/template/SmartVisitorMapper.xml">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="562">
-              <caret line="84" column="47" selection-start-line="84" selection-start-column="40" selection-end-line="84" selection-end-column="47" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartVisitorControllerAPI.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="664">
-              <caret line="88" column="141" selection-start-line="88" selection-start-column="141" selection-end-line="88" selection-end-column="141" />
-            </state>
-          </provider>
-        </entry>
-      </file>
-    </leaf>
-  </component>
   <component name="FileTemplateManagerImpl">
     <option name="RECENT_TEMPLATES">
       <list>
@@ -250,9 +179,8 @@
   <component name="MavenImportPreferences">
     <option name="generalSettings">
       <MavenGeneralSettings>
-        <option name="localRepository" value="D:\Software\Develop\Maven\repository" />
-        <option name="mavenHome" value="D:/Software/Develop/Maven/apache-maven-3.3.9" />
-        <option name="userSettingsFile" value="D:\Software\Develop\Maven\apache-maven-3.3.9\conf\settings.xml" />
+        <option name="mavenHome" value="D:/soft/maven/apache-maven-3.8.6" />
+        <option name="userSettingsFile" value="D:/soft/maven/apache-maven-3.8.6\conf\settings.xml" />
       </MavenGeneralSettings>
     </option>
   </component>
@@ -280,6 +208,7 @@
     <option name="width" value="974" />
     <option name="height" value="1039" />
   </component>
+  <component name="ProjectId" id="2b6sxhjtfk5YsWPguK3OYQgIn3k" />
   <component name="ProjectView">
     <navigator proportions="" version="1">
       <foldersAlwaysOnTop value="true" />
@@ -425,19 +354,18 @@
       <pane id="Scope" />
     </panes>
   </component>
-  <component name="PropertiesComponent">
-    <property name="RequestMappingsPanelOrder0" value="0" />
-    <property name="RequestMappingsPanelOrder1" value="1" />
-    <property name="RequestMappingsPanelWidth0" value="75" />
-    <property name="RequestMappingsPanelWidth1" value="75" />
-    <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="aspect.path.notification.shown" value="true" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../../报修系统/repair_backend" />
-    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
-    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
-    <property name="restartRequiresConfirmation" value="false" />
-    <property name="settings.editor.selected.configurable" value="preferences.language.Kotlin" />
+  <component name="ProjectViewState">
+    <option name="showExcludedFiles" value="false" />
+    <option name="showLibraryContents" value="true" />
   </component>
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "WebServerToolWindowFactoryState": "false",
+    "last_opened_file_path": "E:/company/backend_code",
+    "settings.editor.selected.configurable": "MavenSettings",
+    "spring.configuration.checksum": "e47aab31ad1364ed6c9b0acc24afdcf3"
+  }
+}]]></component>
   <component name="RebelAgentSelection">
     <selection>jr</selection>
   </component>
@@ -457,18 +385,6 @@
       <recent name="D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\resources\mapper\template" />
     </key>
   </component>
-  <component name="RunDashboard">
-    <option name="ruleStates">
-      <list>
-        <RuleState>
-          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
-        </RuleState>
-        <RuleState>
-          <option name="name" value="StatusDashboardGroupingRule" />
-        </RuleState>
-      </list>
-    </option>
-  </component>
   <component name="RunManager" selected="Spring Boot.MybatisPlusApplication">
     <configuration name="AesTestOne" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
       <option name="MAIN_CLASS_NAME" value="com.template.common.utils.AesTestOne" />
@@ -538,9 +454,13 @@
       </list>
     </recent_temporary>
   </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
   <component name="SpringBootOptions">
     <option name="showAdditionalConfigNotification" value="false" />
   </component>
+  <component name="SshConsoleOptionsProvider">
+    <option name="myEncoding" value="UTF-8" />
+  </component>
   <component name="SvnConfiguration">
     <configuration />
   </component>
@@ -561,6 +481,7 @@
       <workItem from="1704936821369" duration="29299000" />
       <workItem from="1705280443643" duration="25331000" />
       <workItem from="1705388695984" duration="38689000" />
+      <workItem from="1705547111998" duration="20000" />
     </task>
     <servers />
   </component>
@@ -650,7 +571,18 @@
     </layout-to-restore>
   </component>
   <component name="TypeScriptGeneratedFilesManager">
-    <option name="version" value="1" />
+    <option name="version" value="3" />
+  </component>
+  <component name="Vcs.Log.Tabs.Properties">
+    <option name="TAB_STATES">
+      <map>
+        <entry key="MAIN">
+          <value>
+            <State />
+          </value>
+        </entry>
+      </map>
+    </option>
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>
@@ -658,43 +590,36 @@
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/WechatScanLoginController.java</url>
           <line>117</line>
-          <properties />
           <option name="timeStamp" value="57" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartAttendanceController.java</url>
           <line>81</line>
-          <properties />
           <option name="timeStamp" value="59" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartScoreController.java</url>
           <line>487</line>
-          <properties />
           <option name="timeStamp" value="76" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java</url>
           <line>1173</line>
-          <properties />
           <option name="timeStamp" value="91" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartGradeController.java</url>
           <line>139</line>
-          <properties />
           <option name="timeStamp" value="98" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/common/utils/AesTestOne.java</url>
           <line>52</line>
-          <properties />
           <option name="timeStamp" value="99" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/src/main/java/com/template/common/utils/AesTestOne.java</url>
           <line>71</line>
-          <properties />
           <option name="timeStamp" value="100" />
         </line-breakpoint>
       </breakpoints>

+ 13 - 0
pom.xml

@@ -22,6 +22,19 @@
     <dependencies>
 
         <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-mp</artifactId>
+            <version>4.3.0</version>
+        </dependency>
+
+        <!-- 海康 -->
+        <dependency>
+            <groupId>com.hikvision.ga</groupId>
+            <artifactId>artemis-http-client</artifactId>
+            <version>1.1.3</version>
+        </dependency>
+
+        <dependency>
             <groupId>open.platform</groupId>
             <artifactId>platform</artifactId>
             <version>1.0</version>

+ 18 - 0
src/main/java/com/template/annotation/ExcelExport.java

@@ -0,0 +1,18 @@
+package com.template.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExcelExport {
+    String value();
+
+    int sort() default 0;
+
+    String kv() default "";
+
+    String example() default "";
+}

+ 20 - 0
src/main/java/com/template/annotation/ExcelImport.java

@@ -0,0 +1,20 @@
+package com.template.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExcelImport {
+    String value();
+
+    String kv() default "";
+
+    boolean required() default false;
+
+    int maxLength() default 255;
+
+    boolean unique() default false;
+}

+ 29 - 0
src/main/java/com/template/api/HikvisionAPI.java

@@ -0,0 +1,29 @@
+package com.template.api;
+
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RequestMapping({"/eventRcv"})
+@Api(tags = {"HikvisionController"}, value = "海康威视回调地址")
+public interface HikvisionAPI {
+    @PostMapping({"/subscription"})
+    void subscription(HttpServletRequest request);
+
+    @PostMapping({"/faceComparison"})
+    void faceComparison(HttpServletRequest request);
+
+    @PostMapping({"/emphasisFace"})
+    void emphasisFace(HttpServletRequest request);
+
+    @PostMapping({"/playback"})
+    JSONObject playback();
+
+    @PostMapping({"/general"})
+    JSONObject general(@RequestBody JSONObject jsonObject);
+}

+ 44 - 1
src/main/java/com/template/api/SmartWarningControllerAPI.java

@@ -1,5 +1,8 @@
 package com.template.api;
 
+import com.baomidou.mybatisplus.extension.api.R;
+import com.template.model.dto.OperationWarningDto;
+import com.template.model.dto.WarningSavePushDto;
 import com.template.model.pojo.SmartWarning;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
@@ -8,6 +11,8 @@ import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+
 /**
  * @Author: binguo
  * @Date: 2023/3/30 星期四 17:28
@@ -27,9 +32,47 @@ public interface SmartWarningControllerAPI {
 
     @GetMapping(value = "/queryPageSmartWarning")
     @ApiOperation(value = "预警信息分页数据", notes = "预警信息分页数据", httpMethod = "GET")
-    CommonResult queryPageSmartWarning(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+    CommonResult queryPageSmartWarning(@RequestParam int currentPage, @RequestParam int pageCount, String name,String state);
 
     @GetMapping(value = "/deleteSmartWarningById")
     @ApiOperation(value = "根据ID删除指定预警信息", notes = "根据ID删除指定预警信息", httpMethod = "GET")
     CommonResult deleteSmartWarningById(@RequestParam int id);
+
+    @PostMapping(value = "/operation")
+    @ApiOperation(value = "根据ID操作", notes = "根据ID操作", httpMethod = "POST")
+    CommonResult operation(@RequestBody OperationWarningDto operationWarningDto);
+
+    @GetMapping(value = "/excelSmartWarning")
+    @ApiOperation(value = "预警导出", notes = "预警导出", httpMethod = "GET")
+    void excelSmartWarning(HttpServletResponse response,String location,String state);
+
+    @GetMapping(value = "/warningType")
+    @ApiOperation(value = "预警小程序下拉框", notes = "预警小程序下拉框", httpMethod = "GET")
+    CommonResult warningType();
+
+    @GetMapping(value = "/pageWarning")
+    @ApiOperation(value = "预警小程序分页展示", notes = "预警小程序分页展示", httpMethod = "GET")
+    CommonResult pageWarning(@RequestParam int currentPage, @RequestParam int pageCount,@RequestParam String type,@RequestParam String dateTime);
+
+    @GetMapping(value = "/warningDepartmentTree")
+    @ApiOperation(value = "查询部门树形结构数据", notes = "查询部门树形结构数据", httpMethod = "GET")
+    CommonResult warningDepartmentTree();
+
+    @GetMapping(value = "/warningUserList")
+    @ApiOperation(value = "预警推送用户分页", notes = "预警推送用户分页", httpMethod = "GET")
+    CommonResult warningUserList(@RequestParam int currentPage, @RequestParam int pageCount,Integer departmentId,String name);
+
+    @GetMapping(value = "/warningPushList")
+    @ApiOperation(value = "可推送用户展示", notes = "预警推送用户分页", httpMethod = "GET")
+    CommonResult warningPushList();
+
+    @PostMapping(value = "/warningSavePush")
+    @ApiOperation(value = "添加预警可推送用户", notes = "添加预警可推送用户", httpMethod = "POST")
+    CommonResult warningSavePush(@RequestBody WarningSavePushDto warningSavePushDto);
+
+    @GetMapping(value = "/warningDeletePush")
+    @ApiOperation(value = "删除预警可推送用户", notes = "删除预警可推送用户", httpMethod = "GET")
+    CommonResult warningDeletePush(Integer id);
+
+
 }

+ 1 - 0
src/main/java/com/template/common/result/ResponseStatusEnum.java

@@ -38,6 +38,7 @@ public enum ResponseStatusEnum implements Code{
     SYSTEM_TOKEN_ERROR(558,false,"token为空"),
     SYSTEM_LOGIN_ERROR(559,false,"无效token"),
     PARAM_ERROR(560, false, "参数不能为空!"),
+    GZH_ERROR(561, false, "设置失败,请先关联公众号!"),
     EXISTS(999,false,"已存在");
 
     // 响应业务状态

+ 23 - 0
src/main/java/com/template/common/utils/AccessToken.java

@@ -0,0 +1,23 @@
+package com.template.common.utils;
+
+public class AccessToken {
+	private String access_token;// 网页获取用户信息凭证
+	private String expires_in;// 有效时间
+
+	public String getAccess_token() {
+		return access_token;
+	}
+
+	public void setAccess_token(String access_token) {
+		this.access_token = access_token;
+	}
+
+	public String getExpires_in() {
+		return expires_in;
+	}
+
+	public void setExpires_in(String expires_in) {
+		this.expires_in = expires_in;
+	}
+
+}

+ 75 - 0
src/main/java/com/template/common/utils/ExcelClassField.java

@@ -0,0 +1,75 @@
+package com.template.common.utils;
+ 
+import java.util.LinkedHashMap;
+ 
+/**
+ *  */
+public class ExcelClassField {
+ 
+    /** 字段名称 */
+    private String fieldName;
+ 
+    /** 表头名称 */
+    private String name;
+ 
+    /** 映射关系 */
+    private LinkedHashMap<String, String> kvMap;
+ 
+    /** 示例值 */
+    private Object example;
+ 
+    /** 排序 */
+    private int sort;
+ 
+    /** 是否为注解字段:0-否,1-是 */
+    private int hasAnnotation;
+ 
+    public String getFieldName() {
+        return fieldName;
+    }
+ 
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+ 
+    public String getName() {
+        return name;
+    }
+ 
+    public void setName(String name) {
+        this.name = name;
+    }
+ 
+    public LinkedHashMap<String, String> getKvMap() {
+        return kvMap;
+    }
+ 
+    public void setKvMap(LinkedHashMap<String, String> kvMap) {
+        this.kvMap = kvMap;
+    }
+ 
+    public Object getExample() {
+        return example;
+    }
+ 
+    public void setExample(Object example) {
+        this.example = example;
+    }
+ 
+    public int getSort() {
+        return sort;
+    }
+ 
+    public void setSort(int sort) {
+        this.sort = sort;
+    }
+ 
+    public int getHasAnnotation() {
+        return hasAnnotation;
+    }
+ 
+    public void setHasAnnotation(int hasAnnotation) {
+        this.hasAnnotation = hasAnnotation;
+    }
+ 
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1008 - 0
src/main/java/com/template/common/utils/ExcelUtils2.java


+ 84 - 0
src/main/java/com/template/common/utils/GetCameraPreviewURL.java

@@ -0,0 +1,84 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.hikvision.artemis.sdk.ArtemisHttpUtil;
+import com.hikvision.artemis.sdk.config.ArtemisConfig;
+import java.util.HashMap;
+import java.util.Map;
+
+public class GetCameraPreviewURL {
+    public GetCameraPreviewURL() {
+    }
+
+    public static String GetCameraPreviewURL() {
+        ArtemisConfig.host = "192.168.161.72:443";
+        ArtemisConfig.appKey = "29849943";
+        ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd";
+        String ARTEMIS_PATH = "/artemis";
+        String previewURLsApi = "/artemis/api/eventService/v1/eventSubscriptionByEventTypes";
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                this.put("https://", "/artemis/api/eventService/v1/eventSubscriptionByEventTypes");
+            }
+        };
+        String contentType = "application/json";
+        JSONObject jsonBody = new JSONObject();
+        int[] ingArr = new int[]{131588, 131586, 131587, 131603, 131608, 131604, 930335};
+        jsonBody.put("eventTypes", ingArr);
+        String url = "http://192.168.161.224:8080/wanzai/eventRcv/subscription";
+        jsonBody.put("eventDest", url);
+        String body = jsonBody.toJSONString();
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map)null, (String)null, contentType, (Map)null);
+        return result;
+    }
+
+    public static String CameraPreviewURL(String url, JSONObject jsonBody) {
+        ArtemisConfig.host = "192.168.161.72:443";
+        ArtemisConfig.appKey = "29849943";
+        ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd";
+        String ARTEMIS_PATH = "/artemis";
+        final String previewURLsApi = "/artemis" + url;
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                this.put("https://", previewURLsApi);
+            }
+        };
+        String contentType = "application/json";
+        String body = jsonBody.toJSONString();
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map)null, (String)null, contentType, (Map)null);
+        return result;
+    }
+
+    public static String CameraPreviewURL2(String url, JSONArray jsonBody) {
+        ArtemisConfig.host = "192.168.161.72:443";
+        ArtemisConfig.appKey = "29849943";
+        ArtemisConfig.appSecret = "e1eXZtEvJhi4waZmSgmd";
+        String ARTEMIS_PATH = "/artemis";
+        final String previewURLsApi = "/artemis" + url;
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                this.put("https://", previewURLsApi);
+            }
+        };
+        String contentType = "application/json";
+        String body = jsonBody.toString();
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map)null, (String)null, contentType, (Map)null);
+        return result;
+    }
+
+    public static void main(String[] args) {
+        JSONObject jsonBody = new JSONObject();
+        int[] ingArr = new int[]{1644175361};
+        jsonBody.put("eventTypes", ingArr);
+        String url = "http://192.168.161.224:8080/wanzai/eventRcv/emphasisFace";
+        jsonBody.put("eventDest", url);
+        String result = CameraPreviewURL("/api/eventService/v1/eventSubscriptionByEventTypes", jsonBody);
+        System.out.println("result结果示例: " + result);
+    }
+}

+ 530 - 0
src/main/java/com/template/common/utils/HttpsClient.java

@@ -0,0 +1,530 @@
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+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.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+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 javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * HttpsClient类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class HttpsClient {
+
+    /**
+     * GET请求方式
+     */
+    public static final String METHOD_GET = "GET";
+    /**
+     * POST请求方式
+     */
+    public static final String METHOD_POST = "POST";
+    /**
+     * 连接超时时间
+     */
+    private static Integer CONNECTION_TIMEOUT = WxConfig.connectionTimeout;
+    /**
+     * 请求超时时间
+     */
+    private static Integer READ_TIMEOUT = WxConfig.readTimeout;
+
+    /**
+     * 发起https请求
+     * @param requestUrl 请求地址
+     * @param requestMethod 请求方式(Get或者post)
+     * @param postData 提交数据
+     * @return JSONObject
+     */
+    public static JSONObject httpsRequestReturnJSONObject(String requestUrl, String requestMethod, String postData) throws Exception{
+        JSONObject  jsonObject = JSONObject.parseObject(HttpsClient.httpsRequestReturnString(requestUrl,requestMethod,postData));
+        System.out.println("jsonObjectDate:  " + jsonObject);
+        return jsonObject;
+    }
+
+
+    /**
+     * 发起https请求
+     * @param requestUrl 请求地址
+     * @param requestMethod 请求方式(Get或者post)
+     * @param postData 提交数据
+     * @return String
+     */
+    public static String httpsRequestReturnString(String requestUrl, String requestMethod, String postData) throws Exception{
+        String response;
+        HttpsURLConnection httpsUrlConnection = null;
+        try{
+            //创建https请求证书
+            TrustManager[] tm={new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext=SSLContext.getInstance("SSL","SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf=sslContext.getSocketFactory();
+
+            // 创建URL对象
+            URL url= new URL(requestUrl);
+            // 创建HttpsURLConnection对象,并设置其SSLSocketFactory对象
+            httpsUrlConnection=(HttpsURLConnection)url.openConnection();
+            //设置ssl证书
+            httpsUrlConnection.setSSLSocketFactory(ssf);
+
+            //设置header信息
+            httpsUrlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            //设置User-Agent信息
+            httpsUrlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
+            //设置可接受信息
+            httpsUrlConnection.setDoOutput(true);
+            //设置可输入信息
+            httpsUrlConnection.setDoInput(true);
+            //不使用缓存
+            httpsUrlConnection.setUseCaches(false);
+            //设置请求方式(GET/POST)
+            httpsUrlConnection.setRequestMethod(requestMethod);
+            //设置连接超时时间
+            if (CONNECTION_TIMEOUT > 0) {
+                httpsUrlConnection.setConnectTimeout(CONNECTION_TIMEOUT);
+            } else {
+                //默认10秒超时
+                httpsUrlConnection.setConnectTimeout(10000);
+            }
+            //设置请求超时
+            if (READ_TIMEOUT > 0) {
+                httpsUrlConnection.setReadTimeout(READ_TIMEOUT);
+            } else {
+                //默认10秒超时
+                httpsUrlConnection.setReadTimeout(10000);
+            }
+            //设置编码
+            httpsUrlConnection.setRequestProperty("Charsert", WxConstants.DEFAULT_CHARSET);
+
+            //判断是否需要提交数据
+            if(StringUtils.equals(requestMethod,HttpsClient.METHOD_POST) && StringUtils.isNotBlank(postData)){
+                //讲参数转换为字节提交
+                byte[] bytes = postData.getBytes(WxConstants.DEFAULT_CHARSET);
+                //设置头信息
+                httpsUrlConnection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
+                //开始连接
+                httpsUrlConnection.connect();
+                //防止中文乱码
+                OutputStream outputStream=httpsUrlConnection.getOutputStream();
+                outputStream.write(postData.getBytes(WxConstants.DEFAULT_CHARSET));
+                outputStream.flush();
+                outputStream.close();
+            }else{
+                //开始连接
+                httpsUrlConnection.connect();
+            }
+            response = WxUtil.getStreamString(httpsUrlConnection.getInputStream());
+        }catch (Exception e){
+            throw new Exception();
+        }finally {
+            if (httpsUrlConnection != null) {
+                // 关闭连接
+                httpsUrlConnection.disconnect();
+            }
+        }
+        return response;
+    }
+
+
+    public static String get(String url, Map<String, String> params){
+        CloseableHttpClient httpClient = null;
+        HttpGet httpGet = null;
+        StringBuffer str = new StringBuffer("");
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            String ps = "";
+            for (String pKey : params.keySet()) {
+                if(!"".equals(ps)){
+                    ps = ps + "&";
+                }
+                ps = pKey+"="+params.get(pKey);
+            }
+            if(!"".equals(ps)){
+                url = url + "?" + ps;
+            }
+            httpGet = new HttpGet(url);
+            httpGet.setConfig(requestConfig);
+            CloseableHttpResponse response = httpClient.execute(httpGet);
+            HttpEntity httpEntity = response.getEntity();
+            str.append(EntityUtils.toString(httpEntity,"utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally{
+            try {
+                if(httpGet!=null){
+                    httpGet.releaseConnection();
+                }
+                if(httpClient!=null){
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return str.toString();
+    }
+
+    public static String get(String strURL) throws Exception{
+
+        URL url = new URL(strURL);
+        HttpURLConnection httpConn = (HttpURLConnection)
+                url.openConnection();
+        httpConn.setRequestMethod("GET");
+        httpConn.connect();
+        System.out.println("bbb: "+httpConn.getResponseCode());
+        BufferedReader reader = new BufferedReader(new InputStreamReader(
+                httpConn.getInputStream(),"utf-8"));
+        String line;
+        StringBuffer buffer = new StringBuffer();
+        while ((line = reader.readLine()) != null) {
+            buffer.append(line);
+        }
+        reader.close();
+        httpConn.disconnect();
+
+        return buffer.toString();
+    }
+
+    /**
+     * 发送 post请求
+     * @param
+     * @param
+     */
+    public static String post(String url, Map<String, String> params){
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        StringBuilder sb = new StringBuilder("");
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            List<NameValuePair> ps = new ArrayList<NameValuePair>();
+            for (String pKey : params.keySet()) {
+                ps.add(new BasicNameValuePair(pKey, params.get(pKey)));
+            }
+            httpPost.setEntity(new UrlEncodedFormEntity(ps));
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            sb.append(EntityUtils.toString(httpEntity,"utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally{
+            try {
+                if(httpPost!=null){
+                    httpPost.releaseConnection();
+                }
+                if(httpClient!=null){
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return sb.toString();
+    }
+
+    public static String postFile(String url, File file){
+
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        StringBuilder sb = new StringBuilder("");
+        try {
+            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+            builder.addBinaryBody("files", file, ContentType.DEFAULT_BINARY, file.getName());
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            httpPost.setEntity(builder.build());
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            sb.append(EntityUtils.toString(httpEntity,"utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally{
+            try {
+                if(httpPost!=null){
+                    httpPost.releaseConnection();
+                }
+                if(httpClient!=null){
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        JSONObject  jsonObject = JSONObject.parseObject(sb.toString());
+        return jsonObject.get("data").toString();
+    }
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
+            // 发送请求参数
+            out.print("&"+param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream(),"utf-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost2(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            HttpsURLConnection httpsUrlConnection = null;
+            //创建https请求证书
+            TrustManager[] tm={new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext=SSLContext.getInstance("SSL","SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf=sslContext.getSocketFactory();
+            // 创建URL对象
+            URL realUrl= new URL(url);
+            // 创建HttpsURLConnection对象,并设置其SSLSocketFactory对象,
+            // 打开和URL之间的连接
+            httpsUrlConnection=(HttpsURLConnection)realUrl.openConnection();
+            //设置ssl证书
+            httpsUrlConnection.setSSLSocketFactory(ssf);
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            httpsUrlConnection.setRequestMethod("POST");
+            httpsUrlConnection.setDoOutput(true);
+            httpsUrlConnection.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(httpsUrlConnection.getOutputStream(),"utf-8"));
+            // 发送请求参数
+            out.print("&"+param);
+            // flush输出流的缓冲
+            out.flush();
+            if (httpsUrlConnection.getResponseCode()==200) {
+                // 定义BufferedReader输入流来读取URL的响应
+                in = new BufferedReader(
+                        new InputStreamReader(httpsUrlConnection.getInputStream(), "utf-8"));
+                String line;
+                while ((line = in.readLine()) != null) {
+                    result += line;
+                }
+            }else {
+                result = "获取输入流异常!";
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String dateToStamp(String s) throws Exception {
+        String res = "";
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = simpleDateFormat.parse(s);
+        long time = date.getTime();
+        res = String.valueOf(time);
+        return res;
+    }
+
+    /*
+     * 将时间戳转换为时间
+     */
+    public static String stampToDate(String s){
+        String res;
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long lt = new Long(s);
+        Date date = new Date(lt);
+        res = simpleDateFormat.format(date);
+        return res;
+    }
+
+    public static String sendJson(String request_url, JSONObject json) {
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            URL url = new URL(request_url);// 创建连接
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            int length = (int) connection.getContentLength();// 获取字节长度
+            System.out.println(length);
+            if (length != -1) {
+                byte[] data = new byte[length];
+                byte[] temp = new byte[512];
+                int readLen = 0;
+                int destPos = 0;
+                while ((readLen = is.read(temp)) > 0) {
+                    System.arraycopy(temp, 0, data, destPos, readLen);
+                    destPos += readLen;
+                }
+                result = new String(data, "UTF-8"); // utf-8编码
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    /**
+     * post请求
+     * @param request_url
+     * @param json
+     * @return
+     */
+    public static String sendJson2(String request_url, JSONObject json) {
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            URL url = new URL(request_url);// 创建连接
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            BufferedReader in = new BufferedReader(new InputStreamReader(is));
+            result = in.readLine();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static void main(String[] args) throws Exception {
+        JSONObject json = new JSONObject();
+        json.put("buildCode", "5栋");
+        json.put("currentAggr", "20");
+        json.put("energyType", "2");
+        json.put("updateTime", "2021-09-09 10:15:33");
+        String msg = sendJson2("https://chtech.ncjti.edu.cn/bigdata-api/api/energy/energyDataUpload", json);
+        System.out.println(msg);
+    }
+}

+ 548 - 0
src/main/java/com/template/common/utils/Message.java

@@ -0,0 +1,548 @@
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+// 小程序消息通知
+public class Message {
+
+    /**
+     * hotel_name酒店名称
+     * order_status订单状态,用中文表示
+     * live_time入住时间
+     * end_time离店时间
+     * dom_name房间名称
+     * **/
+
+    public static String send(String openid,String hotel_name,
+                              String order_status,String live_time,
+                              String end_time,String dom_name)
+            throws Exception {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("grant_type", "client_credential");
+        jsonObject.put("appid", "");
+        jsonObject.put("secret","");
+        String msg3 = HttpsClient.sendJson2("https://api.weixin.qq.com/cgi-bin/stable_token",jsonObject);
+        Gson gson = new Gson();
+        HashMap<String, String> userMap = gson.fromJson(msg3.toString(), new TypeToken<HashMap<String, String>>() {}.getType());
+        JSONObject message = new JSONObject();
+        String token = userMap.get("access_token");
+        message.put("touser", openid);
+        message.put("template_id", "c9whRYC3d8ebNI_RdyG2X_1BBDwy2625hHmRWlW5Z9U");
+        message.put("page", "/pages/orderManage/orderManage");
+        message.put("miniprogram_state", "formal");
+        message.put("lang", "zh_CN");
+        JSONObject data = new JSONObject();
+        // 酒店名称
+        JSONObject string1 = new JSONObject();
+        string1.put("value", hotel_name);
+        // 订单状态
+        JSONObject phrase2 = new JSONObject();
+        phrase2.put("value", "");
+        // 到店时间
+        JSONObject date5 = new JSONObject();
+        date5.put("value", live_time);
+        // 离店时间
+        JSONObject date6 = new JSONObject();
+        date6.put("value", end_time);
+        // 房间名称
+        JSONObject thing27 = new JSONObject();
+        thing27.put("value", dom_name);
+        // 酒店名称
+        data.put("thing1",string1);
+        // 订单状态
+        data.put("phrase2",phrase2);
+        // 入住日期
+        data.put("date5",date5);
+        // 离店日期
+        data.put("date6",date6);
+        // 房间名称
+        data.put("thing27",thing27);
+        message.put("data", data);
+        String msg = HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+token, message);
+        System.out.println("小程序端消息发生:"+msg);
+        return msg;
+    }
+
+    public static String wxErrorMsg(String mag) {
+        Map mapType = JSON.parseObject(mag, Map.class);
+        Integer errorcode = (Integer) mapType.get("errcode");
+        String errmsg = "";
+        switch (errorcode) {
+            case -1:
+                errmsg = "系统繁忙";
+                break;
+            case 0:
+                errmsg = "请求成功";
+                break;
+            case 40001:
+                errmsg = "获取access_token时Secret错误,或者access_token无效";
+                break;
+            case 40002:
+                errmsg = "不合法的凭证类型";
+                break;
+            case 40003:
+                errmsg = "不合法的UserID";
+                break;
+            case 40004:
+                errmsg = "不合法的媒体文件类型 ";
+                break;
+            case 40005:
+                errmsg = "不合法的文件类型 ";
+                break;
+            case 40006:
+                errmsg = "不合法的文件大小";
+                break;
+            case 40007:
+                errmsg = "不合法的媒体文件id";
+                break;
+            case 40008:
+                errmsg = "不合法的消息类型 ";
+                break;
+            case 40013:
+                errmsg = "不合法的corpid ";
+                break;
+            case 40014:
+                errmsg = "不合法的access_token";
+                break;
+            case 40015:
+                errmsg = "不合法的菜单类型";
+                break;
+            case 40016:
+                errmsg = "不合法的按钮个数";
+                break;
+            case 40017:
+                errmsg = "不合法的按钮类型";
+                break;
+            case 40018:
+                errmsg = "不合法的按钮名字长度";
+                break;
+            case 40019:
+                errmsg = "不合法的按钮KEY长度";
+                break;
+            case 40020:
+                errmsg = "不合法的按钮URL长度 ";
+                break;
+            case 40021:
+                errmsg = "不合法的菜单版本号 ";
+                break;
+            case 40022:
+                errmsg = "不合法的子菜单级数";
+                break;
+            case 40023:
+                errmsg = "不合法的子菜单按钮个数";
+                break;
+            case 40024:
+                errmsg = "不合法的子菜单按钮类型";
+                break;
+            case 40025:
+                errmsg = "不合法的子菜单按钮名字长度";
+                break;
+            case 40026:
+                errmsg = "不合法的子菜单按钮KEY长度";
+                break;
+            case 40027:
+                errmsg = "不合法的子菜单按钮URL长度";
+                break;
+            case 40028:
+                errmsg = "不合法的自定义菜单使用员工";
+                break;
+            case 40029:
+                errmsg = "不合法的oauth_code";
+                break;
+            case 40031:
+                errmsg = "不合法的UserID列表";
+                break;
+            case 40032:
+                errmsg = "不合法的UserID列表长度";
+                break;
+            case 40033:
+                errmsg = "不合法的请求字符,不能包含\\uxxxx格式的字符 ";
+                break;
+            case 40035:
+                errmsg = "不合法的参数 ";
+                break;
+            case 40038:
+                errmsg = "不合法的请求格式 ";
+                break;
+            case 40039:
+                errmsg = "不合法的URL长度";
+                break;
+            case 40040:
+                errmsg = "不合法的插件token";
+                break;
+            case 40041:
+                errmsg = "不合法的插件id";
+                break;
+            case 40042:
+                errmsg = "不合法的插件会话";
+                break;
+            case 40048:
+                errmsg = "url中包含不合法domain";
+                break;
+            case 40054:
+                errmsg = "不合法的子菜单url域名";
+                break;
+            case 40055:
+                errmsg = "不合法的按钮url域名 ";
+                break;
+            case 40056:
+                errmsg = "不合法的agentid";
+                break;
+            case 40057:
+                errmsg = "不合法的callbackurl";
+                break;
+            case 40058:
+                errmsg = "不合法的红包参数 ";
+                break;
+            case 40059:
+                errmsg = "不合法的上报地理位置标志位 ";
+                break;
+            case 40060:
+                errmsg = "设置上报地理位置标志位时没有设置callbackurl";
+                break;
+            case 40061:
+                errmsg = "设置应用头像失败";
+                break;
+            case 40062:
+                errmsg = "不合法的应用模式";
+                break;
+            case 40063:
+                errmsg = "红包参数为空";
+                break;
+            case 40064:
+                errmsg = "管理组名字已存在";
+                break;
+            case 40065:
+                errmsg = "不合法的管理组名字长度";
+                break;
+            case 40066:
+                errmsg = "不合法的部门列表";
+                break;
+            case 40067:
+                errmsg = "标题长度不合法 ";
+                break;
+            case 40068:
+                errmsg = "不合法的标签ID";
+                break;
+            case 40069:
+                errmsg = "不合法的标签ID列表";
+                break;
+            case 40070:
+                errmsg = "列表中所有标签(用户)ID都不合法  ";
+                break;
+            case 40071:
+                errmsg = "不合法的标签名字,标签名字已经存在 ";
+                break;
+            case 40072:
+                errmsg = "不合法的标签名字长度";
+                break;
+            case 40073:
+                errmsg = "不合法的openid";
+                break;
+            case 40074:
+                errmsg = "news消息不支持指定为高保密消息";
+                break;
+            case 41001:
+                errmsg = "缺少access_token参数 ";
+                break;
+            case 41002:
+                errmsg = "缺少corpid参数";
+                break;
+            case 41003:
+                errmsg = "缺少refresh_token参数";
+                break;
+            case 41004:
+                errmsg = "缺少secret参数";
+                break;
+            case 41005:
+                errmsg = "缺少多媒体文件数据";
+                break;
+            case 41006:
+                errmsg = "缺少media_id参数";
+                break;
+            case 41007:
+                errmsg = "缺少子菜单数据";
+                break;
+            case 41008:
+                errmsg = "缺少oauth code";
+                break;
+            case 41009:
+                errmsg = "缺少UserID";
+                break;
+            case 41010:
+                errmsg = "缺少url";
+                break;
+            case 41011:
+                errmsg = "缺少agentid";
+                break;
+            case 41012:
+                errmsg = "缺少应用头像mediaid";
+                break;
+            case 41013:
+                errmsg = "缺少应用名字";
+                break;
+            case 41014:
+                errmsg = "缺少应用描述";
+                break;
+            case 41015:
+                errmsg = "缺少Content";
+                break;
+            case 41016:
+                errmsg = "缺少标题";
+                break;
+            case 41017:
+                errmsg = "缺少标签ID";
+                break;
+            case 41018:
+                errmsg = "缺少标签名字 ";
+                break;
+            case 42001:
+                errmsg = "access_token超时 ";
+                break;
+            case 42002:
+                errmsg = "refresh_token超时";
+                break;
+            case 42003:
+                errmsg = "oauth_code超时 ";
+                break;
+            case 42004:
+                errmsg = "插件token超时";
+                break;
+            case 43001:
+                errmsg = "需要GET请求";
+                break;
+            case 43002:
+                errmsg = "需要POST请求";
+                break;
+            case 43003:
+                errmsg = "需要HTTPS";
+                break;
+            case 43004:
+                errmsg = "需要接收者关注";
+                break;
+            case 43005:
+                errmsg = "需要好友关系";
+                break;
+            case 43006:
+                errmsg = "需要订阅";
+                break;
+            case 43007:
+                errmsg = "需要授权";
+                break;
+            case 43008:
+                errmsg = "需要支付授权";
+                break;
+            case 43009:
+                errmsg = "需要员工已关注";
+                break;
+            case 43010:
+                errmsg = "需要处于回调模式";
+                break;
+            case 43011:
+                errmsg = "需要企业授权";
+                break;
+            case 43101:
+                errmsg = "用户拒绝接受消息,如果用户之前曾经订阅过,则表示用户取消了订阅关系";
+                break;
+            case 44001:
+                errmsg = "多媒体文件为空";
+                break;
+            case 44002:
+                errmsg = "POST的数据包为空";
+                break;
+            case 44003:
+                errmsg = "图文消息内容为空";
+                break;
+            case 44004:
+                errmsg = "文本消息内容为空";
+                break;
+            case 45001:
+                errmsg = "多媒体文件大小超过限制";
+                break;
+            case 45002:
+                errmsg = "消息内容超过限制";
+                break;
+            case 45003:
+                errmsg = "标题字段超过限制";
+                break;
+            case 45004:
+                errmsg = "描述字段超过限制";
+                break;
+            case 45005:
+                errmsg = "链接字段超过限制";
+                break;
+            case 45006:
+                errmsg = "图片链接字段超过限制";
+                break;
+            case 45007:
+                errmsg = "语音播放时间超过限制";
+                break;
+            case 45008:
+                errmsg = "图文消息超过限制";
+                break;
+            case 45009:
+                errmsg = "接口调用超过限制";
+                break;
+            case 45010:
+                errmsg = "创建菜单个数超过限制";
+                break;
+            case 45015:
+                errmsg = "回复时间超过限制";
+                break;
+            case 45016:
+                errmsg = "系统分组,不允许修改";
+                break;
+            case 45017:
+                errmsg = "分组名字过长";
+                break;
+            case 45018:
+                errmsg = "分组数量超过上限";
+                break;
+            case 45024:
+                errmsg = "账号数量超过上限";
+                break;
+            case 46001:
+                errmsg = "不存在媒体数据";
+                break;
+            case 46002:
+                errmsg = "不存在的菜单版本";
+                break;
+            case 46003:
+                errmsg = "不存在的菜单数据";
+                break;
+            case 46004:
+                errmsg = "不存在的员工";
+                break;
+            case 47001:
+                errmsg = "解析JSON/XML内容错误";
+                break;
+            case 48002:
+                errmsg = "Api禁用";
+                break;
+            case 50001:
+                errmsg = "redirect_uri未授权";
+                break;
+            case 50002:
+                errmsg = "员工不在权限范围";
+                break;
+            case 50003:
+                errmsg = "应用已停用";
+                break;
+            case 50004:
+                errmsg = "员工状态不正确(未关注状态) ";
+                break;
+            case 50005:
+                errmsg = "企业已禁用";
+                break;
+            case 60001:
+                errmsg = "部门长度不符合限制";
+                break;
+            case 60002:
+                errmsg = "部门层级深度超过限制";
+                break;
+            case 60003:
+                errmsg = "部门不存在";
+                break;
+            case 60004:
+                errmsg = "父亲部门不存在";
+                break;
+            case 60005:
+                errmsg = "不允许删除有成员的部门";
+                break;
+            case 60006:
+                errmsg = "不允许删除有子部门的部门";
+                break;
+            case 60007:
+                errmsg = "不允许删除根部门";
+                break;
+            case 60008:
+                errmsg = "部门名称已存在";
+                break;
+            case 60009:
+                errmsg = "部门名称含有非法字符";
+                break;
+            case 60010:
+                errmsg = "部门存在循环关系";
+                break;
+            case 60011:
+                errmsg = "管理员权限不足,(user/department/agent)无权限";
+                break;
+            case 60012:
+                errmsg = "不允许删除默认应用";
+                break;
+            case 60013:
+                errmsg = "不允许关闭应用";
+                break;
+            case 60014:
+                errmsg = "不允许开启应用";
+                break;
+            case 60015:
+                errmsg = "不允许修改默认应用可见范围";
+                break;
+            case 60016:
+                errmsg = "不允许删除存在成员的标签";
+                break;
+            case 60017:
+                errmsg = "不允许设置企业";
+                break;
+            case 60102:
+                errmsg = "UserID已存在";
+                break;
+            case 60103:
+                errmsg = "手机号码不合法";
+                break;
+            case 60104:
+                errmsg = "手机号码已存在";
+                break;
+            case 60105:
+                errmsg = "邮箱不合法";
+                break;
+            case 60106:
+                errmsg = "邮箱已存在";
+                break;
+            case 60107:
+                errmsg = "微信号不合法";
+                break;
+            case 60108:
+                errmsg = "微信号已存在";
+                break;
+            case 60109:
+                errmsg = "QQ号已存在";
+                break;
+            case 60110:
+                errmsg = "部门个数超出限制";
+                break;
+            case 60111:
+                errmsg = "UserID不存在";
+                break;
+            case 60112:
+                errmsg = "成员姓名不合法";
+                break;
+            case 60113:
+                errmsg = "身份认证信息(微信号/手机/邮箱)不能同时为空 ";
+                break;
+            case 60114:
+                errmsg = "性别不合法";
+                break;
+
+            default:
+                errmsg = "没有此错误码! ";
+                break;
+        }
+        return errmsg;
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        System.out.println(send("ou2uV5DGDxJ7BouxiAZZigGQFIHU","测试","测试",
+                "2023-08-25","2023-08-26","cesss"));
+    }
+}

+ 76 - 0
src/main/java/com/template/common/utils/Message2.java

@@ -0,0 +1,76 @@
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+
+import java.util.HashMap;
+
+/**
+ * 公众号,推送信息,推给商家信息
+ */
+public class Message2 {
+
+    /** 公众号推送消息
+     * openid:用户小程序openid, order_num订单号,
+     *  h_type房型, live_end入住和离店日期:2023-08-02~2023-08-06
+     *  user_name:用户名, hotel_name:酒店名
+     * **/
+    public static String send(String openid,String order_num,
+                              String h_type,String live_end,
+                              String user_name,String hotel_name,String id)
+            throws Exception {
+        Gson gson = new Gson();
+        String access_token = "";
+        JSONObject json = new JSONObject();
+        json.put("grant_type", "client_credential");
+        json.put("appid","");
+        json.put("secret","");
+        String url = "https://api.weixin.qq.com/cgi-bin/stable_token";
+        access_token = HttpsClient.sendJson(url,json);
+        access_token = gson.fromJson(access_token, AccessToken.class).getAccess_token();
+        JSONObject message = new JSONObject();
+        message.put("touser", openid);
+        message.put("template_id", "pQLY-9pKW-lD-6PuOlxieatGmuCHOezubTxI99cs7Zo");
+        JSONObject small = new JSONObject();
+        small.put("appid", "");
+        small.put("pagepath", "/pages/push/push?id=" + id);
+        message.put("miniprogram", small);
+        // 订单号
+        JSONObject character_string1_ = new JSONObject();
+        character_string1_.put("value", order_num);
+        character_string1_.put("color", "#173177");
+        // 房型名称
+        JSONObject thing6 = new JSONObject();
+        thing6.put("value", h_type);
+        thing6.put("color", "#0000FF");
+        // 入离时间
+        JSONObject time11 = new JSONObject();
+        time11.put("value", live_end);
+        time11.put("color", "#173177");
+        // 客户名称
+        JSONObject thing10 = new JSONObject();
+        thing10.put("value", user_name);
+        thing10.put("color", "#173177");
+        // 酒店名称
+        JSONObject thing9_ = new JSONObject();
+        thing9_.put("value", hotel_name);
+        thing9_.put("color", "#173177");
+        // 封装data
+        JSONObject data = new JSONObject();
+        // 订单号
+        data.put("character_string1",character_string1_);
+        // 房型名称
+        data.put("thing6",thing6);
+        // 入离时间
+        data.put("time11",time11);
+        // 客户名称
+        data.put("thing10",thing10);
+        // 酒店名称
+        data.put("thing9",thing9_);
+        message.put("data",data);
+        return HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+access_token, message);
+    }
+
+}

+ 23 - 0
src/main/java/com/template/common/utils/MyX509TrustManager.java

@@ -0,0 +1,23 @@
+package com.template.common.utils;
+
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * X509TrustManager用于实现SSL证书的安全校验
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class MyX509TrustManager implements X509TrustManager {
+    @Override
+    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+
+    @Override
+    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+
+    @Override
+    public X509Certificate[] getAcceptedIssuers() {
+        return null;
+    }
+}

+ 42 - 0
src/main/java/com/template/common/utils/SHA1.java

@@ -0,0 +1,42 @@
+package com.template.common.utils;
+import java.security.MessageDigest;
+
+/**
+ * 微信SHA1算法
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public final class SHA1 {
+
+    private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    /**
+     *  将字节并格式化
+     * @param bytes 原始字节
+     * @return 格式化字节
+     */
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        // 把密文转换成十六进制的字符串形式
+        for (int j = 0; j < len; j++) {
+            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+        }
+        return buf.toString();
+    }
+
+    public static String encode(String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
+            messageDigest.update(str.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

+ 52 - 0
src/main/java/com/template/common/utils/WxConfig.java

@@ -0,0 +1,52 @@
+package com.template.common.utils;
+
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+
+/**
+ * 微信公众号开发配置类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+@Component
+public class WxConfig {
+
+    /**
+     * 开发者ID
+     */
+    public static String apicode = "CS0001";
+
+    /**
+     * 商户号
+     */
+    public static String apikey  = "XMZnRsZe61hEXyYa7JuAtUupJZ2Q5byc";
+
+
+    /**
+     * 统一下单-通知链接
+     */
+    public static String unifiedorderNotifyUrl = "https://app.dev.9kbs.com/";
+
+
+    /**
+     * 连接超时时间
+     */
+    public static Integer connectionTimeout = 15000;
+
+    /**
+     * 连接超时时间
+     */
+    public static Integer readTimeout = 15000;
+
+    //支付map缓存处理
+    private static HashMap<String,String> payMap = new HashMap<String,String>();
+    public static String getPayMap(String key) {
+        return payMap.get(key);
+    }
+    public static void setPayMap(String key,String value) {
+        payMap.put(key,value);
+    }
+
+
+}

+ 53 - 0
src/main/java/com/template/common/utils/WxConstants.java

@@ -0,0 +1,53 @@
+package com.template.common.utils;
+
+/**
+ * 微信公众号常量类
+ * @author lujunjie
+ * @date   2018/06/28
+ */
+public class WxConstants {
+
+    /**
+     * 默认编码
+     */
+    public static final String DEFAULT_CHARSET = "UTF-8";
+
+    /**
+     * 统一下单-扫描支付
+     */
+    public static String PAY_UNIFIEDORDER = "https://app.dev.9kbs.com/shopOpenApi/services/deviceAntiScode/getStartCode";
+
+    public static String Test = "http://localhost:8088/HotWaters/userget_stu.action";
+
+    public static String Test2 = "http://localhost:8088/HotWaters/userstu_info.action";
+
+    /**
+     * 请求成功返回码
+     */
+    public final static String ERRCODE_OK_CODE = "0";
+    /**
+     * 错误的返回码的Key
+     */
+    public final static String ERRCODE = "errcode";
+
+    /**
+     * 返回状态码
+     */
+    public final static String RETURN_CODE= "return_code";
+
+    /**
+     * access_token 字符串
+     */
+    public final static String ACCESS_TOKEN = "access_token";
+
+    /**
+     * 签名类型 MD5
+     */
+    public final static String SING_MD5 = "MD5";
+
+    /**
+     * 签名类型 HMAC-SHA256
+     */
+    public final static String SING_HMACSHA256 = "HMAC-SHA256";
+
+}

+ 385 - 0
src/main/java/com/template/common/utils/WxUtil.java

@@ -0,0 +1,385 @@
+package com.template.common.utils;
+
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.*;
+import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 微信公众号接口工具类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class WxUtil {
+
+	/**
+	 * 加密/校验流程如下:
+	 * 1. 将token、timestamp、nonce三个参数进行字典序排序<br>
+	 * 2. 将三个参数字符串拼接成一个字符串进行sha1加密<br>
+	 * 3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信<br>
+	 *
+	 * @param token Token验证密钥
+	 * @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数,nonce参数
+	 * @param timestamp 时间戳
+	 * @param nonce 随机数
+	 * @return 验证成功返回:true,失败返回:false
+	 */
+	public static boolean checkSignature(String token, String signature, String timestamp, String nonce) {
+		List<String> params = new ArrayList<String>();
+		params.add(token);
+		params.add(timestamp);
+		params.add(nonce);
+		//1. 将token、timestamp、nonce三个参数进行字典序排序
+		Collections.sort(params, new Comparator<String>() {
+			@Override
+			public int compare(String o1, String o2) {
+				return o1.compareTo(o2);
+			}
+		});
+		//2. 将三个参数字符串拼接成一个字符串进行sha1加密
+		String temp = SHA1.encode(params.get(0) + params.get(1) + params.get(2));
+		//3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信
+		return temp.equals(signature);
+	}
+
+	/**
+	 * 输入流转化为字符串
+	 * @param inputStream 流
+	 * @return String 字符串
+	 * @throws Exception
+	 */
+	public static String getStreamString(InputStream inputStream) throws Exception{
+		StringBuffer buffer=new StringBuffer();
+		InputStreamReader inputStreamReader = null;
+		BufferedReader bufferedReader = null;
+		try{
+			inputStreamReader=new InputStreamReader(inputStream, WxConstants.DEFAULT_CHARSET);
+			bufferedReader=new BufferedReader(inputStreamReader);
+			String line;
+			while((line=bufferedReader.readLine())!=null){
+				buffer.append(line);
+			}
+		}catch(Exception e){
+			throw new Exception();
+		}finally {
+			if(bufferedReader != null){
+				bufferedReader.close();
+			}
+			if(inputStreamReader != null){
+				inputStreamReader.close();
+			}
+			if(inputStream != null){
+				inputStream.close();
+			}
+		}
+		return buffer.toString();
+	}
+
+	/**
+	 * 获取随机字符串 Nonce Str
+	 * @return String 随机字符串
+	 */
+	public static String getNonceStr() {
+		return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
+	}
+
+	/**
+	 * 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
+	 * @param data 待签名数据
+	 * @param apikey API密钥
+	 * @return 签名
+	 */
+	public static String getSignature(final Map<String, String> data, String apikey,
+				String signType) throws Exception {
+		Set<String> keySet = data.keySet();
+		String[] keyArray = keySet.toArray(new String[keySet.size()]);
+		Arrays.sort(keyArray);
+		StringBuilder sb = new StringBuilder();
+		sb.append(apikey);
+		sb.append("amount10apicodeCS0001collect_code");
+		sb.append(data.get("collect_code").trim());
+		sb.append("order_no");
+		sb.append(data.get("order_no").trim());
+        sb.append("timestamp");
+        sb.append(data.get("timestamp").trim());
+        sb.append(apikey);
+		System.out.println(sb);
+		if (signType.equals(WxConstants.SING_MD5)) {
+			System.out.println(MD5(sb.toString()).toUpperCase());
+			return MD5(sb.toString()).toLowerCase();
+		}
+		else if (signType.equals(WxConstants.SING_HMACSHA256)) {
+			return HMACSHA256(sb.toString(), apikey);
+		}
+		else {
+			throw new Exception(String.format("Invalid sign_type: %s", signType));
+		}
+	}
+
+	/**
+	 * 生成 MD5
+	 * @param data 待处理数据
+	 * @return MD5结果
+	 */
+	public static String MD5(String data) throws Exception {
+		MessageDigest md = MessageDigest.getInstance("MD5");
+		byte[] array = md.digest(data.getBytes("UTF-8"));
+		StringBuilder sb = new StringBuilder();
+		for (byte item : array) {
+			sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+		}
+		return sb.toString().toUpperCase();
+	}
+
+	/**
+	 * 生成 HMACSHA256
+	 * @param data 待处理数据
+	 * @param key 密钥
+	 * @return 加密结果
+	 * @throws Exception
+	 */
+	public static String HMACSHA256(String data, String key) throws Exception {
+		Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
+		SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
+		sha256_HMAC.init(secret_key);
+		byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
+		StringBuilder sb = new StringBuilder();
+		for (byte item : array) {
+			sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+		}
+		return sb.toString().toUpperCase();
+	}
+
+	/**
+	 * @param data Map类型数据
+	 * @return XML格式的字符串
+	 * @throws Exception
+	 */
+	public static String mapToXml(Map<String, String> data) throws Exception {
+		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+		DocumentBuilder documentBuilder= documentBuilderFactory.newDocumentBuilder();
+		org.w3c.dom.Document document = documentBuilder.newDocument();
+		org.w3c.dom.Element root = document.createElement("xml");
+		document.appendChild(root);
+		for (String key: data.keySet()) {
+			String value = data.get(key);
+			if (value == null) {
+				value = "";
+			}
+			value = value.trim();
+			org.w3c.dom.Element filed = document.createElement(key);
+			filed.appendChild(document.createTextNode(value));
+			root.appendChild(filed);
+		}
+		TransformerFactory tf = TransformerFactory.newInstance();
+		Transformer transformer = tf.newTransformer();
+		DOMSource source = new DOMSource(document);
+		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+		StringWriter writer = new StringWriter();
+		StreamResult result = new StreamResult(writer);
+		transformer.transform(source, result);
+		String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", "");
+		try {
+			writer.close();
+		}
+		catch (Exception ex) {
+		}
+		return output;
+	}
+
+	/**
+	 * 处理 HTTPS API返回数据,转换成Map对象。return_code为SUCCESS时,验证签名。
+	 * @param xmlStr API返回的XML格式数据
+	 * @return Map类型数据
+	 * @throws Exception
+	 */
+	public static Map<String, String> processResponseXml(String xmlStr,String signType) throws Exception {
+		String RETURN_CODE = WxConstants.RETURN_CODE;
+		String return_code;
+		Map<String, String> respData = xmlToMap(xmlStr);
+		if (respData.containsKey(RETURN_CODE)) {
+			return_code = respData.get(RETURN_CODE);
+		}
+		else {
+			throw new Exception(String.format("No `return_code` in XML: %s", xmlStr));
+		}
+
+		if (return_code.equals("FAIL")) {
+			return respData;
+		}
+		else if (return_code.equals("SUCCESS")) {
+			if (isResponseSignatureValid(respData,signType)) {
+				return respData;
+			}
+			else {
+				throw new Exception(String.format("Invalid sign value in XML: %s", xmlStr));
+			}
+		}
+		else {
+			throw new Exception(String.format("return_code value %s is invalid in XML: %s", return_code, xmlStr));
+		}
+	}
+
+
+	/**
+	 * XML格式字符串转换为Map
+	 * @param strXML XML字符串
+	 * @return XML数据转换后的Map
+	 * @throws Exception
+	 */
+	public static Map<String, String> xmlToMap(String strXML) throws Exception {
+		try {
+			Map<String, String> data = new HashMap<String, String>();
+			DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+
+			String FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
+			documentBuilderFactory.setFeature(FEATURE, true);
+
+			FEATURE = "http://xml.org/sax/features/external-general-entities";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			FEATURE = "http://xml.org/sax/features/external-parameter-entities";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			documentBuilderFactory.setXIncludeAware(false);
+			documentBuilderFactory.setExpandEntityReferences(false);
+			DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+			InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
+			org.w3c.dom.Document doc = documentBuilder.parse(stream);
+			doc.getDocumentElement().normalize();
+			NodeList nodeList = doc.getDocumentElement().getChildNodes();
+			for (int idx = 0; idx < nodeList.getLength(); ++idx) {
+				Node node = nodeList.item(idx);
+				if (node.getNodeType() == Node.ELEMENT_NODE) {
+					org.w3c.dom.Element element = (org.w3c.dom.Element) node;
+					data.put(element.getNodeName(), element.getTextContent());
+				}
+			}
+			try {
+				stream.close();
+			} catch (Exception ex) {
+				// do nothing
+			}
+			return data;
+		} catch (Exception ex) {
+			throw ex;
+		}
+	}
+
+	/**
+	 * 判断xml数据的sign是否有效,必须包含sign字段,否则返回false。
+	 * @param reqData 向wxpay post的请求数据
+	 * @return 签名是否有效
+	 * @throws Exception
+	 */
+	private static boolean isResponseSignatureValid(final Map<String, String> reqData,String signType) throws Exception {
+		// 返回数据的签名方式和请求中给定的签名方式是一致的
+		return isSignatureValid(reqData,WxConfig.apikey,signType);
+	}
+
+	/**
+	 * 判断签名是否正确,必须包含sign字段,否则返回false。
+	 * @param data Map类型数据
+	 * @param key API密钥
+	 * @param signType 签名方式
+	 * @return 签名是否正确
+	 * @throws Exception
+	 */
+	public static boolean isSignatureValid(Map<String, String> data, String key, String signType) throws Exception {
+		if (!data.containsKey("sign")) {
+			return false;
+		}
+		String sign = data.get("sign");
+		return getSignature(data, key, signType).equals(sign);
+	}
+
+//	/**
+//	 * 生成支付二维码
+//	 * @param response 响应
+//	 * @param contents url链接
+//	 * @throws Exception
+//	 */
+//	public static void writerPayImage(HttpServletResponse response, String contents) throws Exception{
+//		ServletOutputStream out = response.getOutputStream();
+//		try {
+//			Map<EncodeHintType,Object> hints = new HashMap<EncodeHintType,Object>();
+//			hints.put(EncodeHintType.CHARACTER_SET,"UTF-8");
+//			hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
+//			hints.put(EncodeHintType.MARGIN, 0);
+//			BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE,300,300,hints);
+//			MatrixToImageWriter.writeToStream(bitMatrix,"jpg",out);
+//		}catch (Exception e){
+//			throw new Exception("生成二维码失败!");
+//		}finally {
+//			if(out != null){
+//				out.flush();
+//				out.close();
+//			}
+//		}
+//	}
+
+	/**
+	 * 生成商户订单号
+	 * @return String
+	 */
+	public static String mchOrderNo(){
+		SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
+		String date = sdf.format(new Date());
+
+		Random random = new Random();
+		String fourRandom = String.valueOf(random.nextInt(10000));
+		int randLength = fourRandom.length();
+		//不足4位继续补充
+		if(randLength<4){
+			for(int remain = 1; remain <= 4 - randLength; remain ++ ){
+				fourRandom += random.nextInt(10)  ;
+			}
+		}
+		return date+fourRandom;
+	}
+
+	/**
+	 * 生成默认用户名
+	 * @return String
+	 */
+	public static String createDefaultUserName(){
+		SimpleDateFormat sdf = new SimpleDateFormat("ddHHmmss");
+		String date = sdf.format(new Date());
+		return "微信用户" + date;
+	}
+
+	/**
+	 * 返回信息给微信
+	 * @param response
+	 * @param content 内容
+	 * @throws Exception
+	 */
+	public static void responsePrint(HttpServletResponse response, String content) throws Exception{
+		response.setCharacterEncoding("UTF-8");
+		response.setContentType("text/xml");
+		response.getWriter().print(content);
+		response.getWriter().flush();
+		response.getWriter().close();
+	}
+
+
+}

+ 34 - 0
src/main/java/com/template/controller/HikvisionController.java

@@ -0,0 +1,34 @@
+package com.template.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.template.api.HikvisionAPI;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+@RestController
+public class HikvisionController implements HikvisionAPI {
+    @Override
+    public void subscription(HttpServletRequest request) {
+
+    }
+
+    @Override
+    public void faceComparison(HttpServletRequest request) {
+
+    }
+
+    @Override
+    public void emphasisFace(HttpServletRequest request) {
+
+    }
+
+    @Override
+    public JSONObject playback() {
+        return null;
+    }
+
+    @Override
+    public JSONObject general(JSONObject jsonObject) {
+        return null;
+    }
+}

+ 250 - 8
src/main/java/com/template/controller/SmartWarningController.java

@@ -1,21 +1,44 @@
 package com.template.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.template.api.SmartWarningControllerAPI;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.common.utils.ExcelUtils;
+import com.template.common.utils.ExcelUtils2;
 import com.template.common.utils.paramUtils;
+import com.template.model.dto.OperationWarningDto;
+import com.template.model.dto.WarningSavePushDto;
+import com.template.model.pojo.SmartDepartment;
+import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartWarning;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.DepartmentTreeVo;
+import com.template.model.vo.UserVo;
+import com.template.services.SmartDepartmentService;
+import com.template.services.SmartUserService;
 import com.template.services.SmartWarningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.yaml.snakeyaml.events.Event;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author ceshi
@@ -27,9 +50,16 @@ public class SmartWarningController implements SmartWarningControllerAPI {
     @Autowired
     private SmartWarningService smartWarningService;
 
+    @Autowired
+    private SmartDepartmentService smartDepartmentService;
+
+    @Autowired
+    private SmartUserService smartUserService;
+
     /**
      * 新增预警信息
-     * @param smartApply 预警信息数据
+     *
+     * @param smartApply    预警信息数据
      * @param bindingResult
      * @return
      */
@@ -47,7 +77,8 @@ public class SmartWarningController implements SmartWarningControllerAPI {
 
     /**
      * 更新预警信息
-     * @param sa 预警信息数据
+     *
+     * @param sa            预警信息数据
      * @param bindingResult
      * @return
      */
@@ -64,14 +95,15 @@ public class SmartWarningController implements SmartWarningControllerAPI {
 
     /**
      * 预警信息分页数据查询
+     *
      * @param currentPage 当前页数
-     * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * @param pageCount   一页数据条数
+     * @param name        查询名称
      * @return
      */
     @Override
-    public CommonResult queryPageSmartWarning(int currentPage, int pageCount, String name) {
-        PageUtils<SmartWarning> result = smartWarningService.queryPageSmartWarnings(currentPage, pageCount, name);
+    public CommonResult queryPageSmartWarning(int currentPage, int pageCount, String name, String state) {
+        PageUtils<SmartWarning> result = smartWarningService.queryPageSmartWarnings(currentPage, pageCount, name, state);
 
         return CommonResult.ok(result);
     }
@@ -82,7 +114,7 @@ public class SmartWarningController implements SmartWarningControllerAPI {
 
         SmartWarning data = smartWarningService.getSmartById(id);
 
-        if(data == null){
+        if (data == null) {
             return CommonResult.fail("当前数据不存在,删除失败!");
         }
 
@@ -91,5 +123,215 @@ public class SmartWarningController implements SmartWarningControllerAPI {
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
     }
 
+    @Override
+    public CommonResult operation(OperationWarningDto operationWarningDto) {
+        Integer id = operationWarningDto.getId();
+        if (ObjectUtils.isEmpty(id)) {
+            return CommonResult.fail("缺少id");
+        }
+        String remark = operationWarningDto.getRemark();
+
+        SmartWarning smartById = smartWarningService.getSmartById(id);
+
+        smartById.setStatu(1);
+        smartById.setRemark(remark);
+
+        int result = smartWarningService.updateSmartWarning(smartById);
+
+        return result > 0 ? CommonResult.ok("操作成功") : CommonResult.fail("操作失败");
+    }
+
+    @Override
+    public void excelSmartWarning(HttpServletResponse response, String location, String state) {
+        // 表头数据
+        List<Object> head = Arrays.asList("姓名", "事件", "地点", "时间", "备注", "状态", "图片");
+
+        List<List<Object>> sheetDataList = new ArrayList<>();
+        sheetDataList.add(head);
+
+//        获取数据
+        LambdaQueryWrapper<SmartWarning> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.like(ObjectUtils.isNotEmpty(location), SmartWarning::getLocation, location)
+                .eq(ObjectUtils.isNotEmpty(state), SmartWarning::getStatu, state);
+        List<SmartWarning> list = smartWarningService.list(queryWrapper);
+
+        if (ObjectUtils.isNotEmpty(list) && list.size() > 0) {
+            for (SmartWarning smartWarning : list) {
+                List<Object> user = new ArrayList<>();
+                user.add(smartWarning.getWarningName());
+                user.add(smartWarning.getType());
+                user.add(smartWarning.getLocation());
+                user.add(smartWarning.getDateTime());
+                user.add(smartWarning.getRemark());
+                Integer statu = smartWarning.getStatu();
+                String status = "";
+                if (statu == 0) {
+                    status = "未处理";
+                } else if (statu == 1) {
+                    status = "已处理";
+                }
+                user.add(status);
+                user.add(smartWarning.getImage());
+                // 将数据汇总
+                sheetDataList.add(user);
+            }
+
+        }
+
+        // 导出数据
+        ExcelUtils2.export(response, "预警表", sheetDataList);
+
+    }
+
+    @Override
+    public CommonResult warningType() {
+        List<String> typeList = smartWarningService.warningType();
+        typeList.add("全部");
+
+        return CommonResult.ok(typeList);
+    }
+
+    @Override
+    public CommonResult pageWarning(int currentPage, int pageCount, String type, String dateTime) {
+        PageUtils<SmartWarning> result = smartWarningService.pageWarning(currentPage, pageCount, type, dateTime);
+
+        return CommonResult.ok(result);
+    }
+
+    @Override
+    public CommonResult warningDepartmentTree() {
+        List<SmartDepartment> result = smartDepartmentService.list(new QueryWrapper<>());
+
+        List<SmartDepartment> zeroResult = result.stream().filter(e -> e.getParentId().intValue() == 0).collect(Collectors.toList());
+        List<DepartmentTreeVo> departments = new ArrayList<>();
+        for (SmartDepartment data : zeroResult) {
+            DepartmentTreeVo newData = DepartmentTreeVo.builder()
+                    .id(data.getId())
+                    .name(data.getName())
+                    .parentId(data.getParentId())
+                    .build();
+
+            List<DepartmentTreeVo> departmentTrees = QueryDepartmentTreeRecords(newData.getId(), result);
+            newData.setChildren(departmentTrees);
+            departments.add(newData);
+        }
+
+
+        return CommonResult.ok(departments);
+    }
+
+    @Override
+    public CommonResult warningUserList(int currentPage, int pageCount, Integer departmentId, String name) {
+        //获取该部门下的所有子级部门ID
+        List<Integer> childDepartmentIds = new ArrayList<>();
+        List<SmartDepartment> departments = smartDepartmentService.list(null);
+        childDepartmentIds.add(departmentId);
+        QueryDepartmentTreeRecords(departmentId, departments, childDepartmentIds);
+
+        if (departmentId == null) {
+            childDepartmentIds = null;
+        }
+
+        PageUtils<UserVo> result = smartUserService.warningUserList(currentPage, pageCount, childDepartmentIds, name);
+        return CommonResult.ok(result);
+    }
+
+    @Override
+    public CommonResult warningPushList() {
+        List<SmartUser> names = smartUserService.warningPushList();
+
+        return CommonResult.ok(names);
+    }
+
+    @Override
+    public CommonResult warningSavePush(WarningSavePushDto warningSavePushDto) {
+        List<Integer> ids = warningSavePushDto.getIds();
+
+        if (ObjectUtils.isEmpty(ids) && ids.size() <= 0) {
+            return CommonResult.fail(ResponseStatusEnum.PARAM_ERROR);
+        }
+
+        List<SmartUser> smartUsers = smartUserService.getSmartUserByIds(ids);
+
+        for (SmartUser smartUser : smartUsers) {
+            String gzhOpenId = smartUser.getGzhOpenId();
+            if (ObjectUtils.isEmpty(gzhOpenId)) {
+                return CommonResult.fail(smartUser.getName()+ "未关联公众号");
+            }
+            smartUser.setIsPush(1);
+            smartUserService.updateSmartUser(smartUser);
+        }
+
+        return CommonResult.ok();
+    }
+
+    @Override
+    public CommonResult warningDeletePush(Integer id) {
+
+        if (ObjectUtils.isEmpty(id)) {
+            return CommonResult.fail();
+        }
+
+        SmartUser smartById = smartUserService.getSmartById(id);
+
+        if (ObjectUtils.isEmpty(smartById)) {
+            return CommonResult.fail();
+        }
+        smartById.setIsPush(0);
+        int result = smartUserService.updateSmartUser(smartById);
+        return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
+    }
+
+
+    /**
+     * 根据父级ID获取树形数据
+     *
+     * @param parentID 父级ID
+     * @param lists    数据集合
+     * @return
+     */
+    private List<DepartmentTreeVo> QueryDepartmentTreeRecords(Integer parentID, List<SmartDepartment> lists) {
+        List<DepartmentTreeVo> newTrees = new ArrayList<>();
+
+        List<SmartDepartment> datas = lists.stream().filter(e -> e.getParentId().equals(parentID)).collect(Collectors.toList());
+
+        for (SmartDepartment data : datas) {
+            DepartmentTreeVo item = DepartmentTreeVo.builder()
+                    .id(data.getId())
+                    .parentId(parentID)
+                    .name(data.getName())
+                    .build();
+            List<DepartmentTreeVo> news = QueryDepartmentTreeRecords(item.getId(), lists);
+            if (news == null || news.size() == 0) {
+                newTrees.add(item);
+                continue;
+            } else {
+                item.setChildren(news);
+                newTrees.add(item);
+            }
+        }
+
+        return newTrees;
+    }
+
+    /**
+     * 根据父级ID获取树形数据
+     *
+     * @param parentID 父级ID
+     * @param lists    数据集合
+     * @return
+     */
+    private List<DepartmentTreeVo> QueryDepartmentTreeRecords(Integer parentID, List<SmartDepartment> lists, List<Integer> departmentIds) {
+        List<DepartmentTreeVo> newTrees = new ArrayList<>();
+
+        List<SmartDepartment> datas = lists.stream().filter(e -> e.getParentId().equals(parentID)).collect(Collectors.toList());
+
+        for (SmartDepartment data : datas) {
+            departmentIds.add(data.getId());
+            QueryDepartmentTreeRecords(data.getId(), lists, departmentIds);
+        }
+
+        return newTrees;
+    }
 }
 

+ 1 - 1
src/main/java/com/template/core/JwtlnterceptorConfig.java

@@ -14,7 +14,7 @@ public class JwtlnterceptorConfig implements WebMvcConfigurer {
         //目前测试下来 使用 /**所有的话,response.sendError浏览器获取不到响应的信息
         //默认拦截所有路径
         registry.addInterceptor(authenticationInterceptor())
-                .addPathPatterns("/api/**");
+                .addPathPatterns("/api0/**");
         //endregion
     }
 

+ 6 - 0
src/main/java/com/template/mapper/SmartUserMapper.java

@@ -1,5 +1,6 @@
 package com.template.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.model.pojo.SmartUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -28,4 +29,9 @@ public interface SmartUserMapper extends BaseMapper<SmartUser> {
     List<SmartUser> querySmartUsers(@Param("departmentIds") List<Integer> departmentIds, @Param("name") String name);
 
     IPage<GradeVo> querySmartSecordPage(IPage<GradeVo> page, @Param("name") String name);
+
+    IPage<UserVo> warningUserList(Page<UserVo> page,@Param("departmentIds") List<Integer> departmentIds,@Param("name") String name);
+
+    List<SmartUser> warningPushList();
+
 }

+ 5 - 0
src/main/java/com/template/mapper/SmartWarningMapper.java

@@ -4,6 +4,8 @@ import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  *  Mapper 接口
@@ -15,4 +17,7 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface SmartWarningMapper extends BaseMapper<SmartWarning> {
 
+    List<String> warningType();
+
+
 }

+ 10 - 0
src/main/java/com/template/model/dto/OperationWarningDto.java

@@ -0,0 +1,10 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+@Data
+public class OperationWarningDto {
+    private Integer id;
+    private String remark;
+
+}

+ 11 - 0
src/main/java/com/template/model/dto/WarningSavePushDto.java

@@ -0,0 +1,11 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class WarningSavePushDto {
+    private List<Integer> ids;
+
+}

+ 6 - 0
src/main/java/com/template/model/pojo/SmartUser.java

@@ -97,12 +97,18 @@ public class SmartUser implements Serializable {
     @ApiModelProperty(value = "职务")
     private Integer duties;
 
+    @ApiModelProperty(value = "是否推送公众号信息  不推送:0 推送:1")
+    private Integer isPush;
+
     @ApiModelProperty(value = "是否注销  未注销:0  注销:1")
     private Integer isCancel;
 
     @ApiModelProperty(value = "微信openId")
     private String openId;
 
+    @ApiModelProperty(value = "公众号openId")
+    private String gzhOpenId;
+
     @ApiModelProperty(value = "希沃学生UID")
     private String xwStudentUid;
 

+ 5 - 2
src/main/java/com/template/model/pojo/SmartWarning.java

@@ -34,8 +34,8 @@ public class SmartWarning implements Serializable {
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
-    @ApiModelProperty(value = "用户ID")
-    private Integer userId;
+    @ApiModelProperty("预警人姓名")
+    private String warningName;
 
     @ApiModelProperty(value = "类型")
     private String type;
@@ -52,6 +52,9 @@ public class SmartWarning implements Serializable {
     @ApiModelProperty(value = "状态 未处理:0 已处理:1 已推送:2")
     private Integer statu;
 
+    @ApiModelProperty(value = "发生时间")
+    private String dateTime;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;

+ 4 - 1
src/main/java/com/template/services/SmartUserService.java

@@ -52,6 +52,9 @@ public interface SmartUserService extends IService<SmartUser> {
     List<SmartUser> querySmartUsers(List<Integer> departmentIds, String name);
 
     List<SmartUser> queryStudentDatas();
+	List<SmartUser> queryStudentBySchoolClass(Integer schoolClass);
 
-    List<SmartUser> queryStudentBySchoolClass(Integer schoolClass);
+    PageUtils<UserVo> warningUserList(int currentPage, int pageCount, List<Integer> departmentIds, String name);
+
+    List<SmartUser> warningPushList();
 }

+ 10 - 1
src/main/java/com/template/services/SmartWarningService.java

@@ -5,6 +5,8 @@ import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -18,9 +20,16 @@ public interface SmartWarningService extends IService<SmartWarning> {
 
     int updateSmartWarning(SmartWarning rns);
 
-    PageUtils<SmartWarning> queryPageSmartWarnings(int currentPage, int pageCount, String name);
+    PageUtils<SmartWarning> queryPageSmartWarnings(int currentPage, int pageCount, String name,String state);
 
     int deleteSmartWarningById(int id);
 
     SmartWarning getSmartById(int id);
+
+    List<String> warningType();
+
+    PageUtils<SmartWarning> pageWarning(int currentPage, int pageCount, String type, String dateTime);
+
+
+
 }

+ 4 - 0
src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java

@@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.SmartAuthorGroupMapper;
+import com.template.mapper.SmartAuthorityMapper;
 import com.template.model.pojo.SmartAuthorGroup;
+import com.template.model.pojo.SmartAuthorGroup;
+import com.template.mapper.SmartAuthorGroupMapper;
 import com.template.model.result.PageUtils;
 import com.template.services.SmartAuthorGroupService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.List;
 

+ 14 - 0
src/main/java/com/template/services/impl/SmartUserServiceImpl.java

@@ -170,4 +170,18 @@ public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser
         return result;
     }
 
+    @Override
+    public PageUtils<UserVo> warningUserList(int currentPage, int pageCount, List<Integer> departmentIds, String name) {
+        Page<UserVo> page = new Page<>();
+        page.setCurrent(currentPage);
+        page.setSize(pageCount);
+        IPage<UserVo> result = smartUserMapper.warningUserList(page, departmentIds, name);
+        return new PageUtils(result);
+    }
+
+    @Override
+    public List<SmartUser> warningPushList() {
+        return smartUserMapper.warningPushList();
+    }
+
 }

+ 35 - 3
src/main/java/com/template/services/impl/SmartWarningServiceImpl.java

@@ -1,7 +1,9 @@
 package com.template.services.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.SmartWarningMapper;
 import com.template.model.pojo.SmartWarning;
@@ -14,6 +16,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
 /**
  * <p>
  * 服务实现类
@@ -40,10 +46,11 @@ public class SmartWarningServiceImpl extends ServiceImpl<SmartWarningMapper, Sma
     }
 
     @Override
-    public PageUtils<SmartWarning> queryPageSmartWarnings(int currentPage, int pageCount, String name) {
+    public PageUtils<SmartWarning> queryPageSmartWarnings(int currentPage, int pageCount, String name,String state) {
         Page<SmartWarning> page = new Page<>(currentPage, pageCount);
-        QueryWrapper<SmartWarning> queryWrapper = new QueryWrapper<>();
-        //queryWrapper.like(StringUtils.hasText(name), "name", name);
+        LambdaQueryWrapper<SmartWarning> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.like(ObjectUtils.isNotEmpty(name),SmartWarning::getLocation,name)
+                .eq(ObjectUtils.isNotEmpty(state),SmartWarning::getStatu,state);
         IPage<SmartWarning> result = smartWarningMapper.selectPage(page, queryWrapper);
         return new PageUtils<>(result);
     }
@@ -59,4 +66,29 @@ public class SmartWarningServiceImpl extends ServiceImpl<SmartWarningMapper, Sma
         SmartWarning result = smartWarningMapper.selectById(id);
         return result;
     }
+
+    @Override
+    public List<String> warningType() {
+        return smartWarningMapper.warningType();
+    }
+
+    @Override
+    public PageUtils<SmartWarning> pageWarning(int currentPage, int pageCount, String type, String dateTime) {
+        DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate state = LocalDate.parse(dateTime, dateTimeFormatter2);
+        LocalDate end = state.plusDays(1);
+        Page<SmartWarning> page = new Page<>(currentPage, pageCount);
+        LambdaQueryWrapper<SmartWarning> queryWrapper = new LambdaQueryWrapper<>();
+        if (!"全部".equals(type)) {
+            queryWrapper.eq(SmartWarning::getType,type);
+        }
+        queryWrapper.between(SmartWarning::getDateTime,state,end);
+
+
+        IPage<SmartWarning> result = smartWarningMapper.selectPage(page, queryWrapper);
+
+        return new PageUtils<>(result);
+    }
+
+
 }

+ 19 - 0
src/main/resources/mapper/template/SmartUserMapper.xml

@@ -113,4 +113,23 @@
         </if>
     </select>
 
+    <select id="warningUserList" resultType="com.template.model.vo.UserVo">
+        select *
+        from smart_user
+        where deleted = 0 and is_cancel = 0
+        <if test="departmentIds != null and departmentIds.size() > 0">
+            and department_id in
+            <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
+                ${departmentId}
+            </foreach>
+        </if>
+        <if test="name != null and name != ''">
+            and name like '%' #{name} '%'
+        </if>
+    </select>
+    <select id="warningPushList" resultType="com.template.model.pojo.SmartUser">
+        SELECT * FROM `smart_user` WHERE is_push=1 and is_cancel=0
+    </select>
+
+
 </mapper>

+ 3 - 0
src/main/resources/mapper/template/SmartWarningMapper.xml

@@ -2,4 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartWarningMapper">
 
+    <select id="warningType" resultType="java.lang.String">
+        SELECT type FROM `smart_warning` GROUP BY type
+    </select>
 </mapper>

+ 14 - 1
target/classes/mapper/template/SmartAuthorGroupMapper.xml

@@ -1,5 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartAuthorGroupMapper">
-
+    <resultMap type="com.template.model.pojo.SmartAuthorGroup" id="smartAuthorGroupMap">
+        <result property="id" column="id"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="name" column="name"/>
+        <result property="userId" column="user_id"/>
+        <result property="applyId" column="apply_id"/>
+    </resultMap>
+    <select id="smartAuthorGroup" resultType="com.template.model.pojo.SmartAuthorGroup" resultMap="smartAuthorGroupMap">
+        SELECT * FROM `smart_author_group`
+        where deleted = 0
+        <if test="userId != null and userId != ''">
+            and FIND_IN_SET(userId,user_id)
+        </if>
+    </select>
 </mapper>

+ 19 - 0
target/classes/mapper/template/SmartUserMapper.xml

@@ -113,4 +113,23 @@
         </if>
     </select>
 
+    <select id="warningUserList" resultType="com.template.model.vo.UserVo">
+        select *
+        from smart_user
+        where deleted = 0 and is_cancel = 0
+        <if test="departmentIds != null and departmentIds.size() > 0">
+            and department_id in
+            <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
+                ${departmentId}
+            </foreach>
+        </if>
+        <if test="name != null and name != ''">
+            and name like '%' #{name} '%'
+        </if>
+    </select>
+    <select id="warningPushList" resultType="com.template.model.pojo.SmartUser">
+        SELECT * FROM `smart_user` WHERE is_push=1 and is_cancel=0
+    </select>
+
+
 </mapper>

+ 42 - 0
target/classes/mapper/template/SmartVisitorMapper.xml

@@ -46,4 +46,46 @@
     </select>
 
 
+    <resultMap type="com.template.model.pojo.SmartVisitor" id="visitorDatasMap">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="userPhone" column="user_phone"/>
+        <result property="userNumber" column="user_number"/>
+        <result property="peerNum" column="peer_num"/>
+        <result property="carNum" column="car_num"/>
+        <result property="visitReason" column="visit_reason"/>
+        <result property="statu" column="statu"/>
+        <result property="visitorTime" column="visitor_time"/>
+        <result property="visitorDeadline" column="visitor_deadline"/>
+        <result property="respondent" column="respondent"/>
+        <result property="responcode" column="responcode"/>
+        <result property="departmentId" column="department_id"/>
+        <result property="respondentPhone" column="respondent_phone"/>
+        <result property="respondentName" column="respondent_name"/>
+        <result property="visitorType" column="visitor_type"/>
+    </resultMap>
+    <select id="queryVisitorPageDatas" resultType="com.template.model.pojo.SmartVisitor" resultMap="visitorPageMap">
+        select * from smart_visitor
+        where deleted = 0
+        <if test="type != null and type != ''">
+            and statu = #{type}
+        </if>
+        and (
+        <if test="studentIds != null and studentIds.size() > 0">
+            (respondent in
+            <foreach collection="studentIds" item="studentId" index="index" open="(" close=")" separator=",">
+                ${studentId}
+            </foreach>
+            and visitor_type = 1)
+        </if>
+        <if test="studentIds != null and studentIds.size() > 0 and isAdmin = 'true'">
+            or visitor_type = 2
+        </if>
+        <if test="studentIds = null and isAdmin != 'true'">
+            visitor_type = 2
+        </if>
+        )
+    </select>
+
 </mapper>

+ 3 - 0
target/classes/mapper/template/SmartWarningMapper.xml

@@ -2,4 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartWarningMapper">
 
+    <select id="warningType" resultType="java.lang.String">
+        SELECT type FROM `smart_warning` GROUP BY type
+    </select>
 </mapper>