Browse Source

rbac+spring-security+filter+手机号验证码登录

36052 4 weeks ago
commit
2b84309997
33 changed files with 3662 additions and 0 deletions
  1. 38 0
      .gitignore
  2. BIN
      .idea/.cache/.Apifox_Helper/.toolWindow.db
  3. 33 0
      .idea/dataSources.xml
  4. 13 0
      .idea/encodings.xml
  5. 12 0
      .idea/misc.xml
  6. 102 0
      .idea/mybatisx/templates.xml
  7. 7 0
      .idea/vcs.xml
  8. 191 0
      .idea/workspace.xml
  9. 38 0
      common/.gitignore
  10. 167 0
      common/pom.xml
  11. 139 0
      common/src/main/java/com/zhentao/config/SecurityConfig.java
  12. 36 0
      common/src/main/java/com/zhentao/controller/UserController.java
  13. 91 0
      common/src/main/java/com/zhentao/filter/JwtFilter.java
  14. 14 0
      common/src/main/java/com/zhentao/pojo/dto/LoginDto.java
  15. 13 0
      common/src/main/java/com/zhentao/pojo/dto/PhoneDto.java
  16. 22 0
      common/src/main/java/com/zhentao/utils/ApiException.java
  17. 61 0
      common/src/main/java/com/zhentao/utils/ApiServiceExceptionEnum.java
  18. 18 0
      common/src/main/java/com/zhentao/utils/BaseExceptionEnum.java
  19. 1445 0
      common/src/main/java/com/zhentao/utils/CacheService.java
  20. 169 0
      common/src/main/java/com/zhentao/utils/HttpClient.java
  21. 311 0
      common/src/main/java/com/zhentao/utils/HttpUtils.java
  22. 118 0
      common/src/main/java/com/zhentao/utils/JwtService.java
  23. 111 0
      common/src/main/java/com/zhentao/utils/ResultVo.java
  24. 86 0
      common/src/main/java/com/zhentao/utils/ShenModerationPlusDemo.java
  25. 78 0
      common/src/main/java/com/zhentao/utils/SnowflakeUtil.java
  26. 20 0
      common/src/main/java/com/zhentao/utils/ThreadLocalUtil.java
  27. 29 0
      common/src/main/java/com/zhentao/vo/Result.java
  28. 20 0
      common/src/test/java/Testtt.java
  29. 128 0
      pom.xml
  30. 38 0
      starter/.gitignore
  31. 30 0
      starter/pom.xml
  32. 31 0
      starter/src/main/java/com/zhentao/StarterApplication.java
  33. 53 0
      starter/src/main/resources/application.yml

+ 38 - 0
.gitignore

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

BIN
.idea/.cache/.Apifox_Helper/.toolWindow.db


+ 33 - 0
.idea/dataSources.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
+    <data-source source="LOCAL" name="@localhost" uuid="97125e19-07f0-447b-bfc0-67ad9a673a33">
+      <driver-ref>mysql.8</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
+      <jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+    <data-source source="LOCAL" name="@47.95.170.81" uuid="9091e455-a30a-4c28-8c11-10f641335afd">
+      <driver-ref>mysql.8</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
+      <jdbc-url>jdbc:mysql://47.95.170.81:3306</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+    <data-source source="LOCAL" name="@182.92.251.243" uuid="0a4890f5-223e-4909-8683-f1c37a7c3076">
+      <driver-ref>mysql.8</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
+      <jdbc-url>jdbc:mysql://182.92.251.243:3306</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+    <data-source source="LOCAL" name="@59.110.13.105" uuid="d979ca3d-5acf-4e66-868e-329744cb73b5">
+      <driver-ref>mysql.8</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
+      <jdbc-url>jdbc:mysql://59.110.13.105:3306</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+  </component>
+</project>

+ 13 - 0
.idea/encodings.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/common/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/common/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/minio/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/minio/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/starter/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/starter/src/main/resources" charset="UTF-8" />
+  </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_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
+</project>

+ 102 - 0
.idea/mybatisx/templates.xml

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="TemplatesSettings">
+    <option name="templateConfigs">
+      <TemplateContext>
+        <option name="generateConfig">
+          <GenerateConfig>
+            <option name="annotationType" value="MYBATIS_PLUS3" />
+            <option name="basePackage" value="com.zhentao" />
+            <option name="basePath" value="src/main/java" />
+            <option name="classNameStrategy" value="camel" />
+            <option name="encoding" value="UTF-8" />
+            <option name="extraClassSuffix" value="" />
+            <option name="ignoreFieldPrefix" value="" />
+            <option name="ignoreFieldSuffix" value="" />
+            <option name="ignoreTablePrefix" value="" />
+            <option name="ignoreTableSuffix" value="" />
+            <option name="moduleName" value="common" />
+            <option name="modulePath" value="$PROJECT_DIR$/common" />
+            <option name="moduleUIInfoList">
+              <list>
+                <ModuleInfoGo>
+                  <option name="basePath" value="${domain.basePath}" />
+                  <option name="configFileName" value="serviceImpl.ftl" />
+                  <option name="configName" value="serviceImpl" />
+                  <option name="encoding" value="${domain.encoding}" />
+                  <option name="fileName" value="${domain.fileName}ServiceImpl" />
+                  <option name="fileNameWithSuffix" value="${domain.fileName}ServiceImpl.java" />
+                  <option name="modulePath" value="$PROJECT_DIR$/common" />
+                  <option name="packageName" value="${domain.basePackage}.service.impl" />
+                </ModuleInfoGo>
+                <ModuleInfoGo>
+                  <option name="basePath" value="${domain.basePath}" />
+                  <option name="configFileName" value="mapperInterface.ftl" />
+                  <option name="configName" value="mapperInterface" />
+                  <option name="encoding" value="${domain.encoding}" />
+                  <option name="fileName" value="${domain.fileName}Mapper" />
+                  <option name="fileNameWithSuffix" value="${domain.fileName}Mapper.java" />
+                  <option name="modulePath" value="$PROJECT_DIR$/common" />
+                  <option name="packageName" value="${domain.basePackage}.mapper" />
+                </ModuleInfoGo>
+                <ModuleInfoGo>
+                  <option name="basePath" value="${domain.basePath}" />
+                  <option name="configFileName" value="serviceInterface.ftl" />
+                  <option name="configName" value="serviceInterface" />
+                  <option name="encoding" value="${domain.encoding}" />
+                  <option name="fileName" value="${domain.fileName}Service" />
+                  <option name="fileNameWithSuffix" value="${domain.fileName}Service.java" />
+                  <option name="modulePath" value="$PROJECT_DIR$/common" />
+                  <option name="packageName" value="${domain.basePackage}.service" />
+                </ModuleInfoGo>
+                <ModuleInfoGo>
+                  <option name="basePath" value="src/main/resources" />
+                  <option name="configFileName" value="mapperXml.ftl" />
+                  <option name="configName" value="mapperXml" />
+                  <option name="encoding" value="${domain.encoding}" />
+                  <option name="fileName" value="${domain.fileName}Mapper" />
+                  <option name="fileNameWithSuffix" value="${domain.fileName}Mapper.xml" />
+                  <option name="modulePath" value="$PROJECT_DIR$/common" />
+                  <option name="packageName" value="mapper" />
+                </ModuleInfoGo>
+              </list>
+            </option>
+            <option name="needsComment" value="true" />
+            <option name="needsModel" value="true" />
+            <option name="relativePackage" value="pojo" />
+            <option name="superClass" value="" />
+            <option name="tableUIInfoList">
+              <list>
+                <TableUIInfo>
+                  <option name="className" value="Permission" />
+                  <option name="tableName" value="permission" />
+                </TableUIInfo>
+                <TableUIInfo>
+                  <option name="className" value="Role" />
+                  <option name="tableName" value="role" />
+                </TableUIInfo>
+                <TableUIInfo>
+                  <option name="className" value="RolePermission" />
+                  <option name="tableName" value="role_permission" />
+                </TableUIInfo>
+                <TableUIInfo>
+                  <option name="className" value="User" />
+                  <option name="tableName" value="user" />
+                </TableUIInfo>
+                <TableUIInfo>
+                  <option name="className" value="UserRole" />
+                  <option name="tableName" value="user_role" />
+                </TableUIInfo>
+              </list>
+            </option>
+            <option name="templatesName" value="mybatis-plus3" />
+            <option name="useLombokPlugin" value="true" />
+          </GenerateConfig>
+        </option>
+        <option name="moduleName" value="common" />
+        <option name="projectPath" value="$PROJECT_DIR$" />
+        <option name="templateName" value="mybatis-plus3" />
+      </TemplateContext>
+    </option>
+  </component>
+</project>

+ 7 - 0
.idea/vcs.xml

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

+ 191 - 0
.idea/workspace.xml

@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="180e1c9e-61e9-4f04-9789-b9e6c1f02213" name="更改" comment="">
+      <change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/.cache/.Apifox_Helper/.toolWindow.db" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/mybatisx/templates.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/.gitignore" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/config/SecurityConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/controller/UserController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/filter/JwtFilter.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/pojo/dto/LoginDto.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/pojo/dto/PhoneDto.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/ApiException.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/ApiServiceExceptionEnum.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/BaseExceptionEnum.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/CacheService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/HttpClient.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/HttpUtils.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/JwtService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/ResultVo.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/ShenModerationPlusDemo.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/SnowflakeUtil.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/utils/ThreadLocalUtil.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/main/java/com/zhentao/vo/Result.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/common/src/test/java/Testtt.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/.gitignore" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/main/java/com/zhentao/minio/MinioApplication.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/main/java/com/zhentao/minio/config/MinioConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/main/java/com/zhentao/minio/config/MinioConfigProperties.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/main/java/com/zhentao/minio/service/FileService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/main/java/com/zhentao/minio/service/impl/FileServiceImpl.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/main/resources/META-INF/spring.factories" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/minio/src/test/java/com/zhentao/minio/MinioApplicationTests.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/starter/.gitignore" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/starter/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/starter/src/main/java/com/zhentao/StarterApplication.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/starter/src/main/resources/application.yml" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="Class" />
+      </list>
+    </option>
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="MarkdownSettingsMigration">
+    <option name="stateVersion" value="1" />
+  </component>
+  <component name="MavenImportPreferences">
+    <option name="generalSettings">
+      <MavenGeneralSettings>
+        <option name="localRepository" value="D:\StudyWJB\mavenWJB" />
+        <option name="mavenHome" value="D:/StudyWJB/apache-maven-3.9.2" />
+        <option name="useMavenConfig" value="true" />
+        <option name="userSettingsFile" value="D:\StudyWJB\apache-maven-3.9.2\conf\settings.xml" />
+      </MavenGeneralSettings>
+    </option>
+    <option name="importingSettings">
+      <MavenImportingSettings>
+        <option name="workspaceImportEnabled" value="true" />
+      </MavenImportingSettings>
+    </option>
+  </component>
+  <component name="ProjectId" id="2xIXVNZpAsj2upq8Y1ZKFEW1jji" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "RequestMappingsPanelOrder0": "0",
+    "RequestMappingsPanelOrder1": "1",
+    "RequestMappingsPanelWidth0": "75",
+    "RequestMappingsPanelWidth1": "75",
+    "RunOnceActivity.OpenProjectViewOnStart": "true",
+    "RunOnceActivity.ShowReadmeOnStart": "true",
+    "WebServerToolWindowFactoryState": "false",
+    "last_opened_file_path": "C:/Users/36052/Desktop/demo-mastar (14)/common/src/main/java/com/zhentao",
+    "node.js.detected.package.eslint": "true",
+    "node.js.detected.package.tslint": "true",
+    "node.js.selected.package.eslint": "(autodetect)",
+    "node.js.selected.package.tslint": "(autodetect)",
+    "project.structure.last.edited": "项目",
+    "project.structure.proportion": "0.0",
+    "project.structure.side.proportion": "0.0",
+    "settings.editor.selected.configurable": "MavenSettings",
+    "spring.configuration.checksum": "87ca4e19e0256a592230cbc81e899670",
+    "vue.rearranger.settings.migration": "true"
+  },
+  "keyToStringList": {
+    "DatabaseDriversLRU": [
+      "mysql"
+    ]
+  }
+}]]></component>
+  <component name="RecentsManager">
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="C:\Users\36052\Desktop\demo-mastar (14)\common\src\main\java\com\zhentao" />
+      <recent name="C:\Users\36052\Desktop\demo-mastar (14)\common\src\main\java\com\zhentao\utils" />
+    </key>
+    <key name="CopyClassDialog.RECENTS_KEY">
+      <recent name="com.zhentao.pojo.dto" />
+    </key>
+  </component>
+  <component name="RunManager" selected="Spring Boot.StarterApplication">
+    <configuration name="MinioApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
+      <module name="minio" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.zhentao.minio.MinioApplication" />
+      <extension name="coverage">
+        <pattern>
+          <option name="PATTERN" value="com.zhentao.minio.*" />
+          <option name="ENABLED" value="true" />
+        </pattern>
+      </extension>
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
+    <configuration name="StarterApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
+      <module name="starter" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.zhentao.StarterApplication" />
+      <extension name="coverage">
+        <pattern>
+          <option name="PATTERN" value="com.zhentao.*" />
+          <option name="ENABLED" value="true" />
+        </pattern>
+      </extension>
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
+    <recent_temporary>
+      <list>
+        <item itemvalue="Spring Boot.StarterApplication" />
+        <item itemvalue="Spring Boot.MinioApplication" />
+      </list>
+    </recent_temporary>
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="默认任务">
+      <changelist id="180e1c9e-61e9-4f04-9789-b9e6c1f02213" name="更改" comment="" />
+      <created>1747626584577</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1747626584577</updated>
+      <workItem from="1747626585942" duration="2577000" />
+      <workItem from="1747723498826" duration="8422000" />
+      <workItem from="1747738054041" duration="1220000" />
+      <workItem from="1747818535386" duration="2982000" />
+      <workItem from="1747914556824" duration="1151000" />
+      <workItem from="1748264042722" duration="1680000" />
+      <workItem from="1748331882387" duration="2898000" />
+      <workItem from="1748432201940" duration="3000" />
+      <workItem from="1748566551942" duration="521000" />
+      <workItem from="1748658802360" duration="1349000" />
+      <workItem from="1748860292290" duration="4548000" />
+      <workItem from="1749170187758" duration="419000" />
+      <workItem from="1749171142510" duration="140000" />
+      <workItem from="1749189988737" duration="1377000" />
+      <workItem from="1749207696844" duration="849000" />
+      <workItem from="1749257852738" duration="3965000" />
+      <workItem from="1749449752549" duration="589000" />
+      <workItem from="1749450350434" duration="7911000" />
+    </task>
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+</project>

+ 38 - 0
common/.gitignore

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

+ 167 - 0
common/pom.xml

@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.zhentao</groupId>
+        <artifactId>demo-mastar</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <artifactId>common</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.4.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.mybatis</groupId>
+                    <artifactId>mybatis-spring</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis-spring</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.4.6</version>
+        </dependency>
+
+        <!--jwt工具-->
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-api</artifactId>
+            <version>0.11.2</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-impl</artifactId>
+            <version>0.11.2</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-jackson</artifactId>
+            <version>0.11.2</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <!--mybatisplus生成工具-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.5.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.32</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>jakarta.servlet</groupId>
+            <artifactId>jakarta.servlet-api</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+            <version>4.4.14</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.zhentao</groupId>
+            <artifactId>minio</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+<!--        //内容审核-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>green20220302</artifactId>
+            <version>2.2.8</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>2.0.39</version>
+        </dependency>
+<!--        视频时长获取-->
+        <dependency>
+            <groupId>ws.schild</groupId>
+            <artifactId>jave-all-deps</artifactId>
+            <version>3.3.1</version>
+        </dependency>
+<!--        wx支付-->
+        <dependency>
+            <groupId>com.github.wxpay</groupId>
+            <artifactId>wxpay-sdk</artifactId>
+            <version>0.0.3</version>
+        </dependency>
+    </dependencies>
+</project>

+ 139 - 0
common/src/main/java/com/zhentao/config/SecurityConfig.java

@@ -0,0 +1,139 @@
+package com.zhentao.config;
+
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.zhentao.filter.JwtFilter;
+import com.zhentao.pojo.Permission;
+import com.zhentao.pojo.User;
+import com.zhentao.vo.Result;
+import com.zhentao.filter.JwtFilter;
+import com.zhentao.mapper.PermissionMapper;
+import com.zhentao.utils.CacheService;
+import com.zhentao.utils.JwtService;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.authorization.AuthorizationDecision;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.security.web.access.intercept.RequestAuthorizationContext;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig {
+    @Autowired
+    private JwtFilter jwtFilter;
+    @Autowired
+    private CacheService cacheService;
+    @Autowired
+    private PermissionMapper permissionMapper;
+    @Bean
+    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
+        //关闭csrf
+        http.csrf(config->config.disable());
+        http.authorizeHttpRequests(config->config.requestMatchers("/user/login1","/user/login","/user/yan","/user/test").permitAll().anyRequest().access(this::check));
+        http.formLogin(config->config.loginProcessingUrl("/user/login").successHandler(this::loginsuccess).failureHandler(this::loginshibai));
+        http.logout(config->config.logoutUrl("/user/logout").logoutSuccessHandler(this::logout));
+        http.exceptionHandling(config->config.accessDeniedHandler(this::meideng).authenticationEntryPoint(this::meiquan));
+        //关闭session缓存
+        http.sessionManagement(config->config.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
+        http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
+//        http.userDetailsService(userDetailsService);
+        return http.build();
+    }
+
+    //正确退出
+    private void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
+        Result result = Result.OK("登出成功",null);
+        response.setContentType("application/json;charset=utf-8");
+        response.getWriter().write(JSON.toJSONString(result));
+    }
+    //没有登陆处理
+    private void meideng(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException {
+        Result result = Result.ERR("没权限",null);
+        response.setContentType("application/json;charset=utf-8");
+        response.getWriter().write(JSON.toJSONString(result));
+    }
+    //登录失败处理
+
+    private void loginshibai(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException {
+        Result result = Result.ERR("登录失败",null);
+        response.setContentType("application/json;charset=utf-8");
+        response.getWriter().write(JSON.toJSONString(result));
+    }
+
+    //没有权限处理
+    private void meiquan(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException {
+        Result result = Result.ERR("没登录",null);
+        response.setContentType("application/json;charset=utf-8");
+        response.getWriter().write(JSON.toJSONString(result));
+    }
+
+    //校验处理
+    private AuthorizationDecision check(Supplier<Authentication> authenticationSupplier, RequestAuthorizationContext context) {
+        Object principal = authenticationSupplier.get().getPrincipal();
+        if(principal instanceof String){
+            return new AuthorizationDecision(false);
+        }
+        String uri = context.getRequest().getRequestURI();
+        System.out.println(uri);
+        System.out.println("11111111111111");
+        QueryWrapper<Permission> wrapper = new QueryWrapper<>();
+        wrapper.eq("path",uri);
+        Permission permission = permissionMapper.selectOne(wrapper);
+        System.err.println(permission);
+        if(permission==null){
+            return new AuthorizationDecision(false);
+        }
+        User user = (User) principal;
+        List<String> perms = user.getPerms();
+        String perms1 = permission.getPerms();
+        //查询是否有权限
+        System.err.println(perms1);
+        if(perms.contains(perms1)){
+            return new AuthorizationDecision(true);
+        }
+        return new AuthorizationDecision(false);
+    }
+
+    private void loginsuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
+        User user = (User) authentication.getPrincipal();
+        Map<String,Object> map = new HashMap<>();
+        map.put("id",user.getId());
+        map.put("username",user.getUsername());
+        map.put("phone",user.getPhone());
+        map.put("perms",user.getPerms());
+        String token = JwtService.createToken(map);
+        System.err.println(token);
+        String uuid = UUID.randomUUID().toString();
+        String key = "aaa" + uuid;
+        cacheService.setEx(key,token,10, TimeUnit.DAYS);
+        map.put("uuid",uuid);
+        map.put("token",token);
+        Result result = Result.OK("登陆成功",map);
+        response.setContentType("application/json;charset=utf-8");
+        response.getWriter().write(JSON.toJSONString(result));
+    }
+
+    @Bean
+    public BCryptPasswordEncoder bCryptPasswordEncoder(){
+        return new BCryptPasswordEncoder();
+    }
+}

+ 36 - 0
common/src/main/java/com/zhentao/controller/UserController.java

@@ -0,0 +1,36 @@
+package com.zhentao.controller;
+
+import com.zhentao.pojo.dto.LoginDto;
+import com.zhentao.pojo.dto.PhoneDto;
+import com.zhentao.service.UserService;
+import com.zhentao.utils.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Date 2025/5/6 12:03
+ * @Author gln
+ **/
+@RestController
+@RequestMapping("user")
+public class UserController {
+    @Autowired
+    private UserService userService;
+    //测试
+    @RequestMapping("test")
+    public ResultVo test(){
+        return ResultVo.success("测试");
+    }
+    //获取验证码
+    @RequestMapping("yan")
+    public ResultVo yan(@RequestBody PhoneDto phone){
+        return userService.yan(phone);
+    }
+    //用户手机号验证码登录/注册
+    @RequestMapping("login1")
+    public ResultVo login1(@RequestBody LoginDto loginDto) {
+        return ResultVo.success(userService.login1(loginDto));
+    }
+}

+ 91 - 0
common/src/main/java/com/zhentao/filter/JwtFilter.java

@@ -0,0 +1,91 @@
+package com.zhentao.filter;
+
+import com.alibaba.fastjson2.JSON;
+import com.zhentao.pojo.User;
+import com.zhentao.vo.Result;
+import com.zhentao.utils.CacheService;
+import com.zhentao.utils.JwtService;
+import com.zhentao.utils.ThreadLocalUtil;
+import jakarta.servlet.*;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class JwtFilter implements Filter {
+    @Autowired
+    private CacheService cacheService;
+
+    static ArrayList<String> list = new ArrayList<>();
+    static {
+        list.add("/user/yan");
+        list.add("/user/login");
+        list.add("/user/login1");
+        list.add("/user/test");
+    }
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        HttpServletRequest req = (HttpServletRequest) request;
+        HttpServletResponse res = (HttpServletResponse) response;
+        //获取路径
+        String uri = req.getRequestURI();
+        System.out.println(uri);
+//        if("/user/login".equals(uri)||"/user/login1".equals(uri)||"/user/yan".equals(uri)|| "/user/getOpenId".equals(uri) || req.getRequestURI().startsWith("/image")){
+//            //如果路径等于则放行
+//            chain.doFilter(request, response);
+//            return;
+//        }
+        if(list.contains(req.getRequestURI())){
+            chain.doFilter(req,res);
+            return;
+        }
+        //获取token
+        String token = req.getHeader("Authorization");
+        //获取rides数据
+        String key = "aaa" + token;
+        String s = cacheService.get(key);
+        System.out.println(key);
+        if(s==null){
+            Result result = Result.ERR("当前操作有误",null);
+            res.setContentType("application/json;charset=utf-8");
+            res.getWriter().write(JSON.toJSONString(result));
+            return;
+        }
+        //解析
+        Map<String, Object> map = JwtService.getClaimsMap(s);
+        if(map!=null){
+            Object id = map.get("id");
+            ThreadLocalUtil.set(id);
+            Object username = map.get("username");
+            Object phone = map.get("phone");
+            Object perms = map.get("perms");
+            Object avatar = map.get("avatar");
+            User user = new User();
+            user.setId((Long) id);
+            user.setUsername((String) username);
+            user.setPhone((String) phone);
+            user.setPerms((List<String>) perms);
+            user.setAvatar((String) avatar);
+            //把数据存入
+            UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(user,null,user.getAuthorities());
+            usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(req));
+            SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
+            chain.doFilter(request, response);
+            return;
+        }
+        Result result = Result.ERR("当前操作有误,请重新操作",null);
+        res.setContentType("application/json;charset=utf-8");
+        res.getWriter().write(JSON.toJSONString(result));
+        return;
+    }
+}

+ 14 - 0
common/src/main/java/com/zhentao/pojo/dto/LoginDto.java

@@ -0,0 +1,14 @@
+package com.zhentao.pojo.dto;
+
+import lombok.Data;
+
+/**
+ * @Date 2025/5/5 20:40
+ * @Author neko
+ **/
+@Data
+public class LoginDto {
+    private String phone;
+    private String smsCode;
+    private Integer rid;
+}

+ 13 - 0
common/src/main/java/com/zhentao/pojo/dto/PhoneDto.java

@@ -0,0 +1,13 @@
+package com.zhentao.pojo.dto;
+
+/**
+ * @Date 2025/6/9 15:19
+ * @Author gln
+ **/
+
+import lombok.Data;
+
+@Data
+public class PhoneDto {
+    private String phone;
+}

+ 22 - 0
common/src/main/java/com/zhentao/utils/ApiException.java

@@ -0,0 +1,22 @@
+package com.zhentao.utils;
+
+import lombok.Data;
+
+
+@Data
+public class ApiException extends RuntimeException{
+
+	public Integer code;
+	public String msg;
+	public ApiException(BaseExceptionEnum baseExceptionEnum) {
+		super(baseExceptionEnum.getMessage());
+		this.code = baseExceptionEnum.getCode();
+		this.msg = baseExceptionEnum.getMessage();
+	}
+	public ApiException(Integer code, String message) {
+		super(message);
+		this.code=code;
+		this.msg=message;
+	}
+
+}

+ 61 - 0
common/src/main/java/com/zhentao/utils/ApiServiceExceptionEnum.java

@@ -0,0 +1,61 @@
+package com.zhentao.utils;
+
+public enum ApiServiceExceptionEnum implements BaseExceptionEnum{
+	SUCCESS(1, "成功"),
+	RESULT_SUCCES(200,"成功"),
+    RESULT_ERROR(0,"失败"),
+    Login_SUCCESS(200,"登录成功"),
+    Login_ERROR(0,"登录失败"),
+    REG_SUCCESS(200,"注册成功"),
+    REG_ERROR(0,"注册失败"),
+    ISEXISTS_ERROR(0,"已存在"),
+    SHOP_NOEXISTS_ERROR(1001,"店铺不存在"),
+    SHOP_AUDIT_STATUS(1010,"审核中"),
+    SHOP_AUDIT_REN(1010,"转人工"),
+    SHOP_AUDIT_ERROR(1011,"审核失败"),
+    USER_NOT_EXISTS(1024,"该用户不存在"),
+    DATA_NOT_EXISTS(1023,"数据不存在"),
+    PASSWORD_ERROR(1022,"密码错误"),
+    PHONE_ERROR(1021,"手机号格式错误"),
+    PHONE_NOTNULL(1020,"手机号不能为空"),
+    SMSCODE_NOTNULL(1027,"请输入验证码"),
+    YAN_ERROR(1025,"验证码错误"),
+    LOGOUT_OK(200,"退出登录"),
+    NOT_NULL(1030, "参数不能为空" ),
+    NOT_NULL_USER(1040, "未获取到当前用户信息" ),
+    NOT_AUTH(1041,"请先实名认证"),
+    FABU_OK(1042,"发布成功"),
+    UPDATE_OK(200,"修改成功"),
+    AUTH_SUCCESS_OK(1044,"实名认证成功"),
+    LESSONS_TITLE_NOT_NULL(1045,"标题不能为空"),
+    SHOP_CREATE_OK(1046,"店铺创建成功"),
+    SHOP_EXIST_CZ(1047,"请先创建店铺"),
+    NOT_LOGIN_NULL(400,"未登录"),
+    NOT_HUOQU_KEC(1048,"未获取到课程信息"),
+    ORDERITEM_XQ_EXIT_ERROR(1071,"订单详情获取失败"),
+    ERWEIMA_ERROR(1072,"二维码生成失败");
+
+
+
+     ApiServiceExceptionEnum(Integer code , String message) {
+
+    	 this.code=code;
+    	 this.message=message;
+    }
+     private Integer code;
+
+     private String message;
+
+    @Override
+	public Integer getCode() {
+		// TODO Auto-generated method stub
+		return code;
+	}
+
+	@Override
+	public String getMessage() {
+		// TODO Auto-generated method stub
+		return message;
+	}
+
+}

+ 18 - 0
common/src/main/java/com/zhentao/utils/BaseExceptionEnum.java

@@ -0,0 +1,18 @@
+package com.zhentao.utils;
+
+/**
+ * 抽象接口
+ *
+ */
+public interface BaseExceptionEnum {
+
+    /**
+     * 获取异常编码
+     */
+    Integer getCode();
+
+    /**
+     * 获取异常信息
+     */
+    String getMessage();
+}

+ 1445 - 0
common/src/main/java/com/zhentao/utils/CacheService.java

@@ -0,0 +1,1445 @@
+package com.zhentao.utils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.*;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.core.ZSetOperations.TypedTuple;
+import org.springframework.data.redis.core.types.Expiration;
+import org.springframework.lang.Nullable;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+@Component
+public class CacheService extends CachingConfigurerSupport {
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+    public StringRedisTemplate getstringRedisTemplate() {
+        return this.stringRedisTemplate;
+    }
+
+    /** -------------------key相关操作--------------------- */
+
+    /**
+     * 删除key
+     *
+     * @param key
+     */
+    public void delete(String key) {
+        stringRedisTemplate.delete(key);
+    }
+
+    /**
+     * 批量删除key
+     *
+     * @param keys
+     */
+    public void delete(Collection<String> keys) {
+        stringRedisTemplate.delete(keys);
+    }
+
+    /**
+     * 序列化key
+     *
+     * @param key
+     * @return
+     */
+    public byte[] dump(String key) {
+        return stringRedisTemplate.dump(key);
+    }
+
+    /**
+     * 是否存在key
+     *
+     * @param key
+     * @return
+     */
+    public Boolean exists(String key) {
+        return stringRedisTemplate.hasKey(key);
+    }
+
+    /**
+     * 设置过期时间
+     *
+     * @param key
+     * @param timeout
+     * @param unit
+     * @return
+     */
+    public Boolean expire(String key, long timeout, TimeUnit unit) {
+        return stringRedisTemplate.expire(key, timeout, unit);
+    }
+
+    /**
+     * 设置过期时间
+     *
+     * @param key
+     * @param date
+     * @return
+     */
+    public Boolean expireAt(String key, Date date) {
+        return stringRedisTemplate.expireAt(key, date);
+    }
+
+    /**
+     * 查找匹配的key
+     *
+     * @param pattern
+     * @return
+     */
+    public Set<String> keys(String pattern) {
+        return stringRedisTemplate.keys(pattern);
+    }
+
+    /**
+     * 将当前数据库的 key 移动到给定的数据库 db 当中
+     *
+     * @param key
+     * @param dbIndex
+     * @return
+     */
+    public Boolean move(String key, int dbIndex) {
+        return stringRedisTemplate.move(key, dbIndex);
+    }
+
+    /**
+     * 移除 key 的过期时间,key 将持久保持
+     *
+     * @param key
+     * @return
+     */
+    public Boolean persist(String key) {
+        return stringRedisTemplate.persist(key);
+    }
+
+    /**
+     * 返回 key 的剩余的过期时间
+     *
+     * @param key
+     * @param unit
+     * @return
+     */
+    public Long getExpire(String key, TimeUnit unit) {
+        return stringRedisTemplate.getExpire(key, unit);
+    }
+
+    /**
+     * 返回 key 的剩余的过期时间
+     *
+     * @param key
+     * @return
+     */
+    public Long getExpire(String key) {
+        return stringRedisTemplate.getExpire(key);
+    }
+
+    /**
+     * 从当前数据库中随机返回一个 key
+     *
+     * @return
+     */
+    public String randomKey() {
+        return stringRedisTemplate.randomKey();
+    }
+
+    /**
+     * 修改 key 的名称
+     *
+     * @param oldKey
+     * @param newKey
+     */
+    public void rename(String oldKey, String newKey) {
+        stringRedisTemplate.rename(oldKey, newKey);
+    }
+
+    /**
+     * 仅当 newkey 不存在时,将 oldKey 改名为 newkey
+     *
+     * @param oldKey
+     * @param newKey
+     * @return
+     */
+    public Boolean renameIfAbsent(String oldKey, String newKey) {
+        return stringRedisTemplate.renameIfAbsent(oldKey, newKey);
+    }
+
+    /**
+     * 返回 key 所储存的值的类型
+     *
+     * @param key
+     * @return
+     */
+    public DataType type(String key) {
+        return stringRedisTemplate.type(key);
+    }
+
+    /** -------------------string相关操作--------------------- */
+
+    /**
+     * 设置指定 key 的值
+     * @param key
+     * @param value
+     */
+    public void set(String key, String value) {
+        stringRedisTemplate.opsForValue().set(key, value);
+    }
+
+    /**
+     * 获取指定 key 的值
+     * @param key
+     * @return
+     */
+    public String get(String key) {
+        return stringRedisTemplate.opsForValue().get(key);
+    }
+
+    /**
+     * 返回 key 中字符串值的子字符
+     * @param key
+     * @param start
+     * @param end
+     * @return
+     */
+    public String getRange(String key, long start, long end) {
+        return stringRedisTemplate.opsForValue().get(key, start, end);
+    }
+
+    /**
+     * 将给定 key 的值设为 value ,并返回 key 的旧值(old value)
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public String getAndSet(String key, String value) {
+        return stringRedisTemplate.opsForValue().getAndSet(key, value);
+    }
+
+    /**
+     * 对 key 所储存的字符串值,获取指定偏移量上的位(bit)
+     *
+     * @param key
+     * @param offset
+     * @return
+     */
+    public Boolean getBit(String key, long offset) {
+        return stringRedisTemplate.opsForValue().getBit(key, offset);
+    }
+
+    /**
+     * 批量获取
+     *
+     * @param keys
+     * @return
+     */
+    public List<String> multiGet(Collection<String> keys) {
+        return stringRedisTemplate.opsForValue().multiGet(keys);
+    }
+
+    /**
+     * 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value
+     *
+     * @param key
+     * @param
+     * @param value
+     *            值,true为1, false为0
+     * @return
+     */
+    public boolean setBit(String key, long offset, boolean value) {
+        return stringRedisTemplate.opsForValue().setBit(key, offset, value);
+    }
+
+    /**
+     * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout
+     *
+     * @param key
+     * @param value
+     * @param timeout
+     *            过期时间
+     * @param unit
+     *            时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES
+     *            秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS
+     */
+    public void setEx(String key, String value, long timeout, TimeUnit unit) {
+        stringRedisTemplate.opsForValue().set(key, value, timeout, unit);
+    }
+
+    /**
+     * 只有在 key 不存在时设置 key 的值
+     *
+     * @param key
+     * @param value
+     * @return 之前已经存在返回false,不存在返回true
+     */
+    public boolean setIfAbsent(String key, String value) {
+        return stringRedisTemplate.opsForValue().setIfAbsent(key, value);
+    }
+
+    /**
+     * 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始
+     *
+     * @param key
+     * @param value
+     * @param offset
+     *            从指定位置开始覆写
+     */
+    public void setRange(String key, String value, long offset) {
+        stringRedisTemplate.opsForValue().set(key, value, offset);
+    }
+
+    /**
+     * 获取字符串的长度
+     *
+     * @param key
+     * @return
+     */
+    public Long size(String key) {
+        return stringRedisTemplate.opsForValue().size(key);
+    }
+
+    /**
+     * 批量添加
+     *
+     * @param maps
+     */
+    public void multiSet(Map<String, String> maps) {
+        stringRedisTemplate.opsForValue().multiSet(maps);
+    }
+
+    /**
+     * 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在
+     *
+     * @param maps
+     * @return 之前已经存在返回false,不存在返回true
+     */
+    public boolean multiSetIfAbsent(Map<String, String> maps) {
+        return stringRedisTemplate.opsForValue().multiSetIfAbsent(maps);
+    }
+
+    /**
+     * 增加(自增长), 负数则为自减
+     *
+     * @param key
+     * @param
+     * @return
+     */
+    public Long incrBy(String key, long increment) {
+        return stringRedisTemplate.opsForValue().increment(key, increment);
+    }
+
+    /**
+     *
+     * @param key
+     * @param
+     * @return
+     */
+    public Double incrByFloat(String key, double increment) {
+        return stringRedisTemplate.opsForValue().increment(key, increment);
+    }
+
+    /**
+     * 追加到末尾
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Integer append(String key, String value) {
+        return stringRedisTemplate.opsForValue().append(key, value);
+    }
+
+    /** -------------------hash相关操作------------------------- */
+
+    /**
+     * 获取存储在哈希表中指定字段的值
+     *
+     * @param key
+     * @param field
+     * @return
+     */
+    public Object hGet(String key, String field) {
+        return stringRedisTemplate.opsForHash().get(key, field);
+    }
+
+    /**
+     * 获取所有给定字段的值
+     *
+     * @param key
+     * @return
+     */
+    public Map<Object, Object> hGetAll(String key) {
+        return stringRedisTemplate.opsForHash().entries(key);
+    }
+
+    /**
+     * 获取所有给定字段的值
+     *
+     * @param key
+     * @param fields
+     * @return
+     */
+    public List<Object> hMultiGet(String key, Collection<Object> fields) {
+        return stringRedisTemplate.opsForHash().multiGet(key, fields);
+    }
+
+    public void hPut(String key, String hashKey, String value) {
+        stringRedisTemplate.opsForHash().put(key, hashKey, value);
+    }
+
+    public void hPutAll(String key, Map<String, String> maps) {
+        stringRedisTemplate.opsForHash().putAll(key, maps);
+    }
+
+    /**
+     * 仅当hashKey不存在时才设置
+     *
+     * @param key
+     * @param hashKey
+     * @param value
+     * @return
+     */
+    public Boolean hPutIfAbsent(String key, String hashKey, String value) {
+        return stringRedisTemplate.opsForHash().putIfAbsent(key, hashKey, value);
+    }
+
+    /**
+     * 删除一个或多个哈希表字段
+     *
+     * @param key
+     * @param fields
+     * @return
+     */
+    public Long hDelete(String key, Object... fields) {
+        return stringRedisTemplate.opsForHash().delete(key, fields);
+    }
+
+    /**
+     * 查看哈希表 key 中,指定的字段是否存在
+     *
+     * @param key
+     * @param field
+     * @return
+     */
+    public boolean hExists(String key, String field) {
+        return stringRedisTemplate.opsForHash().hasKey(key, field);
+    }
+
+    /**
+     * 为哈希表 key 中的指定字段的整数值加上增量 increment
+     *
+     * @param key
+     * @param field
+     * @param increment
+     * @return
+     */
+    public Long hIncrBy(String key, Object field, long increment) {
+        return stringRedisTemplate.opsForHash().increment(key, field, increment);
+    }
+
+    /**
+     * 为哈希表 key 中的指定字段的整数值加上增量 increment
+     *
+     * @param key
+     * @param field
+     * @param delta
+     * @return
+     */
+    public Double hIncrByFloat(String key, Object field, double delta) {
+        return stringRedisTemplate.opsForHash().increment(key, field, delta);
+    }
+
+    /**
+     * 获取所有哈希表中的字段
+     *
+     * @param key
+     * @return
+     */
+    public Set<Object> hKeys(String key) {
+        return stringRedisTemplate.opsForHash().keys(key);
+    }
+
+    /**
+     * 获取哈希表中字段的数量
+     *
+     * @param key
+     * @return
+     */
+    public Long hSize(String key) {
+        return stringRedisTemplate.opsForHash().size(key);
+    }
+
+    /**
+     * 获取哈希表中所有值
+     *
+     * @param key
+     * @return
+     */
+    public List<Object> hValues(String key) {
+        return stringRedisTemplate.opsForHash().values(key);
+    }
+
+    /**
+     * 迭代哈希表中的键值对
+     *
+     * @param key
+     * @param options
+     * @return
+     */
+    public Cursor<Map.Entry<Object, Object>> hScan(String key, ScanOptions options) {
+        return stringRedisTemplate.opsForHash().scan(key, options);
+    }
+
+    /** ------------------------list相关操作---------------------------- */
+
+    /**
+     * 通过索引获取列表中的元素
+     *
+     * @param key
+     * @param index
+     * @return
+     */
+    public String lIndex(String key, long index) {
+        return stringRedisTemplate.opsForList().index(key, index);
+    }
+
+    /**
+     * 获取列表指定范围内的元素
+     *
+     * @param key
+     * @param start
+     *            开始位置, 0是开始位置
+     * @param end
+     *            结束位置, -1返回所有
+     * @return
+     */
+    public List<String> lRange(String key, long start, long end) {
+        return stringRedisTemplate.opsForList().range(key, start, end);
+    }
+
+    /**
+     * 存储在list头部
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lLeftPush(String key, String value) {
+        return stringRedisTemplate.opsForList().leftPush(key, value);
+    }
+
+    /**
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lLeftPushAll(String key, String... value) {
+        return stringRedisTemplate.opsForList().leftPushAll(key, value);
+    }
+
+    /**
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lLeftPushAll(String key, Collection<String> value) {
+        return stringRedisTemplate.opsForList().leftPushAll(key, value);
+    }
+
+    /**
+     * 当list存在的时候才加入
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lLeftPushIfPresent(String key, String value) {
+        return stringRedisTemplate.opsForList().leftPushIfPresent(key, value);
+    }
+
+    /**
+     * 如果pivot存在,再pivot前面添加
+     *
+     * @param key
+     * @param pivot
+     * @param value
+     * @return
+     */
+    public Long lLeftPush(String key, String pivot, String value) {
+        return stringRedisTemplate.opsForList().leftPush(key, pivot, value);
+    }
+
+    /**
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lRightPush(String key, String value) {
+        return stringRedisTemplate.opsForList().rightPush(key, value);
+    }
+
+    /**
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lRightPushAll(String key, String... value) {
+        return stringRedisTemplate.opsForList().rightPushAll(key, value);
+    }
+
+    /**
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lRightPushAll(String key, Collection<String> value) {
+        return stringRedisTemplate.opsForList().rightPushAll(key, value);
+    }
+
+    /**
+     * 为已存在的列表添加值
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long lRightPushIfPresent(String key, String value) {
+        return stringRedisTemplate.opsForList().rightPushIfPresent(key, value);
+    }
+
+    /**
+     * 在pivot元素的右边添加值
+     *
+     * @param key
+     * @param pivot
+     * @param value
+     * @return
+     */
+    public Long lRightPush(String key, String pivot, String value) {
+        return stringRedisTemplate.opsForList().rightPush(key, pivot, value);
+    }
+
+    /**
+     * 通过索引设置列表元素的值
+     *
+     * @param key
+     * @param index
+     *            位置
+     * @param value
+     */
+    public void lSet(String key, long index, String value) {
+        stringRedisTemplate.opsForList().set(key, index, value);
+    }
+
+    /**
+     * 移出并获取列表的第一个元素
+     *
+     * @param key
+     * @return 删除的元素
+     */
+    public String lLeftPop(String key) {
+        return stringRedisTemplate.opsForList().leftPop(key);
+    }
+
+    /**
+     * 移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
+     *
+     * @param key
+     * @param timeout
+     *            等待时间
+     * @param unit
+     *            时间单位
+     * @return
+     */
+    public String lBLeftPop(String key, long timeout, TimeUnit unit) {
+        return stringRedisTemplate.opsForList().leftPop(key, timeout, unit);
+    }
+
+    /**
+     * 移除并获取列表最后一个元素
+     *
+     * @param key
+     * @return 删除的元素
+     */
+    public String lRightPop(String key) {
+        return stringRedisTemplate.opsForList().rightPop(key);
+    }
+
+    /**
+     * 移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
+     *
+     * @param key
+     * @param timeout
+     *            等待时间
+     * @param unit
+     *            时间单位
+     * @return
+     */
+    public String lBRightPop(String key, long timeout, TimeUnit unit) {
+        return stringRedisTemplate.opsForList().rightPop(key, timeout, unit);
+    }
+
+    /**
+     * 移除列表的最后一个元素,并将该元素添加到另一个列表并返回
+     *
+     * @param sourceKey
+     * @param destinationKey
+     * @return
+     */
+    public String lRightPopAndLeftPush(String sourceKey, String destinationKey) {
+        return stringRedisTemplate.opsForList().rightPopAndLeftPush(sourceKey,
+                destinationKey);
+    }
+
+    /**
+     * 从列表中弹出一个值,将弹出的元素插入到另外一个列表中并返回它; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
+     *
+     * @param sourceKey
+     * @param destinationKey
+     * @param timeout
+     * @param unit
+     * @return
+     */
+    public String lBRightPopAndLeftPush(String sourceKey, String destinationKey,
+                                        long timeout, TimeUnit unit) {
+        return stringRedisTemplate.opsForList().rightPopAndLeftPush(sourceKey,
+                destinationKey, timeout, unit);
+    }
+
+    /**
+     * 删除集合中值等于value得元素
+     *
+     * @param key
+     * @param index
+     *            index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素;
+     *            index<0, 从尾部开始删除第一个值等于value的元素;
+     * @param value
+     * @return
+     */
+    public Long lRemove(String key, long index, String value) {
+        return stringRedisTemplate.opsForList().remove(key, index, value);
+    }
+
+    /**
+     * 裁剪list
+     *
+     * @param key
+     * @param start
+     * @param end
+     */
+    public void lTrim(String key, long start, long end) {
+        stringRedisTemplate.opsForList().trim(key, start, end);
+    }
+
+    /**
+     * 获取列表长度
+     *
+     * @param key
+     * @return
+     */
+    public Long lLen(String key) {
+        return stringRedisTemplate.opsForList().size(key);
+    }
+
+
+    /** --------------------set相关操作-------------------------- */
+
+    /**
+     * set添加元素
+     *
+     * @param key
+     * @param values
+     * @return
+     */
+    public Long sAdd(String key, String... values) {
+        return stringRedisTemplate.opsForSet().add(key, values);
+    }
+
+    /**
+     * set移除元素
+     *
+     * @param key
+     * @param values
+     * @return
+     */
+    public Long sRemove(String key, Object... values) {
+        return stringRedisTemplate.opsForSet().remove(key, values);
+    }
+
+    /**
+     * 移除并返回集合的一个随机元素
+     *
+     * @param key
+     * @return
+     */
+    public String sPop(String key) {
+        return stringRedisTemplate.opsForSet().pop(key);
+    }
+
+    /**
+     * 将元素value从一个集合移到另一个集合
+     *
+     * @param key
+     * @param value
+     * @param destKey
+     * @return
+     */
+    public Boolean sMove(String key, String value, String destKey) {
+        return stringRedisTemplate.opsForSet().move(key, value, destKey);
+    }
+
+    /**
+     * 获取集合的大小
+     *
+     * @param key
+     * @return
+     */
+    public Long sSize(String key) {
+        return stringRedisTemplate.opsForSet().size(key);
+    }
+
+    /**
+     * 判断集合是否包含value
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Boolean sIsMember(String key, Object value) {
+        return stringRedisTemplate.opsForSet().isMember(key, value);
+    }
+
+    /**
+     * 获取两个集合的交集
+     *
+     * @param key
+     * @param otherKey
+     * @return
+     */
+    public Set<String> sIntersect(String key, String otherKey) {
+        return stringRedisTemplate.opsForSet().intersect(key, otherKey);
+    }
+
+    /**
+     * 获取key集合与多个集合的交集
+     *
+     * @param key
+     * @param otherKeys
+     * @return
+     */
+    public Set<String> sIntersect(String key, Collection<String> otherKeys) {
+        return stringRedisTemplate.opsForSet().intersect(key, otherKeys);
+    }
+
+    /**
+     * key集合与otherKey集合的交集存储到destKey集合中
+     *
+     * @param key
+     * @param otherKey
+     * @param destKey
+     * @return
+     */
+    public Long sIntersectAndStore(String key, String otherKey, String destKey) {
+        return stringRedisTemplate.opsForSet().intersectAndStore(key, otherKey,
+                destKey);
+    }
+
+    /**
+     * key集合与多个集合的交集存储到destKey集合中
+     *
+     * @param key
+     * @param otherKeys
+     * @param destKey
+     * @return
+     */
+    public Long sIntersectAndStore(String key, Collection<String> otherKeys,
+                                   String destKey) {
+        return stringRedisTemplate.opsForSet().intersectAndStore(key, otherKeys,
+                destKey);
+    }
+
+    /**
+     * 获取两个集合的并集
+     *
+     * @param key
+     * @param otherKeys
+     * @return
+     */
+    public Set<String> sUnion(String key, String otherKeys) {
+        return stringRedisTemplate.opsForSet().union(key, otherKeys);
+    }
+
+    /**
+     * 获取key集合与多个集合的并集
+     *
+     * @param key
+     * @param otherKeys
+     * @return
+     */
+    public Set<String> sUnion(String key, Collection<String> otherKeys) {
+        return stringRedisTemplate.opsForSet().union(key, otherKeys);
+    }
+
+    /**
+     * key集合与otherKey集合的并集存储到destKey中
+     *
+     * @param key
+     * @param otherKey
+     * @param destKey
+     * @return
+     */
+    public Long sUnionAndStore(String key, String otherKey, String destKey) {
+        return stringRedisTemplate.opsForSet().unionAndStore(key, otherKey, destKey);
+    }
+
+    /**
+     * key集合与多个集合的并集存储到destKey中
+     *
+     * @param key
+     * @param otherKeys
+     * @param destKey
+     * @return
+     */
+    public Long sUnionAndStore(String key, Collection<String> otherKeys,
+                               String destKey) {
+        return stringRedisTemplate.opsForSet().unionAndStore(key, otherKeys, destKey);
+    }
+
+    /**
+     * 获取两个集合的差集
+     *
+     * @param key
+     * @param otherKey
+     * @return
+     */
+    public Set<String> sDifference(String key, String otherKey) {
+        return stringRedisTemplate.opsForSet().difference(key, otherKey);
+    }
+
+    /**
+     * 获取key集合与多个集合的差集
+     *
+     * @param key
+     * @param otherKeys
+     * @return
+     */
+    public Set<String> sDifference(String key, Collection<String> otherKeys) {
+        return stringRedisTemplate.opsForSet().difference(key, otherKeys);
+    }
+
+    /**
+     * key集合与otherKey集合的差集存储到destKey中
+     *
+     * @param key
+     * @param otherKey
+     * @param destKey
+     * @return
+     */
+    public Long sDifference(String key, String otherKey, String destKey) {
+        return stringRedisTemplate.opsForSet().differenceAndStore(key, otherKey,
+                destKey);
+    }
+
+    /**
+     * key集合与多个集合的差集存储到destKey中
+     *
+     * @param key
+     * @param otherKeys
+     * @param destKey
+     * @return
+     */
+    public Long sDifference(String key, Collection<String> otherKeys,
+                            String destKey) {
+        return stringRedisTemplate.opsForSet().differenceAndStore(key, otherKeys,
+                destKey);
+    }
+
+    /**
+     * 获取集合所有元素
+     *
+     * @param key
+     * @param
+     * @param
+     * @return
+     */
+    public Set<String> setMembers(String key) {
+        return stringRedisTemplate.opsForSet().members(key);
+    }
+
+    /**
+     * 随机获取集合中的一个元素
+     *
+     * @param key
+     * @return
+     */
+    public String sRandomMember(String key) {
+        return stringRedisTemplate.opsForSet().randomMember(key);
+    }
+
+    /**
+     * 随机获取集合中count个元素
+     *
+     * @param key
+     * @param count
+     * @return
+     */
+    public List<String> sRandomMembers(String key, long count) {
+        return stringRedisTemplate.opsForSet().randomMembers(key, count);
+    }
+
+    /**
+     * 随机获取集合中count个元素并且去除重复的
+     *
+     * @param key
+     * @param count
+     * @return
+     */
+    public Set<String> sDistinctRandomMembers(String key, long count) {
+        return stringRedisTemplate.opsForSet().distinctRandomMembers(key, count);
+    }
+
+    /**
+     *
+     * @param key
+     * @param options
+     * @return
+     */
+    public Cursor<String> sScan(String key, ScanOptions options) {
+        return stringRedisTemplate.opsForSet().scan(key, options);
+    }
+
+    /**------------------zSet相关操作--------------------------------*/
+
+    /**
+     * 添加元素,有序集合是按照元素的score值由小到大排列
+     *
+     * @param key
+     * @param value
+     * @param score
+     * @return
+     */
+    public Boolean zAdd(String key, String value, double score) {
+        return stringRedisTemplate.opsForZSet().add(key, value, score);
+    }
+
+    /**
+     *
+     * @param key
+     * @param values
+     * @return
+     */
+    public Long zAdd(String key, Set<TypedTuple<String>> values) {
+        return stringRedisTemplate.opsForZSet().add(key, values);
+    }
+
+    /**
+     *
+     * @param key
+     * @param values
+     * @return
+     */
+    public Long zRemove(String key, Object... values) {
+        return stringRedisTemplate.opsForZSet().remove(key, values);
+    }
+
+    public Long zRemove(String key, Collection<String> values) {
+        if(values!=null&&!values.isEmpty()){
+            Object[] objs = values.toArray(new Object[values.size()]);
+            return stringRedisTemplate.opsForZSet().remove(key, objs);
+        }
+       return 0L;
+    }
+
+    /**
+     * 增加元素的score值,并返回增加后的值
+     *
+     * @param key
+     * @param value
+     * @param delta
+     * @return
+     */
+    public Double zIncrementScore(String key, String value, double delta) {
+        return stringRedisTemplate.opsForZSet().incrementScore(key, value, delta);
+    }
+
+    /**
+     * 返回元素在集合的排名,有序集合是按照元素的score值由小到大排列
+     *
+     * @param key
+     * @param value
+     * @return 0表示第一位
+     */
+    public Long zRank(String key, Object value) {
+        return stringRedisTemplate.opsForZSet().rank(key, value);
+    }
+
+    /**
+     * 返回元素在集合的排名,按元素的score值由大到小排列
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Long zReverseRank(String key, Object value) {
+        return stringRedisTemplate.opsForZSet().reverseRank(key, value);
+    }
+
+    /**
+     * 获取集合的元素, 从小到大排序
+     *
+     * @param key
+     * @param start
+     *            开始位置
+     * @param end
+     *            结束位置, -1查询所有
+     * @return
+     */
+    public Set<String> zRange(String key, long start, long end) {
+        return stringRedisTemplate.opsForZSet().range(key, start, end);
+    }
+
+    /**
+     * 获取zset集合的所有元素, 从小到大排序
+     *
+     */
+    public Set<String> zRangeAll(String key) {
+        return zRange(key,0,-1);
+    }
+
+    /**
+     * 获取集合元素, 并且把score值也获取
+     *
+     * @param key
+     * @param start
+     * @param end
+     * @return
+     */
+    public Set<TypedTuple<String>> zRangeWithScores(String key, long start,
+                                                    long end) {
+        return stringRedisTemplate.opsForZSet().rangeWithScores(key, start, end);
+    }
+
+    /**
+     * 根据Score值查询集合元素
+     *
+     * @param key
+     * @param min
+     *            最小值
+     * @param max
+     *            最大值
+     * @return
+     */
+    public Set<String> zRangeByScore(String key, double min, double max) {
+        return stringRedisTemplate.opsForZSet().rangeByScore(key, min, max);
+    }
+
+
+    /**
+     * 根据Score值查询集合元素, 从小到大排序
+     *
+     * @param key
+     * @param min
+     *            最小值
+     * @param max
+     *            最大值
+     * @return
+     */
+    public Set<TypedTuple<String>> zRangeByScoreWithScores(String key,
+                                                           double min, double max) {
+        return stringRedisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max);
+    }
+
+    /**
+     *
+     * @param key
+     * @param min
+     * @param max
+     * @param start
+     * @param end
+     * @return
+     */
+    public Set<TypedTuple<String>> zRangeByScoreWithScores(String key,
+                                                           double min, double max, long start, long end) {
+        return stringRedisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max,
+                start, end);
+    }
+
+    /**
+     * 获取集合的元素, 从大到小排序
+     *
+     * @param key
+     * @param start
+     * @param end
+     * @return
+     */
+    public Set<String> zReverseRange(String key, long start, long end) {
+        return stringRedisTemplate.opsForZSet().reverseRange(key, start, end);
+
+    }
+
+    public Set<String> zReverseRangeByScore(String key, long min, long max) {
+        return stringRedisTemplate.opsForZSet().reverseRangeByScore(key, min, max);
+
+    }
+
+    /**
+     * 获取集合的元素, 从大到小排序, 并返回score值
+     *
+     * @param key
+     * @param start
+     * @param end
+     * @return
+     */
+    public Set<TypedTuple<String>> zReverseRangeWithScores(String key,
+                                                           long start, long end) {
+        return stringRedisTemplate.opsForZSet().reverseRangeWithScores(key, start,
+                end);
+    }
+
+    /**
+     * 根据Score值查询集合元素, 从大到小排序
+     *
+     * @param key
+     * @param min
+     * @param max
+     * @return
+     */
+    public Set<String> zReverseRangeByScore(String key, double min,
+                                            double max) {
+        return stringRedisTemplate.opsForZSet().reverseRangeByScore(key, min, max);
+    }
+
+    /**
+     * 根据Score值查询集合元素, 从大到小排序
+     *
+     * @param key
+     * @param min
+     * @param max
+     * @return
+     */
+    public Set<TypedTuple<String>> zReverseRangeByScoreWithScores(
+            String key, double min, double max) {
+        return stringRedisTemplate.opsForZSet().reverseRangeByScoreWithScores(key,
+                min, max);
+    }
+
+    /**
+     *
+     * @param key
+     * @param min
+     * @param max
+     * @param start
+     * @param end
+     * @return
+     */
+    public Set<String> zReverseRangeByScore(String key, double min,
+                                            double max, long start, long end) {
+        return stringRedisTemplate.opsForZSet().reverseRangeByScore(key, min, max,
+                start, end);
+    }
+
+    /**
+     * 根据score值获取集合元素数量
+     *
+     * @param key
+     * @param min
+     * @param max
+     * @return
+     */
+    public Long zCount(String key, double min, double max) {
+        return stringRedisTemplate.opsForZSet().count(key, min, max);
+    }
+
+    /**
+     * 获取集合大小
+     *
+     * @param key
+     * @return
+     */
+    public Long zSize(String key) {
+        return stringRedisTemplate.opsForZSet().size(key);
+    }
+
+    /**
+     * 获取集合大小
+     *
+     * @param key
+     * @return
+     */
+    public Long zZCard(String key) {
+        return stringRedisTemplate.opsForZSet().zCard(key);
+    }
+
+    /**
+     * 获取集合中value元素的score值
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public Double zScore(String key, Object value) {
+        return stringRedisTemplate.opsForZSet().score(key, value);
+    }
+
+    /**
+     * 移除指定索引位置的成员
+     *
+     * @param key
+     * @param start
+     * @param end
+     * @return
+     */
+    public Long zRemoveRange(String key, long start, long end) {
+        return stringRedisTemplate.opsForZSet().removeRange(key, start, end);
+    }
+
+    /**
+     * 根据指定的score值的范围来移除成员
+     *
+     * @param key
+     * @param min
+     * @param max
+     * @return
+     */
+    public Long zRemoveRangeByScore(String key, double min, double max) {
+        return stringRedisTemplate.opsForZSet().removeRangeByScore(key, min, max);
+    }
+
+    /**
+     * 获取key和otherKey的并集并存储在destKey中
+     *
+     * @param key
+     * @param otherKey
+     * @param destKey
+     * @return
+     */
+    public Long zUnionAndStore(String key, String otherKey, String destKey) {
+        return stringRedisTemplate.opsForZSet().unionAndStore(key, otherKey, destKey);
+    }
+
+    /**
+     *
+     * @param key
+     * @param otherKeys
+     * @param destKey
+     * @return
+     */
+    public Long zUnionAndStore(String key, Collection<String> otherKeys,
+                               String destKey) {
+        return stringRedisTemplate.opsForZSet()
+                .unionAndStore(key, otherKeys, destKey);
+    }
+
+    /**
+     * 交集
+     *
+     * @param key
+     * @param otherKey
+     * @param destKey
+     * @return
+     */
+    public Long zIntersectAndStore(String key, String otherKey,
+                                   String destKey) {
+        return stringRedisTemplate.opsForZSet().intersectAndStore(key, otherKey,
+                destKey);
+    }
+
+    /**
+     * 交集
+     *
+     * @param key
+     * @param otherKeys
+     * @param destKey
+     * @return
+     */
+    public Long zIntersectAndStore(String key, Collection<String> otherKeys,
+                                   String destKey) {
+        return stringRedisTemplate.opsForZSet().intersectAndStore(key, otherKeys,
+                destKey);
+    }
+
+    /**
+     *
+     * @param key
+     * @param options
+     * @return
+     */
+    public Cursor<TypedTuple<String>> zScan(String key, ScanOptions options) {
+        return stringRedisTemplate.opsForZSet().scan(key, options);
+    }
+
+    /**
+     * 管道技术,提高性能
+     * @param type
+     * @param values
+     * @return
+     */
+    public List<Object> lRightPushPipeline(String type,Collection<String> values){
+        List<Object> results = stringRedisTemplate.executePipelined(new RedisCallback<Object>() {
+                    public Object doInRedis(RedisConnection connection) throws DataAccessException {
+                        StringRedisConnection stringRedisConn = (StringRedisConnection)connection;
+                        //集合转换数组
+                        String[] strings = values.toArray(new String[values.size()]);
+                        //直接批量发送
+                        stringRedisConn.rPush(type, strings);
+                        return null;
+                    }
+                });
+        return results;
+    }
+
+    public List<Object> refreshWithPipeline(String future_key,String topic_key,Collection<String> values){
+
+        List<Object> objects = stringRedisTemplate.executePipelined(new RedisCallback<Object>() {
+            @Nullable
+            @Override
+            public Object doInRedis(RedisConnection redisConnection) throws DataAccessException {
+                StringRedisConnection stringRedisConnection = (StringRedisConnection)redisConnection;
+                String[] strings = values.toArray(new String[values.size()]);
+                stringRedisConnection.rPush(topic_key,strings);
+                stringRedisConnection.zRem(future_key,strings);
+                return null;
+            }
+        });
+        return objects;
+    }
+
+    /**
+     * 加锁
+     *
+     * @param name
+     * @param expire
+     * @return
+     */
+    public String tryLock(String name, long expire) {
+        name = name + ":lock";
+        String token = UUID.randomUUID().toString();
+        RedisConnectionFactory factory = stringRedisTemplate.getConnectionFactory();
+        RedisConnection conn = factory.getConnection();
+        try {
+
+            //参考redis命令:
+            //set key value [EX seconds] [PX milliseconds] [NX|XX]
+            Boolean result = conn.set(
+                    name.getBytes(),
+                    token.getBytes(),
+                    Expiration.from(expire, TimeUnit.SECONDS),
+                    RedisStringCommands.SetOption.SET_IF_ABSENT //NX
+            );
+            if (result != null && result)
+                return token;
+        } finally {
+            RedisConnectionUtils.releaseConnection(conn, factory);
+        }
+        return null;
+    }
+
+}

+ 169 - 0
common/src/main/java/com/zhentao/utils/HttpClient.java

@@ -0,0 +1,169 @@
+package com.zhentao.utils;
+
+import org.apache.http.Consts;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.*;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLContextBuilder;
+import org.apache.http.conn.ssl.TrustStrategy;
+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 javax.net.ssl.SSLContext;
+import java.io.IOException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * http请求客户端
+ *
+ * @author Administrator
+ *
+ */
+public class HttpClient {
+   private String url;
+   private Map<String, String> param;
+   private int statusCode;
+   private String content;
+   private String xmlParam;
+   private boolean isHttps;
+
+   public boolean isHttps() {
+      return isHttps;
+   }
+
+   public void setHttps(boolean isHttps) {
+      this.isHttps = isHttps;
+   }
+
+   public String getXmlParam() {
+      return xmlParam;
+   }
+
+   public void setXmlParam(String xmlParam) {
+      this.xmlParam = xmlParam;
+   }
+
+   public HttpClient(String url, Map<String, String> param) {
+      this.url = url;
+      this.param = param;
+   }
+
+   public HttpClient(String url) {
+      this.url = url;
+   }
+
+   public void setParameter(Map<String, String> map) {
+      param = map;
+   }
+
+   public void addParameter(String key, String value) {
+      if (param == null)
+         param = new HashMap<String, String>();
+      param.put(key, value);
+   }
+
+   public void post() throws ClientProtocolException, IOException {
+      HttpPost http = new HttpPost(url);
+      setEntity(http);
+      execute(http);
+   }
+
+   public void put() throws ClientProtocolException, IOException {
+      HttpPut http = new HttpPut(url);
+      setEntity(http);
+      execute(http);
+   }
+
+   public void get() throws ClientProtocolException, IOException {
+      if (param != null) {
+         StringBuilder url = new StringBuilder(this.url);
+         boolean isFirst = true;
+         for (String key : param.keySet()) {
+            if (isFirst)
+               url.append("?");
+            else
+               url.append("&");
+            url.append(key).append("=").append(param.get(key));
+         }
+         this.url = url.toString();
+      }
+      HttpGet http = new HttpGet(url);
+      execute(http);
+   }
+
+   /**
+    * set http post,put param
+    */
+   private void setEntity(HttpEntityEnclosingRequestBase http) {
+      if (param != null) {
+         List<NameValuePair> nvps = new LinkedList<NameValuePair>();
+         for (String key : param.keySet())
+            nvps.add(new BasicNameValuePair(key, param.get(key))); // 参数
+         http.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); // 设置参数
+      }
+      if (xmlParam != null) {
+         http.setEntity(new StringEntity(xmlParam, Consts.UTF_8));
+      }
+   }
+
+   private void execute(HttpUriRequest http) throws ClientProtocolException,
+         IOException {
+      CloseableHttpClient httpClient = null;
+      try {
+         if (isHttps) {
+            SSLContext sslContext = new SSLContextBuilder()
+                  .loadTrustMaterial(null, new TrustStrategy() {
+                     // 信任所有
+                     public boolean isTrusted(X509Certificate[] chain,
+                           String authType)
+                           throws CertificateException {
+                        return true;
+                     }
+                  }).build();
+            SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
+                  sslContext);
+            httpClient = HttpClients.custom().setSSLSocketFactory(sslsf)
+                  .build();
+         } else {
+            httpClient = HttpClients.createDefault();
+         }
+         CloseableHttpResponse response = httpClient.execute(http);
+         try {
+            if (response != null) {
+               if (response.getStatusLine() != null)
+                  statusCode = response.getStatusLine().getStatusCode();
+               HttpEntity entity = response.getEntity();
+               // 响应内容
+               content = EntityUtils.toString(entity, Consts.UTF_8);
+            }
+         } finally {
+            response.close();
+         }
+      } catch (Exception e) {
+         e.printStackTrace();
+      } finally {
+         httpClient.close();
+      }
+   }
+
+   public int getStatusCode() {
+      return statusCode;
+   }
+
+   public String getContent() throws ParseException, IOException {
+      return content;
+   }
+
+}

+ 311 - 0
common/src/main/java/com/zhentao/utils/HttpUtils.java

@@ -0,0 +1,311 @@
+package com.zhentao.utils;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpUtils {
+
+	/**
+	 * get
+	 *
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doGet(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpGet request = new HttpGet(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+	/**
+	 * post form
+	 *
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param bodys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys,
+			Map<String, String> bodys)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (bodys != null) {
+            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
+
+            for (String key : bodys.keySet()) {
+                nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+            }
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+            formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
+            request.setEntity(formEntity);
+        }
+
+        return httpClient.execute(request);
+    }
+
+	/**
+	 * Post String
+	 *
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys,
+			String body)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+        	request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+
+	/**
+	 * Post stream
+	 *
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys,
+			byte[] body)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+        	request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+
+	/**
+	 * Put String
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPut(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys,
+			String body)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+        	request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+
+	/**
+	 * Put stream
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPut(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys,
+			byte[] body)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+        	request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+
+	/**
+	 * Delete
+	 *
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doDelete(String host, String path, String method,
+			Map<String, String> headers,
+			Map<String, String> querys)
+            throws Exception {
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+	private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
+    	StringBuilder sbUrl = new StringBuilder();
+    	sbUrl.append(host);
+    	if (!StringUtils.isBlank(path)) {
+    		sbUrl.append(path);
+        }
+    	if (null != querys) {
+    		StringBuilder sbQuery = new StringBuilder();
+        	for (Map.Entry<String, String> query : querys.entrySet()) {
+        		if (0 < sbQuery.length()) {
+        			sbQuery.append("&");
+        		}
+        		if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+        			sbQuery.append(query.getValue());
+                }
+        		if (!StringUtils.isBlank(query.getKey())) {
+        			sbQuery.append(query.getKey());
+        			if (!StringUtils.isBlank(query.getValue())) {
+        				sbQuery.append("=");
+        				sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+        			}
+                }
+        	}
+        	if (0 < sbQuery.length()) {
+        		sbUrl.append("?").append(sbQuery);
+        	}
+        }
+
+    	return sbUrl.toString();
+    }
+
+	private static HttpClient wrapClient(String host) {
+		HttpClient httpClient = new DefaultHttpClient();
+		if (host.startsWith("https://")) {
+			sslClient(httpClient);
+		}
+
+		return httpClient;
+	}
+
+	private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+                }
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+                }
+            };
+            ctx.init(null, new TrustManager[] { tm }, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+        	throw new RuntimeException(ex);
+        }
+    }
+}

+ 118 - 0
common/src/main/java/com/zhentao/utils/JwtService.java

@@ -0,0 +1,118 @@
+package com.zhentao.utils;
+
+import io.jsonwebtoken.*;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+
+/**
+ * @ClassName: JwtUtil
+ * @Author: O蛋
+ * @Date: 2024年3月1日 09:29
+ */
+public class JwtService {
+
+    // 设置token过期时间30分钟
+    private static final long EXPIRE_TIME = 30 * 60 * 1000; // 30分钟
+    // 加密KEY
+    private static final String TOKEN_ENCRY_KEY = "MDk4ZjZi789y438h9jikog5tfr4dew7gg5ft4689iy6t5f4rd3y679uiy6t5f4ry9uyg5tf4rh9jikog5tf4rd38h9ujiyg5fr4d38h9juig5tf4rd3h9juiyg5ft4r9jigt5f4rY2Q0NjIxZDM3M2NhZGU0ZTgzMjYyN2I0ZjY";
+
+    // 生成TOKEN
+    public static String createToken(Map<String, Object> claimMaps) {
+        long currentTime = System.currentTimeMillis();
+        return Jwts.builder()
+                .setId(UUID.randomUUID().toString())
+                .setIssuedAt(new Date(currentTime)) // 签发时间
+                .setSubject("zhentao.bms.token") // 说明
+                .setIssuer("zhentao.bms") // 签发者信息
+                .setAudience("zhentao.bms.pc.b") // 接收用户
+                .compressWith(CompressionCodecs.GZIP) // 数据压缩方式
+                .signWith(SignatureAlgorithm.HS512, TOKEN_ENCRY_KEY) // 加密方式
+                .setExpiration(new Date(currentTime + EXPIRE_TIME)) // 过期时间戳
+                .addClaims(claimMaps) // cla信息
+                .compact();
+    }
+
+    /**
+     * 获取payload body信息
+     *
+     * @param token
+     * @return
+     */
+    private static Claims getClaimsBody(String token) {
+        try {
+            Jws<Claims> jwt = Jwts.parser().setSigningKey(TOKEN_ENCRY_KEY).parseClaimsJws(token);
+            return jwt.getBody();
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /**
+     * 获取payload中claims的集合
+     *
+     * @param token
+     * @return
+     */
+    public static Map<String, Object> getClaimsMap(String token) {
+        try {
+            Jws<Claims> jwt = Jwts.parser().setSigningKey(TOKEN_ENCRY_KEY).parseClaimsJws(token);
+            return jwt.getBody();
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /**
+     * 获取hearder body信息
+     *
+     * @param token
+     * @return
+     */
+    public static JwsHeader getHeaderBody(String token) {
+        Jws<Claims> jwt = Jwts.parser().setSigningKey(TOKEN_ENCRY_KEY).parseClaimsJws(token);
+        return jwt.getHeader();
+    }
+
+    /**
+     * 是否有效
+     *
+     * @param token
+     * @return 1:有效,0:无效
+     */
+    public static int verifyToken(String token) {
+        if(StringUtils.isBlank(token)){//token为空
+            return -3;
+        }
+        try {
+            Jwts.parser().setSigningKey(TOKEN_ENCRY_KEY).parseClaimsJws(token);
+        } catch (ExpiredJwtException e) {//token过期
+            return -2;
+        } catch (JwtException e){//token被篡改
+            return -1;
+        }
+        // 当前时间在有效期范围内
+        return 1;
+    }
+
+    public static void main(String[] args) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("userId", "1");
+        map.put("username", "admin");
+//        map.put("authorities", Arrays.asList("student:add","user:list"));
+
+        String token = createToken(map);
+        System.out.println(token);
+
+        int i = verifyToken(token);
+        System.out.println(i);
+
+
+        Map<String, Object> claimsMap = getClaimsMap(token);
+        System.out.println(claimsMap);
+    }
+}

+ 111 - 0
common/src/main/java/com/zhentao/utils/ResultVo.java

@@ -0,0 +1,111 @@
+package com.zhentao.utils;
+
+import lombok.Data;
+
+@Data
+public class ResultVo<T> {
+    private Integer code;
+    private String msg;
+    private T obj;
+
+    public ResultVo() {
+    }
+
+    public ResultVo(int code, String msg, T obj) {
+        this.code = code;
+        this.msg = msg;
+        this.obj = obj;
+
+    }
+
+    public ResultVo(ApiServiceExceptionEnum apiServiceExceptionEnum, T object) {
+        this.code = apiServiceExceptionEnum.getCode();
+        this.msg = apiServiceExceptionEnum.getMessage();
+        this.obj = object;
+    }
+
+    public ResultVo(ApiServiceExceptionEnum apiServiceExceptionEnum) {
+        this.code = apiServiceExceptionEnum.getCode();
+        this.msg = apiServiceExceptionEnum.getMessage();
+        this.obj = null;
+    }
+
+    public static ResultVo success(Object object) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(200);
+        resultVO.setMsg("成功");
+        resultVO.setObj(object);
+        return resultVO;
+    }
+
+    public static ResultVo success() {
+        return success(null);
+    }
+
+    public static ResultVo error(Integer code, String msg) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(code);
+        resultVO.setMsg(msg);
+        return resultVO;
+    }
+
+    public static ResultVo error() {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(0);
+        resultVO.setMsg("失败");
+        return resultVO;
+    }
+
+    public static ResultVo error(Integer code, String msg, Object obj) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(0);
+        resultVO.setMsg(msg);
+        resultVO.setObj(obj);
+        return resultVO;
+    }
+
+    public static ResultVo error(ApiServiceExceptionEnum apiServiceExceptionEnum) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(apiServiceExceptionEnum.getCode());
+        resultVO.setMsg(apiServiceExceptionEnum.getMessage());
+        return resultVO;
+    }
+
+    public static ResultVo success(Integer code, String msg, Object obj) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(code);
+        resultVO.setMsg(msg);
+        resultVO.setObj(obj);
+        return resultVO;
+    }
+
+    public static ResultVo success(ApiServiceExceptionEnum apiServiceExceptionEnum) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(apiServiceExceptionEnum.getCode());
+        resultVO.setMsg(apiServiceExceptionEnum.getMessage());
+        return resultVO;
+    }
+
+    public static ResultVo success(ApiServiceExceptionEnum apiServiceExceptionEnum, Object object) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(apiServiceExceptionEnum.getCode());
+        resultVO.setMsg(apiServiceExceptionEnum.getMessage());
+        resultVO.setObj(object);
+        return resultVO;
+    }
+
+    public static ResultVo error(Object object) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(400);
+        resultVO.setMsg("失败");
+        resultVO.setObj(object);
+        return resultVO;
+    }
+    public static ResultVo error(String msg,Object object) {
+        ResultVo resultVO = new ResultVo();
+        resultVO.setCode(400);
+        resultVO.setMsg("msg");
+        resultVO.setObj(object);
+        return resultVO;
+    }
+}

+ 86 - 0
common/src/main/java/com/zhentao/utils/ShenModerationPlusDemo.java

@@ -0,0 +1,86 @@
+package com.zhentao.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.green20220302.Client;
+import com.aliyun.green20220302.models.TextModerationPlusRequest;
+import com.aliyun.green20220302.models.TextModerationPlusResponse;
+import com.aliyun.green20220302.models.TextModerationPlusResponseBody;
+import com.aliyun.teaopenapi.models.Config;
+
+/**
+ * @Date 2025/4/22 14:38
+ * @Author neko
+ **/
+public class ShenModerationPlusDemo {
+    public static ResultVo textModerationPlus(String args) throws Exception {
+        Config config = new Config();
+        /**
+         * 阿里云账号AccessKey拥有所有API的访问权限,建议您使用RAM用户进行API访问或日常运维。
+         * 常见获取环境变量方式:
+         * 方式一:
+         *     获取RAM用户AccessKey ID:System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
+         *     获取RAM用户AccessKey Secret:System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
+         * 方式二:
+         *     获取RAM用户AccessKey ID:System.getProperty("ALIBABA_CLOUD_ACCESS_KEY_ID");
+         *     获取RAM用户AccessKey Secret:System.getProperty("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
+         */
+        config.setAccessKeyId("LTAI5tFvQPjADzs9fipxNTSQ");
+        config.setAccessKeySecret("HRvFeZyT3pdOngsZcFjLy5HbHgzGWu");
+        //接入区域和地址请根据实际情况修改
+        config.setRegionId("cn-shanghai");
+        config.setEndpoint("green-cip.cn-shanghai.aliyuncs.com");
+        //读取时超时时间,单位毫秒(ms)。
+        config.setReadTimeout(6000);
+        //连接时超时时间,单位毫秒(ms)。
+        config.setConnectTimeout(3000);
+        //设置http代理。
+        //config.setHttpProxy("http://xx.xx.xx.xx:xxxx");
+        //设置https代理。
+        //config.setHttpsProxy("https://xx.xx.xx.xx:xxxx");
+        Client client = new Client(config);
+
+        JSONObject serviceParameters = new JSONObject();
+        serviceParameters.put("content", args);
+
+        TextModerationPlusRequest textModerationPlusRequest = new TextModerationPlusRequest();
+        // 检测类型
+        textModerationPlusRequest.setService("llm_query_moderation");
+        textModerationPlusRequest.setServiceParameters(serviceParameters.toJSONString());
+
+        try {
+            TextModerationPlusResponse response = client.textModerationPlus(textModerationPlusRequest);
+            if (response.getStatusCode() == 200) {
+                TextModerationPlusResponseBody result = response.getBody();
+                System.out.println(JSON.toJSONString(result));
+                System.out.println("requestId = " + result.getRequestId());
+                System.out.println("code = " + result.getCode());
+                System.out.println("msg = " + result.getMessage());
+                Integer code = result.getCode();
+                if (200 == code) {
+                    TextModerationPlusResponseBody.TextModerationPlusResponseBodyData data = result.getData();
+                    System.out.println(JSON.toJSONString(data, true));
+                    String getJsonString = JSON.toJSONString(data,true);
+                    //转成json对象
+                    JSONObject jsonObject = JSONObject.parseObject(getJsonString);
+                    String riskLeavel = (String) jsonObject.get("riskLevel");
+                    System.out.println(riskLeavel);
+                    if(riskLeavel.equals("high")){
+                        return ResultVo.success(202,"审核失败",null);
+                    }else if(riskLeavel.equals("none")){
+                        return ResultVo.success(200,"审核成功",null);
+                    }else{
+                        return ResultVo.success(201,"转人工",null);
+                    }
+                } else {
+                    return ResultVo.success(201,"转人工",null);
+                }
+            } else {
+                return ResultVo.success(201,"转人工",null);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResultVo.success(201,"转人工",null);
+        }
+    }
+}

+ 78 - 0
common/src/main/java/com/zhentao/utils/SnowflakeUtil.java

@@ -0,0 +1,78 @@
+package com.zhentao.utils;
+
+/**
+ * @Date 2025/4/21 19:25
+ * @Author gln
+ **/
+
+public class SnowflakeUtil {
+    // 起始时间戳,可自定义,这里以 2020-01-01 00:00:00 为例
+    private static final long START_TIMESTAMP = 1577836800000L;
+
+    // 数据中心 ID 所占位数
+    private static final long DATA_CENTER_ID_BITS = 5L;
+    // 机器 ID 所占位数
+    private static final long WORKER_ID_BITS = 5L;
+    // 序列号所占位数
+    private static final long SEQUENCE_BITS = 12L;
+
+    // 数据中心 ID 最大值
+    private static final long MAX_DATA_CENTER_ID = -1L ^ (-1L << DATA_CENTER_ID_BITS);
+    // 机器 ID 最大值
+    private static final long MAX_WORKER_ID = -1L ^ (-1L << WORKER_ID_BITS);
+    // 序列号最大值
+    private static final long SEQUENCE_MASK = -1L ^ (-1L << SEQUENCE_BITS);
+
+    // 机器 ID 向左移位数
+    private static final long WORKER_ID_SHIFT = SEQUENCE_BITS;
+    // 数据中心 ID 向左移位数
+    private static final long DATA_CENTER_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS;
+    // 时间戳向左移位数
+    private static final long TIMESTAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATA_CENTER_ID_BITS;
+
+    // 固定数据中心 ID 和机器 ID
+    private static final long DATA_CENTER_ID = 1;
+    private static final long WORKER_ID = 1;
+
+    private static long sequence = 0L;
+    private static long lastTimestamp = -1L;
+
+    public static synchronized long nextId() {
+        long timestamp = System.currentTimeMillis();
+
+        if (timestamp < lastTimestamp) {
+            throw new RuntimeException("Clock moved backwards. Refusing to generate id for " + (lastTimestamp - timestamp) + " milliseconds");
+        }
+
+        if (timestamp == lastTimestamp) {
+            sequence = (sequence + 1) & SEQUENCE_MASK;
+            if (sequence == 0) {
+                timestamp = waitForNextMillis(lastTimestamp);
+            }
+        } else {
+            sequence = 0L;
+        }
+
+        lastTimestamp = timestamp;
+
+        return ((timestamp - START_TIMESTAMP) << TIMESTAMP_LEFT_SHIFT) |
+                (DATA_CENTER_ID << DATA_CENTER_ID_SHIFT) |
+                (WORKER_ID << WORKER_ID_SHIFT) |
+                sequence;
+    }
+
+    private static long waitForNextMillis(long lastTimestamp) {
+        long timestamp = System.currentTimeMillis();
+        while (timestamp <= lastTimestamp) {
+            timestamp = System.currentTimeMillis();
+        }
+        return timestamp;
+    }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 10; i++) {
+            System.out.println(nextId());
+        }
+    }
+}
+

+ 20 - 0
common/src/main/java/com/zhentao/utils/ThreadLocalUtil.java

@@ -0,0 +1,20 @@
+package com.zhentao.utils;
+
+
+
+public class ThreadLocalUtil {
+    // 提供ThreadLocal对象
+    private static final ThreadLocal THREAD_LOCAL = new ThreadLocal();
+    // 获取数据的方法,根据键获取值
+    public static <T> T get(){
+        return (T) THREAD_LOCAL.get();
+    }
+    // 存储数据的方法,储存键值对
+    public static void set(Object value){
+        THREAD_LOCAL.set(value);
+    }
+    // 删除数据的方法,清除ThreadLocal,防止内存溢出
+    public static void remove(){
+        THREAD_LOCAL.remove();
+    }
+}

+ 29 - 0
common/src/main/java/com/zhentao/vo/Result.java

@@ -0,0 +1,29 @@
+package com.zhentao.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class Result implements Serializable {
+
+    private Integer code;
+    private String message;
+    private Object object;
+
+    public static Result OK(String message,Object object){
+        Result result = new Result();
+        result.setCode(200);
+        result.setMessage(message);
+        result.setObject(object);
+        return result;
+    }
+
+    public static Result ERR(String message,Object object){
+        Result result = new Result();
+        result.setCode(400);
+        result.setMessage(message);
+        result.setObject(object);
+        return result;
+    }
+}

+ 20 - 0
common/src/test/java/Testtt.java

@@ -0,0 +1,20 @@
+import jakarta.servlet.http.HttpServletRequest;
+import org.junit.jupiter.api.Test;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @Date 2025/5/12 8:51
+ * @Author neko
+ **/
+public class Testtt {
+    public static void main(String[] args) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+        String timestamp = sdf.format(new Date());
+        Random random = new Random();
+        int randomNumber = random.nextInt(10000);
+        String orderNumber = timestamp + String.format("%04d", randomNumber);
+        System.out.println("生成的订单编号: " + orderNumber);
+    }
+}

+ 128 - 0
pom.xml

@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.zhentao</groupId>
+    <artifactId>demo-mastar</artifactId>
+    <version>1.0</version>
+    <packaging>pom</packaging>
+    <modules>
+        <module>common</module>
+        <module>starter</module>
+        <module>minio</module>
+    </modules>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <!--自定义标签-->
+        <!--版本统一管理-->
+        <springboot.version>3.1.5</springboot.version>
+        <druid.version>1.2.23</druid.version>
+        <mysql.version>8.0.33</mysql.version>
+        <springdoc.version>1.6.15</springdoc.version>
+        <knife4j.version>4.1.0</knife4j.version>
+        <mybatis-plus.version>3.5.4</mybatis-plus.version>
+        <mybatis-spring.version>3.0.3</mybatis-spring.version>
+        <hutool.version>5.8.22</hutool.version>
+        <springfox.version>3.0.0</springfox.version>
+        <lombok.version>1.18.30</lombok.version>
+        <jwt.version>4.3.0</jwt.version>
+        <jxb.version>2.3.1</jxb.version>
+        <redis.version>3.1.5</redis.version>
+        <fastjson2.version>2.0.39</fastjson2.version>
+        <zg2.version>1.0</zg2.version>
+    </properties>
+    <!--项目依赖的统一管理  清单-->
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${springboot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${mysql.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>druid-spring-boot-starter</artifactId>
+                <version>${druid.version}</version>
+            </dependency>
+            <!--引入redis-->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-data-redis</artifactId>
+                <version>${redis.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba.fastjson2</groupId>
+                <artifactId>fastjson2</artifactId>
+                <version>${fastjson2.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-security</artifactId>
+                <version>${springboot.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>io.springfox</groupId>
+                <artifactId>springfox-boot-starter</artifactId>
+                <version>${springfox.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>mybatis-plus-boot-starter</artifactId>
+                <version>${mybatis-plus.version}</version>
+                <!--排除-->
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.mybatis</groupId>
+                        <artifactId>mybatis-spring</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.mybatis</groupId>
+                <artifactId>mybatis-spring</artifactId>
+                <version>${mybatis-spring.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.auth0</groupId>
+                <artifactId>java-jwt</artifactId>
+                <version>${jwt.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+                <version>${jxb.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>cn.hutool</groupId>
+                <artifactId>hutool-all</artifactId>
+                <version>${hutool.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+                <version>${lombok.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.zhentao</groupId>
+                <artifactId>common</artifactId>
+                <version>1.0</version>
+            </dependency>
+
+        </dependencies>
+    </dependencyManagement>
+
+</project>

+ 38 - 0
starter/.gitignore

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

+ 30 - 0
starter/pom.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.zhentao</groupId>
+        <artifactId>demo-mastar</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <artifactId>starter</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.zhentao</groupId>
+            <artifactId>common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.zhentao</groupId>
+            <artifactId>minio</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>

+ 31 - 0
starter/src/main/java/com/zhentao/StarterApplication.java

@@ -0,0 +1,31 @@
+package com.zhentao;
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SpringBootApplication
+@MapperScan("com.zhentao.mapper")
+public class StarterApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(StarterApplication.class,args);
+//        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
+//        String mm = "123"+"26adf541-4e16-495f-b95d-722da08bd136";
+//        String encode = encoder.encode(mm);
+//        System.out.println(encode);
+    }
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
+        // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
+        return interceptor;
+    }
+}

+ 53 - 0
starter/src/main/resources/application.yml

@@ -0,0 +1,53 @@
+server:
+  port: 8080
+
+#数据库参数
+#spring:
+#  datasource:
+#    driver-class-name: com.mysql.cj.jdbc.Driver
+#    url: jdbc:mysql://localhost:3306/gooset?characterEncoding=utf8&serverTimezone=GMT%2B8
+#    username: root
+#    password: 212579974
+spring:
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 1000MB
+      max-request-size: 1000MB
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+#    url: jdbc:mysql://localhost:3306/gooset?characterEncoding=utf8&serverTimezone=GMT%2B8
+#    username: root
+#    password: 212579974
+    url: jdbc:mysql://59.110.13.105:3306/carservice?characterEncoding=utf8&serverTimezone=GMT%2B8
+    username: guolina
+    password: gln212579974
+minio:
+  accessKey: admin
+  secretKey: admin123
+  bucketName: gln
+  endpoint: http://59.110.13.105:9000
+
+#  web:http://59.110.13.105/:9000/gln/img.png
+#    resources:
+#      static-locations: file:///D:/img/,/resouces/,/public/
+#mybatis
+#mybatis:
+#  type-aliases-package: com.zhentao.pojo
+#  mapper-locations: classpath:mapper/*.xml
+#  configuration:
+#    map-underscore-to-camel-case: true
+
+
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*.xml
+  type-aliases-package: com.zhentao.pojo
+
+#日志
+logging:
+  level:
+    com:
+      zhentao: debug
+
+#  统一配置文件上传的根路径
+#file_path: D://img//image