Administrator 1 سال پیش
کامیت
8d064c8a58
100فایلهای تغییر یافته به همراه11850 افزوده شده و 0 حذف شده
  1. 8 0
      .idea/.gitignore
  2. 25 0
      .idea/compiler.xml
  3. 6 0
      .idea/encodings.xml
  4. 25 0
      .idea/jarRepositories.xml
  5. 12 0
      .idea/misc.xml
  6. 10 0
      .idea/runConfigurations.xml
  7. 124 0
      .idea/uiDesigner.xml
  8. 6 0
      .idea/vcs.xml
  9. 1 0
      README.md
  10. 222 0
      hs_err_pid5336.log
  11. 247 0
      pom.xml
  12. 84 0
      src/main/java/com/template/AutoCode.java
  13. 19 0
      src/main/java/com/template/MybatisPlusApplication.java
  14. 12 0
      src/main/java/com/template/annotation/ControllerIsShow.java
  15. 17 0
      src/main/java/com/template/annotation/DESRespondSecret.java
  16. 18 0
      src/main/java/com/template/annotation/ExcelExport.java
  17. 20 0
      src/main/java/com/template/annotation/ExcelImport.java
  18. 28 0
      src/main/java/com/template/annotation/PassToken.java
  19. 14 0
      src/main/java/com/template/annotation/UserLoginCheck.java
  20. 85 0
      src/main/java/com/template/aop/CharsetKit.java
  21. 115 0
      src/main/java/com/template/aop/Constants.java
  22. 1000 0
      src/main/java/com/template/aop/Convert.java
  23. 95 0
      src/main/java/com/template/aop/DESResponseSecretAspect.java
  24. 45 0
      src/main/java/com/template/aop/LoginCheckAspect.java
  25. 90 0
      src/main/java/com/template/aop/StrFormatter.java
  26. 624 0
      src/main/java/com/template/aop/StringUtils.java
  27. 18 0
      src/main/java/com/template/api/ExcelControllerAPI.java
  28. 26 0
      src/main/java/com/template/api/FastDFSControllerAPI.java
  29. 21 0
      src/main/java/com/template/api/LogInfoControllerAPI.java
  30. 34 0
      src/main/java/com/template/api/LoginControllerAPI.java
  31. 34 0
      src/main/java/com/template/api/RepairAdminControllerAPI.java
  32. 16 0
      src/main/java/com/template/api/SmsCodeControllerAPI.java
  33. 56 0
      src/main/java/com/template/api/SystemMenuControllerAPI.java
  34. 22 0
      src/main/java/com/template/api/system/OrganizeControllerAPI.java
  35. 35 0
      src/main/java/com/template/api/system/SysConfigControllerAPI.java
  36. 35 0
      src/main/java/com/template/api/system/SysMenuControllerAPI.java
  37. 79 0
      src/main/java/com/template/api/system/SysProjectControllerAPI.java
  38. 40 0
      src/main/java/com/template/api/system/SysRoleControllerAPI.java
  39. 70 0
      src/main/java/com/template/api/system/SysUserControllerAPI.java
  40. 56 0
      src/main/java/com/template/api/system/TaskControllerAPI.java
  41. 16 0
      src/main/java/com/template/common/constanst/Constanst.java
  42. 14 0
      src/main/java/com/template/common/exception/EmsException.java
  43. 199 0
      src/main/java/com/template/common/exception/EmsExceptionHandler.java
  44. 29 0
      src/main/java/com/template/common/exception/MyCustomException.java
  45. 43 0
      src/main/java/com/template/common/jh/ReqRespResearchProductQuestionnaireItem.java
  46. 243 0
      src/main/java/com/template/common/jh/SectionUtil.java
  47. 85 0
      src/main/java/com/template/common/result/BaseController.java
  48. 7 0
      src/main/java/com/template/common/result/Code.java
  49. 188 0
      src/main/java/com/template/common/result/HttpStatusCode.java
  50. 42 0
      src/main/java/com/template/common/result/PageResult.java
  51. 83 0
      src/main/java/com/template/common/result/ResponseStatusEnum.java
  52. 23 0
      src/main/java/com/template/common/utils/AccessToken.java
  53. 84 0
      src/main/java/com/template/common/utils/AesTestOne.java
  54. 165 0
      src/main/java/com/template/common/utils/AesUtil.java
  55. 199 0
      src/main/java/com/template/common/utils/AesUtils.java
  56. 47 0
      src/main/java/com/template/common/utils/Base64Util.java
  57. 211 0
      src/main/java/com/template/common/utils/CommonUtil.java
  58. 9 0
      src/main/java/com/template/common/utils/DataBliu.java
  59. 241 0
      src/main/java/com/template/common/utils/DateUtils.java
  60. 82 0
      src/main/java/com/template/common/utils/EncryptUtil.java
  61. 41 0
      src/main/java/com/template/common/utils/EncryptionUtil.java
  62. 75 0
      src/main/java/com/template/common/utils/ExcelClassField.java
  63. 22 0
      src/main/java/com/template/common/utils/ExcelUtil3.java
  64. 64 0
      src/main/java/com/template/common/utils/ExcelUtils.java
  65. 1008 0
      src/main/java/com/template/common/utils/ExcelUtils2.java
  66. 68 0
      src/main/java/com/template/common/utils/FileUploadUtil.java
  67. 76 0
      src/main/java/com/template/common/utils/FileUtils.java
  68. 18 0
      src/main/java/com/template/common/utils/GetVertifyCode.java
  69. 241 0
      src/main/java/com/template/common/utils/HttpClientUtils.java
  70. 112 0
      src/main/java/com/template/common/utils/HttpUtils.java
  71. 530 0
      src/main/java/com/template/common/utils/HttpsClient.java
  72. 106 0
      src/main/java/com/template/common/utils/JWTUtil.java
  73. 54 0
      src/main/java/com/template/common/utils/Md5Utils.java
  74. 548 0
      src/main/java/com/template/common/utils/Message.java
  75. 113 0
      src/main/java/com/template/common/utils/Message2.java
  76. 23 0
      src/main/java/com/template/common/utils/MyX509TrustManager.java
  77. 101 0
      src/main/java/com/template/common/utils/PageMySqlDialectPlus.java
  78. 99 0
      src/main/java/com/template/common/utils/PropertiesUtil.java
  79. 196 0
      src/main/java/com/template/common/utils/RSAUtils.java
  80. 32 0
      src/main/java/com/template/common/utils/RandomTrackAlgorithm.java
  81. 126 0
      src/main/java/com/template/common/utils/RequestUtils.java
  82. 42 0
      src/main/java/com/template/common/utils/SHA1.java
  83. 36 0
      src/main/java/com/template/common/utils/Send.java
  84. 213 0
      src/main/java/com/template/common/utils/SendSms.java
  85. 158 0
      src/main/java/com/template/common/utils/SnowflakeIdWorker.java
  86. 774 0
      src/main/java/com/template/common/utils/TimeExchange.java
  87. 640 0
      src/main/java/com/template/common/utils/TimeExchange2.java
  88. 42 0
      src/main/java/com/template/common/utils/TreeRecordsUtil.java
  89. 25 0
      src/main/java/com/template/common/utils/UUIDUtil.java
  90. 25 0
      src/main/java/com/template/common/utils/ValidateCode.java
  91. 52 0
      src/main/java/com/template/common/utils/WxConfig.java
  92. 53 0
      src/main/java/com/template/common/utils/WxConstants.java
  93. 385 0
      src/main/java/com/template/common/utils/WxUtil.java
  94. 47 0
      src/main/java/com/template/common/utils/imageUtils.java
  95. 27 0
      src/main/java/com/template/common/utils/paramUtils.java
  96. 25 0
      src/main/java/com/template/common/utils/smsUtil.java
  97. 53 0
      src/main/java/com/template/config/CosConfig.java
  98. 59 0
      src/main/java/com/template/config/MyBatisPlusConfig.java
  99. 37 0
      src/main/java/com/template/config/MySecurity.java
  100. 0 0
      src/main/java/com/template/config/smsConfig.java

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/

+ 25 - 0
.idea/compiler.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="true" />
+      <profile name="Maven default annotation processors profile" enabled="true">
+        <sourceOutputDir name="target/generated-sources/annotations" />
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
+        <outputRelativeToContentRoot value="true" />
+        <module name="projectManage2" />
+        <module name="projectManage" />
+        <module name="Project_process_houtai" />
+        <module name="mybatis_plus" />
+      </profile>
+    </annotationProcessing>
+  </component>
+  <component name="JavacSettings">
+    <option name="ADDITIONAL_OPTIONS_OVERRIDE">
+      <module name="Project_process_houtai" options="-parameters" />
+      <module name="mybatis_plus" options="-parameters" />
+      <module name="projectManage" options="-parameters" />
+      <module name="projectManage2" options="-parameters" />
+    </option>
+  </component>
+</project>

+ 6 - 0
.idea/encodings.xml

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

+ 25 - 0
.idea/jarRepositories.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
+      <option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
+      <option name="url" value="https://maven.aliyun.com/repository/public" />
+    </remote-repository>
+  </component>
+</project>

+ 12 - 0
.idea/misc.xml

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

+ 10 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 124 - 0
.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

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

+ 1 - 0
README.md

@@ -0,0 +1 @@
+#Project_process_houtai

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 222 - 0
hs_err_pid5336.log


+ 247 - 0
pom.xml

@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.4.0</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.template</groupId>
+    <artifactId>mybatis_plus</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>mybatis_plus</name>
+    <description>Demo project for Spring Boot</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+        <tencent.qcloudsms.version>1.0.6</tencent.qcloudsms.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>javax.validation</groupId>
+            <artifactId>validation-api</artifactId>
+            <version>2.0.1.Final</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.1.5.Final</version>
+        </dependency>
+
+        <!--   读取excel数据     -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+
+        <!-- fastjson -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>2.0.12</version>
+        </dependency>
+
+        <!--引入JWT-->
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.qcloudsms</groupId>
+            <artifactId>qcloudsms</artifactId>
+            <version>${tencent.qcloudsms.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <version>3.1.742</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.10</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-quartz</artifactId>
+        </dependency>
+        <!-- 数据库驱动 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <!-- lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <!-- mybatis-plus -->
+        <!-- mybatis-plus 是自己开发,并非官方的! -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.0.5</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>5.3.22</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit -->
+        <dependency>
+            <groupId>org.eclipse.jgit</groupId>
+            <artifactId>org.eclipse.jgit</artifactId>
+            <version>5.4.3.201909031940-r</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <!-- redis -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>io.lettuce</groupId>
+                    <artifactId>lettuce-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>jakarta.validation</groupId>
+            <artifactId>jakarta.validation-api</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>cos_api</artifactId>
+            <version>5.6.155</version>
+        </dependency>
+
+
+        <!--hutools-->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.4.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.4.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <version>6.0.9</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <!-- 上传文件的依赖 -->
+        <dependency>
+            <!--common-fileupload的依赖组件-->
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.6</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.2.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>2.2.11</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 84 - 0
src/main/java/com/template/AutoCode.java

@@ -0,0 +1,84 @@
+package com.template;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.GlobalConfig;
+import com.baomidou.mybatisplus.generator.config.PackageConfig;
+import com.baomidou.mybatisplus.generator.config.StrategyConfig;
+import com.baomidou.mybatisplus.generator.config.po.TableFill;
+import com.baomidou.mybatisplus.generator.config.rules.DateType;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.util.ArrayList;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 15:46
+ * @Description: com.video
+ * @Version: 1.0
+ */
+public class AutoCode {
+    public static void main(String[] args) {
+// 需要构建一个 代码自动生成器 对象
+        AutoGenerator mpg = new AutoGenerator();
+// 配置策略
+// 1、全局配置
+        GlobalConfig gc = new GlobalConfig();
+        String projectPath = System.getProperty("user.dir");
+        gc.setOutputDir(projectPath + "/src/main/java");
+        gc.setAuthor("ceshi");
+        gc.setOpen(false);
+        gc.setFileOverride(false); // 是否覆盖
+        gc.setServiceName("%sService"); // 去Service的I前缀
+        gc.setIdType(IdType.UUID);
+        gc.setDateType(DateType.ONLY_DATE);
+        gc.setSwagger2(true);
+        mpg.setGlobalConfig(gc);
+//2、设置数据源
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://192.168.161.220:3306/repair_report?useUnicode=tru&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowPublicKeyRetrieval=true&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai");
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("root");
+        dsc.setDbType(DbType.MYSQL);
+        mpg.setDataSource(dsc);
+        //3、包的配置
+        PackageConfig pc = new PackageConfig();
+        pc.setModuleName("auto");
+        pc.setParent("com.template");
+        pc.setEntity("model");
+        pc.setMapper("mapper");
+        pc.setService("services");
+        pc.setController("controller");
+        mpg.setPackageInfo(pc);
+        //4、策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setInclude("repair_admin"); // 设置要映射的表名
+        strategy.setNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
+        strategy.setEntityLombokModel(true); // 自动lombok;
+        strategy.setLogicDeleteFieldName("deleted");//逻辑删除 调用service的删除方法不会真删除 会把deleted字段的值改为1 (未删除="0",删除="1")
+        // 自动填充配置
+        TableFill deletedCreate = new TableFill("deleted", FieldFill.INSERT);
+        TableFill timeCreate = new TableFill("create_time", FieldFill.INSERT);
+        TableFill userCreate = new TableFill("create_user", FieldFill.INSERT);
+        TableFill timeModified = new TableFill("update_time", FieldFill.INSERT_UPDATE);
+        TableFill userModified = new TableFill("update_user", FieldFill.INSERT_UPDATE);
+        ArrayList<TableFill> tableFills = new ArrayList<>();
+        tableFills.add(deletedCreate);
+        tableFills.add(timeCreate);
+        tableFills.add(userCreate);
+        tableFills.add(timeModified);
+        tableFills.add(userModified);
+        strategy.setTableFillList(tableFills);
+        // 乐观锁
+        strategy.setVersionFieldName("version");
+        strategy.setRestControllerStyle(true);
+        strategy.setControllerMappingHyphenStyle(true); //localhost:8080/hello_id_2
+        mpg.setStrategy(strategy);
+        mpg.execute(); //执行
+    }
+}

+ 19 - 0
src/main/java/com/template/MybatisPlusApplication.java

@@ -0,0 +1,19 @@
+package com.template;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@EnableCaching//开启缓存
+@SpringBootApplication
+@EnableTransactionManagement //开启事务回滚
+@EnableScheduling // 开启定时任务
+public class MybatisPlusApplication {
+
+    public static void main(String[] args) {
+
+        SpringApplication.run(MybatisPlusApplication.class, args);
+    }
+}

+ 12 - 0
src/main/java/com/template/annotation/ControllerIsShow.java

@@ -0,0 +1,12 @@
+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(value = {ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ControllerIsShow {
+    String value() default "";
+}

+ 17 - 0
src/main/java/com/template/annotation/DESRespondSecret.java

@@ -0,0 +1,17 @@
+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(value = {ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DESRespondSecret {
+    boolean validated() default true;
+}

+ 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;
+}

+ 28 - 0
src/main/java/com/template/annotation/PassToken.java

@@ -0,0 +1,28 @@
+package com.template.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** 说明
+ * 在方法上加入本注解 即可接口拦截
+ * @interface:代表当前类是注解
+ * @Target:描述当前的注解可以定义在扫描资源上。
+ * 属性value:
+ *     定义具体的资源。包括:
+ *     ElementType.METHOD:可以定义在方法上
+ *     ElementType.TYPE:可以定义在类上
+ *     ElementType.FIELD:可以定义在属性上
+ *     ElementType.PARAMETER:可以定义在方法参数上
+ * @Retention:当前注解在什么时候有效
+ *     定义具体的生效标记
+ *     RetentionPolicy.RUNTIME:运行时有效
+ *     RetentionPolicy.SOURCE:源码中有效
+ *     RetentionPolicy.CLASS:字节码有效
+ *///说明 该注解要加在控制器中的方法上才会生效 加在api中无法生效
+@Target(value = {ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PassToken {
+    boolean requeired() default true;
+}

+ 14 - 0
src/main/java/com/template/annotation/UserLoginCheck.java

@@ -0,0 +1,14 @@
+package com.template.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/4/10 星期一 14:04
+ * @Description: com.video.services.annotation
+ * @Version: 1.0
+ */
+@Target(ElementType.METHOD)
+public @interface UserLoginCheck {
+}

+ 85 - 0
src/main/java/com/template/aop/CharsetKit.java

@@ -0,0 +1,85 @@
+package com.template.aop;
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * 字符集工具类
+ * 
+ * @author ruoyi
+ */
+public class CharsetKit
+{
+    /** ISO-8859-1 */
+    public static final String ISO_8859_1 = "ISO-8859-1";
+    /** UTF-8 */
+    public static final String UTF_8 = "UTF-8";
+    /** GBK */
+    public static final String GBK = "GBK";
+
+    /** ISO-8859-1 */
+    public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
+    /** UTF-8 */
+    public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
+    /** GBK */
+    public static final Charset CHARSET_GBK = Charset.forName(GBK);
+
+    /**
+     * 转换为Charset对象
+     * 
+     * @param charset 字符集,为空则返回默认字符集
+     * @return Charset
+     */
+    public static Charset charset(String charset)
+    {
+        return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
+    }
+
+    /**
+     * 转换字符串的字符集编码
+     * 
+     * @param source 字符串
+     * @param srcCharset 源字符集,默认ISO-8859-1
+     * @param destCharset 目标字符集,默认UTF-8
+     * @return 转换后的字符集
+     */
+    public static String convert(String source, String srcCharset, String destCharset)
+    {
+        return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
+    }
+
+    /**
+     * 转换字符串的字符集编码
+     * 
+     * @param source 字符串
+     * @param srcCharset 源字符集,默认ISO-8859-1
+     * @param destCharset 目标字符集,默认UTF-8
+     * @return 转换后的字符集
+     */
+    public static String convert(String source, Charset srcCharset, Charset destCharset)
+    {
+        if (null == srcCharset)
+        {
+            srcCharset = StandardCharsets.ISO_8859_1;
+        }
+
+        if (null == destCharset)
+        {
+            destCharset = StandardCharsets.UTF_8;
+        }
+
+        if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
+        {
+            return source;
+        }
+        return new String(source.getBytes(srcCharset), destCharset);
+    }
+
+    /**
+     * @return 系统字符集编码
+     */
+    public static String systemCharset()
+    {
+        return Charset.defaultCharset().name();
+    }
+}

+ 115 - 0
src/main/java/com/template/aop/Constants.java

@@ -0,0 +1,115 @@
+package com.template.aop;
+
+/**
+ * 通用常量信息
+ * 
+ * @author ruoyi
+ */
+public class Constants
+{
+    /**
+     * UTF-8 字符集
+     */
+    public static final String UTF8 = "UTF-8";
+
+    /**
+     * GBK 字符集
+     */
+    public static final String GBK = "GBK";
+
+    /**
+     * http请求
+     */
+    public static final String HTTP = "http://";
+
+    /**
+     * https请求
+     */
+    public static final String HTTPS = "https://";
+
+    /**
+     * 通用成功标识
+     */
+    public static final String SUCCESS = "0";
+
+    /**
+     * 通用失败标识
+     */
+    public static final String FAIL = "1";
+
+    /**
+     * 登录成功
+     */
+    public static final String LOGIN_SUCCESS = "Success";
+
+    /**
+     * 注销
+     */
+    public static final String LOGOUT = "Logout";
+
+    /**
+     * 注册
+     */
+    public static final String REGISTER = "Register";
+
+    /**
+     * 登录失败
+     */
+    public static final String LOGIN_FAIL = "Error";
+
+    /**
+     * 系统用户授权缓存
+     */
+    public static final String SYS_AUTH_CACHE = "sys-authCache";
+
+    /**
+     * 参数管理 cache name
+     */
+    public static final String SYS_CONFIG_CACHE = "sys-config";
+
+    /**
+     * 参数管理 cache key
+     */
+    public static final String SYS_CONFIG_KEY = "sys_config:";
+
+    /**
+     * 字典管理 cache name
+     */
+    public static final String SYS_DICT_CACHE = "sys-dict";
+
+    /**
+     * 字典管理 cache key
+     */
+    public static final String SYS_DICT_KEY = "sys_dict:";
+
+    /**
+     * 资源映射路径 前缀
+     */
+    public static final String RESOURCE_PREFIX = "/profile";
+
+    /**
+     * RMI 远程方法调用
+     */
+    public static final String LOOKUP_RMI = "rmi:";
+
+    /**
+     * LDAP 远程方法调用
+     */
+    public static final String LOOKUP_LDAP = "ldap:";
+
+    /**
+     * LDAPS 远程方法调用
+     */
+    public static final String LOOKUP_LDAPS = "ldaps:";
+
+    /**
+     * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
+     */
+    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
+
+    /**
+     * 定时任务违规的字符
+     */
+    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
+            "org.springframework", "org.apache", "com.template.common.utils.file", "com.template.common.config" };
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1000 - 0
src/main/java/com/template/aop/Convert.java


+ 95 - 0
src/main/java/com/template/aop/DESResponseSecretAspect.java

@@ -0,0 +1,95 @@
+package com.template.aop;
+
+import com.alibaba.fastjson.JSON;
+import com.template.annotation.DESRespondSecret;
+import com.template.common.utils.EncryptUtil;
+import com.template.model.result.CommonResult;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+
+/**
+ * @Author: binguo
+ * @Date: 2024/2/26 星期一 10:02
+ * @Description: com.template.aop
+ * @Version: 1.0
+ */
+@Component
+@Aspect
+//规定AOP的执行顺序
+//Order(1) 多个aop时可通过该注解来确定执行顺序
+public class DESResponseSecretAspect {
+
+    // 定义切点,使用了@DESRespondSecret注解的类 或 使用了@DESRespondSecret注解的方法
+
+    /**
+     * 切点,方法上有注解或类上有注解
+     * 拦截类或者是方法上标注注解的方法
+     */
+    @Pointcut("@within(com.template.annotation.DESRespondSecret) || @annotation(com.template.annotation.DESRespondSecret)")
+    public void pointCut() {
+    }
+
+    @Around("pointCut()")
+    public Object after(ProceedingJoinPoint joinPoint) throws Throwable {
+        Object rvt = joinPoint.proceed(joinPoint.getArgs());
+        return rvt;
+    }
+
+    /**
+     * 与After的区别在于AfterReturning只有在方法执行成功之后才会被植入,如果After和
+     * AfterReturning同时存在于一个文件中,谁写在前面谁先运行
+     *
+     * @param joinpoint
+     * @param rvt
+     * @return
+     */
+    @AfterReturning(pointcut = "execution(public * com.template.controller.*.*(..))", returning = "rvt")
+    public Object log(JoinPoint joinpoint, Object rvt) {
+        //获取被代理对象
+        Object target = joinpoint.getTarget();
+        //获取通知签名 获取方法上的DESRespondSecret注解
+        MethodSignature signature = (MethodSignature) joinpoint.getSignature();
+        try {
+            // 获取被代理方法
+            Method pointMethod = target.getClass().getMethod(signature.getName(), signature.getParameterTypes());
+            // 获取被代理方法上面的注解@DESRespondSecret
+            DESRespondSecret secret = pointMethod.getAnnotation(DESRespondSecret.class);
+            // 被代理方法上没有,则说明@DESRespondSecret注解在被代理类上
+            if (secret == null) {
+                secret = target.getClass().getAnnotation(DESRespondSecret.class);
+            }
+            //类上也没有 直接返回
+            if (secret == null) {
+                return rvt;
+            }
+            // 如果有,并且值为false,则不进行加密
+            if (secret != null && !secret.validated()) {
+                return rvt;
+            } else {
+                CommonResult baseVo1 = (CommonResult) rvt;
+                // 获取返回值json字符串
+                Object data = baseVo1.getData();
+                if (null != data) {
+                    String jsonString = JSON.toJSONString(data);
+                    // 加密
+                    String s = EncryptUtil.encrypt(jsonString);
+                    baseVo1.setData(s);
+                }
+                return baseVo1;
+
+            }
+        } catch (Throwable throwable) {
+            throwable.printStackTrace();
+        }
+        return rvt;
+    }
+
+}

+ 45 - 0
src/main/java/com/template/aop/LoginCheckAspect.java

@@ -0,0 +1,45 @@
+package com.template.aop;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/4/10 星期一 14:10
+ * @Description: com.video.aop
+ * @Version: 1.0
+ */
+@Aspect//把当前类标识作为一个切面供容器读取
+@Component//将此类标记为Spring容器中的一个Bean
+@Order(0)//order的值越小,优先级越高 order如果不标注数字,默认最低优先级,因为其默认值是int最大值
+public class LoginCheckAspect {
+
+    @Around("@annotation(com.template.annotation.UserLoginCheck)")
+    public Object userLoginCheck(ProceedingJoinPoint process) throws Throwable {
+        System.out.println("用户登录检测机制");
+        if(1 == 1){
+           //通过抛异常方式拦截
+           // throw new Exception("非法登录");
+        }
+
+        Object proceed;
+        proceed = process.proceed();//执行目标方法
+        return proceed;//将执行目标方法后的返回值返回出去
+    }
+
+    @After("@annotation(com.template.annotation.UserLoginCheck)")
+    public void test(){
+        System.out.println("测试After");
+    }
+
+    @Before("@annotation(com.template.annotation.UserLoginCheck)")
+    public void test1(){
+        System.out.println("测试Before");
+    }
+
+}

+ 90 - 0
src/main/java/com/template/aop/StrFormatter.java

@@ -0,0 +1,90 @@
+package com.template.aop;
+
+/**
+ * 字符串格式化
+ * 
+ * @author ruoyi
+ */
+public class StrFormatter
+{
+    public static final String EMPTY_JSON = "{}";
+    public static final char C_BACKSLASH = '\\';
+    public static final char C_DELIM_START = '{';
+    public static final char C_DELIM_END = '}';
+
+    /**
+     * 格式化字符串<br>
+     * 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
+     * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
+     * 例:<br>
+     * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
+     * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
+     * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
+     * 
+     * @param strPattern 字符串模板
+     * @param argArray 参数列表
+     * @return 结果
+     */
+    public static String format(final String strPattern, final Object... argArray)
+    {
+        if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
+        {
+            return strPattern;
+        }
+        final int strPatternLength = strPattern.length();
+
+        // 初始化定义好的长度以获得更好的性能
+        StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
+
+        int handledPosition = 0;
+        int delimIndex;// 占位符所在位置
+        for (int argIndex = 0; argIndex < argArray.length; argIndex++)
+        {
+            delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
+            if (delimIndex == -1)
+            {
+                if (handledPosition == 0)
+                {
+                    return strPattern;
+                }
+                else
+                { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
+                    sbuf.append(strPattern, handledPosition, strPatternLength);
+                    return sbuf.toString();
+                }
+            }
+            else
+            {
+                if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
+                {
+                    if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
+                    {
+                        // 转义符之前还有一个转义符,占位符依旧有效
+                        sbuf.append(strPattern, handledPosition, delimIndex - 1);
+                        sbuf.append(Convert.utf8Str(argArray[argIndex]));
+                        handledPosition = delimIndex + 2;
+                    }
+                    else
+                    {
+                        // 占位符被转义
+                        argIndex--;
+                        sbuf.append(strPattern, handledPosition, delimIndex - 1);
+                        sbuf.append(C_DELIM_START);
+                        handledPosition = delimIndex + 1;
+                    }
+                }
+                else
+                {
+                    // 正常占位符
+                    sbuf.append(strPattern, handledPosition, delimIndex);
+                    sbuf.append(Convert.utf8Str(argArray[argIndex]));
+                    handledPosition = delimIndex + 2;
+                }
+            }
+        }
+        // 加入最后一个占位符后所有的字符
+        sbuf.append(strPattern, handledPosition, strPattern.length());
+
+        return sbuf.toString();
+    }
+}

+ 624 - 0
src/main/java/com/template/aop/StringUtils.java

@@ -0,0 +1,624 @@
+package com.template.aop;
+
+import org.springframework.util.AntPathMatcher;
+
+import java.util.*;
+
+/**
+ * 字符串工具类
+ * 
+ * @author ruoyi
+ */
+public class StringUtils extends org.apache.commons.lang3.StringUtils
+{
+    /** 空字符串 */
+    private static final String NULLSTR = "";
+
+    /** 下划线 */
+    private static final char SEPARATOR = '_';
+
+    /**
+     * 获取参数不为空值
+     * 
+     * @param value defaultValue 要判断的value
+     * @return value 返回值
+     */
+    public static <T> T nvl(T value, T defaultValue)
+    {
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * * 判断一个Collection是否为空, 包含List,Set,Queue
+     * 
+     * @param coll 要判断的Collection
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Collection<?> coll)
+    {
+        return isNull(coll) || coll.isEmpty();
+    }
+
+    /**
+     * * 判断一个Collection是否非空,包含List,Set,Queue
+     * 
+     * @param coll 要判断的Collection
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Collection<?> coll)
+    {
+        return !isEmpty(coll);
+    }
+
+    /**
+     * * 判断一个对象数组是否为空
+     * 
+     * @param objects 要判断的对象数组
+     ** @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Object[] objects)
+    {
+        return isNull(objects) || (objects.length == 0);
+    }
+
+    /**
+     * * 判断一个对象数组是否非空
+     * 
+     * @param objects 要判断的对象数组
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Object[] objects)
+    {
+        return !isEmpty(objects);
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     * 
+     * @param map 要判断的Map
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Map<?, ?> map)
+    {
+        return isNull(map) || map.isEmpty();
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     * 
+     * @param map 要判断的Map
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Map<?, ?> map)
+    {
+        return !isEmpty(map);
+    }
+
+    /**
+     * * 判断一个字符串是否为空串
+     * 
+     * @param str String
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(String str)
+    {
+        return isNull(str) || NULLSTR.equals(str.trim());
+    }
+
+    /**
+     * * 判断一个字符串是否为非空串
+     * 
+     * @param str String
+     * @return true:非空串 false:空串
+     */
+    public static boolean isNotEmpty(String str)
+    {
+        return !isEmpty(str);
+    }
+
+    /**
+     * * 判断一个对象是否为空
+     * 
+     * @param object Object
+     * @return true:为空 false:非空
+     */
+    public static boolean isNull(Object object)
+    {
+        return object == null;
+    }
+
+    /**
+     * * 判断一个对象是否非空
+     * 
+     * @param object Object
+     * @return true:非空 false:空
+     */
+    public static boolean isNotNull(Object object)
+    {
+        return !isNull(object);
+    }
+
+    /**
+     * * 判断一个对象是否是数组类型(Java基本型别的数组)
+     * 
+     * @param object 对象
+     * @return true:是数组 false:不是数组
+     */
+    public static boolean isArray(Object object)
+    {
+        return isNotNull(object) && object.getClass().isArray();
+    }
+
+    /**
+     * 去空格
+     */
+    public static String trim(String str)
+    {
+        return (str == null ? "" : str.trim());
+    }
+
+    /**
+     * 截取字符串
+     * 
+     * @param str 字符串
+     * @param start 开始
+     * @return 结果
+     */
+    public static String substring(final String str, int start)
+    {
+        if (str == null)
+        {
+            return NULLSTR;
+        }
+
+        if (start < 0)
+        {
+            start = str.length() + start;
+        }
+
+        if (start < 0)
+        {
+            start = 0;
+        }
+        if (start > str.length())
+        {
+            return NULLSTR;
+        }
+
+        return str.substring(start);
+    }
+
+    /**
+     * 截取字符串
+     * 
+     * @param str 字符串
+     * @param start 开始
+     * @param end 结束
+     * @return 结果
+     */
+    public static String substring(final String str, int start, int end)
+    {
+        if (str == null)
+        {
+            return NULLSTR;
+        }
+
+        if (end < 0)
+        {
+            end = str.length() + end;
+        }
+        if (start < 0)
+        {
+            start = str.length() + start;
+        }
+
+        if (end > str.length())
+        {
+            end = str.length();
+        }
+
+        if (start > end)
+        {
+            return NULLSTR;
+        }
+
+        if (start < 0)
+        {
+            start = 0;
+        }
+        if (end < 0)
+        {
+            end = 0;
+        }
+
+        return str.substring(start, end);
+    }
+
+    /**
+     * 格式化文本, {} 表示占位符<br>
+     * 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
+     * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
+     * 例:<br>
+     * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
+     * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
+     * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
+     * 
+     * @param template 文本模板,被替换的部分用 {} 表示
+     * @param params 参数值
+     * @return 格式化后的文本
+     */
+    public static String format(String template, Object... params)
+    {
+        if (isEmpty(params) || isEmpty(template))
+        {
+            return template;
+        }
+        return StrFormatter.format(template, params);
+    }
+
+    /**
+     * 是否为http(s)://开头
+     * 
+     * @param link 链接
+     * @return 结果
+     */
+    public static boolean ishttp(String link)
+    {
+        return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
+    }
+
+    /**
+     * 字符串转set
+     * 
+     * @param str 字符串
+     * @param sep 分隔符
+     * @return set集合
+     */
+    public static final Set<String> str2Set(String str, String sep)
+    {
+        return new HashSet<String>(str2List(str, sep, true, false));
+    }
+
+    /**
+     * 字符串转list
+     * 
+     * @param str 字符串
+     * @param sep 分隔符
+     * @param filterBlank 过滤纯空白
+     * @param trim 去掉首尾空白
+     * @return list集合
+     */
+    public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim)
+    {
+        List<String> list = new ArrayList<String>();
+        if (StringUtils.isEmpty(str))
+        {
+            return list;
+        }
+
+        // 过滤空白字符串
+        if (filterBlank && StringUtils.isBlank(str))
+        {
+            return list;
+        }
+        String[] split = str.split(sep);
+        for (String string : split)
+        {
+            if (filterBlank && StringUtils.isBlank(string))
+            {
+                continue;
+            }
+            if (trim)
+            {
+                string = string.trim();
+            }
+            list.add(string);
+        }
+
+        return list;
+    }
+
+    /**
+     * 判断给定的collection列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value
+     *
+     * @param collection 给定的集合
+     * @param array 给定的数组
+     * @return boolean 结果
+     */
+    public static boolean containsAny(Collection<String> collection, String... array)
+    {
+        if (isEmpty(collection) || isEmpty(array))
+        {
+            return false;
+        }
+        else
+        {
+            for (String str : array)
+            {
+                if (collection.contains(str))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
+     *
+     * @param cs 指定字符串
+     * @param searchCharSequences 需要检查的字符串数组
+     * @return 是否包含任意一个字符串
+     */
+    public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences)
+    {
+        if (isEmpty(cs) || isEmpty(searchCharSequences))
+        {
+            return false;
+        }
+        for (CharSequence testStr : searchCharSequences)
+        {
+            if (containsIgnoreCase(cs, testStr))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 驼峰转下划线命名
+     */
+    public static String toUnderScoreCase(String str)
+    {
+        if (str == null)
+        {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        // 前置字符是否大写
+        boolean preCharIsUpperCase = true;
+        // 当前字符是否大写
+        boolean curreCharIsUpperCase = true;
+        // 下一字符是否大写
+        boolean nexteCharIsUpperCase = true;
+        for (int i = 0; i < str.length(); i++)
+        {
+            char c = str.charAt(i);
+            if (i > 0)
+            {
+                preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
+            }
+            else
+            {
+                preCharIsUpperCase = false;
+            }
+
+            curreCharIsUpperCase = Character.isUpperCase(c);
+
+            if (i < (str.length() - 1))
+            {
+                nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
+            }
+
+            if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase)
+            {
+                sb.append(SEPARATOR);
+            }
+            else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase)
+            {
+                sb.append(SEPARATOR);
+            }
+            sb.append(Character.toLowerCase(c));
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 是否包含字符串
+     * 
+     * @param str 验证字符串
+     * @param strs 字符串组
+     * @return 包含返回true
+     */
+    public static boolean inStringIgnoreCase(String str, String... strs)
+    {
+        if (str != null && strs != null)
+        {
+            for (String s : strs)
+            {
+                if (str.equalsIgnoreCase(trim(s)))
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 删除最后一个字符串
+     *
+     * @param str 输入字符串
+     * @param spit 以什么类型结尾的
+     * @return 截取后的字符串
+     */
+    public static String lastStringDel(String str, String spit)
+    {
+        if (!StringUtils.isEmpty(str) && str.endsWith(spit))
+        {
+            return str.subSequence(0, str.length() - 1).toString();
+        }
+        return str;
+    }
+
+    /**
+     * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
+     * 
+     * @param name 转换前的下划线大写方式命名的字符串
+     * @return 转换后的驼峰式命名的字符串
+     */
+    public static String convertToCamelCase(String name)
+    {
+        StringBuilder result = new StringBuilder();
+        // 快速检查
+        if (name == null || name.isEmpty())
+        {
+            // 没必要转换
+            return "";
+        }
+        else if (!name.contains("_"))
+        {
+            // 不含下划线,仅将首字母大写
+            return name.substring(0, 1).toUpperCase() + name.substring(1);
+        }
+        // 用下划线将原始字符串分割
+        String[] camels = name.split("_");
+        for (String camel : camels)
+        {
+            // 跳过原始字符串中开头、结尾的下换线或双重下划线
+            if (camel.isEmpty())
+            {
+                continue;
+            }
+            // 首字母大写
+            result.append(camel.substring(0, 1).toUpperCase());
+            result.append(camel.substring(1).toLowerCase());
+        }
+        return result.toString();
+    }
+
+    /**
+     * 驼峰式命名法
+     * 例如:user_name->userName
+     */
+    public static String toCamelCase(String s)
+    {
+        if (s == null)
+        {
+            return null;
+        }
+        if (s.indexOf(SEPARATOR) == -1)
+        {
+            return s;
+        }
+        s = s.toLowerCase();
+        StringBuilder sb = new StringBuilder(s.length());
+        boolean upperCase = false;
+        for (int i = 0; i < s.length(); i++)
+        {
+            char c = s.charAt(i);
+
+            if (c == SEPARATOR)
+            {
+                upperCase = true;
+            }
+            else if (upperCase)
+            {
+                sb.append(Character.toUpperCase(c));
+                upperCase = false;
+            }
+            else
+            {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
+     * 
+     * @param str 指定字符串
+     * @param strs 需要检查的字符串数组
+     * @return 是否匹配
+     */
+    public static boolean matches(String str, List<String> strs)
+    {
+        if (isEmpty(str) || isEmpty(strs))
+        {
+            return false;
+        }
+        for (String pattern : strs)
+        {
+            if (isMatch(pattern, str))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 判断url是否与规则配置: 
+     * ? 表示单个字符; 
+     * * 表示一层路径内的任意字符串,不可跨层级; 
+     * ** 表示任意层路径;
+     * 
+     * @param pattern 匹配规则
+     * @param url 需要匹配的url
+     * @return
+     */
+    public static boolean isMatch(String pattern, String url)
+    {
+        AntPathMatcher matcher = new AntPathMatcher();
+        return matcher.match(pattern, url);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> T cast(Object obj)
+    {
+        return (T) obj;
+    }
+
+    /**
+     * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。
+     * 
+     * @param num 数字对象
+     * @param size 字符串指定长度
+     * @return 返回数字的字符串格式,该字符串为指定长度。
+     */
+    public static final String padl(final Number num, final int size)
+    {
+        return padl(num.toString(), size, '0');
+    }
+
+    /**
+     * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。
+     * 
+     * @param s 原始字符串
+     * @param size 字符串指定长度
+     * @param c 用于补齐的字符
+     * @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
+     */
+    public static final String padl(final String s, final int size, final char c)
+    {
+        final StringBuilder sb = new StringBuilder(size);
+        if (s != null)
+        {
+            final int len = s.length();
+            if (s.length() <= size)
+            {
+                for (int i = size - len; i > 0; i--)
+                {
+                    sb.append(c);
+                }
+                sb.append(s);
+            }
+            else
+            {
+                return s.substring(len - size, len);
+            }
+        }
+        else
+        {
+            for (int i = size; i > 0; i--)
+            {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+}

+ 18 - 0
src/main/java/com/template/api/ExcelControllerAPI.java

@@ -0,0 +1,18 @@
+package com.template.api;
+
+import com.template.annotation.PassToken;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Api(tags = {"ExcelController"}, value = "导入excel表")
+@RequestMapping("/api/excel")
+public interface ExcelControllerAPI {
+
+    @PostMapping("/toExcel")
+    @ApiOperation(value = "导入excel表更新用户",httpMethod = "POST")
+    @PassToken
+    void toExcel(String fileUrl);
+
+}

+ 26 - 0
src/main/java/com/template/api/FastDFSControllerAPI.java

@@ -0,0 +1,26 @@
+package com.template.api;
+
+import com.template.model.pojo.system.Project;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Map;
+
+@RequestMapping("/api/sysFile")
+@Api(tags = {"sysFile"}, value = "文件操作")
+public interface FastDFSControllerAPI {
+
+    @RequestMapping("/upload")
+    @ApiOperation(value = "上传文件", notes = "上传文件", httpMethod = "POST")
+    public CommonResult<Integer> upload(@RequestParam("file") MultipartFile file);
+
+    @RequestMapping("/delete")
+    @ApiOperation(value = "删除文件", notes = "删除文件", httpMethod = "POST")
+    public CommonResult<Integer> delete(@RequestParam("fileName") String fileName);
+
+}

+ 21 - 0
src/main/java/com/template/api/LogInfoControllerAPI.java

@@ -0,0 +1,21 @@
+package com.template.api;
+
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+@Api(tags = {"LogInfoController"}, value = "登入接口")
+@RequestMapping("/api/logInfo")
+public interface LogInfoControllerAPI {
+
+    @GetMapping("/verify")
+    @ApiOperation(value = "验证手机号phone",httpMethod = "GET")
+    CommonResult verifyPhone(String phone);
+
+
+    @PostMapping("/logIn")
+    @ApiOperation(value = "短信验证",httpMethod = "POST")
+    CommonResult logInfo(String phone,String code);
+}

+ 34 - 0
src/main/java/com/template/api/LoginControllerAPI.java

@@ -0,0 +1,34 @@
+package com.template.api;
+
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.request.loginRequest;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+
+@RequestMapping("/api/login")
+@Api(tags = {"LoginController"}, value = "登录")
+public interface LoginControllerAPI {
+
+    @GetMapping(value = "/queryReduce")
+    @ApiOperation(value = "查看系统版本", notes = "查看系统版本", httpMethod = "GET")
+    CommonResult queryReduce();
+
+    @PostMapping(value = "/Register")
+    @ApiOperation(value = "注册", notes = "注册", httpMethod = "POST")
+    CommonResult Register(@Validated @RequestBody RepairAdmin loginRequest, BindingResult bindingResult);
+
+    @PostMapping(value = "/Login")
+    @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST")
+    CommonResult Login(@Validated @RequestBody loginRequest lr, BindingResult bindingResult);
+
+    @PostMapping(value = "/ChangePassword")
+    @ApiOperation(value = "修改密码", notes = "修改密码", httpMethod = "POST")
+    CommonResult ChangePassword(@Validated @RequestBody com.repair.model.request.changePasswordRequest cpr, @RequestHeader("user_head") String userhead, BindingResult bindingResult);
+}

+ 34 - 0
src/main/java/com/template/api/RepairAdminControllerAPI.java

@@ -0,0 +1,34 @@
+package com.template.api;
+
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("/api/repairAdmin")
+@Api(tags = {"RepairAdminController"}, value = "账号")
+public interface RepairAdminControllerAPI {
+
+    @PostMapping(value = "/insertRepairAdmin")
+    @ApiOperation(value = "添加账号", notes = "添加账号数据", httpMethod = "POST")
+    CommonResult InsertRepairAdmin(@Validated @RequestBody RepairAdmin repairAdmin, BindingResult bindingResult);
+
+    @GetMapping(value = "/queryPageRepairAdmins")
+    @ApiOperation(value = "账号分页数据", notes = "账号分页数据", httpMethod = "POST")
+    CommonResult queryPageRepairAdmins(@RequestParam int currentPage, @RequestParam int pageCount, String account, String phone, String userName);
+
+    @PostMapping(value = "/freezeRepairAdminById")
+    @ApiOperation(value = "根据ID冻结指定账号", notes = "根据ID冻结指定账户", httpMethod = "POST")
+    CommonResult freezeRepairAdminById(@Validated @RequestBody com.repair.model.request.freezeRepairAdminRequest frar, BindingResult bindingResult);
+
+    @GetMapping(value = "/deleteRepairAdminById")
+    @ApiOperation(value = "根据ID删除指定账号", notes = "根据ID删除指定账号", httpMethod = "POST")
+    CommonResult deleteRepairAdminById(@RequestParam String id);
+
+    @PostMapping(value = "/updateRepairAdminById")
+    @ApiOperation(value = "编辑账号数据", notes = "编辑账号数据", httpMethod = "POST")
+    CommonResult updateRepairAdminById(@Validated @RequestBody com.repair.model.request.updateRepairAdminRequest ra, @RequestHeader("user_head") String userhead, BindingResult bindingResult);
+}

+ 16 - 0
src/main/java/com/template/api/SmsCodeControllerAPI.java

@@ -0,0 +1,16 @@
+package com.template.api;
+
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RequestMapping("/api/smsCode")
+@Api(tags = {"SmsCodeControllerAPI"}, value = "短信验证码")
+public interface SmsCodeControllerAPI {
+
+    @GetMapping(value = "/InsertSmsCode")
+    @ApiOperation(value = "新增Code", notes = "新增Code", httpMethod = "POST")
+    CommonResult InsertSmsCode();
+}

+ 56 - 0
src/main/java/com/template/api/SystemMenuControllerAPI.java

@@ -0,0 +1,56 @@
+package com.template.api;
+
+import com.template.model.pojo.system.SystemMenu;
+import com.template.model.pojo.system.Task;
+import com.template.model.result.CommonResult;
+import com.template.model.vo.SystemMenuTreeVo;
+import com.template.model.vo.SystemMenuVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 17:28
+ * @Description: com.video.api
+ * @Version: 1.0
+ */
+@RequestMapping("/api/systemMenu")
+@Api(tags = {"SystemMenuController"}, value = "测试接口")
+public interface SystemMenuControllerAPI {
+
+    @PostMapping(value = "/test")
+    @ApiOperation(value = "新增菜单数据", notes = "新增菜单数据", httpMethod = "POST")
+    public String test(@RequestBody Task task);
+
+    @GetMapping(value = "/QueryPlaybackRecordBySql")
+    @ApiOperation(value = "通过sql获取数据", notes = "通过sql获取数据", httpMethod = "GET")
+    CommonResult<List<SystemMenuVo>> QueryPlaybackRecordBySql();
+
+    @GetMapping(value = "/QuerySystemMenus")
+    @ApiOperation(value = "查询所有菜单数据", notes = "查询所有菜单数据", httpMethod = "GET")
+    CommonResult<List<SystemMenu>> QueryPlaybackRecords();
+
+    @PostMapping(value = "/InsertSystemMenu")
+    @ApiOperation(value = "新增菜单数据", notes = "新增菜单数据", httpMethod = "POST")
+    CommonResult InsertSystemMenu(@RequestBody SystemMenu systemMenu);
+
+    @PostMapping(value = "/DeleteSystemMenu")
+    @ApiOperation(value = "新增菜单数据", notes = "新增菜单数据", httpMethod = "POST")
+    CommonResult DeleteSystemMenu(@RequestParam("userId") Integer userID);
+
+    @GetMapping(value = "/QueryMenuTrees")
+    @ApiOperation(value = "查询树形菜单数据", notes = "查询树形菜单数据", httpMethod = "GET")
+    CommonResult<List<SystemMenuTreeVo>> QueryMenuTreeRecords();
+
+    @PostMapping(value = "/InsertPlaybackRecord")
+    @ApiOperation(value = "新增", notes = "新增", httpMethod = "POST")
+    CommonResult<Integer> InsertPlaybackRecord(@RequestBody SystemMenu pb);
+
+    @GetMapping("/testQuery")
+    @ApiOperation(value = "查询", notes = "查询", httpMethod = "GET")
+    CommonResult<List<SystemMenu>> QueryPlaybackRecords(HttpServletRequest request);
+}

+ 22 - 0
src/main/java/com/template/api/system/OrganizeControllerAPI.java

@@ -0,0 +1,22 @@
+package com.template.api.system;
+
+import com.template.common.result.PageResult;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RequestMapping("/api/Organize")
+@Api(tags = {"Organize"}, value = "部门")
+public interface OrganizeControllerAPI {
+
+    @PostMapping(value = "/query")
+    @ApiOperation(value = "查询部门数据", notes = "查询部门数据", httpMethod = "POST")
+    public CommonResult query();
+
+    @PostMapping(value = "/queryUser")
+    @ApiOperation(value = "根据部门查询用户", notes = "根据部门查询用户", httpMethod = "POST")
+    public CommonResult queryUser(@RequestParam String organize);
+}

+ 35 - 0
src/main/java/com/template/api/system/SysConfigControllerAPI.java

@@ -0,0 +1,35 @@
+package com.template.api.system;
+
+import com.template.common.result.PageResult;
+import com.template.model.pojo.system.SysConfig;
+import com.template.model.pojo.system.SysUser;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RequestMapping("/api/sysConfig")
+@Api(tags = {"sysConfig"}, value = "配置")
+public interface SysConfigControllerAPI {
+
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增维度数据", notes = "新增维度数据", httpMethod = "POST")
+    public CommonResult<Integer> add(@Validated @RequestBody SysConfig sysConfig);
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改维度数据", notes = "修改维度数据", httpMethod = "POST")
+    public CommonResult<Integer> update(@Validated @RequestBody SysConfig sysConfig);
+
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除维度数据", notes = "删除维度数据", httpMethod = "POST")
+    public CommonResult<Integer> del(@RequestParam Long id);
+
+    @PostMapping(value = "/queryPage")
+    @ApiOperation(value = "查询维度数据", notes = "查询维度数据", httpMethod = "POST")
+    public CommonResult<PageResult> queryPage(@RequestParam String name);
+
+}

+ 35 - 0
src/main/java/com/template/api/system/SysMenuControllerAPI.java

@@ -0,0 +1,35 @@
+package com.template.api.system;
+
+import com.template.model.pojo.system.MenuList;
+import com.template.model.pojo.system.SysMenu;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@RequestMapping("/api/sysMenu")
+@Api(tags = {"sysMenu"}, value = "菜单")
+public interface SysMenuControllerAPI {
+
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增菜单数据", notes = "新增菜单数据", httpMethod = "POST")
+    public CommonResult<Integer> add(@Validated @RequestBody SysMenu sysMenu);
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改菜单数据", notes = "修改菜单数据", httpMethod = "POST")
+    public CommonResult<Integer> update(@Validated @RequestBody SysMenu sysMenu);
+
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除菜单数据", notes = "删除菜单数据", httpMethod = "POST")
+    public CommonResult<Integer> del(@RequestParam Long id);
+
+    @PostMapping(value = "/QueryMenuTreeRecords")
+    @ApiOperation(value = "查询菜单数据", notes = "查询菜单数据", httpMethod = "POST")
+    public CommonResult<List<MenuList>> QueryMenuTreeRecords();
+}

+ 79 - 0
src/main/java/com/template/api/system/SysProjectControllerAPI.java

@@ -0,0 +1,79 @@
+package com.template.api.system;
+
+import com.alibaba.fastjson.JSONObject;
+import com.template.common.result.PageResult;
+import com.template.model.pojo.system.Project;
+import com.template.model.pojo.system.SysConfig;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+
+@RequestMapping("/api/sysProject")
+@Api(tags = {"sysProject"}, value = "项目")
+public interface SysProjectControllerAPI {
+
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增项目数据", notes = "新增项目数据", httpMethod = "POST")
+    public CommonResult<Integer> add(@Validated @RequestBody Project project);
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改项目数据", notes = "修改项目数据", httpMethod = "POST")
+    public CommonResult<Integer> update(@Validated @RequestBody Project project);
+
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除项目数据", notes = "删除项目数据", httpMethod = "POST")
+    public CommonResult<Integer> del(@RequestParam Long id);
+
+    @PostMapping(value = "/queryPage")
+    @ApiOperation(value = "查询项目数据", notes = "查询项目数据", httpMethod = "POST")
+    public CommonResult<PageResult> queryPage(@RequestBody JSONObject jsonObject);
+
+    @PostMapping(value = "/queryProblemList")
+    @ApiOperation(value = "查询问题清单", notes = "查询问题清单", httpMethod = "POST")
+    public CommonResult<PageResult> queryProblemList(@RequestBody JSONObject jsonObject) throws ParseException;
+
+    @PostMapping(value = "/queryWarmList")
+    @ApiOperation(value = "查询预警清单", notes = "查询预警清单", httpMethod = "POST")
+    public CommonResult<PageResult> queryWarmList(@RequestBody JSONObject jsonObject) throws ParseException;
+
+    @PostMapping(value = "/evaluate")
+    @ApiOperation(value = "评分", notes = "评分", httpMethod = "POST")
+    public CommonResult evaluate(@RequestParam Long projectId, @RequestParam String evaluate, @RequestParam BigDecimal score);
+
+    @PostMapping(value = "/queryLogs")
+    @ApiOperation(value = "查看项目操作日志", notes = "查看项目操作日志", httpMethod = "POST")
+    public CommonResult queryLogs(@RequestParam Long projectId);
+
+    @PostMapping(value = "/urge")
+    @ApiOperation(value = "催办项目", notes = "催办项目", httpMethod = "POST")
+    public CommonResult urge(@RequestParam String projectId);
+
+    @PostMapping(value = "/collect")
+    @ApiOperation(value = "收藏项目", notes = "收藏项目", httpMethod = "POST")
+    public CommonResult collect(@RequestParam Long projectId, @RequestParam Long state);
+
+    @PostMapping(value = "/queryTjByState")
+    @ApiOperation(value = "查看项目总览", notes = "查看项目总览", httpMethod = "POST")
+    public CommonResult queryTjByState(@RequestBody JSONObject jsonObject) throws ParseException;
+
+    @PostMapping(value = "/queryCoUsers")
+    @ApiOperation(value = "查看项目用户", notes = "查看项目用户", httpMethod = "POST")
+    public CommonResult queryCoUsers(String userName);
+
+    @PostMapping(value = "/queryMessage")
+    @ApiOperation(value = "查看推送消息", notes = "查看推送消息", httpMethod = "POST")
+    public CommonResult queryMessage(@RequestBody Project project) throws ParseException;
+
+    @PostMapping(value = "/queryMessageTj")
+    @ApiOperation(value = "查看推送消息统计", notes = "查看推送消息统计", httpMethod = "POST")
+    public CommonResult queryMessageTj(@RequestBody Project project) throws ParseException;
+
+}

+ 40 - 0
src/main/java/com/template/api/system/SysRoleControllerAPI.java

@@ -0,0 +1,40 @@
+package com.template.api.system;
+
+import com.template.model.pojo.system.complex.RoleRelaMenu;
+import com.template.model.pojo.system.MenuList;
+import com.template.model.pojo.system.SysRole;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+@RequestMapping("/api/sysRole")
+@Api(tags = {"sysRole"}, value = "角色")
+public interface SysRoleControllerAPI {
+
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增角色数据", notes = "新增角色数据", httpMethod = "POST")
+    public CommonResult<Integer> add(@Validated @RequestBody RoleRelaMenu roleRelaMenu);
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改角色数据", notes = "修改角色数据", httpMethod = "POST")
+    public CommonResult<Integer> update(@Validated @RequestBody RoleRelaMenu roleRelaMenu);
+
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除角色数据", notes = "删除角色数据", httpMethod = "POST")
+    public CommonResult<Integer> del(@RequestParam Long id);
+
+    @PostMapping(value = "/queryPageSysRole")
+    @ApiOperation(value = "查询角色数据", notes = "查询角色数据", httpMethod = "POST")
+    public CommonResult queryPageSysRole(@RequestBody SysRole sysRole);
+
+    @PostMapping(value = "/queryMenuByRole")
+    @ApiOperation(value = "查询角色菜单数据", notes = "查询角色菜单数据", httpMethod = "POST")
+    public CommonResult<List<MenuList>> queryMenuByRole(@RequestParam String roleId);
+}

+ 70 - 0
src/main/java/com/template/api/system/SysUserControllerAPI.java

@@ -0,0 +1,70 @@
+package com.template.api.system;
+
+import com.template.common.result.PageResult;
+import com.template.model.pojo.system.SysUser;
+import com.template.model.request.loginRequest;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.UnsupportedEncodingException;
+
+@RequestMapping("/api/sysUser")
+@Api(tags = {"sysUser"}, value = "用户")
+public interface SysUserControllerAPI {
+
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增用户数据", notes = "新增用户数据", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult<Integer> add(@Validated @RequestBody SysUser sysUser);
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改用户数据", notes = "修改用户数据", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult<Integer> update(@Validated @RequestBody SysUser sysUser);
+
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除用户数据", notes = "删除用户数据", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult<Integer> del(@RequestParam Long id);
+
+    @PostMapping(value = "/queryPage")
+    @ApiOperation(value = "查看用户数据", notes = "查看用户数据", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult<PageResult> queryPage(@RequestBody SysUser sysUser);
+
+    @PostMapping(value = "/login")
+    @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult Login(@RequestBody loginRequest loginRequest, BindingResult bindingResult);
+
+    @PostMapping(value = "/queryOwn")
+    @ApiOperation(value = "获取个人信息", notes = "获取个人信息", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult<PageResult> queryOwn();
+
+    @RequestMapping(value = "/authorize")
+    @ApiOperation(value = "统一认证", notes = "统一认证", httpMethod = "POST")
+    public String authorize(Model model) throws UnsupportedEncodingException;
+
+    @RequestMapping(value = "/callback")
+    @ApiOperation(value = "回调", notes = "回调", httpMethod = "POST")
+    public String callback(String code, String state) throws UnsupportedEncodingException;
+
+    @RequestMapping(value = "/queryScorer")
+    @ApiOperation(value = "查看评分人", notes = "查看评分人", httpMethod = "POST")
+    @ResponseBody
+    public CommonResult queryScorer(@RequestParam String organizes);
+
+    @RequestMapping(value = "/authorizeWp")
+    @ApiOperation(value = "微校授权", notes = "微校授权", httpMethod = "POST")
+    public String authorizeWp();
+
+    @RequestMapping(value = "/code")
+    @ApiOperation(value = "回调", notes = "回调", httpMethod = "POST")
+    public String code(String wxcode, String state) throws UnsupportedEncodingException;
+}

+ 56 - 0
src/main/java/com/template/api/system/TaskControllerAPI.java

@@ -0,0 +1,56 @@
+package com.template.api.system;
+
+import com.alibaba.fastjson.JSONObject;
+import com.template.model.pojo.system.Task;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.text.ParseException;
+
+@RequestMapping("/api/sysTask")
+@Api(tags = {"sysTask"}, value = "任务")
+public interface TaskControllerAPI {
+
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增任务数据", notes = "新增任务数据", httpMethod = "POST")
+    public CommonResult<Integer> add(@Validated @RequestBody Task task);
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改任务数据", notes = "修改任务数据", httpMethod = "POST")
+    public CommonResult<Integer> update(@Validated @RequestBody Task task);
+
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除任务数据", notes = "删除任务数据", httpMethod = "POST")
+    public CommonResult<Integer> del(@RequestParam Long id);
+
+    @PostMapping(value = "/queryTaskByProject")
+    @ApiOperation(value = "查看任务数据", notes = "查看任务数据", httpMethod = "POST")
+    public CommonResult queryTaskByProject(@RequestParam Long projectId);
+
+    @PostMapping(value = "/submitTask")
+    @ApiOperation(value = "完成任务", notes = "完成任务", httpMethod = "POST")
+    public CommonResult submitTask(@RequestParam Long TaskId, @RequestParam String finishRemark, @RequestParam String fileUrl);
+
+    @PostMapping(value = "/urge")
+    @ApiOperation(value = "催办任务", notes = "催办任务", httpMethod = "POST")
+    public CommonResult urge(@RequestParam Long taskId);
+
+    @PostMapping(value = "/queryDepartScoreBank")
+    @ApiOperation(value = "部门分数排行", notes = "部门分数排行", httpMethod = "POST")
+    public CommonResult queryDepartScoreBank(@RequestBody JSONObject jsonObject) throws ParseException;
+
+    @PostMapping(value = "/queryDepartFinishBank")
+    @ApiOperation(value = "部门完成率排行", notes = "部门完成率排行", httpMethod = "POST")
+    public CommonResult queryDepartFinishBank(@RequestBody JSONObject jsonObject) throws ParseException;
+
+    @PostMapping(value = "/queryProblemAndWarmList")
+    @ApiOperation(value = "问题和预警清单", notes = "问题和预警清单", httpMethod = "POST")
+    public CommonResult queryProblemAndWarmList(@RequestBody Task task);
+
+}

+ 16 - 0
src/main/java/com/template/common/constanst/Constanst.java

@@ -0,0 +1,16 @@
+package com.template.common.constanst;
+
+/**
+ * <p>Title: Constanst</p>
+ * <p>Description: 系统所用到的常量 </p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class Constanst {
+	
+	/**
+	 * 自定义加密措施
+	 */
+	public static final String PWD_MD5 = "FeNG#@YOnG";
+
+}

+ 14 - 0
src/main/java/com/template/common/exception/EmsException.java

@@ -0,0 +1,14 @@
+package com.template.common.exception;
+
+import com.template.common.result.ResponseStatusEnum;
+
+/**
+ * 处理异常,统一封装
+ */
+public class EmsException {
+
+    public static void display(ResponseStatusEnum responseStatusEnum) {
+        throw new MyCustomException(responseStatusEnum);
+    }
+
+}

+ 199 - 0
src/main/java/com/template/common/exception/EmsExceptionHandler.java

@@ -0,0 +1,199 @@
+package com.template.common.exception;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.model.result.CommonResult;
+import org.mybatis.spring.MyBatisSystemException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.support.DefaultMessageSourceResolvable;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.validation.BindException;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.fasterxml.jackson.databind.exc.InvalidFormatException;
+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 统一异常拦截处理
+ * 可以针对异常的类型进行捕获,然后返回json信息到前端
+ */
+@ControllerAdvice
+public class EmsExceptionHandler {
+
+    //org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported
+    final static Logger logger=LoggerFactory.getLogger(EmsExceptionHandler.class);
+
+    //处理Get请求中 使用@Valid 验证路径中请求实体校验失败后抛出的异常
+    @ExceptionHandler(BindException.class)
+    @ResponseBody
+    public CommonResult BindExceptionHandler(BindException e) {
+        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
+        logger.error("错误信息",message);
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_NULL_POINTER);
+    }
+
+    //处理请求参数格式错误 @RequestParam上validate失败后抛出的异常是javax.validation.ConstraintViolationException
+    @ExceptionHandler(ConstraintViolationException.class)
+    @ResponseBody
+    public CommonResult ConstraintViolationExceptionHandler(ConstraintViolationException e) {
+        String message = e.getConstraintViolations().stream().map(ConstraintViolation::getMessage).collect(Collectors.joining());
+        logger.error("错误信息",message);
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_NULL_POINTER);
+    }
+
+    @ResponseBody
+    @ExceptionHandler(NullPointerException.class)
+    public CommonResult exception(NullPointerException e) {
+        e.printStackTrace();
+        //String error=e.getFieldError().getDefaultMessage();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_NULL_POINTER);
+    }
+
+    @ExceptionHandler(Exception.class)
+    @ResponseBody
+    public CommonResult exception(Exception e) {
+        e.printStackTrace();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.fail(e.getMessage());
+    }
+
+    //mysql连接超时
+    @ExceptionHandler(MyBatisSystemException.class)
+    @ResponseBody
+    public CommonResult exception(MyBatisSystemException e) {
+        e.printStackTrace();
+        //String error=e.getFieldError().getDefaultMessage();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_MYSQL_TIMEOUT_ERROR);
+    }
+
+    //请求方式错误
+    @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
+    @ResponseBody
+    public CommonResult httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
+        e.printStackTrace();
+        logger.error("错误信息",e.fillInStackTrace());
+        //String error=e.getFieldError().getDefaultMessage();
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_REQUEST_METHOD_ERROR);
+    }
+
+    //传参空异常
+    @ExceptionHandler(MissingServletRequestParameterException.class)
+    @ResponseBody
+    public CommonResult missingServletRequestParameterException(MissingServletRequestParameterException e) {
+        String name=  e.getParameterName();
+        logger.error("错误信息",e.fillInStackTrace());
+
+        //String error=e.getFieldError().getDefaultMessage();
+        return CommonResult.fail(name+"不能为空");
+    }
+
+    @ExceptionHandler(MyCustomException.class)
+    @ResponseBody
+    public CommonResult returnMyException(MyCustomException e) {
+        e.printStackTrace();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(e.getResponseStatusEnum());
+    }
+
+    /**
+     * 传入JSON数据格式错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(JsonParseException.class)
+    @ResponseBody
+    public CommonResult returnMyException(JsonParseException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        e.printStackTrace();
+        return CommonResult.resultValue(ResponseStatusEnum.SEND_PARAMS);
+    }
+
+
+    /**
+     * 传入JSON数据格式转换错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(HttpMessageNotReadableException.class)
+    @ResponseBody
+    public CommonResult httpMessageNotReadableException(HttpMessageNotReadableException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        e.printStackTrace();//
+        if(e.getCause() instanceof  InvalidFormatException){
+            InvalidFormatException e1=   (InvalidFormatException)e.getCause();
+            Object erro1= e1.getValue();
+            Object erro2=e1.getTargetType().getSimpleName();
+            System.out.print(erro1);
+            System.out.print(erro2);
+        }
+
+        String error=e.getMessage();
+        return CommonResult.resultValue(ResponseStatusEnum.SEND_PARAMS_TYPE);
+    }
+
+
+
+
+
+
+
+    /**
+     * 参数验证错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(MethodArgumentNotValidException.class)
+    @ResponseBody
+    public CommonResult returnException(MethodArgumentNotValidException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        BindingResult result = e.getBindingResult();
+        Map<String, String> map = getErrors(result);
+        return CommonResult.fail(map.values().toString().replace("[","").replace("]",""));
+    }
+
+    /**
+     * 参数验证错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(MethodArgumentTypeMismatchException.class)
+    @ResponseBody
+    public CommonResult returnException(MethodArgumentTypeMismatchException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        String value=e.getValue().toString();
+        String paraType=e.getRequiredType().getName().toString();
+
+        return CommonResult.errorMsg(e.getName()+"数据格式转换错误");
+    }
+
+
+    public Map<String, String> getErrors(BindingResult result) {
+        Map<String, String> map = new HashMap<>();
+        List<FieldError> errorList = result.getFieldErrors();
+        for (FieldError error : errorList) {
+            // 发送验证错误的时候所对应的某个属性
+            String field = error.getField();
+            // 验证的错误消息
+            String msg = error.getDefaultMessage();
+            map.put(field, msg);
+        }
+        return map;
+    }
+
+
+}

+ 29 - 0
src/main/java/com/template/common/exception/MyCustomException.java

@@ -0,0 +1,29 @@
+package com.template.common.exception;
+
+import com.template.common.result.ResponseStatusEnum;
+
+/**
+ * 自定义异常
+ * 目的:统一处理异常信息
+ *      便于解耦,service与controller错误的解耦,不会被service返回的类型而限制
+ */
+public class MyCustomException extends RuntimeException {
+
+    private ResponseStatusEnum responseStatusEnum;
+
+    public MyCustomException(ResponseStatusEnum responseStatusEnum) {
+        super("异常状态码为:" + responseStatusEnum.status()
+                + ";具体异常信息为:" + responseStatusEnum.msg());
+        this.responseStatusEnum = responseStatusEnum;
+    }
+
+    public ResponseStatusEnum getResponseStatusEnum() {
+        return responseStatusEnum;
+    }
+
+    public void setResponseStatusEnum(ResponseStatusEnum responseStatusEnum) {
+        this.responseStatusEnum = responseStatusEnum;
+    }
+
+
+}

+ 43 - 0
src/main/java/com/template/common/jh/ReqRespResearchProductQuestionnaireItem.java

@@ -0,0 +1,43 @@
+package com.template.common.jh;
+
+import java.io.Serializable;
+
+public class ReqRespResearchProductQuestionnaireItem implements Serializable {
+    private static final long serialVersionUID = -2850886454687095222L;
+    private String minValue;
+    private String maxValue;
+    //"范围符号:1-大于/2-小于/3-等于/4-不等于/5-大于等于/6-小于等于/7-全闭区间/8-左闭右开区间/9-左开右闭区间/10-全开区间"
+    private Byte symbol;
+
+    public ReqRespResearchProductQuestionnaireItem( String minValue, String maxValue, Byte symbol) {
+        this.minValue = minValue;
+        this.maxValue = maxValue;
+        this.symbol = symbol;
+    }
+
+    public String getMinValue() {
+        return minValue;
+    }
+
+    public void setMinValue(String minValue) {
+        this.minValue = minValue;
+    }
+
+    public String getMaxValue() {
+        return maxValue;
+    }
+
+    public void setMaxValue(String maxValue) {
+        this.maxValue = maxValue;
+    }
+
+    public Byte getSymbol() {
+        return symbol;
+    }
+
+    public void setSymbol(Byte symbol) {
+        this.symbol = symbol;
+    }
+}
+
+

+ 243 - 0
src/main/java/com/template/common/jh/SectionUtil.java

@@ -0,0 +1,243 @@
+package com.template.common.jh;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description: 区间工具类
+ * @author: wyj
+ * @time: 2020/3/1 15:05
+ */
+public class SectionUtil {
+    //最小值
+    private String min_entity;
+    //最大值
+    private String max_entity;
+    //左侧括号状态:false -开区间  true-- 闭区间
+    private boolean left_sate = false;
+    //右侧括号状态:false -开区间  true-- 闭区间
+    private boolean right_sate = false;
+    private SectionUtil() {
+
+    }
+
+    public SectionUtil(String min_entity, String max_entity, boolean left_sate, boolean right_sate) {
+        this.min_entity = min_entity;
+        this.max_entity = max_entity;
+        this.left_sate = left_sate;
+        this.right_sate = right_sate;
+    }
+
+    public String getMin_entity() {
+        return min_entity;
+    }
+
+    public String getMax_entity() {
+        return max_entity;
+    }
+
+    public boolean isLeft_sate() {
+        return left_sate;
+    }
+
+    public boolean isRight_sate() {
+        return right_sate;
+    }
+
+    /**
+     * @description: 创建负区间((负无穷,X])
+     * @param value 区间最大值
+     * @param right_sate 区间开闭状态
+     * @Date: 2020/3/2 14:37
+     */
+    public static SectionUtil creatFu(String value, boolean right_sate) {
+
+        return new SectionUtil("", value, false, right_sate);
+    }
+    /**
+     * @description: 创建正区间[X,正无穷))
+     * @param value 区间最小值
+     * @param left_sate 区间开闭状态
+     * @Date: 2020/3/2 14:37
+     */
+    public static SectionUtil creatZheng(String value, boolean left_sate) {
+
+        return new SectionUtil(value, "", left_sate, false);
+    }
+    /**
+     * @description: 创建闭合区间([X,Y])
+     * @param min   区间最小值
+     * @param max   区间最大值
+     * @param left_sate 区间左侧开闭状态
+     * @param right_sate 区间右侧开闭状态
+     * @return
+     * @Date: 2020/3/2 14:41
+     */
+    public static SectionUtil creat(String min, boolean left_sate, String max, boolean right_sate) {
+
+        return new SectionUtil(min, max, left_sate, right_sate);
+    }
+    /**
+     * @description:  将实体类转换成区间集合
+     * @param record  待转换的实体类
+     * @return 转换后的区间集合类(不等于时转换后为2个区间,所以采用集合)
+     * @Date: 2020/3/2 14:19
+     */
+    public static List<SectionUtil> getSections(ReqRespResearchProductQuestionnaireItem record) {
+        List<SectionUtil> list = new ArrayList<>();
+        String record_max = record.getMaxValue();
+        String record_min = record.getMinValue();
+        switch (record.getSymbol()) {
+            case 1:
+                list.add(creatZheng(record_max, false));
+                break;
+            case 2:
+                list.add(creatFu(record_max, false));
+                break;
+            case 3:
+                list.add(creat(record_max, true, record_max, true));
+                break;
+            case 4:
+                list.add(creatFu(record_max, false));
+                list.add(creatZheng(record_max, false));
+                break;
+            case 5:
+                list.add(creatZheng(record_max, true));
+                break;
+            case 6:
+                list.add(creatFu(record_max, true));
+                break;
+            case 7:
+                list.add(creat(record_min, true, record_max, true));
+                break;
+            case 8:
+                list.add(creat(record_min, true, record_max, false));
+                break;
+            case 9:
+                list.add(creat(record_min, false, record_max, true));
+                break;
+            case 10:
+                list.add(creat(record_min, false, record_max, false));
+                break;
+        }
+        return list;
+    }
+
+
+
+    public int compareTo(String first_value, String second_value) {
+        //first_value为空表示为正无穷,second_value为空表示为负无穷
+        if (isBlank(first_value) || isBlank(second_value)) {
+            return 1;
+        }
+        return compareToValue(first_value,second_value);
+    }
+    //判断字符串是否为空
+    public static boolean isBlank(String str) {
+        int strLen;
+        if (str == null || (strLen = str.length()) == 0) {
+            return true;
+        }
+        for (int i = 0; i < strLen; i++) {
+            if ((Character.isWhitespace(str.charAt(i)) == false)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * @param record 判断区间是否有重合
+     * @return true-有重合  false -无重合
+     * @description: 判断当前区间是否和指定区间重合
+     * @Date: 2020/3/2 10:20
+     */
+    public boolean isChonghe(SectionUtil record) {
+        String min_entity = record.getMin_entity();
+        String max_entity = record.getMax_entity();
+        boolean left_sate = record.isLeft_sate();
+        boolean right_sate = record.isRight_sate();
+        boolean left_isok = false;
+        boolean right_isok = false;
+        //重合条件,第一个区间最大值大于第二个区间最小值并且第一个区间的最小值小于第二个区间的最大值
+        //注意传值顺序,第一个值为第一个区间的最大值(此处不能反)
+        int first_result = compareTo(this.max_entity, min_entity);
+        if ((first_result == 0 && this.right_sate && left_sate) || (first_result > 0)) {
+            left_isok = true;
+        }
+        //注意传值顺序,第一个值为第二个区间的最大值(此处不能反)
+        int second_result = compareTo(max_entity, this.min_entity);
+        //此处本应该是second_result<0,但由于上一步参数传递时时反正传递,故此此处为second_result>0
+        if ((second_result == 0 && this.left_sate && right_sate) || second_result > 0) {
+            right_isok = true;
+        }
+        return left_isok && right_isok;
+    }
+    /**
+     * @description:   比较集合中区间是否有重叠
+     * @param list1 待比较集合1
+     * @param list2 待比较集合2
+     * @return
+     * @Date: 2020/3/2 11:49
+     */
+    public static boolean isChonghe(List<SectionUtil> list1, List<SectionUtil> list2) {
+        boolean chonghed = false;
+        for (SectionUtil item1 : list1) {
+            for (SectionUtil item2 : list2) {
+                chonghed = item1.isChonghe(item2);
+                if (chonghed) {
+                    return true;
+                }
+            }
+        }
+        return chonghed;
+    }
+
+    //比较大小
+    public static int compareToValue(String value1, String value2) {
+        BigDecimal b1 = new BigDecimal(value1);
+        BigDecimal b2 = new BigDecimal(value2);
+        return b1.compareTo(b2);
+    }
+
+    /**
+     * @description:   判断集合中区间是否重叠
+     * @param list  待判断集合
+     * @return  fasle-无重叠 true-有重叠
+     * @Date: 2020/3/3 14:51
+     */
+    public static boolean compareSection(List<ReqRespResearchProductQuestionnaireItem> list) {
+        for (int i = 0; i < list.size(); i++) {
+            ReqRespResearchProductQuestionnaireItem record = list.get(i);
+            for (int j = i + 1; j < list.size(); j++) {
+                ReqRespResearchProductQuestionnaireItem item = list.get(j);
+                //判断区间是否有交叉
+                List<SectionUtil> records = SectionUtil.getSections(record);
+                List<SectionUtil> items = SectionUtil.getSections(item);
+                boolean chonghe = SectionUtil.isChonghe(records, items);
+                if (chonghe) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public static void main(String[] args) {
+        List<ReqRespResearchProductQuestionnaireItem> all = new ArrayList<>();
+        ReqRespResearchProductQuestionnaireItem re1 = new ReqRespResearchProductQuestionnaireItem("110","120", (byte) 7);
+        ReqRespResearchProductQuestionnaireItem re2 = new ReqRespResearchProductQuestionnaireItem("90","112", (byte) 7);
+        ReqRespResearchProductQuestionnaireItem re3 = new ReqRespResearchProductQuestionnaireItem("80","89", (byte) 7);
+        ReqRespResearchProductQuestionnaireItem re4 = new ReqRespResearchProductQuestionnaireItem("60","79", (byte) 7);
+        ReqRespResearchProductQuestionnaireItem re5 = new ReqRespResearchProductQuestionnaireItem("0","59", (byte) 7);
+        all.add(re1);
+        all.add(re2);
+        all.add(re3);
+        all.add(re4);
+        all.add(re5);
+        System.out.println(compareSection(all));
+    }
+}
+
+

+ 85 - 0
src/main/java/com/template/common/result/BaseController.java

@@ -0,0 +1,85 @@
+package com.template.common.result;
+
+import com.alibaba.fastjson.JSONObject;
+import com.auth0.jwt.interfaces.Claim;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.github.pagehelper.util.StringUtil;
+import com.template.common.exception.MyCustomException;
+import com.template.common.utils.HttpClientUtils;
+import com.template.common.utils.JWTUtil;
+import com.template.services.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.SocketUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.ModelAttribute;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+public class BaseController {
+
+	protected HttpServletRequest request;
+	protected HttpServletResponse response;
+
+	public Integer perSize;
+
+	/**
+	 * BaseController 初始化
+	 * @ModelAttribute,被注解的方法或属性会执行于 @RequestMapping 之前。
+	 */
+	@ModelAttribute
+	protected void init(HttpServletRequest request, HttpServletResponse response) {
+		this.request = request;
+		this.response = response;
+	}
+	
+	protected void startPage() {
+		String pageNum = request.getParameter("page"); // 当前页数
+		String pageSize = request.getParameter("rows"); // 每页记录数
+		this.perSize = Integer.parseInt(pageSize);
+		if (StringUtil.isNotEmpty(pageNum) && StringUtil.isNotEmpty(pageSize)) {
+			PageHelper.startPage(Integer.valueOf(pageNum), Integer.valueOf(pageSize));
+		}
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	protected PageResult getPageFooterInfo(List<?> list,List<?> footer) {
+		return new PageResult(list.size(), list,footer);
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	protected PageResult getPageInfo(PageInfo<?> pageInfo) {
+		return new PageResult((int) pageInfo.getTotal(), pageInfo.getPages(), pageInfo.getList());
+	}
+
+	protected String getUserCode(){
+		//获取url参数 getParameter方法里的参数名和定义的参数名一致
+		String tokenP = request.getHeader("tokenP");
+		String tokenW = request.getHeader("tokenW");
+		if (tokenW!=null && !tokenW.equals("")){
+			// 解析token
+			Map<String, Claim> stringClaimMap = JWTUtil.verifyToken(tokenW);
+			System.out.println(stringClaimMap.get("account").asString());
+			if (ObjectUtils.isEmpty(stringClaimMap)) { // 登录
+				return null;
+			}
+			return stringClaimMap.get("account").asString();
+		}
+		if (tokenP!=null && !tokenP.equals("")){
+			// 解析token
+			String responseContent = HttpClientUtils.getInstance().sendHttpGet("https://cas.ncjti.edu.cn/cas/oauth2.0/profile?access_token="+tokenP);
+			System.out.println("获取userCode======"+responseContent);
+			if (responseContent == null || responseContent.equals("")) {
+				return null;
+			}
+			JSONObject parseObject = JSONObject.parseObject(responseContent);
+			return parseObject.getString("id");
+		}
+		return null;
+	}
+
+}

+ 7 - 0
src/main/java/com/template/common/result/Code.java

@@ -0,0 +1,7 @@
+package com.template.common.result;
+
+public interface Code {
+    Integer getStatus();
+    Boolean getSuccess();
+    String getMsg();
+}

+ 188 - 0
src/main/java/com/template/common/result/HttpStatusCode.java

@@ -0,0 +1,188 @@
+package com.template.common.result;
+
+/**
+ * HTTP状态码
+ */
+public class HttpStatusCode {
+	
+	/**
+	 * HTTP Status-Code 200: OK.
+	 */
+	public static final int OK = 200;
+
+	/**
+	 * HTTP Status-Code 201: Created.
+	 */
+	public static final int CREATED = 201;
+
+	/**
+	 * HTTP Status-Code 202: Accepted.
+	 */
+	public static final int ACCEPTED = 202;
+
+	/**
+	 * HTTP Status-Code 203: Non-Authoritative Information.
+	 */
+	public static final int NOT_AUTHORITATIVE = 203;
+
+	/**
+	 * HTTP Status-Code 204: No Content.
+	 */
+	public static final int NO_CONTENT = 204;
+
+	/**
+	 * HTTP Status-Code 205: Reset Content.
+	 */
+	public static final int RESET = 205;
+
+	/**
+	 * HTTP Status-Code 206: Partial Content.
+	 */
+	public static final int PARTIAL = 206;
+
+	/* 3XX: relocation/redirect */
+
+	/**
+	 * HTTP Status-Code 300: Multiple Choices.
+	 */
+	public static final int MULT_CHOICE = 300;
+
+	/**
+	 * HTTP Status-Code 301: Moved Permanently.
+	 */
+	public static final int MOVED_PERM = 301;
+
+	/**
+	 * HTTP Status-Code 302: Temporary Redirect.
+	 */
+	public static final int MOVED_TEMP = 302;
+
+	/**
+	 * HTTP Status-Code 303: See Other.
+	 */
+	public static final int SEE_OTHER = 303;
+
+	/**
+	 * HTTP Status-Code 304: Not Modified.
+	 */
+	public static final int NOT_MODIFIED = 304;
+
+	/**
+	 * HTTP Status-Code 305: Use Proxy.
+	 */
+	public static final int USE_PROXY = 305;
+
+	/* 4XX: client error */
+
+	/**
+	 * HTTP Status-Code 400: Bad Request.
+	 */
+	public static final int BAD_REQUEST = 400;
+
+	/**
+	 * HTTP Status-Code 401: Unauthorized.
+	 */
+	public static final int UNAUTHORIZED = 401;
+
+	/**
+	 * HTTP Status-Code 402: Payment Required.
+	 */
+	public static final int PAYMENT_REQUIRED = 402;
+
+	/**
+	 * HTTP Status-Code 403: Forbidden.
+	 */
+	public static final int FORBIDDEN = 403;
+
+	/**
+	 * HTTP Status-Code 404: Not Found.
+	 */
+	public static final int NOT_FOUND = 404;
+
+	/**
+	 * HTTP Status-Code 405: Method Not Allowed.
+	 */
+	public static final int BAD_METHOD = 405;
+
+	/**
+	 * HTTP Status-Code 406: Not Acceptable.
+	 */
+	public static final int NOT_ACCEPTABLE = 406;
+
+	/**
+	 * HTTP Status-Code 407: Proxy Authentication Required.
+	 */
+	public static final int PROXY_AUTH = 407;
+
+	/**
+	 * HTTP Status-Code 408: Request Time-Out.
+	 */
+	public static final int CLIENT_TIMEOUT = 408;
+
+	/**
+	 * HTTP Status-Code 409: Conflict.
+	 */
+	public static final int CONFLICT = 409;
+
+	/**
+	 * HTTP Status-Code 410: Gone.
+	 */
+	public static final int GONE = 410;
+
+	/**
+	 * HTTP Status-Code 411: Length Required.
+	 */
+	public static final int LENGTH_REQUIRED = 411;
+
+	/**
+	 * HTTP Status-Code 412: Precondition Failed.
+	 */
+	public static final int PRECON_FAILED = 412;
+
+	/**
+	 * HTTP Status-Code 413: Request Entity Too Large.
+	 */
+	public static final int ENTITY_TOO_LARGE = 413;
+
+	/**
+	 * HTTP Status-Code 414: Request-URI Too Large.
+	 */
+	public static final int REQ_TOO_LONG = 414;
+
+	/**
+	 * HTTP Status-Code 415: Unsupported Media Type.
+	 */
+	public static final int UNSUPPORTED_TYPE = 415;
+
+	/* 5XX: server error */
+
+	/**
+	 * HTTP Status-Code 500: Internal Server Error.
+	 */
+	public static final int ERROR = 500;
+
+	/**
+	 * HTTP Status-Code 501: Not Implemented.
+	 */
+	public static final int NOT_IMPLEMENTED = 501;
+
+	/**
+	 * HTTP Status-Code 502: Bad Gateway.
+	 */
+	public static final int BAD_GATEWAY = 502;
+
+	/**
+	 * HTTP Status-Code 503: Service Unavailable.
+	 */
+	public static final int UNAVAILABLE = 503;
+
+	/**
+	 * HTTP Status-Code 504: Gateway Timeout.
+	 */
+	public static final int GATEWAY_TIMEOUT = 504;
+
+	/**
+	 * HTTP Status-Code 505: HTTP Version Not Supported.
+	 */
+	public static final int VERSION = 505;
+}

+ 42 - 0
src/main/java/com/template/common/result/PageResult.java

@@ -0,0 +1,42 @@
+package com.template.common.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class PageResult implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/** 总记录数 */
+	private int total;
+	private int totalPage;
+	/** 当前页数据列表 */
+	private List<?> rows;
+
+
+	public PageResult() {
+		super();
+	}
+
+	public PageResult(int total, int totalPage, List<?> rows) {
+		super();
+		this.total = total;
+		this.totalPage = totalPage;
+		this.rows = rows;
+	}
+
+	public PageResult(int total, List<?> rows,List<?> footer) {
+		super();
+		this.total = total;
+		this.rows = rows;
+	}
+
+	public PageResult(int code, String msg, int total, List<?> rows) {
+		super();
+		this.total = total;
+		this.rows = rows;
+	}
+}

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

@@ -0,0 +1,83 @@
+package com.template.common.result;
+
+/**
+ * 响应结果枚举,用于提供给GraceJSONResult返回给前端的
+ * 本枚举类中包含了很多的不同的状态码供使用,可以自定义
+ * 便于更优雅的对状态码进行管理,一目了然
+ */
+public enum ResponseStatusEnum implements Code{
+
+
+    SUCCESS(200, true, "操作成功!"),
+    NO_PERMISSION(401,false,"没有权限"),
+    MISSING_REQUEST_HEADER(499,false,"缺少请求头"),
+    FAILED(500, false, "操作失败!"),
+    SEND_PARAMS(501,false,"传入参数数据结构错误"),
+    SEND_PARAMS_TYPE(502,false,"传入参数数据类型错误"),
+    UN_SERVICES_ERROR(505,false,"操作失败,请联系管理员"),
+
+    // 自定义系统级别异常 54x
+    SYSTEM_ERROR(540, false, "系统错误,错误未知!"),
+    SYSTEM_INDEX_OUT_OF_BOUNDS(541, false, "系统错误,数组越界!"),
+    SYSTEM_ARITHMETIC_BY_ZERO(542, false, "系统错误,无法除零!"),
+    SYSTEM_NULL_POINTER(543, false, "系统错误,空指针!"),
+    SYSTEM_NUMBER_FORMAT(544, false, "系统错误,数字转换异常!"),
+    SYSTEM_PARSE(545, false, "系统错误,解析异常!"),
+    SYSTEM_IO(546, false, "系统错误,IO输入输出异常!"),
+    SYSTEM_FILE_NOT_FOUND(547, false, "系统错误,文件未找到!"),
+    SYSTEM_CLASS_CAST(548, false, "系统错误,类型强制转换错误!"),
+    SYSTEM_PARSER_ERROR(549, false, "系统错误,解析出错!"),
+    SYSTEM_DATE_PARSER_ERROR(550, false, "系统错误,日期解析出错!"),
+    SYSTEM_ERROR_GLOBAL(551, false, "系统繁忙,请稍后再试!"),
+    SYSTEM_ERROR_ZUUL(552, false, "请求系统过于繁忙,请稍后再试!"),
+    SYSTEM_REQUEST_METHOD_ERROR(553, false, "请求类型错误"),
+    SYSTEM_MYSQL_TIMEOUT_ERROR(554, false, "Mysql连接超时"),
+    SYSTEM_MONGO_TIMEOUT_ERROR(555, false, "Mongo连接超时"),
+    SYSTEM_PHONE_ERROR(556,false,"手机号格式错误"),
+    SYSTEM_SEND_PHONE_ERROR(557,false,"发送验证码失败"),
+    SYSTEM_TOKEN_ERROR(558,false,"token为空"),
+    SYSTEM_LOGIN_ERROR(559,false,"无效token"),
+    PARAM_ERROR(560, false, "参数不能为空!"),
+    GZH_ERROR(561, false, "设置失败,请先关联公众号!"),
+    EXISTS(999,false,"已存在");
+
+    // 响应业务状态
+    private Integer status;
+    // 调用是否成功
+    private Boolean success;
+    // 响应消息,可以为成功或者失败的消息
+    private String msg;
+
+    ResponseStatusEnum(Integer status, Boolean success, String msg) {
+        this.status = status;
+        this.success = success;
+        this.msg = msg;
+    }
+
+    public Integer status() {
+        return status;
+    }
+    public Boolean success() {
+        return success;
+    }
+    public String msg() {
+        return msg;
+    }
+
+    @Override
+    public Integer getStatus() {
+        return status;
+    }
+
+    @Override
+    public Boolean getSuccess() {
+        return success;
+    }
+
+    @Override
+    public String getMsg() {
+        return msg;
+    }
+
+
+}

+ 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;
+	}
+
+}

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

@@ -0,0 +1,84 @@
+package com.template.common.utils;
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * @Author: binguo
+ * @Date: 2024/1/5 星期五 14:26
+ * @Description: com.template.common.utils
+ * @Version: 1.0
+ */
+public class AesTestOne {
+
+    /**
+     * AES 对称加密(RSA非对称加密)
+     * CBC 有向量 (ECB 无向量)
+     * PKCS5Padding 填充模式(NoPadding 无填充)
+     */
+    private static final String ALG_AES_CBC_PKCS5 = "AES/CBC/PKCS5Padding";
+
+    private static final String ALGORITHM = "AES";
+
+    private static final Charset UTF8 = StandardCharsets.UTF_8;
+
+    //private static String aesKey = "61afd794ed3244e995c5e894e5788193";  // 指定好的秘钥,非Base64和16进制
+
+    private static String aesIv = "activevector4api";   // 偏移量
+
+    private static SecretKeySpec skeySpec;
+
+    private static IvParameterSpec iv;
+
+    /**
+     * 解密方法
+     * @param cipherStr Base64编码的加密字符串
+     * @return 解密后的字符串(UTF8编码)
+     * @throws Exception 异常
+     */
+    public static String decrypt(String cipherStr, String appSecret) throws Exception{
+        // step 1 获得一个密码器
+        Cipher cipher = Cipher.getInstance(ALG_AES_CBC_PKCS5);
+        // step 2 初始化密码器,指定是加密还是解密(Cipher.DECRYPT_MODE 解密; Cipher.ENCRYPT_MODE 加密)
+        // 加密时使用的盐来够造秘钥对象
+        skeySpec = new SecretKeySpec(appSecret.getBytes(),ALGORITHM);
+        // 加密时使用的向量,16位字符串
+        iv = new IvParameterSpec(aesIv.getBytes());
+        cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
+        // 对加密报文进行base64解码
+        byte[] encrypted1 = Base64.decodeBase64(cipherStr);
+        // 解密后的报文数组
+        byte[] original = cipher.doFinal(encrypted1);
+        // 输出utf8编码的字符串,输出字符串需要指定编码格式
+        return new String(original, UTF8);
+    }
+
+    /**
+     * 加密
+     * @param plainText 明文
+     * @return Base64编码的密文
+     * @throws Exception  加密异常
+     */
+    public static String encrypt(String plainText, String appSecret) throws Exception{
+        Cipher cipher = Cipher.getInstance(ALG_AES_CBC_PKCS5);
+        skeySpec = new SecretKeySpec(appSecret.getBytes(),ALGORITHM);
+        iv = new IvParameterSpec(aesIv.getBytes());
+        cipher.init(Cipher.ENCRYPT_MODE, skeySpec,iv);
+        // 这里的编码格式需要与解密编码一致
+        byte [] encryptText = cipher.doFinal(plainText.getBytes(UTF8));
+        return Base64.encodeBase64String(encryptText);
+    }
+
+    public static void main(String[] args) throws Exception {
+        // URL解码
+        System.out.println("");
+    }
+}

+ 165 - 0
src/main/java/com/template/common/utils/AesUtil.java

@@ -0,0 +1,165 @@
+package com.template.common.utils;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.UUID;
+
+/**
+ * <p>Title: AesUtil</p>
+ * <p>Description: AES加密解密</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class AesUtil {
+
+	/**
+	 * 秘钥
+	 */
+	public static final String PASSWORD_SECRET_KEY = "EasyRailEveryday";
+	
+	/**
+	 * 初始向量
+	 */
+	public static final String INITIAL_VECTOR = "EasyRailEasyRail";
+	
+    /**
+     * 加密
+     * @param content 需要加密的内容
+     * @param password  加密密码
+     * @param keySize 密钥长度16,24,32(密码长度为24和32时需要将local_policy.jar/US_export_policy.jar两个jar包放到JRE目录%jre%/lib/security下)
+     * @return
+     */
+    public static byte[] encrypt(String content, String password, int keySize){
+    	try {                              
+        	//密钥长度不够用0补齐。
+    		SecretKeySpec key = new SecretKeySpec(ZeroPadding(password.getBytes(Base64Util.DEFAULT_CHARSET), keySize), "AES");
+    		//定义加密算法AES、算法模式ECB、补码方式PKCS5Padding
+            //Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+    		//定义加密算法AES 算法模式CBC、补码方式PKCS5Padding
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            //CBC模式模式下初始向量 不足16位用0补齐
+            IvParameterSpec iv = new IvParameterSpec(ZeroPadding(INITIAL_VECTOR.getBytes(Base64Util.DEFAULT_CHARSET),16));
+            byte[] byteContent = content.getBytes();  
+            //初始化加密
+            //ECB
+            //cipher.init(Cipher.ENCRYPT_MODE, key);
+            //CBC 
+			cipher.init(Cipher.ENCRYPT_MODE, key,iv);
+            byte[] result = cipher.doFinal(byteContent);
+            return result; 
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+        } catch (InvalidKeyException e) {
+            e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+            e.printStackTrace();
+        } catch (BadPaddingException e) {
+            e.printStackTrace();
+        } catch (InvalidAlgorithmParameterException e) {
+        	e.printStackTrace();
+        } catch (Exception e) {
+        	e.printStackTrace();
+        }
+        return null;
+    }
+    
+    /**解密
+     * @param content  待解密内容
+     * @param password 解密密钥
+     * @param keySize 密钥长度16,24,32(密码长度为24和32时需要将local_policy.jar/US_export_policy.jar两个jar包放到JRE目录%jre%/lib/security下)
+     * @return
+     */
+    public static String decrypt(byte[] content, String password, int keySize) {
+        try { 
+        	//密钥长度不够用0补齐。
+    		SecretKeySpec key = new SecretKeySpec(ZeroPadding(password.getBytes(), keySize), "AES");
+    		//定义加密算法AES、算法模式ECB、补码方式PKCS5Padding
+            //Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+    		//定义加密算法AES 算法模式CBC、补码方式PKCS5Padding
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            //CBC模式模式下初始向量 不足16位用0补齐
+            IvParameterSpec iv = new IvParameterSpec(ZeroPadding(INITIAL_VECTOR.getBytes(Base64Util.DEFAULT_CHARSET),16));
+            // 初始化解密
+            //ECB
+            //cipher.init(Cipher.DECRYPT_MODE, key);
+            //CBC
+            cipher.init(Cipher.DECRYPT_MODE, key,iv);
+            byte[] result = cipher.doFinal(content);
+            return new String(result,Base64Util.DEFAULT_CHARSET); 
+        } catch (NoSuchAlgorithmException e) {
+        	e.printStackTrace();
+        } catch (NoSuchPaddingException e) {
+        	e.printStackTrace();
+        } catch (InvalidKeyException e) {
+        	e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+        	e.printStackTrace();
+        } catch (BadPaddingException e) {
+        	e.printStackTrace();
+        } catch (InvalidAlgorithmParameterException e){
+        	e.printStackTrace();
+        } catch (Exception e){
+        	e.printStackTrace();
+        }
+        return null;
+    }
+    
+    /**将二进制转换成16进制
+     * @param buf
+     * @return
+     */
+    public static String parseByte2HexStr(byte buf[]) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < buf.length; i++) {
+            String hex = Integer.toHexString(buf[i] & 0xFF);
+            if (hex.length() == 1) {
+                    hex = '0' + hex;
+            }
+            sb.append(hex.toUpperCase());
+        }
+        return sb.toString();
+    }
+    
+    /**将16进制转换为二进制
+     * @param hexStr
+     * @return
+     */
+    public static byte[] parseHexStr2Byte(String hexStr) {
+        if (hexStr.length() < 1){
+        	return null;
+        }
+        byte[] result = new byte[hexStr.length()/2];
+        for (int i = 0;i< hexStr.length()/2; i++) {
+            int high = Integer.parseInt(hexStr.substring(i*2, i*2+1), 16);
+            int low = Integer.parseInt(hexStr.substring(i*2+1, i*2+2), 16);
+            result[i] = (byte) (high * 16 + low);
+        }
+        return result;
+    }
+    
+    /**
+     * 字符达不到指定长度补0
+     * @param in 字符数组
+     * @param blockSize 长度
+     * @return
+     */
+    public static byte[] ZeroPadding(byte[] in,Integer blockSize){
+    	Integer copyLen = in.length;
+    	if (copyLen > blockSize) {
+			copyLen = blockSize;
+		}
+    	byte[] out = new byte[blockSize];
+    	System.arraycopy(in, 0, out, 0, copyLen);
+    	return out;
+    }
+
+}

+ 199 - 0
src/main/java/com/template/common/utils/AesUtils.java

@@ -0,0 +1,199 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.bouncycastle.util.encoders.Base64;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * @Author: liujun
+ * @Description: Aes 加解密算法
+ * @Date Create in 上午 9:38$ 2017/12/26 0026$
+ * @Modify By:
+ */
+@Slf4j
+public class AesUtils {
+    private static String password = "52D04DC20036DBD8";
+    /**
+     * @Author liujun
+     * @Description:
+     * @params: * @param content 需要加密的内容
+     * @param password  加密密码
+     * @Date 上午 9:41 2017/12/26 0026
+     */
+    public static String encrypt(String content) {
+
+        if(password.length()<16) {
+            password = password + "0000000000000000".substring(0, 16-password.length());
+        }
+        else if(password.length()>16) {
+            password = password.substring(0, 16);
+        }
+
+        return bytes2HexString(encryptAES(content.getBytes(), password.getBytes()));
+    }
+
+
+    /**
+     * @Author liujun
+     * @Description:
+     * @params: * @param content 待解密内容
+     * @param password 解密密钥
+     * @Date 上午 9:40 2017/12/26 0026
+     */
+    public static String decrypt(String content) {
+        if(password.length()<16) {
+            password = password + "0000000000000000".substring(0, 16-password.length());
+        }
+        else if(password.length()>16) {
+            password = password.substring(0, 16);
+        }
+
+        return new String(decryptAES(hexString2Bytes(content), password.getBytes()));
+    }
+
+    /**
+     * AES 加密
+     *
+     * @param data 明文
+     * @param key  16、24、32 字节秘钥
+     * @return 密文
+     */
+    public static byte[] encryptAES(final byte[] data, final byte[] key) {
+
+        try {
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
+            Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+            byte[] byteContent = data;
+            cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);// 初始化
+            byte[] result = cipher.doFinal(byteContent);
+            return result; // 加密
+        } catch (NoSuchAlgorithmException e) {
+            log.error(e.getMessage(),e);
+        } catch (NoSuchPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (InvalidKeyException e) {
+            log.error(e.getMessage(),e);
+        } catch (IllegalBlockSizeException e) {
+            log.error(e.getMessage(),e);
+        } catch (BadPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+        }
+        return null;
+    }
+
+    /**
+     * AES 解密
+     *
+     * @param data 密文
+     * @param key  16、24、32 字节秘钥
+     * @return 明文
+     */
+    public static byte[] decryptAES(final byte[] data, final byte[] key) {
+
+        try {
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
+            Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+            cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);// 初始化
+            byte[] result = cipher.doFinal(data);
+            return result; // 加密
+        } catch (NoSuchAlgorithmException e) {
+            log.error(e.getMessage(),e);
+        } catch (NoSuchPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (InvalidKeyException e) {
+            log.error(e.getMessage(),e);
+        } catch (IllegalBlockSizeException e) {
+            log.error(e.getMessage(),e);
+        } catch (BadPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+        }
+        return null;
+    }
+
+    public static String bytes2HexString(final byte[] bytes) {
+        if (bytes == null) return null;
+        int len = bytes.length;
+        if (len <= 0) return null;
+        char[] ret = new char[len << 1];
+        for (int i = 0, j = 0; i < len; i++) {
+            ret[j++] = hexDigits[bytes[i] >>> 4 & 0x0f];
+            ret[j++] = hexDigits[bytes[i] & 0x0f];
+        }
+        return new String(ret);
+    }
+
+    private static final char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+
+    public static byte[] hexString2Bytes(String hexString) {
+        if (isSpace(hexString)) return null;
+        int len = hexString.length();
+        if (len % 2 != 0) {
+            hexString = "0" + hexString;
+            len = len + 1;
+        }
+        char[] hexBytes = hexString.toUpperCase().toCharArray();
+        byte[] ret = new byte[len >> 1];
+        for (int i = 0; i < len; i += 2) {
+            ret[i >> 1] = (byte) (hex2Dec(hexBytes[i]) << 4 | hex2Dec(hexBytes[i + 1]));
+        }
+        return ret;
+    }
+
+    private static int hex2Dec(final char hexChar) {
+        if (hexChar >= '0' && hexChar <= '9') {
+            return hexChar - '0';
+        } else if (hexChar >= 'A' && hexChar <= 'F') {
+            return hexChar - 'A' + 10;
+        } else {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    public static byte[] base64Encode(final byte[] input) {
+        return Base64.encode(input);
+    }
+
+    public static byte[] base64Decode(final byte[] input) {
+
+        return Base64.decode(input);
+    }
+
+    private static boolean isSpace(final String s) {
+        if (s == null) return true;
+        for (int i = 0, len = s.length(); i < len; ++i) {
+            if (!Character.isWhitespace(s.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static void main(String[] args) {
+        String s="{\n" +
+                "  \"categoryId\": \"72cf28a8789643bbbbb62d08ee91f17e\",\n" +
+                "     \"luid\": \"80A036D93CFB\",\n" +
+                "     \"type\":\"4\",\n" +
+                "     \"userName\":\"13097286670\",\n" +
+                "     \"startTime\":\"1682389484000\",\n" +
+                "     \"endTime\":\"1684981484000\",\n" +
+                "     \"password\":\"A08E87B5E777EBEE2C6EF3262F069D5A\"\n" +
+                "}";
+        //加密
+        String encryptString = AesUtils.encrypt("548903");
+        System.out.println("加密后字符串:"+encryptString);
+        //解密
+        String decryptString = AesUtils.decrypt(encryptString);
+        System.out.println("解密后字符串:"+decryptString);
+    }
+}

+ 47 - 0
src/main/java/com/template/common/utils/Base64Util.java

@@ -0,0 +1,47 @@
+package com.template.common.utils;
+
+import org.apache.tomcat.util.codec.binary.Base64;
+
+import java.nio.charset.Charset;
+
+/**
+ * <p>Title: Base64Util</p>
+ * <p>Description: Base64Util工具类 --- 加密和解密</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class Base64Util {
+	
+	public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+	/**
+     * 解密
+     * @param str
+     * @return
+     */
+    public static String decodeStr(String str){
+        if (str == null) {
+			return null;
+		}
+		if (str.length() == 0) {
+			return "";
+		}
+		return new String(Base64.decodeBase64(new String(str).getBytes(DEFAULT_CHARSET)),DEFAULT_CHARSET).trim();
+    }
+
+    /**
+     * 加密
+     * 
+     * @param str
+     * @return
+     */
+    public static String encodeStr(String str){
+        if (str == null) {
+			return null;
+		}
+		if (str.length() == 0) {
+			return "";
+		}
+        return new String(Base64.encodeBase64Chunked(str.getBytes(DEFAULT_CHARSET)),DEFAULT_CHARSET).trim();
+    }
+
+}

+ 211 - 0
src/main/java/com/template/common/utils/CommonUtil.java

@@ -0,0 +1,211 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 公共工具类
+ **/
+@Slf4j
+public class CommonUtil {
+    /**
+     * 检查字符串是否符合正则表达式
+     */
+    public static boolean checkStrByRegx(String regex, String str) {
+        //使用Pattern类的compile()方法编译正则表达式
+        Pattern pattern = Pattern.compile(regex);
+        //使用Matcher类的matcher()方法将正则表达式和字符串进行匹配
+        Matcher matcher = pattern.matcher(str);
+        //返回匹配结果
+        return matcher.matches();
+    }
+
+    /**
+     * 检测客户端参数
+     *
+     * @param code   状态码
+     * @param object 对象
+     * @return 返回类型
+     */
+    public static Map<String, Object> getReturnMap(String code, Object object) {
+        Map<String, Object> returnMap = new HashMap<>();
+        returnMap.put("code", code);
+        returnMap.put("msg", object);
+        return returnMap;
+    }
+
+    public static String getNumberFromString(String string) {
+        Pattern pattern = Pattern.compile("\\d+");
+        Matcher matcher = pattern.matcher(string);
+        if (matcher.find()) {
+            return matcher.group();
+        }
+        return null;
+    }
+
+    /**
+     * 获取ip
+     *
+     * @param request
+     * @return
+     */
+    public static String getIpAddr(HttpServletRequest request) {
+        String ipAddress = null;
+        try {
+            ipAddress = request.getHeader("x-forwarded-for");
+            System.out.println("x-forwarded-for=" + ipAddress);
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("Proxy-Client-IP");
+                System.out.println("Proxy-Client-IP=" + ipAddress);
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("WL-Proxy-Client-IP");
+                System.out.println("WL-Proxy-Client-IP=" + ipAddress);
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getRemoteAddr();
+                System.out.println("getRemoteAddr=" + ipAddress);
+                if (ipAddress.equals("127.0.0.1")) {
+                    // 根据网卡取本机配置的IP
+                    InetAddress inet = null;
+                    try {
+                        inet = InetAddress.getLocalHost();
+                    } catch (UnknownHostException e) {
+                        e.printStackTrace();
+                    }
+                    ipAddress = inet.getHostAddress();
+                    System.out.println("getHostAddress=" + ipAddress);
+                }
+            }
+            // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+            if (ipAddress != null && ipAddress.length() > 15) {
+                // "***.***.***.***".length()
+                // = 15
+                if (ipAddress.indexOf(",") > 0) {
+                    ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
+                }
+            }
+        } catch (Exception e) {
+            ipAddress = "";
+        }
+        return ipAddress;
+    }
+
+
+    /**
+     * 获取全部请求头
+     *
+     * @param request
+     * @return
+     */
+    public static Map<String, String> getAllRequestHeader(HttpServletRequest request) {
+        Enumeration<String> headerNames = request.getHeaderNames();
+        Map<String, String> map = new HashMap<>();
+        while (headerNames.hasMoreElements()) {
+            String key = headerNames.nextElement();
+            //根据名称获取请求头的值
+            String value = request.getHeader(key);
+            map.put(key, value);
+        }
+
+        return map;
+    }
+
+
+    /**
+     * MD5加密
+     *
+     * @param data
+     * @return
+     */
+    public static String MD5(String data) {
+        try {
+            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();
+        } catch (Exception exception) {
+        }
+        return null;
+    }
+
+
+    /**
+     * 获取验证码随机数
+     *
+     * @param length
+     * @return
+     */
+    public static String getRandomCode(int length) {
+        String sources = "0123456789";
+        Random random = new Random();
+        StringBuilder sb = new StringBuilder();
+        for (int j = 0; j < length; j++) {
+            sb.append(sources.charAt(random.nextInt(9)));
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 获取当前时间戳
+     *
+     * @return
+     */
+    public static long getCurrentTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+    /**
+     * 生成uuid
+     *
+     * @return
+     */
+    public static String generateUUID() {
+        return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
+    }
+
+    /**
+     * 获取随机长度的串
+     *
+     * @param length
+     * @return
+     */
+    private static final String ALL_CHAR_NUM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+    public static String getStringNumRandom(int length) {
+        //生成随机数字和字母,
+        Random random = new Random();
+        StringBuilder saltString = new StringBuilder(length);
+        for (int i = 1; i <= length; ++i) {
+            saltString.append(ALL_CHAR_NUM.charAt(random.nextInt(ALL_CHAR_NUM.length())));
+        }
+        return saltString.toString();
+    }
+
+    /**
+     * LocalDate 拼接时间转成 LocalDateTime
+     *
+     * @param localDate
+     * @param timeStr   HH:mm:ss
+     * @return
+     */
+    public static LocalDateTime localDateToTime(LocalDate localDate, String timeStr) {
+        LocalTime time = LocalTime.parse(timeStr);
+        return LocalDateTime.of(localDate.getYear(), localDate.getMonth(), localDate.getDayOfMonth(),
+                time.getHour(), time.getMinute(), time.getSecond());
+    }
+}

+ 9 - 0
src/main/java/com/template/common/utils/DataBliu.java

@@ -0,0 +1,9 @@
+package com.template.common.utils;
+
+public class DataBliu {
+
+    public static double getTwo(double d1){
+        return (double) Math.round(d1 * 100) / 100;
+    }
+
+}

+ 241 - 0
src/main/java/com/template/common/utils/DateUtils.java

@@ -0,0 +1,241 @@
+package com.template.common.utils;
+
+import org.springframework.stereotype.Component;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * <p>Title: DateUtils</p>
+ * <p>Description:日期工具类 </p>
+ * 
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+@Component // 加此注解是把此类实例化spring容器中
+public class DateUtils {
+
+	/**
+	 * 默认日期格式
+	 */
+	public static final String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+	/**
+	 * 如2018 0901 232211(年月日时分秒)
+	 * 
+	 * @return
+	 */
+	public String yyyyMMddHHmmss() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如20180901
+	 * 
+	 * @return
+	 */
+	public static String getYYYYMMdd() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如180901
+	 * @return
+	 */
+	public String getYYMMdd() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如201809
+	 * @return
+	 */
+	public String getYYYYMM() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如 2018/02/11
+	 * @return
+	 */
+	public String getQueryEndDate() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如 2018/02/11
+	 * @return
+	 */
+	public String getQueryStartDate() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_YEAR, -30);
+		return sdf.format(cal.getTime());
+	}
+
+	/**
+	 * 如 2018/02/11 12:30:00
+	 * @return
+	 */
+	public static String getQueryEndTime() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		return sdf.format(Calendar.getInstance().getTime());
+	}
+
+	/**
+	 * 如 2018/02/11
+	 * @return
+	 */
+	public String getQueryStartTime() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_YEAR, -30);
+		return sdf.format(cal.getTime());
+	}
+
+	public String getQueryTwoAgoDate() {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		Calendar cal = Calendar.getInstance();
+		cal.add(Calendar.DAY_OF_YEAR, -2);
+		return sdf.format(cal.getTime());
+	}
+
+	/**
+	 * 字符串转换成日期
+	 * 
+	 * @param str 字符串
+	 * @param format 日期格式
+	 * @return 日期
+	 */
+	public static Date str2Date(String str, String format) {
+		if (null == str || "".equals(str)) {
+			return null;
+		}
+		// 如果没有指定字符串转换的格式,则用默认格式进行转换
+		if (null == format || "".equals(format)) {
+			format = DEFAULT_FORMAT;
+		}
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		Date date = null;
+		try {
+			date = sdf.parse(str);
+			return date;
+		} catch (ParseException e) {
+		}
+		return null;
+	}
+
+	/**
+	 * @param date 日期
+	 * @param format 日期格式
+	 * @return 字符串
+	 */
+	public static String date2Str(Date date, String format) {
+		if (null == date) {
+			return null;
+		}
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		return sdf.format(date);
+	}
+
+	/**
+	 * 时间戳转换为字符串
+	 * @param time
+	 * @return
+	 */
+	public static String timestamp2Str(Timestamp time) {
+		Date date = new Date(time.getTime());
+		return date2Str(date, DEFAULT_FORMAT);
+	}
+
+	/**
+	 * 字符串转换为时间
+	 * @param str
+	 * @return
+	 */
+	public static Timestamp str2Timestamp(String str) {
+		Date date = str2Date(str, DEFAULT_FORMAT);
+		return new Timestamp(date.getTime());
+	}
+
+	/**
+	 * 字符串转换为时间
+	 * @param str
+	 * @return
+	 */
+	public static Timestamp str2Timestamp(String str, String formatStr) {
+		if (null == str) {
+			return null;
+		}
+		Date date = str2Date(str, formatStr);
+		return new Timestamp(date.getTime());
+	}
+
+	/**
+	 * 获取某年第一天日期
+	 * @param year 年份
+	 * @return Date
+	 */
+	public static Date getYearFirst(int year) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.clear();
+		calendar.set(Calendar.YEAR, year);
+		Date currYearFirst = calendar.getTime();
+		return currYearFirst;
+	}
+
+	/**
+	 * 获取某年最后一天日期
+	 * @param year  年份
+	 * @return Date
+	 */
+	public static Date getYearLast(int year) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.clear();
+		calendar.set(Calendar.YEAR, year);
+		calendar.roll(Calendar.DAY_OF_YEAR, -1);
+		Date currYearLast = calendar.getTime();
+
+		return currYearLast;
+	}
+
+	@SuppressWarnings("static-access")
+	public static Date getnextLast(String datetime, int year) {
+		Calendar calendar = new GregorianCalendar();
+		Date date = null;
+		if (datetime.length() > 7) {
+			date = str2Date(datetime, "yyyy-MM-dd");
+		} else {
+			date = str2Date(datetime, "yyyy-MM");
+		}
+		calendar.setTime(date);
+		calendar.add(calendar.YEAR, year);// 把日期往后增加一年.整数往后推,负数往前移动
+		date = calendar.getTime();
+		return date;
+
+	}
+
+	public static String getrightDate(String datetime, int year) {
+		String date = "";
+		String years = datetime.substring(0, 4);
+		String dates = datetime.substring(4, datetime.length());
+		Integer s = new Integer(years) + year;
+		date = s + dates;
+		return date;
+	}
+
+	public static void main(String[] args) {
+		System.out.println(getrightDate("2018-09", 4));
+		System.out.println(date2Str(getnextLast("2018-09", 4), "yyyy-MM"));
+	}
+
+}

+ 82 - 0
src/main/java/com/template/common/utils/EncryptUtil.java

@@ -0,0 +1,82 @@
+package com.template.common.utils;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import java.security.SecureRandom;
+import java.util.Base64;
+
+/**
+ * 对称加密算法
+ *
+ * @Date: 2024/2/26 星期一 10:31
+ * @Description: com.template.common.utils
+ * @Version: 1.0
+ */
+public class EncryptUtil {
+    public static String secretKeyB = "com.template.common.utils";
+    private final static String DES = "DES";
+
+    //加密
+    public static String encrypt(String data) {
+        byte[] bt;
+        try {
+            bt = encrypt(data.getBytes(), secretKeyB.getBytes());
+            //加密
+            String strs = Base64.getEncoder().encodeToString(bt);
+            return strs;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    //解密
+    public static String decrypt(String data) {
+        if (data == null) {
+            return null;
+        }
+        byte[] buf;
+        byte[] bt;
+        try {
+            //解密
+            buf = Base64.getDecoder().decode(data);
+            bt = decrypt(buf, secretKeyB.getBytes());
+            return new String(bt);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+        // 生成可信任的随机数源
+        SecureRandom sr = new SecureRandom();
+        // 从原始密钥数据创建DESKeySpec对象
+        DESKeySpec dks = new DESKeySpec(key);
+        // 创建密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
+        SecretKey securekey = keyFactory.generateSecret(dks);
+        // Cipher对象实际完成加密操作
+        Cipher cipher = Cipher.getInstance(DES);
+        // 用密钥初始化Cipher对象
+        cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
+        return cipher.doFinal(data);
+    }
+
+    private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
+        // 生成可信任的随机数源
+        SecureRandom sr = new SecureRandom();
+        // 从原始密钥数据创建DESKeySpec对象
+        DESKeySpec dks = new DESKeySpec(key);
+        // 创建密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
+        SecretKey securekey = keyFactory.generateSecret(dks);
+        // Cipher对象实际完成解密操作
+        Cipher cipher = Cipher.getInstance(DES);
+        // 用密钥初始化Cipher对象
+        cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
+        return cipher.doFinal(data);
+    }
+}

+ 41 - 0
src/main/java/com/template/common/utils/EncryptionUtil.java

@@ -0,0 +1,41 @@
+package com.template.common.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class EncryptionUtil {
+
+
+    private static final int MAX_JSON_STRING = 40;
+
+    /**
+     * 将需要加密的字段分批加密
+     *
+     * @param jsonString
+     * @param publicKey
+     * @return
+     * @throws Exception
+     */
+    public Map<Object, Object> encryption(String jsonString, String publicKey) throws Exception {
+        int length = jsonString.length();
+        int offset = 0;
+        int i = 0;
+        HashMap<Object, Object> map = new HashMap<>();
+//        判断字符串长度是否大于40,大于就截取前40位,分批加密
+        while (length - offset > 0) {
+            if (length - offset > MAX_JSON_STRING) {
+                String substring = jsonString.substring(offset, offset + MAX_JSON_STRING);
+                String encrypt = RSAUtils.encrypt(substring, RSAUtils.getPublicKey(publicKey));
+                map.put(i, encrypt);
+            } else {
+                String substring = jsonString.substring(offset,length);
+                String encrypt = RSAUtils.encrypt(substring, RSAUtils.getPublicKey(publicKey));
+                map.put(i, encrypt);
+            }
+            i++;
+            offset = i * MAX_JSON_STRING;
+        }
+        return map;
+    }
+}

+ 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;
+    }
+ 
+}

+ 22 - 0
src/main/java/com/template/common/utils/ExcelUtil3.java

@@ -0,0 +1,22 @@
+package com.template.common.utils;
+
+
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+
+public class ExcelUtil3 {
+
+    public static void process(String fileName, List target, Class clazs , HttpServletResponse response) throws IOException {
+        response.setCharacterEncoding("UTF-8");
+        response.setContentType("application/vnd.ms-excel");
+        response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8"));
+        EasyExcel.write(response.getOutputStream(), clazs).excelType(ExcelTypeEnum.XLSX).autoCloseStream(Boolean.TRUE)
+                .sheet("预警报表").doWrite(target);
+    }
+}

+ 64 - 0
src/main/java/com/template/common/utils/ExcelUtils.java

@@ -0,0 +1,64 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.boot.system.ApplicationHome;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/10 星期一 14:21
+ * @Description: com.repair.common.utils
+ * @Version: 1.0
+ */
+@Slf4j
+public class ExcelUtils {
+    public static void fileDownload(String fileName, HttpServletResponse response) {
+        try {
+            ApplicationHome applicationHome = new ApplicationHome(ExcelUtils.class);
+            String pathResouce = applicationHome.getDir().getParentFile().getParentFile().getAbsolutePath();
+            String decode = URLDecoder.decode(pathResouce, "utf-8");
+            File readPath = new File(decode + "/project/repair" + File.separator);
+            File file = new File(readPath.getAbsolutePath() + fileName);
+            // 获取文件名
+            String filename = file.getName();
+            // 获取文件后缀名
+            String ext = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();
+            InputStream inputStream = new FileInputStream(file);//根据路径获取要下载的文件输入流
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            response.setHeader("Content-disposition", "attachment;fileName=" + URLEncoder.encode(filename, "UTF-8"));
+            OutputStream out = response.getOutputStream();
+            byte[] b = new byte[1024];  //创建数据缓冲区
+            int length;
+            while ((length = inputStream.read(b)) > 0) {  //把文件流写到缓冲区里
+                out.write(b, 0, length);
+            }
+            out.flush();
+            out.close();
+            inputStream.close();
+        } catch (IOException ex) {
+            System.out.println("模板导出失败:" + ex.getMessage());
+            ex.printStackTrace();
+        }
+    }
+
+    public static void excelDownload(Workbook workbook, String fileName, HttpServletResponse response) {
+        try {
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            response.setHeader("Content-disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8"));
+            OutputStream out = response.getOutputStream();
+            workbook.write(out);
+            out.flush();
+            out.close();
+        } catch (IOException ex) {
+            System.out.println("模板导出失败:" + ex.getMessage());
+            ex.printStackTrace();
+        }
+    }
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1008 - 0
src/main/java/com/template/common/utils/ExcelUtils2.java


+ 68 - 0
src/main/java/com/template/common/utils/FileUploadUtil.java

@@ -0,0 +1,68 @@
+package com.template.common.utils;
+
+import com.template.model.weixin.HttpParame;
+import org.apache.commons.fileupload.FileUploadException;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * @author 林文塨
+ * @date 2022-04-07 8:53
+ * description 文件上传工具类
+ */
+public class FileUploadUtil {
+
+    public static String fileUpload(MultipartFile multipartFile) throws FileUploadException, IOException {
+        String originalFilename = multipartFile.getOriginalFilename();
+        if (originalFilename == null) {
+            throw new FileUploadException("获得上传文件名失败!");
+        }
+        //提取生成文件名(雪花算法)+上传文件的后缀.jpg  .xls  .pdf
+        String saveFileName =SnowflakeIdWorker.getInstance().getId() + FileUploadUtil.getFileType(originalFilename);
+        //文件上传的地址(后面的静态资源目录static/img可以根据需求修改)
+        String path = "/home/static/file";
+        //处理斜杠Linux
+        String realPath = path.replace('/', '\\');
+        //String realPath = path.substring(1,path.length());
+        System.out.println("realPath:"+realPath);
+        //处理中文编码
+        String decodePath = URLDecoder.decode(realPath, "UTF-8");
+
+        //转存
+        System.out.println(">>>>>>>>>>>开始上传<<<<<<<<<<<<<<");
+        multipartFile.transferTo(new File(path, saveFileName));
+        System.out.println(decodePath);
+        System.out.println("/file/"+saveFileName);
+        return HttpParame.FRONT_URI+ "/file/"+saveFileName;
+    }
+
+    public static int deleteFile(String filePath) {
+        File file = new File(filePath); // 替换为你要删除的文件路径
+        if (file.exists()) {
+            boolean success = file.delete();
+            return success ? 200 : 500;
+        } else {
+            return 404;
+        }
+    }
+
+    public static String getFileType(String fileName){
+        /*
+         * 根据给定的文件名和后缀截取文件名
+         * @author 林文塨
+         * @date 2022/4/7 8:54
+         * @param [fileName]
+         * @return java.lang.String
+         */
+        int index = fileName.lastIndexOf(".");
+        return fileName.substring(index);
+    }
+}
+
+

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

@@ -0,0 +1,76 @@
+package com.template.common.utils;
+
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.springframework.http.MediaType;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/27 星期三 11:08
+ * @Description: com.template.common.utils
+ * @Version: 1.0
+ */
+public class FileUtils {
+
+
+    /**
+     * 获取封装得MultipartFile
+     *
+     * @param inputStream inputStream
+     * @return MultipartFile
+     */
+    public static MultipartFile getMultipartFile(InputStream inputStream, String fileName) {
+        FileItem fileItem = createFileItem(inputStream, fileName);
+        //CommonsMultipartFile是feign对multipartFile的封装,但是要FileItem类对象
+        return new CommonsMultipartFile(fileItem);
+    }
+    /**
+     * FileItem类对象创建
+     *
+     * @param inputStream inputStream
+     * @param fileName    fileName
+     * @return FileItem
+     */
+    public static FileItem createFileItem(InputStream inputStream, String fileName) {
+        FileItemFactory factory = new DiskFileItemFactory(16, null);
+        String textFieldName = "file";
+        FileItem item = factory.createItem(textFieldName, MediaType.MULTIPART_FORM_DATA_VALUE, true, fileName);
+        int bytesRead = 0;
+        byte[] buffer = new byte[10 * 1024 * 1024];
+        OutputStream os = null;
+        //使用输出流输出输入流的字节
+        try {
+            os = item.getOutputStream();
+            while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            inputStream.close();
+        } catch (IOException e) {
+            throw new IllegalArgumentException("文件上传失败");
+        } finally {
+            if (os != null) {
+                try {
+                    os.close();
+                } catch (IOException e) {
+
+                }
+            }
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+
+        return item;
+    }
+}

+ 18 - 0
src/main/java/com/template/common/utils/GetVertifyCode.java

@@ -0,0 +1,18 @@
+package com.template.common.utils;
+
+import java.util.Random;
+
+public class GetVertifyCode {
+
+    public static String getRandomNumCode(int number){
+        String codeNum = "";
+        int [] numbers = {0,1,2,3,4,5,6,7,8,9};
+        Random random = new Random();
+        for (int i = 0; i < number; i++) {
+            int next = random.nextInt(10000);
+            codeNum+=numbers[next%10];
+        }
+        return codeNum;
+    }
+
+}

+ 241 - 0
src/main/java/com/template/common/utils/HttpClientUtils.java

@@ -0,0 +1,241 @@
+package com.template.common.utils;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+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.conn.ssl.DefaultHostnameVerifier;
+import org.apache.http.conn.util.PublicSuffixMatcher;
+import org.apache.http.conn.util.PublicSuffixMatcherLoader;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>Title: HttpClientUtils</p>
+ * <p>Description: httpClient 工具类</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class HttpClientUtils {
+	
+	/**
+	 * 默认参数设置
+	 * setConnectTimeout:设置连接超时时间,单位毫秒。
+	 * setConnectionRequestTimeout:设置从connect Manager获取Connection 超时时间,单位毫秒。
+	 * setSocketTimeout:请求获取数据的超时时间,单位毫秒。访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。 暂时定义15分钟
+	 */
+	private RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(600000).setConnectTimeout(600000).setConnectionRequestTimeout(600000).build();
+	
+	/**
+	 * 静态内部类---作用:单例产生类的实例
+	 * @author Administrator
+	 *
+	 */
+	private static class LazyHolder {    
+       private static final HttpClientUtils INSTANCE = new HttpClientUtils();    
+       
+    }  
+	private HttpClientUtils(){}
+	public static HttpClientUtils getInstance(){
+		return LazyHolder.INSTANCE;    
+	}
+	
+	/**
+	 * 发送 post请求
+	 * @param httpUrl 地址
+	 */
+	public String sendHttpPost(String httpUrl) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost  
+		return sendHttpPost(httpPost);
+	}
+	
+	/**
+	 * 发送 post请求
+	 * @param httpUrl 地址
+	 * @param params 参数(格式:key1=value1&key2=value2)
+	 */
+	public String sendHttpPost(String httpUrl, String params) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost  
+		try {
+			//设置参数
+			StringEntity stringEntity = new StringEntity(params, "UTF-8");
+			stringEntity.setContentType("application/x-www-form-urlencoded");
+			httpPost.setEntity(stringEntity);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return sendHttpPost(httpPost);
+	}
+	
+	/**
+	 * 发送 post请求
+	 * @param httpUrl 地址
+	 * @param maps 参数
+	 */
+	public String sendHttpPost(String httpUrl, Map<String, String> maps) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost  
+		// 创建参数队列  
+		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
+		for (String key : maps.keySet()) {
+			nameValuePairs.add(new BasicNameValuePair(key, maps.get(key)));
+		}
+		try {
+			httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return sendHttpPost(httpPost);
+	}
+	
+	/**
+	 * 发送Post请求
+	 * @param httpPost
+	 * @return
+	 */
+	private String sendHttpPost(HttpPost httpPost) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例
+			httpClient = HttpClients.createDefault();
+			httpPost.setConfig(requestConfig);
+			// 执行请求
+			long execStart = System.currentTimeMillis();
+			response = httpClient.execute(httpPost);
+			long execEnd = System.currentTimeMillis();
+			System.out.println("=================执行post请求耗时:"+(execEnd-execStart)+"ms");
+			long getStart = System.currentTimeMillis();
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+			long getEnd = System.currentTimeMillis();
+			System.out.println("=================获取响应结果耗时:"+(getEnd-getStart)+"ms");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return responseContent;
+	}
+
+	/**
+	 * 发送 get请求
+	 * @param httpUrl
+	 */
+	public String sendHttpGet(String httpUrl) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpGet(httpGet);
+	}
+	
+	/**
+	 * 发送 get请求Https
+	 * @param httpUrl
+	 */
+	public String sendHttpsGet(String httpUrl) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpsGet(httpGet);
+	}
+	
+	/**
+	 * 发送Get请求
+	 * @param httpPost
+	 * @return
+	 */
+	private String sendHttpGet(HttpGet httpGet) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+
+			
+			httpClient = HttpClients.createDefault();
+
+			httpGet.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return responseContent;
+	}
+	
+	/**
+	 * 发送Get请求Https
+	 * @param httpPost
+	 * @return
+	 */
+	private String sendHttpsGet(HttpGet httpGet) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+			PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.load(new URL(httpGet.getURI().toString()));
+			DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher);
+			httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build();
+			httpGet.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return responseContent;
+	}
+	
+	
+	
+}

+ 112 - 0
src/main/java/com/template/common/utils/HttpUtils.java

@@ -0,0 +1,112 @@
+package com.template.common.utils;
+
+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.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/8/21 星期一 14:58
+ * @Description: com.repair.common.utils
+ * @Version: 1.0
+ */
+public class HttpUtils {
+    /**
+     * 发送http post请求
+     *
+     * @param
+     *
+     * @param
+     *
+     */
+    public static String post(String url, Map<String, String> params){
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        String re = "";
+        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();
+            re = 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 re;
+    }
+
+    /**
+     * 发送post请求Https,参数是字符串
+     *
+     * @param
+     * @return
+     */
+    public static String post(String url, String body){
+        String str = "";
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom()
+                    .setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            httpPost.setEntity(new StringEntity(body, "utf-8"));
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            str = 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 str;
+    }
+}

+ 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);
+    }
+}

+ 106 - 0
src/main/java/com/template/common/utils/JWTUtil.java

@@ -0,0 +1,106 @@
+package com.template.common.utils;
+
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTVerifier;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.interfaces.Claim;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.pojo.system.SysUser;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * jwt 工具
+ **/
+@Slf4j
+public class JWTUtil {
+
+    private static String SIGNATURE = "token!@#$%^7890";
+
+    /**
+     * token过期时间,7天
+     */
+//    private static final long EXPIRED = 1000 * 60 * 60 * 24 * 7;
+    private static final long EXPIRED = 1000 * 60 * 60 * 24;
+
+    /**
+     * 生成token 有过期时间
+     * @return 返回token
+     */
+    public static String getToken(SysUser sysUser){
+
+        // 签发时间
+        Date iatDate = new Date();
+
+//        // 过期时间
+//        Calendar nowTime = Calendar.getInstance();
+//        nowTime.add(Calendar.DAY_OF_WEEK, 3);
+//        Date expiresDate = nowTime.getTime();
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("alg", "HMAC256");
+        map.put("typ", "JWT");
+        String token = JWT.create()
+                .withHeader(map) // header
+                .withClaim("account", sysUser.getUserCode()) // 账号
+                .withClaim("password", sysUser.getPassword()) // 密码
+                .withExpiresAt(new Date(CommonUtil.getCurrentTimestamp() + EXPIRED)) // 设置过期时间。过期时间要大于签发时间
+                .withIssuedAt(iatDate) // 设置签发时间
+                .sign(Algorithm.HMAC256(SIGNATURE)); // 加密
+        return token;
+
+//
+//        JWTCreator.Builder builder = JWT.create();
+//        map.forEach((k,v)->{
+//            builder.withClaim(k,v);
+//        });
+//        Calendar instance = Calendar.getInstance();
+//        instance.add(Calendar.SECOND,7);
+//        builder.withExpiresAt(instance.getTime());
+//        return builder.sign(Algorithm.HMAC256(SIGNATURE)).toString();
+    }
+
+    public static long getExpired() {
+        return EXPIRED;
+    }
+
+
+    /**
+     * 验证token
+     * @param token
+     */
+    public static void verify(String token){
+        JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
+    }
+
+    /**
+     * 获取token中payload
+     * @param token
+     * @return
+     */
+    public static DecodedJWT getToken(String token){
+        return JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
+    }
+
+
+
+    /*
+     * 解密Token
+     * */
+    public static Map<String, Claim> verifyToken(String token)  {
+        JWTVerifier verifier = JWT.require(Algorithm.HMAC256(SIGNATURE)).build();
+        DecodedJWT jwt = null;
+        try {
+            jwt = verifier.verify(token);
+        } catch (Exception e) {
+            throw new RuntimeException("登录凭证已过去,请重新登录");
+        }
+
+        return jwt.getClaims();
+    }
+}

+ 54 - 0
src/main/java/com/template/common/utils/Md5Utils.java

@@ -0,0 +1,54 @@
+package com.template.common.utils;
+
+import com.alibaba.druid.util.Utils;
+
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class Md5Utils {
+
+    public static String md5One(String passWord) {
+        byte[] secretBytes = null;
+        try {
+            secretBytes = MessageDigest.getInstance("md5").digest(
+                    passWord.getBytes());
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException("没有md5这个算法!");
+        }
+        String md5code = new BigInteger(1, secretBytes).toString(16);// 16进制数字
+        // 如果生成数字未满32位,需要前面补0
+        for (int i = 0; i < 32 - md5code.length(); i++) {
+            md5code = "0" + md5code;
+        }
+        return md5code;
+    }
+
+    /**
+     * 工具类md5加密
+     * @param password
+     * @return
+     */
+    public static  String md5Two(String password){
+        String s = Utils.md5(password);
+        return s;
+    }
+
+    /**
+     * 可逆的的加密解密方法;两次是解密,一次是加密
+     * @param inStr
+     * @return
+     */
+    public static String convertMD5(String inStr){
+
+        char[] a = inStr.toCharArray();
+        for (int i = 0; i < a.length; i++){
+            a[i] = (char) (a[i] ^ 't');
+        }
+        String s = new String(a);
+        return s;
+
+    }
+
+
+}

+ 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"));
+    }
+}

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

@@ -0,0 +1,113 @@
+package com.template.common.utils;
+
+import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
+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.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpResponseException;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * 公众号,推送信息,推给商家信息
+ */
+public class Message2 {
+
+//小程序
+//    static String appId="wx2fc3f45732fae5d3";
+//    static String secret="7eee4a49a4470a77f9222995e8511547";
+
+//公众号
+    static String appId="wxa46ef222053a1047";
+    static String secret="16f74a1265c314fd79fdf90670173467";
+
+    /**
+     * 公众号推送消息
+     * @param openid 公众号openId
+     * @param type  事件
+     * @param location  地点
+     * @param dateTime  时间
+     * @return
+     * @throws Exception
+     */
+    public static String send(String openid,String type,String location,String dateTime)
+            throws Exception {
+
+        String url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+secret;
+
+        String s = HttpsClient.httpsRequestReturnString(url, "GET", "");
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        String access_token = jsonObject.getString("access_token");
+
+
+        JSONObject message = new JSONObject();
+        message.put("touser", openid);
+        message.put("template_id", "vPuSS7nivkQHxcGzpZB-NedVKzqJ4ifk0FTiBI7Aa20");
+
+        JSONObject small = new JSONObject();
+        small.put("appid", "wx2fc3f45732fae5d3");
+        small.put("pagepath", "pages/msgWarn/msgWarn");
+        message.put("miniprogram", small);
+        // 报警类型
+        JSONObject const2 = new JSONObject();
+        const2.put("value", type);
+        const2.put("color", "#173177");
+
+        // 报警位置
+        JSONObject thing3 = new JSONObject();
+        thing3.put("value", location);
+        thing3.put("color", "#173177");
+
+        // 报警时间
+        JSONObject time4 = new JSONObject();
+        time4.put("value", dateTime);
+        time4.put("color", "#173177");
+
+        // 封装data
+        JSONObject data = new JSONObject();
+        data.put("const2",const2);
+        data.put("thing3",thing3);
+        data.put("time4",time4);
+
+        message.put("data",data);
+
+        String s1 = HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, message);
+        System.out.println("s1 = " + s1);
+        return s1;
+    }
+
+
+    public static String getToken() throws Exception {
+        String url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+secret;
+
+        String s = HttpsClient.httpsRequestReturnString(url, "GET", "");
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        System.out.println("jsonObject = " + jsonObject);
+        String access_token = jsonObject.getString("access_token");
+//        HttpsClient.httpsRequestReturnString("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+access_token, "POST", message.toJSONString());
+        return access_token;
+    }
+
+
+
+
+    public static void main(String[] args) throws Exception {
+        String o9MsY67wqvQ__o_pOzF7oeN4MQPM = send("o9MsY67wqvQ__o_pOzF7oeN4MQPM","进入区域","IPCamera 01","2024-01-29 16:16:14");
+//        String token = getToken();
+//        System.out.println("token = " + token);
+    }
+}

+ 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;
+    }
+}

+ 101 - 0
src/main/java/com/template/common/utils/PageMySqlDialectPlus.java

@@ -0,0 +1,101 @@
+package com.template.common.utils;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.dialect.helper.MySqlDialect;
+import com.github.pagehelper.util.MetaObjectUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.cache.CacheKey;
+import org.apache.ibatis.mapping.BoundSql;
+import org.apache.ibatis.mapping.MappedStatement;
+import org.apache.ibatis.mapping.ParameterMapping;
+import org.apache.ibatis.reflection.MetaObject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Slf4j
+public class PageMySqlDialectPlus extends MySqlDialect {
+
+    //正则表达式
+    private static final String pattern = "([\\s|\\S]*?)/\\*\\s*MAPPINGLIMIT\\s*\\*/\\s*([\\s|\\S]*)";
+    private static final Pattern PATTERN = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
+
+    /**
+     * 把limit语句放到 MAPPINGLIMIT标记所在的位置,也就是主表的位置,对主表进行分页
+     *
+     * @return 加limit后的sql
+     */
+    @Override
+    public String getPageSql(String sql, Page page, CacheKey pageKey) {
+        //如果不匹配正则,走原始的sql
+        if (!Pattern.matches(pattern, sql)) {
+            return super.getPageSql(sql, page, pageKey);
+        }
+
+        String beforeLimitSql = "";
+        String afterLimitsql = "";
+        Matcher m = PATTERN.matcher(sql);
+        if (m.find()) {
+            //MAPPINGLIMIT标记前的sql语句
+            beforeLimitSql = m.group(1);
+            //MAPPINGLIMIT标记后的sql语句
+            afterLimitsql = m.group(2);
+        }
+
+        String limitSql = "";
+        if (page.getStartRow() == 0) {
+            limitSql = " LIMIT ? ";
+        } else {
+            limitSql = " LIMIT ?, ? ";
+        }
+        String sqlString = beforeLimitSql + " " + limitSql + " " + afterLimitsql;
+
+        return sqlString;
+    }
+
+    /**
+     * 把分页参数放到参数列表里
+     *
+     * @return
+     */
+    @Override
+    public Object processPageParameter(MappedStatement ms, Map<String, Object> paramMap, Page page, BoundSql boundSql, CacheKey pageKey) {
+        //如果不匹配正则,走原始的sql设置
+        if (!Pattern.matches(pattern, boundSql.getSql())) {
+            return super.processPageParameter(ms, paramMap, page, boundSql, pageKey);
+        }
+        //设置参数
+        paramMap.put(PAGEPARAMETER_FIRST, page.getStartRow());
+        paramMap.put(PAGEPARAMETER_SECOND, page.getPageSize());
+        pageKey.update(page.getStartRow());
+        pageKey.update(page.getPageSize());
+
+        //设置参数 因为limit放到中间位置,所以要计算出来分页数据的放置位置
+        Matcher m = PATTERN.matcher(boundSql.getSql());
+        String beforeLimitSql = null;
+        int limitIndex;
+        if (m.find()) {
+            //MAPPINGLIMIT标记前的sql语句
+            beforeLimitSql = m.group(1);
+        }
+
+        //计算sql里有几个参数,按数据位置添加page
+        limitIndex = StringUtils.countMatches(beforeLimitSql, "?");
+        if (boundSql.getParameterMappings() != null) {
+            List<ParameterMapping> newParameterMappings = new ArrayList<ParameterMapping>(boundSql.getParameterMappings());
+            if (page.getStartRow() == 0) {
+                newParameterMappings.add(limitIndex,new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, int.class).build());
+            } else {
+                newParameterMappings.add(limitIndex,new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_FIRST, long.class).build());
+                newParameterMappings.add(limitIndex+1,new ParameterMapping.Builder(ms.getConfiguration(), PAGEPARAMETER_SECOND, int.class).build());
+            }
+            MetaObject metaObject = MetaObjectUtil.forObject(boundSql);
+            metaObject.setValue("parameterMappings", newParameterMappings);
+        }
+        return paramMap;
+    }
+}

+ 99 - 0
src/main/java/com/template/common/utils/PropertiesUtil.java

@@ -0,0 +1,99 @@
+package com.template.common.utils;
+
+import java.io.*;
+import java.net.URI;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * <p>Title: PropertiesUtil</p>
+ * <p>Description: properties资源文件解析工具</p>
+ * @author fengyong
+ * @date 2018年9月7日
+ */
+public class PropertiesUtil {
+
+	private static Properties props = null;
+	private static URI uri;
+	private static String fileName = "/application.properties";
+	
+	private static InputStream in = null;
+
+	static {
+		try {
+			props = new Properties();
+			InputStream fis = PropertiesUtil.class.getResourceAsStream(fileName);
+			props.load(fis);
+			uri = PropertiesUtil.class.getResource(fileName).toURI();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 获取某个属性
+	 */
+	public static String getProperty(String key) {
+		try {
+			props.load(PropertiesUtil.class.getResourceAsStream(fileName));
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return props.getProperty(key);
+	}
+
+	/**
+	 * 获取所有属性,返回一个map,不常用 可以试试props.putAll(t)
+	 */
+	@SuppressWarnings("rawtypes")
+	public static Map<String, String> getAllProperty() {
+		Map<String, String> map = new HashMap<String, String>();
+		Enumeration enu = props.propertyNames();
+		while (enu.hasMoreElements()) {
+			String key = (String) enu.nextElement();
+			String value = props.getProperty(key);
+			map.put(key, value);
+		}
+		return map;
+	}
+
+	/**
+	 * 在控制台上打印出所有属性,调试时用。
+	 */
+	public static void printProperties() {
+		props.list(System.out);
+	}
+
+	/**
+	 * 写入properties信息
+	 */
+	public static void writeProperties(String key, String value) {
+		try {
+			OutputStream fos = new FileOutputStream(new File(uri));
+			props.setProperty(key, value);
+			// 将此 Properties 表中的属性列表(键和元素对)写入输出流
+			props.store(fos, "『comments』Update key:" + key);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 取默认key的value
+	 * */
+	public static String getValue(String key){
+		String value = null;
+		props = new Properties();
+		in = PropertiesUtil.class.getResourceAsStream(fileName);
+		try {
+			props.load(in);
+		} catch (IOException e) {
+//			e.printStackTrace();
+		}
+		value = (String) props.get(key);
+		return value;
+	}
+
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 196 - 0
src/main/java/com/template/common/utils/RSAUtils.java


+ 32 - 0
src/main/java/com/template/common/utils/RandomTrackAlgorithm.java

@@ -0,0 +1,32 @@
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+public class RandomTrackAlgorithm {
+
+    public static BigDecimal makeRandom(float max, float min, int scale){
+        BigDecimal cha = new BigDecimal(Math.random() * (max-min) + min);
+        return cha.setScale(scale,BigDecimal.ROUND_HALF_UP);//保留 scale 位小数,并四舍五入
+    }
+
+    public static List<List<BigDecimal>> getPosition(){
+        List<List<BigDecimal>> all = new ArrayList<>();
+        // 生成随机坐标点
+        BigDecimal x = null;
+        BigDecimal y = null;
+        for (int i = 0; i < 10; i++) {
+            List<BigDecimal> list = new LinkedList<>();
+            // 114.449557,28.109357
+            x = makeRandom(0.001f,0.000001f,6).add(BigDecimal.valueOf(114.449557));
+            y = makeRandom(0.001f,0.000001f,6).add(BigDecimal.valueOf(28.109357));
+            list.add(x);
+            list.add(y);
+            all.add(list);
+        }
+        return all;
+    }
+
+}

+ 126 - 0
src/main/java/com/template/common/utils/RequestUtils.java

@@ -0,0 +1,126 @@
+package com.template.common.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/21 星期四 9:39
+ * @Description: com.template.common.utils
+ * @Version: 1.0
+ */
+public class RequestUtils {
+    /**
+     * GET请求
+     * @param url 请求地址
+     * @param param 请求参数
+     * @return
+     */
+    public static String httpGet(String url,String param){
+        String result = "";
+        BufferedReader in = null;
+        try {
+            String urlNameString = url + "?" + param;
+            URL realUrl = new URL(urlNameString);
+            // 打开和URL之间的连接
+            URLConnection connection = realUrl.openConnection();
+            // 设置通用的请求属性
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("user-agent",
+                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            // 建立实际的连接
+            connection.connect();
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+            // 遍历所有的响应头字段
+            for (String key : map.keySet()) {
+                System.out.println(key + "--->" + map.get(key));
+            }
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(
+                    connection.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输入流
+        finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception e2) {
+                e2.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     * POST请求
+     * @param url 请求的url
+     * @param param 参数
+     * @return
+     */
+    public static String httpPost(String url, String param){
+        String dummyData = param.replace("%", "").replace(",", "").replace(" ", "+").replace("/","");
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            conn.setRequestProperty("Content-Type", "application/json");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        //使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+}

+ 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);
+        }
+    }
+
+}

+ 36 - 0
src/main/java/com/template/common/utils/Send.java

@@ -0,0 +1,36 @@
+package com.template.common.utils;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.template.model.weixin.Rmessage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class Send {
+
+    public static Rmessage message(String card_number, String title, String message){
+        Gson gson = new Gson();
+        String msg3 = HttpsClient.sendPost(
+                "https://open.wecard.qq.com/cgi-bin/oauth2/token?app_key="+
+                        "48103AB41FFBC5FE&app_secret=5B7FB4D3CC243695EED3693044D0FC54&grant_type=client_credentials&scope=base&ocode=1015730314", "");
+        HashMap<String, String> userMap_m = gson.fromJson(msg3, new TypeToken<HashMap<String, String>>() {}.getType());
+        String token = userMap_m.get("access_token");
+        ArrayList<String> as = new ArrayList<>();
+        as.add(card_number);
+        String json_mess = com.alibaba.fastjson.JSONObject.toJSONString(as);
+        com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
+        data.put("cards", json_mess);
+        data.put("title", title);
+        data.put("content", message);
+        data.put("sender", "用户");
+        String msg = HttpsClient.sendJson2("https://open.wecard.qq.com/cgi-bin/notice/send?access_token=" + token, data);
+        return gson.fromJson(msg, new TypeToken<Rmessage>(){}.getType());
+    }
+
+    public static void main(String[] args) {
+        Rmessage r = message("02090", "项目催办", "请尽快完成");
+        System.out.println(r.getMessage());
+    }
+
+}

+ 213 - 0
src/main/java/com/template/common/utils/SendSms.java

@@ -0,0 +1,213 @@
+package com.template.common.utils;
+
+
+import com.tencentcloudapi.common.Credential;
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
+
+//导入可选配置类
+import com.tencentcloudapi.common.profile.ClientProfile;
+import com.tencentcloudapi.common.profile.HttpProfile;
+
+// 导入对应SMS模块的client
+import com.tencentcloudapi.sms.v20210111.SmsClient;
+
+// 导入要请求接口对应的request response类
+import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
+import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
+import com.tencentcloudapi.sms.v20210111.models.SendStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.util.Date;
+
+/**
+ * Tencent Cloud Sms Sendsms
+ */
+public class SendSms {
+
+
+    //腾讯云上的签名
+//    private static String secretID="AKIDDPo13qZCZqtgJsGQL7AyYu1wc7QVMyLl";
+    private static String secretID = "AKIDCPVZdcWIxgHpy5FYxVyPiqkZGrhdXUBg";
+
+    //腾讯云上的密钥
+//    private static String secretKey="JPGrELFySiv0pOrKOPEwSnulOq9IPPDr";
+    private static String secretKey = "NkyCN3cz97qKaeXLvHOGxOcdS8f184pL";
+
+    //短信应用id
+//    private static String sdkAppid="1400813506";
+    private static String sdkAppid = "1400885930";
+
+    //短信签名内容
+//    private static String signName="华仁享学教育";
+    private static String signName = "江西省创海科技有限公司";
+
+    //模板Id
+//    private static String templateId="1770016";
+    private static String templateId = "2060673"; //验证码
+    private static String templateId2 = "2065770"; //预约短信
+
+    //验证码有效时长
+    private static String smsMin = "1";
+
+
+    public static String sendSms(String phoneNumber, String code) {
+        String returString = "";
+        try {
+            /* 必要步骤:
+             * 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
+             * 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
+             * 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
+             * 以免泄露密钥对危及你的财产安全。
+             * SecretId、SecretKey 查询: https://console.cloud.tencent.com/cam/capi */
+//            Credential cred = new Credential(smsConfig.getSecretID(), smsConfig.getSecretKey());
+            Credential cred = new Credential(secretID, secretKey);
+
+            // 实例化一个http选项,可选,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            // 设置代理(无需要直接忽略)
+            // httpProfile.setProxyHost("真实代理ip");
+            // httpProfile.setProxyPort(真实代理端口);
+            /* SDK默认使用POST方法。
+             * 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求 */
+            httpProfile.setReqMethod("POST");
+            /* SDK有默认的超时时间,非必要请不要进行调整
+             * 如有需要请在代码中查阅以获取最新的默认值 */
+            httpProfile.setConnTimeout(60);
+            /* 指定接入地域域名,默认就近地域接入域名为 sms.tencentcloudapi.com ,也支持指定地域域名访问,例如广州地域的域名为 sms.ap-guangzhou.tencentcloudapi.com */
+            httpProfile.setEndpoint("sms.tencentcloudapi.com");
+
+            /* 非必要步骤:
+             * 实例化一个客户端配置对象,可以指定超时时间等配置 */
+            ClientProfile clientProfile = new ClientProfile();
+            /* SDK默认用TC3-HMAC-SHA256进行签名
+             * 非必要请不要修改这个字段 */
+            clientProfile.setSignMethod("HmacSHA256");
+            clientProfile.setHttpProfile(httpProfile);
+            /* 实例化要请求产品(以sms为例)的client对象
+             * 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,支持的地域列表参考 https://cloud.tencent.com/document/api/382/52071#.E5.9C.B0.E5.9F.9F.E5.88.97.E8.A1.A8 */
+            SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
+            /* 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
+             * 你可以直接查询SDK源码确定接口有哪些属性可以设置
+             * 属性可能是基本类型,也可能引用了另一个数据结构
+             * 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明 */
+            SendSmsRequest req = new SendSmsRequest();
+
+            /* 填充请求参数,这里request对象的成员变量即对应接口的入参
+             * 你可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义
+             * 基本类型的设置:
+             * 帮助链接:
+             * 短信控制台: https://console.cloud.tencent.com/smsv2
+             * 腾讯云短信小助手: https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81 */
+
+            /* 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666 */
+            // 应用 ID 可前往 [短信控制台](https://console.cloud.tencent.com/smsv2/app-manage) 查看
+//            String sdkAppId = "1400009099";
+//            req.setSmsSdkAppId(smsConfig.getSdkAppid());
+            req.setSmsSdkAppId(sdkAppid);
+
+            /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名 */
+            // 签名信息可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-sign) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-sign) 的签名管理查看
+//            String signName = "腾讯云";
+//            req.setSignName(smsConfig.getSignName());
+            req.setSignName(signName);
+
+            /* 模板 ID: 必须填写已审核通过的模板 ID */
+            // 模板 ID 可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-template) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-template) 的正文模板管理查看
+//            String templateId = "449739";
+//            req.setTemplateId(smsConfig.getTemplateId());
+            req.setTemplateId(templateId);
+
+
+            /* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */
+//           第一个为验证码,第二个为有效时间
+//            String[] templateParamSet = {code,smsConfig.getSmsMin()};
+            String[] templateParamSet = {code, "1"};
+            req.setTemplateParamSet(templateParamSet);
+
+            /* 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]
+             * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号 */
+//            String[] phoneNumberSet = {"+8621212313123", "+8612345678902", "+8612345678903"};
+            String[] phoneNumbers = {phoneNumber};
+            req.setPhoneNumberSet(phoneNumbers);
+
+            /* 用户的 session 内容(无需要可忽略): 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
+//            String sessionContext = "";
+//            req.setSessionContext(sessionContext);
+
+            /* 短信码号扩展号(无需要可忽略): 默认未开通,如需开通请联系 [腾讯云短信小助手] */
+//            String extendCode = "";
+//            req.setExtendCode(extendCode);
+
+            /* 国际/港澳台短信 SenderId(无需要可忽略): 国内短信填空,默认未开通,如需开通请联系 [腾讯云短信小助手] */
+//            String senderid = "";
+//            req.setSenderId(senderid);
+
+            /* 通过 client 对象调用 SendSms 方法发起请求。注意请求方法名与请求对象是对应的
+             * 返回的 res 是一个 SendSmsResponse 类的实例,与请求对象对应 */
+            SendSmsResponse res = client.SendSms(req);
+
+            // 输出json格式的字符串回包
+//            System.out.println(SendSmsResponse.toJsonString(res));
+
+            // 也可以取出单个值,你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
+            // System.out.println(res.getRequestId());
+
+            /* 当出现以下错误码时,快速解决方案参考
+             * [FailedOperation.SignatureIncorrectOrUnapproved](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Afailedoperation.signatureincorrectorunapproved-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * [FailedOperation.TemplateIncorrectOrUnapproved](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Afailedoperation.templateincorrectorunapproved-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * [UnauthorizedOperation.SmsSdkAppIdVerifyFail](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Aunauthorizedoperation.smssdkappidverifyfail-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * [UnsupportedOperation.ContainDomesticAndInternationalPhoneNumber](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Aunsupportedoperation.containdomesticandinternationalphonenumber-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * 更多错误,可咨询[腾讯云助手](https://tccc.qcloud.com/web/im/index.html#/chat?webAppId=8fa15978f85cb41f7e2ea36920cb3ae1&title=Sms)
+             */
+            SendStatus sendStatus = res.getSendStatusSet()[0];
+            System.out.println(sendStatus.getMessage());
+//            System.out.println("sendStatus = " + sendStatus);
+            returString = sendStatus.getMessage();
+        } catch (TencentCloudSDKException e) {
+            e.printStackTrace();
+        }
+        return returString;
+    }
+
+
+    public static String sendVisitorSms(String phoneNumber, String year, String month, String day, String startTime, String endTime, String code) {
+        String returString = "";
+        try {
+            Credential cred = new Credential(secretID, secretKey);
+
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setReqMethod("POST");
+            httpProfile.setConnTimeout(60);
+            httpProfile.setEndpoint("sms.tencentcloudapi.com");
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setSignMethod("HmacSHA256");
+            clientProfile.setHttpProfile(httpProfile);
+            SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
+            SendSmsRequest req = new SendSmsRequest();
+            req.setSmsSdkAppId(sdkAppid);
+            req.setSignName(signName);
+            req.setTemplateId(templateId2);
+            String[] templateParamSet = {year, month, day, startTime, endTime, code};
+            req.setTemplateParamSet(templateParamSet);
+            String[] phoneNumbers = {phoneNumber};
+            req.setPhoneNumberSet(phoneNumbers);
+            SendSmsResponse res = client.SendSms(req);
+            SendStatus sendStatus = res.getSendStatusSet()[0];
+            System.out.println(sendStatus.getMessage());
+            returString = sendStatus.getMessage();
+        } catch (TencentCloudSDKException e) {
+            e.printStackTrace();
+        }
+        return returString;
+    }
+
+    public static void main(String[] args) throws TencentCloudSDKException {
+        //这里定义一个存储电话号码的数组
+
+        String tels = "+8618279193722"; // 手机号前面记得带上国家区域编码
+        String test = sendSms("+8618279193722", "123456");
+
+    }
+
+}

+ 158 - 0
src/main/java/com/template/common/utils/SnowflakeIdWorker.java

@@ -0,0 +1,158 @@
+package com.template.common.utils;
+
+/**
+ * Twitter_Snowflake<br>
+ * SnowFlake的结构如下(每部分用-分开):<br>
+ * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
+ * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
+ * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)
+ * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
+ * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId<br>
+ * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号<br>
+ * 加起来刚好64位,为一个Long型。<br>
+ * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。
+ */
+public class SnowflakeIdWorker {
+
+    // ==============================Fields===========================================
+    /** 开始时间截 (2015-01-01) */
+    private final long twepoch = 1420041600000L;
+
+    /** 机器id所占的位数 */
+    private final long workerIdBits = 5L;
+
+    /** 数据标识id所占的位数 */
+    private final long datacenterIdBits = 5L;
+
+    /** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
+    private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
+
+    /** 支持的最大数据标识id,结果是31 */
+    private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
+
+    /** 序列在id中占的位数 */
+    private final long sequenceBits = 12L;
+
+    /** 机器ID向左移12位 */
+    private final long workerIdShift = sequenceBits;
+
+    /** 数据标识id向左移17位(12+5) */
+    private final long datacenterIdShift = sequenceBits + workerIdBits;
+
+    /** 时间截向左移22位(5+5+12) */
+    private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
+
+    /** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
+    private final long sequenceMask = -1L ^ (-1L << sequenceBits);
+
+    /** 工作机器ID(0~31) */
+    private long workerId;
+
+    /** 数据中心ID(0~31) */
+    private long datacenterId;
+
+    /** 毫秒内序列(0~4095) */
+    private long sequence = 0L;
+
+    /** 上次生成ID的时间截 */
+    private long lastTimestamp = -1L;
+    
+    private static SnowflakeIdWorker instance;
+    
+    //==============================Constructors=====================================
+    public SnowflakeIdWorker(){
+    	//增加配置文件
+        this.workerId = 1;
+        this.datacenterId = 1;
+    }
+    
+    public SnowflakeIdWorker(long workerId, long datacenterId) {
+        if (workerId > maxWorkerId || workerId < 0) {
+            throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
+        }
+        if (datacenterId > maxDatacenterId || datacenterId < 0) {
+            throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
+        }
+        this.workerId = workerId;
+        this.datacenterId = datacenterId;
+    }
+    
+    // ==============================Methods==========================================
+    /**
+     * 获得下一个ID (该方法是线程安全的)
+     * @return SnowflakeId
+     */
+    public synchronized long getId() {
+        long timestamp = timeGen();
+        //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
+        if (timestamp < lastTimestamp) {
+            throw new RuntimeException(
+                    String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
+        }
+        //如果是同一时间生成的,则进行毫秒内序列
+        if (lastTimestamp == timestamp) {
+            sequence = (sequence + 1) & sequenceMask;
+            //毫秒内序列溢出
+            if (sequence == 0) {
+                //阻塞到下一个毫秒,获得新的时间戳
+                timestamp = tilNextMillis(lastTimestamp);
+            }
+        }
+        //时间戳改变,毫秒内序列重置
+        else {
+            sequence = 0L;
+        }
+        //上次生成ID的时间截
+        lastTimestamp = timestamp;
+        //移位并通过或运算拼到一起组成64位的ID
+        timestamp = ((timestamp - twepoch) << timestampLeftShift) //时间戳部分
+                | (datacenterId << datacenterIdShift) // 数据中心部分
+                | (workerId << workerIdShift) // 机器标识部分
+                | sequence; //序列号部分
+        return timestamp;
+    }
+
+    /**
+     * 阻塞到下一个毫秒,直到获得新的时间戳
+     * @param lastTimestamp 上次生成ID的时间截
+     * @return 当前时间戳
+     */
+    protected long tilNextMillis(long lastTimestamp) {
+        long timestamp = timeGen();
+        while (timestamp <= lastTimestamp) {
+            timestamp = timeGen();
+        }
+        return timestamp;
+    }
+
+    /**
+     * 返回以毫秒为单位的当前时间
+     * @return 当前时间(毫秒)
+     */
+    protected long timeGen() {
+        return System.currentTimeMillis();
+    }
+    
+    /**
+     * 增加配置文件,参考:https://blog.csdn.net/github_38924695/article/details/79022701
+     */
+    public static SnowflakeIdWorker getInstance(){
+    	if(instance == null){
+    		synchronized (SnowflakeIdWorker.class) {
+    			if(instance == null){
+    				//加载配置文件
+    				//instance = new SnowflakeIdWorker(SystemConfigUtil.getInteger("worker.id"), SystemConfigUtil.getInteger("datacenter.id"));
+    				instance = new SnowflakeIdWorker(1, 1);
+    			}
+			}
+    	}
+    	return instance;
+    }
+    
+    /** 测试 */
+    public static void main(String[] args) {
+    	for (int i = 0; i < 10; i++) {
+			System.out.println(SnowflakeIdWorker.getInstance().getId());
+		}
+    }
+}

+ 774 - 0
src/main/java/com/template/common/utils/TimeExchange.java

@@ -0,0 +1,774 @@
+package com.template.common.utils;
+
+import com.template.model.enumModel.eWeekStatu;
+import com.template.model.result.UnitTimeHelpModel;
+import com.template.model.vo.ClassSettingDateVo;
+import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
+
+/**
+ * 时间转化工具 date转为时间戳 时间戳转date 互相与String的转换
+ * 所有出现的String time 格式都必须为(yyyy-MM-dd HH:mm:ss),否则出错
+ */
+public class TimeExchange {
+
+    /**
+     * 字符串转时间
+     * @param time 时间字符串
+     * @param formatDate 时间格式
+     * @return
+     */
+    public static Date StringToDate(String time, String formatDate) {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat(formatDate);
+        try {
+            date = dateFormat.parse(time);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    /**
+     * Date转为String
+     * @param time      时间
+     * @param FormatStr 自定义时间格式
+     * @return
+     */
+    public static String DateToString(Date time, String FormatStr) {
+        String dateStr = "";
+        DateFormat dateFormat = new SimpleDateFormat(FormatStr);
+        try {
+            dateStr = dateFormat.format(time);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+
+    /**
+     * 时间转中文的年月日格式
+     * @param time
+     * @return
+     */
+    public static String chineseDateTime(Date time) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
+        String dateStringParse = null;
+        try {
+            dateStringParse = sdf.format(time);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return dateStringParse;
+    }
+
+    /**
+     * String转时间戳
+     * @param time
+     * @return
+     */
+    public static Integer StringToTimestamp(String time) {
+
+        int times = 0;
+        try {
+            times = (int) ((Timestamp.valueOf(time).getTime()) / 1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (times == 0) {
+            System.out.println("String转10位时间戳失败");
+        }
+        return times;
+
+    }
+
+    /**
+     * 时间戳转String
+     * 10位int型的时间戳转换为String(yyyy-MM-dd HH:mm:ss)
+     *
+     * @param time
+     * @return
+     */
+    public static String timestampToString(Integer time) {
+        //int转long时,先进行转型再进行计算,否则会是计算结束后在转型
+        long temp = (long) time * 1000;
+        Timestamp ts = new Timestamp(temp);
+        String tsStr = "";
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            //方法一
+            tsStr = dateFormat.format(ts);
+            System.out.println(tsStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return tsStr;
+    }
+
+    /**
+     * 10位时间戳转Date
+     *
+     * @param time
+     * @return
+     */
+    public static Date TimestampToDate(Integer time) {
+        long temp = (long) time * 1000;
+        Timestamp ts = new Timestamp(temp);
+        Date date = new Date();
+        try {
+            date = ts;
+            //System.out.println(date);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 获取当前时间戳
+     *
+     * @return
+     */
+    public static String DateNowTimeStamo() {
+        Date date = new Date();//获取当前的日期
+        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");//设置日期格式
+        String str = df.format(date);//获取String类型的时间
+        return str;
+    }
+
+    /**
+     * Date类型转换为10位时间戳
+     *
+     * @param time
+     * @return
+     */
+    public static Integer DateToTimestamp(Date time) {
+        Timestamp ts = new Timestamp(time.getTime());
+
+        return (int) ((ts.getTime()) / 1000);
+    }
+
+    /**
+     * 时间减小时数
+     * @param time
+     * @param hour
+     * @return
+     */
+    public static String TimeDesH(Date time, int hour) {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(time);
+        nowTime2.add(Calendar.HOUR, -hour);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    /**
+     * 时间加秒数
+     * @param time
+     * @param s
+     * @return
+     */
+    public static String TimeRangeSrcond(String time, int s) {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time, "yyyy-MM-dd HH:mm:ss"));
+        nowTime2.add(Calendar.SECOND, s);//秒钟
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    /**
+     * 时间加分钟数
+     * @param time
+     * @param m
+     * @return
+     */
+    public static String TimeRangeMinute(String time, int m) {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time, "yyyy-MM-dd HH:mm:ss"));
+        nowTime2.add(Calendar.MINUTE, m);//分钟
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    /**
+     * 获取当天开始时间
+     * @return
+     */
+    public static String getStartDate() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 0, 0, 0);
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
+    }
+
+    /**
+     * 获取当天结束时间
+     * @return
+     */
+    public static String getEndDate() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 23, 59, 59);
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
+    }
+
+    /**
+     * 获取当天的年月日
+     * @return
+     */
+    public static String getDate() {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当天的年月
+     * @return
+     */
+    public static String getDateMonth() {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当前时间的年月日小时分钟秒
+     * @return
+     */
+    public static String getTime() {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当前时间的小时分钟
+     * @return
+     */
+    public static String getOnlyMM() {
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当前时间的年份
+     * @return
+     */
+    public static String getYear() {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当前时间的年月
+     * @return
+     */
+    public static String getMonth() {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当前时间的月份
+     * @return
+     */
+    public static String getNowMonth() {
+        SimpleDateFormat sp = new SimpleDateFormat("MM");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取当前时间的小时分钟秒
+     * @return
+     */
+    public static String getOnlyTime() {
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取指定时间的年份
+     * @param dateNow
+     * @return
+     */
+    public static String getYear(Date dateNow) {
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy");
+        return sp.format(dateNow);
+    }
+
+    /**
+     * 获取指定时间的月份
+     * @param dateNow
+     * @return
+     */
+    public static String getMonth(Date dateNow) {
+        SimpleDateFormat sp = new SimpleDateFormat("MM");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取指定时间的天
+     * @param dateNow
+     * @return
+     */
+    public static String getDay(Date dateNow) {
+        SimpleDateFormat sp = new SimpleDateFormat("dd");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 获取指定时间的小时分钟秒
+     * @param dateNow
+     * @return
+     */
+    public static String getTime(Date dateNow) {
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    /**
+     * 计算两个日期的时间差
+     *
+     * @param time1
+     * @param time2
+     * @return
+     */
+    public static double getTimeDifference(String time1, String time2) {
+        SimpleDateFormat timeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long t1 = 0L;
+        long t2 = 0L;
+        try {
+            t1 = timeformat.parse(time1).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            t2 = timeformat.parse(time2).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        //因为t1-t2得到的是毫秒级,所以要初3600000得出小时.算天数或秒同理
+        double hours = (double) ((t2 - t1) / 3600000);
+        double minutes = (double) (((t2 - t1) / 1000 - hours * 3600) / 60 / 60);
+        return hours + minutes;
+    }
+
+    /**
+     * 计算两个日期的时间差
+     * @param time1
+     * @param time2
+     * @return
+     */
+    public static double getOnlyTimeDifference(String time1, String time2) {
+        SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
+        long t1 = 0L;
+        long t2 = 0L;
+        try {
+            t1 = timeformat.parse(time1).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            t2 = timeformat.parse(time2).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        //因为t1-t2得到的是毫秒级,所以要初3600000得出小时.算天数或秒同理
+        double hours = (double) ((t2 - t1) / 3600000);
+        double minutes = (double) (((t2 - t1) / 1000 - hours * 3600) / 60 / 60);
+        return hours + minutes;
+    }
+
+    public static double getDiff(String str1, String str2) {
+        return str2.compareTo(str1);
+    }
+
+    /**
+     * 时间加减分钟数
+     *
+     * @param time      时间
+     * @param FormatStr 时间格式
+     * @param amount    要加减的时间(单位为分钟)
+     * @return
+     * @throws ParseException
+     */
+    public static String TimeRangeMinute(String time, int amount, String FormatStr) throws ParseException {
+        Date endTime = DateUtils.addMinutes(ShortStringToDate(time, FormatStr), amount);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FormatStr);
+        return simpleDateFormat.format(endTime);
+    }
+
+    /**
+     * 时间加减小时数
+     *
+     * @param time      时间
+     * @param FormatStr 时间格式
+     * @param amount    要加减的时间(单位为小时)
+     * @return
+     * @throws ParseException
+     */
+    public static String TimeRangeHour(Date time, int amount, String FormatStr) {
+        Date endTime = DateUtils.addHours(time, amount);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FormatStr);
+        return simpleDateFormat.format(endTime);
+    }
+
+    /**
+     * String 转 Date
+     *
+     * @param time      时间
+     * @param formatStr 自定义时间格式
+     * @return
+     * @throws ParseException
+     */
+    public static Date ShortStringToDate(String time, String formatStr) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat(formatStr);
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+
+
+    /**
+     * 日期路径 即年/月/日 如2018/08/08
+     */
+    public static final String datePath() {
+        Date now = new Date();
+        return DateFormatUtils.format(now, "yyyy/MM/dd");
+    }
+
+    /**
+     * 比较时间1是否小于时间2
+     * 如果时间1小于时间2,接口返回true
+     * 如果时间1大于时间2,接口返回false
+     *
+     * @param dateOne 时间1
+     * @param dateTwo 时间2
+     * @param Forma   时间格式
+     * @return
+     * @throws ParseException
+     */
+    public static boolean CompareDate(String dateOne, String dateTwo, String Forma) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat(Forma);
+        Date sd1 = df.parse(dateOne);
+        Date sd2 = df.parse(dateTwo);
+        return sd1.before(sd2);
+    }
+
+    public static LocalDateTime StringToLocalTime(String time, String formatStr) {
+        //1.具有转换功能的对象
+        DateTimeFormatter df = DateTimeFormatter.ofPattern(formatStr);
+        //3.LocalDate发动,将字符串转换成  df格式的LocalDateTime对象,的功能
+        LocalDateTime LocalTime = LocalDateTime.parse(time, df);
+
+        return LocalTime;
+    }
+
+    /**
+     * 获取一周的开始时间和结束时间
+     * 获取本周星期一作为一周的第一天的起始时间和结束时间
+     *
+     * @return 返回的数据中第一个是开始时间 第二个是结束时间
+     */
+    public static String[] getCurrentWeekTimeFrame() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));
+        //start of the week
+        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            calendar.add(Calendar.DAY_OF_YEAR, -1);
+        }
+        calendar.add(Calendar.DAY_OF_WEEK, -(calendar.get(Calendar.DAY_OF_WEEK) - 2));
+        //给0的时候查不出数据
+//        calendar.set(Calendar.HOUR_OF_DAY, 0);
+//        calendar.set(Calendar.MINUTE, 0);
+//        calendar.set(Calendar.SECOND, 0);
+//        calendar.set(Calendar.MILLISECOND, 0);
+
+        String startTime = DateToString(calendar.getTime(), "yyyy-MM-dd");
+        //end of the week
+        calendar.add(Calendar.DAY_OF_WEEK, 6);
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+        calendar.set(Calendar.MILLISECOND, 999);
+        String endTime = DateToString(calendar.getTime(), "yyyy-MM-dd");
+        return new String[]{startTime, endTime};
+    }
+
+    /**
+     * 获取指定月份有多少天
+     *
+     * @param month
+     * @return
+     */
+    public static int getMonthDays(String date, int month) {
+        int year = Integer.valueOf(date.substring(0, 4));
+        int[] arr = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+        int day = arr[month - 1];//天数对应=数组-1
+        if (month == 2 && year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
+            day = 29;
+        }
+
+        return day;
+
+    }
+
+    /**
+     * 获取指定月份的第一天和最后一天
+     *
+     * @param DateStr 指定月份
+     * @return 返回的数据中第一个是开始时间 第二个是结束时间
+     */
+    public static String[] getCurrentMonthTimeFrame(String DateStr) {
+        Calendar c = Calendar.getInstance();//获取Calendar实例
+        c.set(Calendar.YEAR, Integer.parseInt(DateStr.substring(0, 4)));
+        int sss = Integer.parseInt(DateStr.substring(5, 7));
+        c.set(Calendar.MONTH, Integer.parseInt(DateStr.substring(5, 7).replace("-", "")) - 1);
+
+        c.set(Calendar.DAY_OF_MONTH, 1);
+
+        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
+
+        int lastDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
+        c.set(Calendar.DAY_OF_MONTH, lastDay);
+        String endDate = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()) + " 23:59:59";
+
+        return new String[]{startDate, endDate};
+    }
+
+    //region 获取某一天的开始时间
+    public static String getStartOfDayStr(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 0, 0, 0);
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
+    }
+    //endregion
+
+    //region 获取某一天的结束时间
+    public static String getEndOfDayStr(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 23, 59, 59);
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
+    }
+    //endregion
+
+    //region 获取指定月份的最后一天
+    public static Date getToMonthEndDate(String DateStr) {
+        Calendar c = Calendar.getInstance();
+        c.clear();
+        c.set(Calendar.YEAR, Integer.parseInt(DateStr.substring(0, 4)));
+        c.set(Calendar.MONTH, Integer.parseInt(DateStr.substring(5, 7).replace("-", "")) - 1);
+        c.roll(Calendar.DAY_OF_MONTH, -1);
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
+        c.set(Calendar.MILLISECOND, 999);
+
+        return c.getTime();
+    }
+    //endregion
+
+    //region 获取指定月份的第一天
+    public static Date getToMonthBeginDate(String DateStr) {
+        Calendar c = Calendar.getInstance();
+        c.clear();
+        c.set(Calendar.YEAR, Integer.parseInt(DateStr.substring(0, 4)));
+        c.set(Calendar.MONTH, Integer.parseInt(DateStr.substring(5, 7).replace("-", "")) - 1);
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+        c.set(Calendar.MILLISECOND, 000);
+        return c.getTime();
+    }
+    //endregion
+
+    //region 获取某一天的开始时间
+    public static Date getStartOfDay(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.set(year, month, day, 0, 0, 0);
+        calendar.set(Calendar.MILLISECOND, 000);
+        return calendar.getTime();
+    }
+    //endregion
+
+    //region 获取某一天的结束时间
+    public static Date getEndOfDay(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH);
+        int day = calendar.get(Calendar.DATE);
+        calendar.setTimeInMillis(0);
+        calendar.set(year, month, day, 23, 59, 59);
+        return calendar.getTime();
+    }
+    //endregion
+
+    public static List<UnitTimeHelpModel> MonthArrayTime(Date StartDate, Date EndDate) {
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//格式化为年月
+        Calendar StartTime = Calendar.getInstance();
+        StartTime.setTime(StartDate);
+        StartTime.set(StartTime.get(Calendar.YEAR), StartTime.get(Calendar.MONTH), StartTime.get(Calendar.DATE));
+        Calendar EndTime = Calendar.getInstance();
+        EndTime.setTime(EndDate);
+        EndTime.set(EndTime.get(Calendar.YEAR), EndTime.get(Calendar.MONTH), EndTime.get(Calendar.DATE));
+        int total = (EndTime.get(Calendar.YEAR) - StartTime.get(Calendar.YEAR)) * 12 + (EndTime.get(Calendar.MONTH) - StartTime.get(Calendar.MONTH));
+        List<UnitTimeHelpModel> result = new ArrayList() {
+        };
+        for (int i = 0; i <= total; i++) {
+            StartTime.add(Calendar.MONTH, i == 0 ? 0 : 1);
+            Date MonthLastDay = getToMonthEndDate(sdf.format(StartTime.getTime()));
+            UnitTimeHelpModel data = new UnitTimeHelpModel();
+            data.setStartDate(i == 0 ? StartTime.getTime() : getStartOfDay(getToMonthBeginDate(sdf.format(StartTime.getTime()))));
+            data.setEndDate(EndTime.getTime().before(MonthLastDay) ? getEndOfDay(EndTime.getTime()) : MonthLastDay);
+            result.add(data);
+        }
+
+        return result;
+    }
+
+    public static List<ClassSettingDateVo> getDatesBetween(LocalDate startDate, LocalDate endDate) {
+        List<ClassSettingDateVo> datas = new ArrayList<>();
+        long numOfDaysBetween = ChronoUnit.DAYS.between(startDate, endDate);
+        for (int i = 0; i <= numOfDaysBetween; i++) {
+            ClassSettingDateVo data = new ClassSettingDateVo();
+            LocalDate date = startDate.plusDays(i);
+            // 获取当前日期对应的星期几
+            DayOfWeek dow = date.getDayOfWeek();
+            int dayOfWeek = dow.getValue(); // 获取星期几的数字表示,1表示周一,7表示周日
+            data.setWeekStr(eWeekStatu.stringOf(dayOfWeek));
+            data.setWeek(dayOfWeek);
+            data.setDateStr(date.toString());
+            datas.add(data);
+        }
+        return datas;
+    }
+
+    /**
+     * 获取时间date1与date2相差的秒数
+     *
+     * @param date1 起始时间
+     * @param date2 结束时间
+     * @return 返回相差的秒数
+     */
+    public static int getOffsetSeconds(Date date1, Date date2) {
+        int seconds = (int) ((date2.getTime() - date1.getTime()) / 1000);
+        return seconds;
+    }
+
+    /**
+     * 获取时间date1与date2相差的分钟数
+     *
+     * @param date1 起始时间
+     * @param date2 结束时间
+     * @return 返回相差的分钟数
+     */
+    public static int getOffsetMinutes(Date date1, Date date2) {
+        return getOffsetSeconds(date1, date2) / 60;
+    }
+
+    /**
+     * 获取时间date1与date2相差的小时数
+     *
+     * @param date1 起始时间
+     * @param date2 结束时间
+     * @return 返回相差的小时数
+     */
+    public static int getOffsetHours(Date date1, Date date2) {
+        return getOffsetMinutes(date1, date2) / 60;
+    }
+
+    /**
+     * 获取时间date1与date2相差的天数数
+     *
+     * @param date1 起始时间
+     * @param date2 结束时间
+     * @return 返回相差的天数
+     */
+    public static int getOffsetDays(Date date1, Date date2) {
+        return getOffsetHours(date1, date2) / 24 + 1;
+    }
+
+    public static boolean overlapping(String start1, String end1, String start2, String end2) throws ParseException {
+        boolean one = CompareDate(start1, end2, "HH:mm");
+        boolean two = CompareDate(start2, end1, "HH:mm");
+        return (one && two);
+    }
+
+    public static String getWeek(String sdate) throws ParseException {
+        // 再转换为时间
+        Date date = StringToDate(sdate, "yyyy-MM-dd");
+        Calendar c = Calendar.getInstance();
+        c.setTime(date);
+        // int hour=c.get(Calendar.DAY_OF_WEEK);
+        // hour中存的就是星期几了,其范围 1~7
+        // 1=星期日 7=星期六,其他类推
+        return new SimpleDateFormat("EEEE").format(c.getTime());
+    }
+
+    public static void main(String[] args) {
+        String[] s = new String[]{"5","2","C","D","+"};
+
+        int sds = calPoints(s);
+        String sdsd = "";
+    }
+
+
+    public static int calPoints(String[] operations) {
+
+        return 0;
+    }
+
+}
+

+ 640 - 0
src/main/java/com/template/common/utils/TimeExchange2.java

@@ -0,0 +1,640 @@
+package com.template.common.utils;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 时间转化工具 date转为时间戳 时间戳转date 互相与String的转换
+ * 所有出现的String time 格式都必须为(yyyy-MM-dd HH:mm:ss),否则出错
+ * @author
+ *
+ */
+public class TimeExchange2 {
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss) 转 Date
+     *
+     * @param time
+     * @return
+     * @throws ParseException
+     */
+    // String date = "2010/05/04 12:34:23";
+    public static Date StringToDate(String time) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    public static Date StringToDate2(String time) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss) 转 Date
+     *
+     * @param time
+     * @return
+     * @throws ParseException
+     */
+    // String date = "2010/05/04 12:34:23";
+    public static Date StringToDate(String time, String formatStr) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat(formatStr);
+        try {
+            date = dateFormat.parse(time);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+
+    /**
+     * Date转为String(yyyy-MM-dd HH:mm:ss)
+     *
+     * @param time
+     * @return
+     */
+    public static String DateToString(Date time) {
+        String dateStr = "";
+        Date date = new Date();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH/mm/ss");
+        try {
+            dateStr = dateFormat.format(time);
+            System.out.println(dateStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+    public static String ToSimpleMonth(Date time) {
+        String dateStr = "";
+        DateFormat dateFormat = new SimpleDateFormat("M");
+        try {
+            dateStr = dateFormat.format(time);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss)转10位时间戳
+     * @param time
+     * @return
+     */
+    public static Integer StringToTimestamp(String time){
+
+        int times = 0;
+        try {
+            times = (int) ((Timestamp.valueOf(time).getTime())/1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if(times==0){
+            System.out.println("String转10位时间戳失败");
+        }
+        return times;
+
+    }
+    /**
+     * 10位int型的时间戳转换为String(yyyy-MM-dd HH:mm:ss)
+     * @param time
+     * @return
+     */
+    public static String timestampToString(Integer time){
+        //int转long时,先进行转型再进行计算,否则会是计算结束后在转型
+        long temp = (long)time*1000;
+        Timestamp ts = new Timestamp(temp);
+        String tsStr = "";
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            //方法一
+            tsStr = dateFormat.format(ts);
+            System.out.println(tsStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return tsStr;
+    }
+    /**
+     * 10位时间戳转Date
+     * @param time
+     * @return
+     */
+    public static Date TimestampToDate(Integer time){
+        long temp = (long)time*1000;
+        Timestamp ts = new Timestamp(temp);
+        Date date = new Date();
+        try {
+            date = ts;
+            //System.out.println(date);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+    /**
+     * Date类型转换为10位时间戳
+     * @param time
+     * @return
+     */
+    public static Integer DateToTimestamp(Date time){
+        Timestamp ts = new Timestamp(time.getTime());
+
+        return (int) ((ts.getTime())/1000);
+    }
+
+    // 当前时间减1小时
+    public static String TimeDesH(String time) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time));
+        nowTime2.add(Calendar.HOUR, -1);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 最近两天
+    public static String getLastTwo() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, -2);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 当前时间加2分钟
+    public static String TimeRangeI10(String time,int m) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time));
+        nowTime2.add(Calendar.SECOND, m);//10分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 当前时间加多少分钟
+    public static String TimeRangeM(String time,int m) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate2(time));
+        nowTime2.add(Calendar.MINUTE, m);//10分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+
+    // 当前时间减5分钟
+    public static String TimeRangeD(String time) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time));
+        nowTime2.add(Calendar.MINUTE, -300);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 获取当前日期
+    public static String getDateStr(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
+        return sp.format(new Date());
+    }
+
+    // 获取当前日期
+    public static String getDate(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    // 获取前天
+    public static String getQianDay() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, -5);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 获取前天
+    public static String getBeforeSeven() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, -6);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime()).substring(0, 10)+" 00:00:00";
+    }
+
+    // 获取本季度第一天
+    public static String getQuarterFirstDay() throws ParseException {
+        Calendar now = Calendar.getInstance();
+        int quarter = (now.get(Calendar.MONTH) / 3) + 1;
+        int year = now.get(Calendar.YEAR);
+        Calendar firstDayOfQuarter = Calendar.getInstance();
+        firstDayOfQuarter.set(Calendar.YEAR, year);
+        firstDayOfQuarter.set(Calendar.MONTH, (quarter - 1) * 3);
+        firstDayOfQuarter.set(Calendar.DAY_OF_MONTH, 1);
+        return DateToString(firstDayOfQuarter.getTime()).substring(0,10)+" 00:00:00";
+    }
+
+    // 获取明天
+    public static String getTomorrow() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, 1);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    // 获取昨天
+    public static String getYesturday()  {
+        try {
+            Calendar nowTime2 = Calendar.getInstance();
+            nowTime2.setTime(StringToDate(getTime()));
+            nowTime2.add(Calendar.DATE, -1);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            return simpleDateFormat.format(nowTime2.getTime());
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    // 获取最近7个月
+    public static List<String> getLastSevenMonth() throws ParseException {
+        List<String> ls = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+        for (int i = -6; i <= 0; i++) {
+            Calendar nowTime2 = Calendar.getInstance();
+            nowTime2.setTime(StringToDate(getTime()));
+            nowTime2.add(Calendar.MONTH, i);//5分钟前的时间
+            ls.add(simpleDateFormat.format(nowTime2.getTime()));
+        }
+        return ls;
+    }
+
+    public static String getTomorrowTime() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.DATE, 1);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    public static String getWeek(String sdate) throws ParseException {
+        // 再转换为时间
+        Date date = StringToDate(sdate,"yyyy-MM-dd");
+        Calendar c = Calendar.getInstance();
+        c.setTime(date);
+        // int hour=c.get(Calendar.DAY_OF_WEEK);
+        // hour中存的就是星期几了,其范围 1~7
+        // 1=星期日 7=星期六,其他类推
+        return new SimpleDateFormat("EEEE").format(c.getTime());
+    }
+
+    // 今天星期几
+    public static String getWeek() throws ParseException {
+        String[] weeks = {"7","1","2","3","4","5","6"};
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(StringToDate(getTime()));
+        int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if(week_index<0){
+            week_index = 0;
+        }
+        return weeks[week_index];
+    }
+
+    // 明天星期几
+    public static String getTomorrowWeek() throws ParseException {
+        String[] weeks = {"7","1","2","3","4","5","6"};
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(StringToDate(getTomorrowTime()));
+        int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if(week_index<0){
+            week_index = 0;
+        }
+        return weeks[week_index];
+    }
+
+    // 获取当前时间
+    public static String getTime(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return sp.format(new Date());
+    }
+
+    public static String getOnlyMM(){
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm");
+        return sp.format(new Date());
+    }
+
+    public static String getOnlyDesMM() throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(getTime()));
+        nowTime2.add(Calendar.MINUTE, -5);//5分钟前的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    public static String getYear(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy");
+        return sp.format(new Date());
+    }
+
+    public static String getMonth(){
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM");
+        return sp.format(new Date());
+    }
+
+    // 获取当前时间
+    public static String getOnlyTime(){
+        SimpleDateFormat sp = new SimpleDateFormat("HH:mm:ss");
+        return sp.format(new Date());
+    }
+    /**
+     * 计算两个日期的时间差
+     * @param time1
+     * @param time2
+     * @return
+     */
+    public static double getTimeDifference(String time1, String time2) {
+        SimpleDateFormat timeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long t1 = 0L;
+        long t2 = 0L;
+        try {
+            t1 = timeformat.parse(time1).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            t2 = timeformat.parse(time2).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        //因为t1-t2得到的是毫秒级,所以要初3600000得出小时.算天数或秒同理
+        double hours=(double) ((t2 - t1)/3600000);
+        double minutes=(double) (((t2 - t1)/1000-hours*3600)/60/60);
+        return hours+minutes;
+    }
+
+    public static double getOnlyTimeDifference(String time1, String time2) {
+        SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
+        long t1 = 0L;
+        long t2 = 0L;
+        try {
+            t1 = timeformat.parse(time1).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            t2 = timeformat.parse(time2).getTime();
+        } catch (ParseException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        //因为t1-t2得到的是毫秒级,所以要初3600000得出小时.算天数或秒同理
+        double hours=(double) ((t2 - t1)/3600000);
+        double minutes=(double) (((t2 - t1)/1000-hours*3600)/60/60);
+        return hours+minutes;
+    }
+
+    public static double getDiff(String str1, String str2){
+        return str2.compareTo(str1);
+    }
+
+    /**
+     * String 转 Date
+     * @param time 时间
+     * @param formatStr 自定义时间格式
+     * @return
+     * @throws ParseException
+     */
+    public static Date ShortStringToDate(String time, String formatStr) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat(formatStr);
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    /**
+     * 获取指定月份有多少天
+     *
+     * @param month
+     * @return
+     */
+    public static int getMonthDays(String date, int month) {
+        int year = Integer.valueOf(date.substring(0, 4));
+        int[] arr = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+        int day = arr[month - 1];//天数对应=数组-1
+        if (month == 2 && year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
+            day = 29;
+        }
+
+        return day;
+
+    }
+
+    /**
+     * Date转为String
+     * @param time 时间
+     * @param FormatStr 自定义时间格式
+     * @return
+     */
+    public static String DateToString(Date time, String FormatStr) {
+        String dateStr = "";
+        DateFormat dateFormat = new SimpleDateFormat(FormatStr);
+        try {
+            dateStr = dateFormat.format(time);
+            System.out.println(dateStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+
+    /**
+     * 比较时间1是否小于时间2
+     * 如果时间1小于时间2,接口返回true
+     * 如果时间1大于时间2,接口返回false
+     * @param dateOne 时间1
+     * @param dateTwo 时间2
+     * @return
+     * @throws ParseException
+     */
+    public static boolean CompareDate(String dateOne, String dateTwo) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date sd1=df.parse(dateOne);
+        Date sd2=df.parse(dateTwo);
+        return sd1.before(sd2);
+    }
+
+    /**
+     * 比较时间1是否小于时间2
+     * 如果时间1小于时间2,接口返回true
+     * 如果时间1大于时间2,接口返回false
+     *
+     * @param dateOne 时间1
+     * @param dateTwo 时间2
+     * @param Forma   时间格式
+     * @return
+     * @throws ParseException
+     */
+    public static boolean CompareDate(String dateOne, String dateTwo, String Forma) throws ParseException {
+        SimpleDateFormat df = new SimpleDateFormat(Forma);
+        Date sd1 = df.parse(dateOne);
+        Date sd2 = df.parse(dateTwo);
+        return sd1.before(sd2);
+    }
+
+    /**
+     * 时间加减天数
+     *
+     * @param time   时间
+     * @param amount 天数 负的为减多少天 正的为加多少天
+     * @return
+     * @throws ParseException
+     */
+    public static String TimeDesD(String time, int amount) throws ParseException {
+        Calendar nowTime2 = Calendar.getInstance();
+        nowTime2.setTime(StringToDate(time, "yyyy-MM-dd"));
+        nowTime2.add(Calendar.DATE, amount);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        return simpleDateFormat.format(nowTime2.getTime());
+    }
+
+    /**
+     * 相差的天数
+     */
+    public static int daysBetween(String smdate, String bdate) throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(sdf.parse(smdate));
+        long time1 = cal.getTimeInMillis();
+        cal.setTime(sdf.parse(bdate));
+        long time2 = cal.getTimeInMillis();
+        long between_days = (time2 - time1) / (1000 * 3600 * 24);
+
+        return Integer.parseInt(String.valueOf(between_days));
+    }
+
+    /**
+     * 获取一周的开始时间和结束时间
+     * 获取本周星期一作为一周的第一天的起始时间和结束时间
+     *
+     * @return 返回的数据中第一个是开始时间 第二个是结束时间
+     */
+    public static String[] getCurrentWeekTimeFrame() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));
+        //start of the week
+        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            calendar.add(Calendar.DAY_OF_YEAR,-1);
+        }
+        calendar.add(Calendar.DAY_OF_WEEK, -(calendar.get(Calendar.DAY_OF_WEEK) - 2));
+        //给0的时候查不出数据
+//        calendar.set(Calendar.HOUR_OF_DAY, 0);
+//        calendar.set(Calendar.MINUTE, 0);
+//        calendar.set(Calendar.SECOND, 0);
+//        calendar.set(Calendar.MILLISECOND, 0);
+
+        String startTime = DateToString(calendar.getTime(), "yyyy-MM-dd");
+        //end of the week
+        calendar.add(Calendar.DAY_OF_WEEK, 6);
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+        calendar.set(Calendar.MILLISECOND, 999);
+        String endTime = DateToString(calendar.getTime());
+        return new String[]{startTime, endTime};
+    }
+
+    /**
+     * 获取指定月份的第一天和最后一天
+     * @param DateStr 指定月份
+     * @return 返回的数据中第一个是开始时间 第二个是结束时间
+     */
+    public static String[] getCurrentMonthTimeFrame(String DateStr) {
+        Calendar c = Calendar.getInstance();//获取Calendar实例
+        c.set(Calendar.YEAR, Integer.parseInt(DateStr.substring(0, 4)));
+        c.set(Calendar.MONTH, Integer.parseInt(DateStr.substring(5, 7).replace("-", "")) - 1);
+
+        c.set(Calendar.DAY_OF_MONTH, 1);
+
+        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
+
+        int lastDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
+        c.set(Calendar.DAY_OF_MONTH, lastDay);
+        String endDate = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
+
+        return new String[]{startDate, endDate};
+    }
+
+    public static List<String> getHighTime(){
+        String year = getYear();
+        return Arrays.asList(year+"-"+"08-30",year+"-"+"08-31",year+"-"+"09-01",year+"-"+"09-02",year+"-"+"09-03",year+"-"+"09-04");
+    }
+
+    public static List<String> getDays(String startTime, String endTime) {
+        // 返回的日期集合
+        List<String> days = new ArrayList<String>();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date start = dateFormat.parse(startTime);
+            Date end = dateFormat.parse(endTime);
+            Calendar tempStart = Calendar.getInstance();
+            tempStart.setTime(start);
+
+            Calendar tempEnd = Calendar.getInstance();
+            tempEnd.setTime(end);
+            tempEnd.add(Calendar.DATE, 0);// 日期加1(包含结束)
+            while (tempStart.before(tempEnd)) {
+                days.add(dateFormat.format(tempStart.getTime()));
+                tempStart.add(Calendar.DAY_OF_YEAR, 1);
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return days;
+    }
+
+
+    public static void main(String[] args) throws ParseException {
+        System.out.println(getBeforeSeven());
+        System.out.println(getMonth()+"-01 00:00:00");
+        System.out.println(getQuarterFirstDay());
+    }
+
+}
+

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

@@ -0,0 +1,42 @@
+package com.template.common.utils;
+
+import com.template.model.pojo.system.MenuList;
+import com.template.model.pojo.system.SysMenu;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class TreeRecordsUtil {
+
+    public static List<MenuList> queryTreeRecords(Long pid, List<SysMenu> lists) {
+        List<MenuList> newTrees = new ArrayList<>();
+
+        List<SysMenu> datas = lists.stream().filter(e -> e.getPid().equals(pid)).collect(Collectors.toList());
+
+        for (SysMenu data : datas) {
+            MenuList item = MenuList.builder()
+                    .id(data.getId())
+                    .pid(data.getPid())
+                    .menuName(data.getMenuName())
+                    .url(data.getUrl())
+                    .sort(data.getSort())
+                    .level(data.getLevel())
+                    .createTime(data.getCreateTime())
+                    .createBy(data.getCreateBy())
+                    .updateTime(data.getUpdateTime())
+                    .updateBy(data.getUpdateBy())
+                    .state(data.getState())
+                    .build();
+            List<MenuList> news = queryTreeRecords(item.getId(), lists);
+            if (news == null || news.size() == 0) {
+                newTrees.add(item);
+                continue;
+            } else {
+                item.setMenuLists(news);
+                newTrees.add(item);
+            }
+        }
+
+        return newTrees;
+    }
+}

+ 25 - 0
src/main/java/com/template/common/utils/UUIDUtil.java

@@ -0,0 +1,25 @@
+package com.template.common.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+public class UUIDUtil {
+
+    public static long generateID(){
+
+        Random r = new Random();
+        long numbers = 1000000000L + (long)(r.nextDouble() * 999999999L);
+
+        return numbers;
+    }
+
+    public static String getNewDate(){
+        Date nowDate = new Date();// 取当前时间
+        SimpleDateFormat dateFormat = new SimpleDateFormat(
+                "yyyy-MM-dd HH:mm:ss"); // 转换时间格式
+        String date = dateFormat.format(nowDate);
+        return date;
+    }
+
+}

+ 25 - 0
src/main/java/com/template/common/utils/ValidateCode.java

@@ -0,0 +1,25 @@
+package com.template.common.utils;
+
+import java.util.Random;
+
+//验证码随机数
+public  class  ValidateCode {
+
+   public static Integer generateValidateCode(int length){
+       Integer code =null;
+       if(length == 4){
+           code = new Random().nextInt(9999);//生成随机数,最大为9999
+           if(code < 1000){
+               code = code + 1000;//保证随机数为4位数字
+           }
+       }else if(length == 6){
+           code = new Random().nextInt(999999);//生成随机数,最大为999999
+           if(code < 100000){
+               code = code + 100000;//保证随机数为6位数字
+           }
+       }else{
+           throw new RuntimeException("只能生成4位或6位数字验证码");
+       }
+       return code;
+   }
+}

+ 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();
+	}
+
+
+}

+ 47 - 0
src/main/java/com/template/common/utils/imageUtils.java

@@ -0,0 +1,47 @@
+package com.template.common.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Base64;
+
+/**
+ * @Author: binguo
+ * @Date: 2024/1/9 星期二 15:17
+ * @Description: com.template.common.utils
+ * @Version: 1.0
+ */
+public class imageUtils {
+
+    public static String getBase64Url(String imagePath){
+        ByteArrayOutputStream outPut = new ByteArrayOutputStream();
+        byte[] data = new byte[1024];
+        try {
+            // 创建URL
+            URL url = new URL(imagePath);
+            // 创建链接
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setRequestMethod("GET");
+            conn.setConnectTimeout(10 * 1000);
+
+            if(conn.getResponseCode() != 200) {
+                return "fail";//连接失败/链接失效/图片不存在
+            }
+            InputStream inStream = conn.getInputStream();
+            int len = -1;
+            while ((len = inStream.read(data)) != -1) {
+                outPut.write(data, 0, len);
+            }
+            inStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        // 对字节数组Base64编码
+        byte[] encode = Base64.getEncoder().encode(outPut.toByteArray());
+        String res = new String(encode);
+        return res;
+    }
+    //https://www.jb51.net/program/288342ppk.htm 图片压缩大小
+}

+ 27 - 0
src/main/java/com/template/common/utils/paramUtils.java

@@ -0,0 +1,27 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.ObjectError;
+
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/5 星期三 16:11
+ * @Description: com.template.utils
+ * @Version: 1.0
+ */
+@Slf4j
+public class paramUtils {
+    public static String getParamError(BindingResult bindingResult){
+        //有校验没通过
+        List<ObjectError> errorList = bindingResult.getAllErrors();
+        StringBuilder st = new StringBuilder();
+        for (ObjectError error : errorList) {
+            st.append(error.getDefaultMessage()+"! ");//输出具体的错误信息
+        }
+
+        return st.toString();
+    }
+}

+ 25 - 0
src/main/java/com/template/common/utils/smsUtil.java

@@ -0,0 +1,25 @@
+package com.template.common.utils;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/4/20 星期四 8:26
+ * @Description: common
+ * @Version: 1.0
+ */
+public class smsUtil {
+//    @Autowired
+//    private static smsConfig smsConfig;
+//
+//    /**
+//     * 发送单条短信验证码
+//     * @param smmCode 短信验证码
+//     * @param phoneNumber 手机号
+//     * @return
+//     */
+//    public static void sendSingleMessage(String smmCode, String phoneNumber) throws HTTPException, IOException {
+//        String[] params = {smmCode,Integer.toString(smsConfig.getSmsMin())};
+//        SmsSingleSender ssender = new SmsSingleSender(smsConfig.getSdkAppid(), smsConfig.getAppKey());
+//        SmsSingleSenderResult result = ssender.sendWithParam("86", phoneNumber, smsConfig.getTemplateId(), params, smsConfig.getSmsSign(), "", "");
+//        System.out.println(result);
+//    };
+}

+ 53 - 0
src/main/java/com/template/config/CosConfig.java

@@ -0,0 +1,53 @@
+package com.template.config;
+
+import com.qcloud.cos.COSClient;
+import com.qcloud.cos.ClientConfig;
+import com.qcloud.cos.auth.BasicCOSCredentials;
+import com.qcloud.cos.auth.COSCredentials;
+import com.qcloud.cos.region.Region;
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "cos")
+@Data
+public class CosConfig {
+    /**
+     * 腾讯云账号秘钥
+     */
+    private String secretId;
+    /**
+     * 密码秘钥
+     */
+    private String secretKey;
+    /**
+     * 存储桶地区
+     */
+    private String region;
+    /**
+     * 存储桶名称
+     */
+    private String bucketName;
+    /**
+     * 存储桶访问路径
+     */
+    private String path;
+
+    /**
+     * 初始化cos对象,配置相关配置信息
+     */
+    @Bean
+    public COSClient cosClient(){
+        // 1 初始化用户身份信息(secretId, secretKey)。
+        COSCredentials cred = new BasicCOSCredentials(this.secretId, this.secretKey);
+        // 2 设置 bucket 的区域
+        Region region = new Region(this.region);
+        ClientConfig clientConfig = new ClientConfig(region);
+        // 3 生成 cos 客户端。
+        COSClient cosClient = new COSClient(cred, clientConfig);
+        return cosClient;
+    }
+}
+

+ 59 - 0
src/main/java/com/template/config/MyBatisPlusConfig.java

@@ -0,0 +1,59 @@
+package com.template.config;
+
+import com.baomidou.mybatisplus.core.config.GlobalConfig;
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
+import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils;
+import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
+import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import com.template.handler.MyMetaObjectHandler;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.sql.DataSource;
+
+// 扫描我们的 mapper 文件夹
+@MapperScan("com.template.mapper")
+@EnableTransactionManagement
+@Configuration // 配置类
+public class MyBatisPlusConfig {
+
+    // 注册乐观锁插件
+    @Bean
+    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
+        return new OptimisticLockerInterceptor();
+    }
+
+    // 分页插件
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return  new PaginationInterceptor();
+    }
+
+    // 逻辑删除组件!
+    @Bean
+    public ISqlInjector sqlInjector() {
+        return new LogicSqlInjector();
+    }
+
+
+    /**
+     * SQL执行效率插件
+     * 在控制台显示sql语句
+     */
+    @Bean
+    @Profile({"dev","test"})// 设置 dev test 环境开启,保证我们的效率
+    public PerformanceInterceptor performanceInterceptor() {
+        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
+        performanceInterceptor.setMaxTime(3000); //ms 设置sql执行的最大时间,如果超过了则不执行
+        performanceInterceptor.setFormat(true);
+        return performanceInterceptor;
+    }
+
+}

+ 37 - 0
src/main/java/com/template/config/MySecurity.java

@@ -0,0 +1,37 @@
+package com.template.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+//@ConfigurationProperties(prefix = "my-security")
+public class MySecurity {
+    @Value("${my-security.privateKey}")
+    public String privateKey;
+    @Value("${my-security.publicKey}")
+    public String publicKey;
+
+    public String getPrivateKey() {
+        return privateKey;
+    }
+
+    public String getPublicKey() {
+        return publicKey;
+    }
+
+    @Override
+    public String toString() {
+        return "MySecurity{" +
+                "privateKey='" + privateKey + '\'' +
+                ", publicKey='" + publicKey + '\'' +
+                '}';
+    }
+
+    public void setPrivateKey(String privateKey) {
+        this.privateKey = privateKey;
+    }
+
+    public void setPublicKey(String publicKey) {
+        this.publicKey = publicKey;
+    }
+}

+ 0 - 0
src/main/java/com/template/config/smsConfig.java


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