MrBird 6 vuotta sitten
vanhempi
commit
b879af6fac
100 muutettua tiedostoa jossa 6371 lisäystä ja 6418 poistoa
  1. 12 12
      .github/FUNDING.yml
  2. 10 10
      .github/issue_template.md
  3. 4 4
      .gitignore
  4. 201 201
      LICENSE
  5. 6 6
      febs-auth/Dockerfile
  6. 71 71
      febs-auth/pom.xml
  7. 24 24
      febs-auth/src/main/java/cc/mrbird/febs/auth/FebsAuthApplication.java
  8. 120 120
      febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsAuthorizationServerConfigure.java
  9. 49 49
      febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsResourceServerConfigure.java
  10. 54 54
      febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsSecurityConfigure.java
  11. 25 25
      febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsWebConfigure.java
  12. 89 89
      febs-auth/src/main/java/cc/mrbird/febs/auth/controller/OAuthClientDetailsController.java
  13. 35 35
      febs-auth/src/main/java/cc/mrbird/febs/auth/controller/SecurityController.java
  14. 148 148
      febs-auth/src/main/java/cc/mrbird/febs/auth/controller/SocialLoginController.java
  15. 20 20
      febs-auth/src/main/java/cc/mrbird/febs/auth/entity/BindUser.java
  16. 66 66
      febs-auth/src/main/java/cc/mrbird/febs/auth/entity/OAuthClientDetails.java
  17. 44 44
      febs-auth/src/main/java/cc/mrbird/febs/auth/entity/UserConnection.java
  18. 86 86
      febs-auth/src/main/java/cc/mrbird/febs/auth/filter/ValidateCodeFilter.java
  19. 81 81
      febs-auth/src/main/java/cc/mrbird/febs/auth/manager/UserManager.java
  20. 13 13
      febs-auth/src/main/java/cc/mrbird/febs/auth/mapper/MenuMapper.java
  21. 10 10
      febs-auth/src/main/java/cc/mrbird/febs/auth/mapper/OAuthClientDetailsMapper.java
  22. 38 38
      febs-auth/src/main/java/cc/mrbird/febs/auth/properties/FebsAuthProperties.java
  23. 34 34
      febs-auth/src/main/java/cc/mrbird/febs/auth/runner/StartedUpRunner.java
  24. 51 51
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/OAuthClientDetailsService.java
  25. 90 90
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/SocialLoginService.java
  26. 26 26
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/ValidateCodeService.java
  27. 55 55
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/FebsUserDetailService.java
  28. 108 108
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/OAuthClientDetailsServiceImpl.java
  29. 88 88
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/RedisClientDetailsService.java
  30. 216 216
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/SocialLoginServiceImpl.java
  31. 51 51
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/UserConnectionServiceImpl.java
  32. 86 86
      febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/ValidateCodeServiceImpl.java
  33. 57 57
      febs-auth/src/main/java/cc/mrbird/febs/auth/translator/FebsWebResponseExceptionTranslator.java
  34. 22 22
      febs-auth/src/main/resources/bootstrap.yml
  35. 11 11
      febs-auth/src/main/resources/febs-auth.properties
  36. 60 60
      febs-auth/src/main/resources/logback-spring.xml
  37. 15 15
      febs-auth/src/main/resources/mapper/MenuMapper.xml
  38. 31 31
      febs-auth/src/main/resources/mapper/UserMapper.xml
  39. 19 19
      febs-auth/src/main/resources/templates/error.html
  40. 20 20
      febs-auth/src/main/resources/templates/result.html
  41. 21 21
      febs-cloud/config/alertmanager.yml
  42. 6 6
      febs-cloud/config/elasticsearch.yml
  43. 10 10
      febs-cloud/config/memory_over.yml
  44. 56 56
      febs-cloud/config/prometheus.yml
  45. 10 10
      febs-cloud/config/server_down.yml
  46. 110 110
      febs-cloud/config/skywalking_application.yml
  47. 70 70
      febs-cloud/docker compose/elk-skywalking/docker-compose.yml
  48. 105 105
      febs-cloud/docker compose/febs-cloud/docker-compose.yml
  49. 22 22
      febs-cloud/docker compose/nacos/docker-compose.yml
  50. 53 53
      febs-cloud/docker compose/prometheus/docker-compose.yml
  51. 54 54
      febs-cloud/pom.xml
  52. 506 506
      febs-cloud/sql/febs_cloud_base.sql
  53. 104 104
      febs-cloud/sql/febs_cloud_route.sql
  54. 0 47
      febs-cloud/sql/febs_nacos.sql
  55. 103 103
      febs-common/pom.xml
  56. 17 17
      febs-common/src/main/java/cc/mrbird/febs/common/annotation/ControllerEndpoint.java
  57. 26 26
      febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsAuthExceptionConfigure.java
  58. 55 55
      febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsLettuceRedisConfigure.java
  59. 28 28
      febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsOAuth2FeignConfigure.java
  60. 34 34
      febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsServerProtectConfigure.java
  61. 45 45
      febs-common/src/main/java/cc/mrbird/febs/common/entity/CurrentUser.java
  62. 15 15
      febs-common/src/main/java/cc/mrbird/febs/common/entity/DeptTree.java
  63. 51 51
      febs-common/src/main/java/cc/mrbird/febs/common/entity/FebsAuthUser.java
  64. 20 20
      febs-common/src/main/java/cc/mrbird/febs/common/entity/MenuTree.java
  65. 32 32
      febs-common/src/main/java/cc/mrbird/febs/common/entity/QueryRequest.java
  66. 32 32
      febs-common/src/main/java/cc/mrbird/febs/common/entity/Tree.java
  67. 85 85
      febs-common/src/main/java/cc/mrbird/febs/common/entity/auth/OauthCliendetails.java
  68. 25 25
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/EndpointConstant.java
  69. 63 63
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/FebsConstant.java
  70. 17 17
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/FebsServerConstant.java
  71. 30 30
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/GrantTypeConstant.java
  72. 18 18
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/ImageTypeConstant.java
  73. 12 12
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/PageConstant.java
  74. 27 27
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/ParamsConstant.java
  75. 10 10
      febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/SocialConstant.java
  76. 44 44
      febs-common/src/main/java/cc/mrbird/febs/common/entity/router/VueRouter.java
  77. 89 89
      febs-common/src/main/java/cc/mrbird/febs/common/entity/system/Log.java
  78. 163 163
      febs-common/src/main/java/cc/mrbird/febs/common/entity/system/LoginLog.java
  79. 21 21
      febs-common/src/main/java/cc/mrbird/febs/common/entity/system/RoleMenu.java
  80. 158 158
      febs-common/src/main/java/cc/mrbird/febs/common/entity/system/SystemUser.java
  81. 23 23
      febs-common/src/main/java/cc/mrbird/febs/common/entity/system/UserRole.java
  82. 15 15
      febs-common/src/main/java/cc/mrbird/febs/common/exception/FebsException.java
  83. 15 15
      febs-common/src/main/java/cc/mrbird/febs/common/exception/ValidateCodeException.java
  84. 105 105
      febs-common/src/main/java/cc/mrbird/febs/common/handler/BaseExceptionHandler.java
  85. 27 27
      febs-common/src/main/java/cc/mrbird/febs/common/handler/FebsAuthExceptionEntryPoint.java
  86. 35 35
      febs-common/src/main/java/cc/mrbird/febs/common/interceptor/FebsServerProtectInterceptor.java
  87. 556 556
      febs-common/src/main/java/cc/mrbird/febs/common/service/RedisService.java
  88. 97 97
      febs-common/src/main/java/cc/mrbird/febs/common/utils/DateUtil.java
  89. 277 277
      febs-common/src/main/java/cc/mrbird/febs/common/utils/FebsUtil.java
  90. 125 125
      febs-common/src/main/java/cc/mrbird/febs/common/utils/SortUtil.java
  91. 43 43
      febs-common/src/main/java/cc/mrbird/febs/common/utils/SpringContextUtil.java
  92. 92 92
      febs-common/src/main/java/cc/mrbird/febs/common/utils/TreeUtil.java
  93. 6 6
      febs-gateway/Dockerfile
  94. 90 90
      febs-gateway/pom.xml
  95. 57 57
      febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/configure/FebsGatewayErrorConfigure.java
  96. 24 24
      febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/controller/FallbackController.java
  97. 59 59
      febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/filter/FebsGatewayRequestFilter.java
  98. 70 70
      febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/handler/FebsGatewayExceptionHandler.java
  99. 20 20
      febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/properties/FebsGatewayProperties.java
  100. 42 42
      febs-gateway/src/main/java/cc/mrbird/febs/gateway/enhance/auth/AuthenticationManager.java

+ 12 - 12
.github/FUNDING.yml

@@ -1,12 +1,12 @@
-# These are supported funding model platforms
-
-github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
-patreon: # Replace with a single Patreon username
-open_collective: # Replace with a single Open Collective username
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-otechie: # Replace with a single Otechie username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

+ 10 - 10
.github/issue_template.md

@@ -1,10 +1,10 @@
-### 问题描述
-简单描述下遇到的问题
-
-### 复现步骤
-简单描述下问题复现的步骤
-
-### 相关截图
-提供相关截图,以协助问题分析
-
-> issue模板,by MrBird.
+### 问题描述
+简单描述下遇到的问题
+
+### 复现步骤
+简单描述下问题复现的步骤
+
+### 相关截图
+提供相关截图,以协助问题分析
+
+> issue模板,by MrBird.

+ 4 - 4
.gitignore

@@ -1,5 +1,5 @@
-**/target/
-**/**/target/
-**/.idea/
-**/log/
+**/target/
+**/**/target/
+**/.idea/
+**/log/
 **/*.iml

+ 201 - 201
LICENSE

@@ -1,201 +1,201 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [2019] [febs & mrbird]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [2019] [febs & mrbird]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

+ 6 - 6
febs-auth/Dockerfile

@@ -1,7 +1,7 @@
-FROM openjdk:8u212-jre
-MAINTAINER MrBird 852252810@qq.com
-
-COPY ./target/febs-auth-1.4-RELEASE.jar /febs/febs-auth-1.4-RELEASE.jar
-ADD agent/ /agent
-
+FROM openjdk:8u212-jre
+MAINTAINER MrBird 852252810@qq.com
+
+COPY ./target/febs-auth-1.4-RELEASE.jar /febs/febs-auth-1.4-RELEASE.jar
+ADD agent/ /agent
+
 ENTRYPOINT ["java", "-javaagent:/agent/skywalking-agent.jar", "-Dskywalking.agent.service_name=febs-auth", "-Dskywalking.collector.backend_service=${skywalking.url}:11800", "-jar", "/febs/febs-auth-1.4-RELEASE.jar"]

+ 71 - 71
febs-auth/pom.xml

@@ -1,71 +1,71 @@
-<?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>cc.mrbird</groupId>
-        <artifactId>febs-cloud</artifactId>
-        <version>1.6-RELEASE</version>
-        <relativePath>../febs-cloud/pom.xml</relativePath>
-    </parent>
-
-    <artifactId>febs-auth</artifactId>
-    <version>1.6-RELEASE</version>
-    <name>FEBS-Auth</name>
-    <description>FEBS-Cloud认证服务器</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>cc.mrbird</groupId>
-            <artifactId>febs-common</artifactId>
-            <version>1.6-RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-            <version>2.5.7</version>
-        </dependency>
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.github.whvcse</groupId>
-            <artifactId>easy-captcha</artifactId>
-            <version>1.6.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-pool2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>net.logstash.logback</groupId>
-            <artifactId>logstash-logback-encoder</artifactId>
-            <version>6.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-jdbc</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.xkcoding</groupId>
-            <artifactId>justauth-spring-boot-starter</artifactId>
-            <version>1.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-thymeleaf</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
+<?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>cc.mrbird</groupId>
+        <artifactId>febs-cloud</artifactId>
+        <version>1.6-RELEASE</version>
+        <relativePath>../febs-cloud/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>febs-auth</artifactId>
+    <version>1.6-RELEASE</version>
+    <name>FEBS-Auth</name>
+    <description>FEBS-Cloud认证服务器</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>cc.mrbird</groupId>
+            <artifactId>febs-common</artifactId>
+            <version>1.6-RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>2.5.7</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.github.whvcse</groupId>
+            <artifactId>easy-captcha</artifactId>
+            <version>1.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+            <version>6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.xkcoding</groupId>
+            <artifactId>justauth-spring-boot-starter</artifactId>
+            <version>1.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 24 - 24
febs-auth/src/main/java/cc/mrbird/febs/auth/FebsAuthApplication.java

@@ -1,24 +1,24 @@
-package cc.mrbird.febs.auth;
-
-import cc.mrbird.febs.common.annotation.EnableFebsAuthExceptionHandler;
-import cc.mrbird.febs.common.annotation.EnableFebsLettuceRedis;
-import cc.mrbird.febs.common.annotation.EnableFebsServerProtect;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
-
-@EnableDiscoveryClient
-@EnableFebsLettuceRedis
-@EnableFebsAuthExceptionHandler
-@EnableFebsServerProtect
-@SpringBootApplication
-@MapperScan("cc.mrbird.febs.auth.mapper")
-@EnableGlobalMethodSecurity(prePostEnabled = true)
-public class FebsAuthApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(FebsAuthApplication.class, args);
-    }
-}
+package cc.mrbird.febs.auth;
+
+import cc.mrbird.febs.common.annotation.EnableFebsAuthExceptionHandler;
+import cc.mrbird.febs.common.annotation.EnableFebsLettuceRedis;
+import cc.mrbird.febs.common.annotation.EnableFebsServerProtect;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+
+@EnableDiscoveryClient
+@EnableFebsLettuceRedis
+@EnableFebsAuthExceptionHandler
+@EnableFebsServerProtect
+@SpringBootApplication
+@MapperScan("cc.mrbird.febs.auth.mapper")
+@EnableGlobalMethodSecurity(prePostEnabled = true)
+public class FebsAuthApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(FebsAuthApplication.class, args);
+    }
+}

+ 120 - 120
febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsAuthorizationServerConfigure.java

@@ -1,120 +1,120 @@
-package cc.mrbird.febs.auth.configure;
-
-import cc.mrbird.febs.auth.properties.FebsAuthProperties;
-import cc.mrbird.febs.auth.service.impl.FebsUserDetailService;
-import cc.mrbird.febs.auth.service.impl.RedisClientDetailsService;
-import cc.mrbird.febs.auth.translator.FebsWebResponseExceptionTranslator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
-import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
-import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
-import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
-import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
-import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter;
-import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
-import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
-import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
-import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter;
-import org.springframework.security.oauth2.provider.token.TokenStore;
-import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
-import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
-import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
-
-import java.util.UUID;
-
-/**
- * 认证服务器配置
- *
- * @author MrBird
- */
-@Configuration
-@EnableAuthorizationServer
-public class FebsAuthorizationServerConfigure extends AuthorizationServerConfigurerAdapter {
-
-    @Autowired
-    private AuthenticationManager authenticationManager;
-    @Autowired
-    private FebsUserDetailService userDetailService;
-    @Autowired
-    private PasswordEncoder passwordEncoder;
-    @Autowired
-    private FebsWebResponseExceptionTranslator exceptionTranslator;
-    @Autowired
-    private FebsAuthProperties properties;
-    @Autowired
-    private RedisClientDetailsService redisClientDetailsService;
-    @Autowired
-    private RedisConnectionFactory redisConnectionFactory;
-
-    @Override
-    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
-        clients.withClientDetails(redisClientDetailsService);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
-        endpoints.tokenStore(tokenStore())
-                .userDetailsService(userDetailService)
-                .authenticationManager(authenticationManager)
-                .exceptionTranslator(exceptionTranslator);
-        if (properties.getEnableJwt()) {
-            endpoints.accessTokenConverter(jwtAccessTokenConverter());
-        }
-    }
-
-    @Bean
-    public TokenStore tokenStore() {
-        if (properties.getEnableJwt()) {
-            return new JwtTokenStore(jwtAccessTokenConverter());
-        } else {
-            RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory);
-            // 解决每次生成的 token都一样的问题
-            redisTokenStore.setAuthenticationKeyGenerator(oAuth2Authentication -> UUID.randomUUID().toString());
-            return redisTokenStore;
-        }
-    }
-
-    @Bean
-    @Primary
-    public DefaultTokenServices defaultTokenServices() {
-        DefaultTokenServices tokenServices = new DefaultTokenServices();
-
-        tokenServices.setTokenStore(tokenStore());
-        tokenServices.setSupportRefreshToken(true);
-        tokenServices.setClientDetailsService(redisClientDetailsService);
-        return tokenServices;
-    }
-
-    @Bean
-    public JwtAccessTokenConverter jwtAccessTokenConverter() {
-        JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();
-        DefaultAccessTokenConverter defaultAccessTokenConverter = (DefaultAccessTokenConverter) accessTokenConverter.getAccessTokenConverter();
-        DefaultUserAuthenticationConverter userAuthenticationConverter = new DefaultUserAuthenticationConverter();
-        userAuthenticationConverter.setUserDetailsService(userDetailService);
-        defaultAccessTokenConverter.setUserTokenConverter(userAuthenticationConverter);
-        accessTokenConverter.setSigningKey(properties.getJwtAccessKey());
-        return accessTokenConverter;
-    }
-
-    @Bean
-    public ResourceOwnerPasswordTokenGranter resourceOwnerPasswordTokenGranter(AuthenticationManager authenticationManager, OAuth2RequestFactory oAuth2RequestFactory) {
-        DefaultTokenServices defaultTokenServices = defaultTokenServices();
-        if (properties.getEnableJwt()) {
-            defaultTokenServices.setTokenEnhancer(jwtAccessTokenConverter());
-        }
-        return new ResourceOwnerPasswordTokenGranter(authenticationManager, defaultTokenServices, redisClientDetailsService, oAuth2RequestFactory);
-    }
-
-    @Bean
-    public DefaultOAuth2RequestFactory oAuth2RequestFactory() {
-        return new DefaultOAuth2RequestFactory(redisClientDetailsService);
-    }
-
-}
+package cc.mrbird.febs.auth.configure;
+
+import cc.mrbird.febs.auth.properties.FebsAuthProperties;
+import cc.mrbird.febs.auth.service.impl.FebsUserDetailService;
+import cc.mrbird.febs.auth.service.impl.RedisClientDetailsService;
+import cc.mrbird.febs.auth.translator.FebsWebResponseExceptionTranslator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
+import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
+import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter;
+import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
+import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
+import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
+import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter;
+import org.springframework.security.oauth2.provider.token.TokenStore;
+import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
+import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
+import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
+
+import java.util.UUID;
+
+/**
+ * 认证服务器配置
+ *
+ * @author MrBird
+ */
+@Configuration
+@EnableAuthorizationServer
+public class FebsAuthorizationServerConfigure extends AuthorizationServerConfigurerAdapter {
+
+    @Autowired
+    private AuthenticationManager authenticationManager;
+    @Autowired
+    private FebsUserDetailService userDetailService;
+    @Autowired
+    private PasswordEncoder passwordEncoder;
+    @Autowired
+    private FebsWebResponseExceptionTranslator exceptionTranslator;
+    @Autowired
+    private FebsAuthProperties properties;
+    @Autowired
+    private RedisClientDetailsService redisClientDetailsService;
+    @Autowired
+    private RedisConnectionFactory redisConnectionFactory;
+
+    @Override
+    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
+        clients.withClientDetails(redisClientDetailsService);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
+        endpoints.tokenStore(tokenStore())
+                .userDetailsService(userDetailService)
+                .authenticationManager(authenticationManager)
+                .exceptionTranslator(exceptionTranslator);
+        if (properties.getEnableJwt()) {
+            endpoints.accessTokenConverter(jwtAccessTokenConverter());
+        }
+    }
+
+    @Bean
+    public TokenStore tokenStore() {
+        if (properties.getEnableJwt()) {
+            return new JwtTokenStore(jwtAccessTokenConverter());
+        } else {
+            RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory);
+            // 解决每次生成的 token都一样的问题
+            redisTokenStore.setAuthenticationKeyGenerator(oAuth2Authentication -> UUID.randomUUID().toString());
+            return redisTokenStore;
+        }
+    }
+
+    @Bean
+    @Primary
+    public DefaultTokenServices defaultTokenServices() {
+        DefaultTokenServices tokenServices = new DefaultTokenServices();
+
+        tokenServices.setTokenStore(tokenStore());
+        tokenServices.setSupportRefreshToken(true);
+        tokenServices.setClientDetailsService(redisClientDetailsService);
+        return tokenServices;
+    }
+
+    @Bean
+    public JwtAccessTokenConverter jwtAccessTokenConverter() {
+        JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();
+        DefaultAccessTokenConverter defaultAccessTokenConverter = (DefaultAccessTokenConverter) accessTokenConverter.getAccessTokenConverter();
+        DefaultUserAuthenticationConverter userAuthenticationConverter = new DefaultUserAuthenticationConverter();
+        userAuthenticationConverter.setUserDetailsService(userDetailService);
+        defaultAccessTokenConverter.setUserTokenConverter(userAuthenticationConverter);
+        accessTokenConverter.setSigningKey(properties.getJwtAccessKey());
+        return accessTokenConverter;
+    }
+
+    @Bean
+    public ResourceOwnerPasswordTokenGranter resourceOwnerPasswordTokenGranter(AuthenticationManager authenticationManager, OAuth2RequestFactory oAuth2RequestFactory) {
+        DefaultTokenServices defaultTokenServices = defaultTokenServices();
+        if (properties.getEnableJwt()) {
+            defaultTokenServices.setTokenEnhancer(jwtAccessTokenConverter());
+        }
+        return new ResourceOwnerPasswordTokenGranter(authenticationManager, defaultTokenServices, redisClientDetailsService, oAuth2RequestFactory);
+    }
+
+    @Bean
+    public DefaultOAuth2RequestFactory oAuth2RequestFactory() {
+        return new DefaultOAuth2RequestFactory(redisClientDetailsService);
+    }
+
+}

+ 49 - 49
febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsResourceServerConfigure.java

@@ -1,49 +1,49 @@
-package cc.mrbird.febs.auth.configure;
-
-import cc.mrbird.febs.auth.properties.FebsAuthProperties;
-import cc.mrbird.febs.common.entity.constant.EndpointConstant;
-import cc.mrbird.febs.common.handler.FebsAccessDeniedHandler;
-import cc.mrbird.febs.common.handler.FebsAuthExceptionEntryPoint;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
-import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
-import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
-
-/**
- * 资源服务器配置
- *
- * @author MrBird
- */
-@Configuration
-@EnableResourceServer
-public class FebsResourceServerConfigure extends ResourceServerConfigurerAdapter {
-
-    @Autowired
-    private FebsAccessDeniedHandler accessDeniedHandler;
-    @Autowired
-    private FebsAuthExceptionEntryPoint exceptionEntryPoint;
-    @Autowired
-    private FebsAuthProperties properties;
-
-    @Override
-    public void configure(HttpSecurity http) throws Exception {
-        String[] anonUrls = StringUtils.splitByWholeSeparatorPreserveAllTokens(properties.getAnonUrl(), ",");
-
-        http.csrf().disable()
-                .requestMatchers().antMatchers(EndpointConstant.ALL)
-                .and()
-                .authorizeRequests()
-                .antMatchers(anonUrls).permitAll()
-                .antMatchers(EndpointConstant.ALL).authenticated()
-                .and().httpBasic();
-    }
-
-    @Override
-    public void configure(ResourceServerSecurityConfigurer resources) {
-        resources.authenticationEntryPoint(exceptionEntryPoint)
-                .accessDeniedHandler(accessDeniedHandler);
-    }
-}
+package cc.mrbird.febs.auth.configure;
+
+import cc.mrbird.febs.auth.properties.FebsAuthProperties;
+import cc.mrbird.febs.common.entity.constant.EndpointConstant;
+import cc.mrbird.febs.common.handler.FebsAccessDeniedHandler;
+import cc.mrbird.febs.common.handler.FebsAuthExceptionEntryPoint;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
+
+/**
+ * 资源服务器配置
+ *
+ * @author MrBird
+ */
+@Configuration
+@EnableResourceServer
+public class FebsResourceServerConfigure extends ResourceServerConfigurerAdapter {
+
+    @Autowired
+    private FebsAccessDeniedHandler accessDeniedHandler;
+    @Autowired
+    private FebsAuthExceptionEntryPoint exceptionEntryPoint;
+    @Autowired
+    private FebsAuthProperties properties;
+
+    @Override
+    public void configure(HttpSecurity http) throws Exception {
+        String[] anonUrls = StringUtils.splitByWholeSeparatorPreserveAllTokens(properties.getAnonUrl(), ",");
+
+        http.csrf().disable()
+                .requestMatchers().antMatchers(EndpointConstant.ALL)
+                .and()
+                .authorizeRequests()
+                .antMatchers(anonUrls).permitAll()
+                .antMatchers(EndpointConstant.ALL).authenticated()
+                .and().httpBasic();
+    }
+
+    @Override
+    public void configure(ResourceServerSecurityConfigurer resources) {
+        resources.authenticationEntryPoint(exceptionEntryPoint)
+                .accessDeniedHandler(accessDeniedHandler);
+    }
+}

+ 54 - 54
febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsSecurityConfigure.java

@@ -1,54 +1,54 @@
-package cc.mrbird.febs.auth.configure;
-
-import cc.mrbird.febs.auth.filter.ValidateCodeFilter;
-import cc.mrbird.febs.auth.service.impl.FebsUserDetailService;
-import cc.mrbird.febs.common.entity.constant.EndpointConstant;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.core.annotation.Order;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-
-/**
- * WebSecurity配置
- *
- * @author MrBird
- */
-@Order(2)
-@EnableWebSecurity
-public class FebsSecurityConfigure extends WebSecurityConfigurerAdapter {
-
-    @Autowired
-    private FebsUserDetailService userDetailService;
-    @Autowired
-    private ValidateCodeFilter validateCodeFilter;
-    @Autowired
-    private PasswordEncoder passwordEncoder;
-
-    @Bean
-    public AuthenticationManager authenticationManagerBean() throws Exception {
-        return super.authenticationManagerBean();
-    }
-
-    @Override
-    protected void configure(HttpSecurity http) throws Exception {
-        http.addFilterBefore(validateCodeFilter, UsernamePasswordAuthenticationFilter.class)
-                .requestMatchers()
-                .antMatchers(EndpointConstant.OAUTH_ALL)
-                .and()
-                .authorizeRequests()
-                .antMatchers(EndpointConstant.OAUTH_ALL).authenticated()
-                .and()
-                .csrf().disable();
-    }
-
-    @Override
-    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-        auth.userDetailsService(userDetailService).passwordEncoder(passwordEncoder);
-    }
-}
+package cc.mrbird.febs.auth.configure;
+
+import cc.mrbird.febs.auth.filter.ValidateCodeFilter;
+import cc.mrbird.febs.auth.service.impl.FebsUserDetailService;
+import cc.mrbird.febs.common.entity.constant.EndpointConstant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.core.annotation.Order;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+/**
+ * WebSecurity配置
+ *
+ * @author MrBird
+ */
+@Order(2)
+@EnableWebSecurity
+public class FebsSecurityConfigure extends WebSecurityConfigurerAdapter {
+
+    @Autowired
+    private FebsUserDetailService userDetailService;
+    @Autowired
+    private ValidateCodeFilter validateCodeFilter;
+    @Autowired
+    private PasswordEncoder passwordEncoder;
+
+    @Bean
+    public AuthenticationManager authenticationManagerBean() throws Exception {
+        return super.authenticationManagerBean();
+    }
+
+    @Override
+    protected void configure(HttpSecurity http) throws Exception {
+        http.addFilterBefore(validateCodeFilter, UsernamePasswordAuthenticationFilter.class)
+                .requestMatchers()
+                .antMatchers(EndpointConstant.OAUTH_ALL)
+                .and()
+                .authorizeRequests()
+                .antMatchers(EndpointConstant.OAUTH_ALL).authenticated()
+                .and()
+                .csrf().disable();
+    }
+
+    @Override
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+        auth.userDetailsService(userDetailService).passwordEncoder(passwordEncoder);
+    }
+}

+ 25 - 25
febs-auth/src/main/java/cc/mrbird/febs/auth/configure/FebsWebConfigure.java

@@ -1,25 +1,25 @@
-package cc.mrbird.febs.auth.configure;
-
-import com.baomidou.mybatisplus.core.parser.ISqlParser;
-import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author MrBird
- */
-@Configuration
-public class FebsWebConfigure {
-    @Bean
-    public PaginationInterceptor paginationInterceptor() {
-        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
-        List<ISqlParser> sqlParserList = new ArrayList<>();
-        sqlParserList.add(new BlockAttackSqlParser());
-        paginationInterceptor.setSqlParserList(sqlParserList);
-        return paginationInterceptor;
-    }
-}
+package cc.mrbird.febs.auth.configure;
+
+import com.baomidou.mybatisplus.core.parser.ISqlParser;
+import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+@Configuration
+public class FebsWebConfigure {
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
+        List<ISqlParser> sqlParserList = new ArrayList<>();
+        sqlParserList.add(new BlockAttackSqlParser());
+        paginationInterceptor.setSqlParserList(sqlParserList);
+        return paginationInterceptor;
+    }
+}

+ 89 - 89
febs-auth/src/main/java/cc/mrbird/febs/auth/controller/OAuthClientDetailsController.java

@@ -1,89 +1,89 @@
-package cc.mrbird.febs.auth.controller;
-
-import cc.mrbird.febs.auth.entity.OAuthClientDetails;
-import cc.mrbird.febs.auth.service.OAuthClientDetailsService;
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.common.exception.FebsException;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
-import java.util.Map;
-
-/**
- * @author Yuuki
- */
-@Slf4j
-@Validated
-@RestController
-@RequestMapping("client")
-public class OAuthClientDetailsController {
-
-    @Autowired
-    private OAuthClientDetailsService oAuthClientDetailsService;
-
-    @GetMapping("check/{clientId}")
-    public boolean checkUserName(@NotBlank(message = "{required}") @PathVariable String clientId) {
-        OAuthClientDetails client = this.oAuthClientDetailsService.findById(clientId);
-        return client == null;
-    }
-
-    @GetMapping("secret/{clientId}")
-    @PreAuthorize("hasAuthority('client:decrypt')")
-    public FebsResponse getOriginClientSecret(@NotBlank(message = "{required}") @PathVariable String clientId) {
-        OAuthClientDetails client = this.oAuthClientDetailsService.findById(clientId);
-        String origin = client != null ? client.getOriginSecret() : StringUtils.EMPTY;
-        return new FebsResponse().data(origin);
-    }
-
-    @GetMapping
-    @PreAuthorize("hasAuthority('client:view')")
-    public FebsResponse oauthCliendetailsList(QueryRequest request, OAuthClientDetails oAuthClientDetails) {
-        Map<String, Object> dataTable = FebsUtil.getDataTable(this.oAuthClientDetailsService.findOAuthClientDetails(request, oAuthClientDetails));
-        return new FebsResponse().data(dataTable);
-    }
-
-
-    @PostMapping
-    @PreAuthorize("hasAuthority('client:add')")
-    public void addOauthCliendetails(@Valid OAuthClientDetails oAuthClientDetails) throws FebsException {
-        try {
-            this.oAuthClientDetailsService.createOAuthClientDetails(oAuthClientDetails);
-        } catch (Exception e) {
-            String message = "新增客户端失败";
-            log.error(message, e);
-            throw new FebsException(message);
-        }
-    }
-
-    @DeleteMapping
-    @PreAuthorize("hasAuthority('client:delete')")
-    public void deleteOauthCliendetails(@NotBlank(message = "{required}") String clientIds) throws FebsException {
-        try {
-            this.oAuthClientDetailsService.deleteOAuthClientDetails(clientIds);
-        } catch (Exception e) {
-            String message = "删除客户端失败";
-            log.error(message, e);
-            throw new FebsException(message);
-        }
-    }
-
-    @PutMapping
-    @PreAuthorize("hasAuthority('client:update')")
-    public void updateOauthCliendetails(@Valid OAuthClientDetails oAuthClientDetails) throws FebsException {
-        try {
-            this.oAuthClientDetailsService.updateOAuthClientDetails(oAuthClientDetails);
-        } catch (Exception e) {
-            String message = "修改客户端失败";
-            log.error(message, e);
-            throw new FebsException(message);
-        }
-    }
-}
+package cc.mrbird.febs.auth.controller;
+
+import cc.mrbird.febs.auth.entity.OAuthClientDetails;
+import cc.mrbird.febs.auth.service.OAuthClientDetailsService;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import java.util.Map;
+
+/**
+ * @author Yuuki
+ */
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("client")
+public class OAuthClientDetailsController {
+
+    @Autowired
+    private OAuthClientDetailsService oAuthClientDetailsService;
+
+    @GetMapping("check/{clientId}")
+    public boolean checkUserName(@NotBlank(message = "{required}") @PathVariable String clientId) {
+        OAuthClientDetails client = this.oAuthClientDetailsService.findById(clientId);
+        return client == null;
+    }
+
+    @GetMapping("secret/{clientId}")
+    @PreAuthorize("hasAuthority('client:decrypt')")
+    public FebsResponse getOriginClientSecret(@NotBlank(message = "{required}") @PathVariable String clientId) {
+        OAuthClientDetails client = this.oAuthClientDetailsService.findById(clientId);
+        String origin = client != null ? client.getOriginSecret() : StringUtils.EMPTY;
+        return new FebsResponse().data(origin);
+    }
+
+    @GetMapping
+    @PreAuthorize("hasAuthority('client:view')")
+    public FebsResponse oauthCliendetailsList(QueryRequest request, OAuthClientDetails oAuthClientDetails) {
+        Map<String, Object> dataTable = FebsUtil.getDataTable(this.oAuthClientDetailsService.findOAuthClientDetails(request, oAuthClientDetails));
+        return new FebsResponse().data(dataTable);
+    }
+
+
+    @PostMapping
+    @PreAuthorize("hasAuthority('client:add')")
+    public void addOauthCliendetails(@Valid OAuthClientDetails oAuthClientDetails) throws FebsException {
+        try {
+            this.oAuthClientDetailsService.createOAuthClientDetails(oAuthClientDetails);
+        } catch (Exception e) {
+            String message = "新增客户端失败";
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
+
+    @DeleteMapping
+    @PreAuthorize("hasAuthority('client:delete')")
+    public void deleteOauthCliendetails(@NotBlank(message = "{required}") String clientIds) throws FebsException {
+        try {
+            this.oAuthClientDetailsService.deleteOAuthClientDetails(clientIds);
+        } catch (Exception e) {
+            String message = "删除客户端失败";
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
+
+    @PutMapping
+    @PreAuthorize("hasAuthority('client:update')")
+    public void updateOauthCliendetails(@Valid OAuthClientDetails oAuthClientDetails) throws FebsException {
+        try {
+            this.oAuthClientDetailsService.updateOAuthClientDetails(oAuthClientDetails);
+        } catch (Exception e) {
+            String message = "修改客户端失败";
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
+}

+ 35 - 35
febs-auth/src/main/java/cc/mrbird/febs/auth/controller/SecurityController.java

@@ -1,35 +1,35 @@
-package cc.mrbird.febs.auth.controller;
-
-import cc.mrbird.febs.auth.manager.UserManager;
-import cc.mrbird.febs.auth.service.ValidateCodeService;
-import cc.mrbird.febs.common.exception.ValidateCodeException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.security.Principal;
-
-/**
- * @author MrBird
- */
-@RestController
-public class SecurityController {
-
-    @Autowired
-    private ValidateCodeService validateCodeService;
-    @Autowired
-    private UserManager userManager;
-
-    @GetMapping("user")
-    public Principal currentUser(Principal principal) {
-        return principal;
-    }
-
-    @GetMapping("captcha")
-    public void captcha(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException {
-        validateCodeService.create(request, response);
-    }
-}
+package cc.mrbird.febs.auth.controller;
+
+import cc.mrbird.febs.auth.manager.UserManager;
+import cc.mrbird.febs.auth.service.ValidateCodeService;
+import cc.mrbird.febs.common.exception.ValidateCodeException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.security.Principal;
+
+/**
+ * @author MrBird
+ */
+@RestController
+public class SecurityController {
+
+    @Autowired
+    private ValidateCodeService validateCodeService;
+    @Autowired
+    private UserManager userManager;
+
+    @GetMapping("user")
+    public Principal currentUser(Principal principal) {
+        return principal;
+    }
+
+    @GetMapping("captcha")
+    public void captcha(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException {
+        validateCodeService.create(request, response);
+    }
+}

+ 148 - 148
febs-auth/src/main/java/cc/mrbird/febs/auth/controller/SocialLoginController.java

@@ -1,148 +1,148 @@
-package cc.mrbird.febs.auth.controller;
-
-import cc.mrbird.febs.auth.entity.BindUser;
-import cc.mrbird.febs.auth.entity.UserConnection;
-import cc.mrbird.febs.auth.service.SocialLoginService;
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.exception.FebsException;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import lombok.extern.slf4j.Slf4j;
-import me.zhyd.oauth.model.AuthCallback;
-import me.zhyd.oauth.model.AuthUser;
-import me.zhyd.oauth.request.AuthRequest;
-import me.zhyd.oauth.utils.AuthStateUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.oauth2.common.OAuth2AccessToken;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author MrBird
- */
-@Slf4j
-@Controller
-@RequestMapping("social")
-public class SocialLoginController {
-
-    private static final String TYPE_LOGIN = "login";
-    private static final String TYPE_BIND = "bind";
-
-    @Autowired
-    private SocialLoginService socialLoginService;
-    @Value("${febs.frontUrl}")
-    private String frontUrl;
-
-    /**
-     * 登录
-     *
-     * @param oauthType 第三方登录类型
-     * @param response  response
-     */
-    @ResponseBody
-    @GetMapping("/login/{oauthType}/{type}")
-    public void renderAuth(@PathVariable String oauthType, @PathVariable String type, HttpServletResponse response) throws IOException, FebsException {
-        AuthRequest authRequest = socialLoginService.renderAuth(oauthType);
-        response.sendRedirect(authRequest.authorize(oauthType + "::" + AuthStateUtils.createState()) + "::" + type);
-    }
-
-    /**
-     * 登录成功后的回调
-     *
-     * @param oauthType 第三方登录类型
-     * @param callback  携带返回的信息
-     * @return String
-     */
-    @GetMapping("/{oauthType}/callback")
-    public String login(@PathVariable String oauthType, AuthCallback callback, String state, Model model) {
-        try {
-            FebsResponse febsResponse = null;
-            String type = StringUtils.substringAfterLast(state, "::");
-            if (StringUtils.equals(type, TYPE_BIND)) {
-                febsResponse = socialLoginService.resolveBind(oauthType, callback);
-            } else {
-                febsResponse = socialLoginService.resolveLogin(oauthType, callback);
-            }
-            model.addAttribute("response", febsResponse);
-            model.addAttribute("frontUrl", frontUrl);
-            return "result";
-        } catch (Exception e) {
-            String errorMessage = FebsUtil.containChinese(e.getMessage()) ? e.getMessage() : "第三方登录失败";
-            model.addAttribute("error", e.getMessage());
-            return "error";
-        }
-    }
-
-    /**
-     * 绑定并登录
-     *
-     * @param bindUser bindUser
-     * @param authUser authUser
-     * @return FebsResponse
-     */
-    @ResponseBody
-    @PostMapping("bind/login")
-    public FebsResponse bindLogin(@Valid BindUser bindUser, AuthUser authUser) throws FebsException {
-        OAuth2AccessToken oAuth2AccessToken = this.socialLoginService.bindLogin(bindUser, authUser);
-        return new FebsResponse().data(oAuth2AccessToken);
-    }
-
-    /**
-     * 注册并登录
-     *
-     * @param registUser registUser
-     * @param authUser   authUser
-     * @return FebsResponse
-     */
-    @ResponseBody
-    @PostMapping("sign/login")
-    public FebsResponse signLogin(@Valid BindUser registUser, AuthUser authUser) throws FebsException {
-        OAuth2AccessToken oAuth2AccessToken = this.socialLoginService.signLogin(registUser, authUser);
-        return new FebsResponse().data(oAuth2AccessToken);
-    }
-
-    /**
-     * 绑定
-     *
-     * @param bindUser bindUser
-     * @param authUser authUser
-     */
-    @ResponseBody
-    @PostMapping("bind")
-    public void bind(BindUser bindUser, AuthUser authUser) throws FebsException {
-        this.socialLoginService.bind(bindUser, authUser);
-    }
-
-    /**
-     * 解绑
-     *
-     * @param bindUser  bindUser
-     * @param oauthType oauthType
-     */
-    @ResponseBody
-    @DeleteMapping("unbind")
-    public void unbind(BindUser bindUser, String oauthType) throws FebsException {
-        this.socialLoginService.unbind(bindUser, oauthType);
-    }
-
-    /**
-     * 根据用户名获取绑定关系
-     *
-     * @param username 用户名
-     * @return FebsResponse
-     */
-    @ResponseBody
-    @GetMapping("connections/{username}")
-    public FebsResponse findUserConnections(@NotBlank(message = "{required}") @PathVariable String username) {
-        List<UserConnection> userConnections = this.socialLoginService.findUserConnections(username);
-        return new FebsResponse().data(userConnections);
-    }
-}
+package cc.mrbird.febs.auth.controller;
+
+import cc.mrbird.febs.auth.entity.BindUser;
+import cc.mrbird.febs.auth.entity.UserConnection;
+import cc.mrbird.febs.auth.service.SocialLoginService;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import lombok.extern.slf4j.Slf4j;
+import me.zhyd.oauth.model.AuthCallback;
+import me.zhyd.oauth.model.AuthUser;
+import me.zhyd.oauth.request.AuthRequest;
+import me.zhyd.oauth.utils.AuthStateUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+@Slf4j
+@Controller
+@RequestMapping("social")
+public class SocialLoginController {
+
+    private static final String TYPE_LOGIN = "login";
+    private static final String TYPE_BIND = "bind";
+
+    @Autowired
+    private SocialLoginService socialLoginService;
+    @Value("${febs.frontUrl}")
+    private String frontUrl;
+
+    /**
+     * 登录
+     *
+     * @param oauthType 第三方登录类型
+     * @param response  response
+     */
+    @ResponseBody
+    @GetMapping("/login/{oauthType}/{type}")
+    public void renderAuth(@PathVariable String oauthType, @PathVariable String type, HttpServletResponse response) throws IOException, FebsException {
+        AuthRequest authRequest = socialLoginService.renderAuth(oauthType);
+        response.sendRedirect(authRequest.authorize(oauthType + "::" + AuthStateUtils.createState()) + "::" + type);
+    }
+
+    /**
+     * 登录成功后的回调
+     *
+     * @param oauthType 第三方登录类型
+     * @param callback  携带返回的信息
+     * @return String
+     */
+    @GetMapping("/{oauthType}/callback")
+    public String login(@PathVariable String oauthType, AuthCallback callback, String state, Model model) {
+        try {
+            FebsResponse febsResponse = null;
+            String type = StringUtils.substringAfterLast(state, "::");
+            if (StringUtils.equals(type, TYPE_BIND)) {
+                febsResponse = socialLoginService.resolveBind(oauthType, callback);
+            } else {
+                febsResponse = socialLoginService.resolveLogin(oauthType, callback);
+            }
+            model.addAttribute("response", febsResponse);
+            model.addAttribute("frontUrl", frontUrl);
+            return "result";
+        } catch (Exception e) {
+            String errorMessage = FebsUtil.containChinese(e.getMessage()) ? e.getMessage() : "第三方登录失败";
+            model.addAttribute("error", e.getMessage());
+            return "error";
+        }
+    }
+
+    /**
+     * 绑定并登录
+     *
+     * @param bindUser bindUser
+     * @param authUser authUser
+     * @return FebsResponse
+     */
+    @ResponseBody
+    @PostMapping("bind/login")
+    public FebsResponse bindLogin(@Valid BindUser bindUser, AuthUser authUser) throws FebsException {
+        OAuth2AccessToken oAuth2AccessToken = this.socialLoginService.bindLogin(bindUser, authUser);
+        return new FebsResponse().data(oAuth2AccessToken);
+    }
+
+    /**
+     * 注册并登录
+     *
+     * @param registUser registUser
+     * @param authUser   authUser
+     * @return FebsResponse
+     */
+    @ResponseBody
+    @PostMapping("sign/login")
+    public FebsResponse signLogin(@Valid BindUser registUser, AuthUser authUser) throws FebsException {
+        OAuth2AccessToken oAuth2AccessToken = this.socialLoginService.signLogin(registUser, authUser);
+        return new FebsResponse().data(oAuth2AccessToken);
+    }
+
+    /**
+     * 绑定
+     *
+     * @param bindUser bindUser
+     * @param authUser authUser
+     */
+    @ResponseBody
+    @PostMapping("bind")
+    public void bind(BindUser bindUser, AuthUser authUser) throws FebsException {
+        this.socialLoginService.bind(bindUser, authUser);
+    }
+
+    /**
+     * 解绑
+     *
+     * @param bindUser  bindUser
+     * @param oauthType oauthType
+     */
+    @ResponseBody
+    @DeleteMapping("unbind")
+    public void unbind(BindUser bindUser, String oauthType) throws FebsException {
+        this.socialLoginService.unbind(bindUser, oauthType);
+    }
+
+    /**
+     * 根据用户名获取绑定关系
+     *
+     * @param username 用户名
+     * @return FebsResponse
+     */
+    @ResponseBody
+    @GetMapping("connections/{username}")
+    public FebsResponse findUserConnections(@NotBlank(message = "{required}") @PathVariable String username) {
+        List<UserConnection> userConnections = this.socialLoginService.findUserConnections(username);
+        return new FebsResponse().data(userConnections);
+    }
+}

+ 20 - 20
febs-auth/src/main/java/cc/mrbird/febs/auth/entity/BindUser.java

@@ -1,20 +1,20 @@
-package cc.mrbird.febs.auth.entity;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-
-/**
- * @author MrBird
- */
-@Data
-public class BindUser implements Serializable {
-
-    private static final long serialVersionUID = -3890998115990166651L;
-
-    @NotBlank(message = "{required}")
-    private String bindUsername;
-    @NotBlank(message = "{required}")
-    private String bindPassword;
-}
+package cc.mrbird.febs.auth.entity;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @author MrBird
+ */
+@Data
+public class BindUser implements Serializable {
+
+    private static final long serialVersionUID = -3890998115990166651L;
+
+    @NotBlank(message = "{required}")
+    private String bindUsername;
+    @NotBlank(message = "{required}")
+    private String bindPassword;
+}

+ 66 - 66
febs-auth/src/main/java/cc/mrbird/febs/auth/entity/OAuthClientDetails.java

@@ -1,66 +1,66 @@
-package cc.mrbird.febs.auth.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import java.io.Serializable;
-
-/**
- * @author Yuuki
- */
-@Data
-@TableName("oauth_client_details")
-public class OAuthClientDetails implements Serializable {
-
-    private static final long serialVersionUID = 421783821058285802L;
-
-    @TableId(value = "client_id")
-    @NotBlank(message = "{required}")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String clientId;
-
-    @TableField("resource_ids")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String resourceIds;
-
-    @TableField("client_secret")
-    @NotBlank(message = "{required}")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String clientSecret;
-
-    @TableField("scope")
-    @NotBlank(message = "{required}")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String scope;
-
-    @TableField("authorized_grant_types")
-    @NotBlank(message = "{required}")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String authorizedGrantTypes;
-
-    @TableField("web_server_redirect_uri")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String webServerRedirectUri;
-
-    @TableField("authorities")
-    @Size(max = 255, message = "{noMoreThan}")
-    private String authorities;
-
-    @TableField("access_token_validity")
-    @NotNull(message = "{required}")
-    private Integer accessTokenValidity;
-
-    @TableField("refresh_token_validity")
-    private Integer refreshTokenValidity;
-
-    @TableField("autoapprove")
-    private Byte autoapprove;
-
-    @TableField("origin_secret")
-    private String originSecret;
-}
+package cc.mrbird.febs.auth.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+
+/**
+ * @author Yuuki
+ */
+@Data
+@TableName("oauth_client_details")
+public class OAuthClientDetails implements Serializable {
+
+    private static final long serialVersionUID = 421783821058285802L;
+
+    @TableId(value = "client_id")
+    @NotBlank(message = "{required}")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String clientId;
+
+    @TableField("resource_ids")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String resourceIds;
+
+    @TableField("client_secret")
+    @NotBlank(message = "{required}")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String clientSecret;
+
+    @TableField("scope")
+    @NotBlank(message = "{required}")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String scope;
+
+    @TableField("authorized_grant_types")
+    @NotBlank(message = "{required}")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String authorizedGrantTypes;
+
+    @TableField("web_server_redirect_uri")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String webServerRedirectUri;
+
+    @TableField("authorities")
+    @Size(max = 255, message = "{noMoreThan}")
+    private String authorities;
+
+    @TableField("access_token_validity")
+    @NotNull(message = "{required}")
+    private Integer accessTokenValidity;
+
+    @TableField("refresh_token_validity")
+    private Integer refreshTokenValidity;
+
+    @TableField("autoapprove")
+    private Byte autoapprove;
+
+    @TableField("origin_secret")
+    private String originSecret;
+}

+ 44 - 44
febs-auth/src/main/java/cc/mrbird/febs/auth/entity/UserConnection.java

@@ -1,45 +1,45 @@
-package cc.mrbird.febs.auth.entity;
-
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-
-/**
- * @author MrBird
- */
-@Data
-@TableName("t_user_connection")
-public class UserConnection {
-
-    @TableId(value = "USER_NAME")
-    @NotBlank(message = "{required}")
-    private String userName;
-
-    @TableId(value = "PROVIDER_NAME")
-    @NotBlank(message = "{required}")
-    private String providerName;
-
-    @TableId(value = "PROVIDER_USER_ID")
-    @NotBlank(message = "{required}")
-    private String providerUserId;
-
-    @TableField(value = "PROVIDER_USER_NAME")
-    private String providerUserName;
-
-    @TableField(value = "NICK_NAME")
-    private String nickName;
-
-    @TableField("IMAGE_URL")
-    private String imageUrl;
-
-    @TableField("LOCATION")
-    private String location;
-
-    @TableField("REMARK")
-    private String remark;
-
+package cc.mrbird.febs.auth.entity;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author MrBird
+ */
+@Data
+@TableName("t_user_connection")
+public class UserConnection {
+
+    @TableId(value = "USER_NAME")
+    @NotBlank(message = "{required}")
+    private String userName;
+
+    @TableId(value = "PROVIDER_NAME")
+    @NotBlank(message = "{required}")
+    private String providerName;
+
+    @TableId(value = "PROVIDER_USER_ID")
+    @NotBlank(message = "{required}")
+    private String providerUserId;
+
+    @TableField(value = "PROVIDER_USER_NAME")
+    private String providerUserName;
+
+    @TableField(value = "NICK_NAME")
+    private String nickName;
+
+    @TableField("IMAGE_URL")
+    private String imageUrl;
+
+    @TableField("LOCATION")
+    private String location;
+
+    @TableField("REMARK")
+    private String remark;
+
 }

+ 86 - 86
febs-auth/src/main/java/cc/mrbird/febs/auth/filter/ValidateCodeFilter.java

@@ -1,86 +1,86 @@
-package cc.mrbird.febs.auth.filter;
-
-import cc.mrbird.febs.auth.service.ValidateCodeService;
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.entity.constant.EndpointConstant;
-import cc.mrbird.febs.common.entity.constant.GrantTypeConstant;
-import cc.mrbird.febs.common.entity.constant.ParamsConstant;
-import cc.mrbird.febs.common.exception.ValidateCodeException;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
-import org.springframework.security.web.util.matcher.RequestMatcher;
-import org.springframework.stereotype.Component;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-import javax.annotation.Nonnull;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.Base64;
-
-/**
- * 验证码过滤器
- *
- * @author MrBird
- */
-@Slf4j
-@Component
-public class ValidateCodeFilter extends OncePerRequestFilter {
-
-    @Autowired
-    private ValidateCodeService validateCodeService;
-
-    @Override
-    protected void doFilterInternal(@Nonnull HttpServletRequest httpServletRequest, @Nonnull HttpServletResponse httpServletResponse, @Nonnull FilterChain filterChain) throws ServletException, IOException {
-        String header = httpServletRequest.getHeader(HttpHeaders.AUTHORIZATION);
-        String clientId = getClientId(header, httpServletRequest);
-
-        RequestMatcher matcher = new AntPathRequestMatcher(EndpointConstant.OAUTH_TOKEN, HttpMethod.POST.toString());
-        if (matcher.matches(httpServletRequest)
-                && StringUtils.equalsIgnoreCase(httpServletRequest.getParameter(ParamsConstant.GRANT_TYPE), GrantTypeConstant.PASSWORD)
-                && !StringUtils.equalsAnyIgnoreCase(clientId, "swagger")) {
-            try {
-                validateCode(httpServletRequest);
-                filterChain.doFilter(httpServletRequest, httpServletResponse);
-            } catch (ValidateCodeException e) {
-                FebsResponse febsResponse = new FebsResponse();
-                FebsUtil.makeResponse(httpServletResponse, MediaType.APPLICATION_JSON_VALUE,
-                        HttpServletResponse.SC_INTERNAL_SERVER_ERROR, febsResponse.message(e.getMessage()));
-                log.error(e.getMessage(), e);
-            }
-        } else {
-            filterChain.doFilter(httpServletRequest, httpServletResponse);
-        }
-    }
-
-    private void validateCode(HttpServletRequest httpServletRequest) throws ValidateCodeException {
-        String code = httpServletRequest.getParameter(ParamsConstant.VALIDATE_CODE_CODE);
-        String key = httpServletRequest.getParameter(ParamsConstant.VALIDATE_CODE_KEY);
-        validateCodeService.check(key, code);
-    }
-
-    private String getClientId(String header, HttpServletRequest request) {
-        String clientId = "";
-        try {
-            byte[] base64Token = header.substring(6).getBytes(StandardCharsets.UTF_8);
-            byte[] decoded;
-            decoded = Base64.getDecoder().decode(base64Token);
-            String token = new String(decoded, StandardCharsets.UTF_8);
-            int delim = token.indexOf(":");
-            if (delim != -1) {
-                clientId = new String[]{token.substring(0, delim), token.substring(delim + 1)}[0];
-            }
-        } catch (Exception ignore) {
-        }
-        return clientId;
-    }
-}
+package cc.mrbird.febs.auth.filter;
+
+import cc.mrbird.febs.auth.service.ValidateCodeService;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.entity.constant.EndpointConstant;
+import cc.mrbird.febs.common.entity.constant.GrantTypeConstant;
+import cc.mrbird.febs.common.entity.constant.ParamsConstant;
+import cc.mrbird.febs.common.exception.ValidateCodeException;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.security.web.util.matcher.RequestMatcher;
+import org.springframework.stereotype.Component;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.annotation.Nonnull;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * 验证码过滤器
+ *
+ * @author MrBird
+ */
+@Slf4j
+@Component
+public class ValidateCodeFilter extends OncePerRequestFilter {
+
+    @Autowired
+    private ValidateCodeService validateCodeService;
+
+    @Override
+    protected void doFilterInternal(@Nonnull HttpServletRequest httpServletRequest, @Nonnull HttpServletResponse httpServletResponse, @Nonnull FilterChain filterChain) throws ServletException, IOException {
+        String header = httpServletRequest.getHeader(HttpHeaders.AUTHORIZATION);
+        String clientId = getClientId(header, httpServletRequest);
+
+        RequestMatcher matcher = new AntPathRequestMatcher(EndpointConstant.OAUTH_TOKEN, HttpMethod.POST.toString());
+        if (matcher.matches(httpServletRequest)
+                && StringUtils.equalsIgnoreCase(httpServletRequest.getParameter(ParamsConstant.GRANT_TYPE), GrantTypeConstant.PASSWORD)
+                && !StringUtils.equalsAnyIgnoreCase(clientId, "swagger")) {
+            try {
+                validateCode(httpServletRequest);
+                filterChain.doFilter(httpServletRequest, httpServletResponse);
+            } catch (ValidateCodeException e) {
+                FebsResponse febsResponse = new FebsResponse();
+                FebsUtil.makeResponse(httpServletResponse, MediaType.APPLICATION_JSON_VALUE,
+                        HttpServletResponse.SC_INTERNAL_SERVER_ERROR, febsResponse.message(e.getMessage()));
+                log.error(e.getMessage(), e);
+            }
+        } else {
+            filterChain.doFilter(httpServletRequest, httpServletResponse);
+        }
+    }
+
+    private void validateCode(HttpServletRequest httpServletRequest) throws ValidateCodeException {
+        String code = httpServletRequest.getParameter(ParamsConstant.VALIDATE_CODE_CODE);
+        String key = httpServletRequest.getParameter(ParamsConstant.VALIDATE_CODE_KEY);
+        validateCodeService.check(key, code);
+    }
+
+    private String getClientId(String header, HttpServletRequest request) {
+        String clientId = "";
+        try {
+            byte[] base64Token = header.substring(6).getBytes(StandardCharsets.UTF_8);
+            byte[] decoded;
+            decoded = Base64.getDecoder().decode(base64Token);
+            String token = new String(decoded, StandardCharsets.UTF_8);
+            int delim = token.indexOf(":");
+            if (delim != -1) {
+                clientId = new String[]{token.substring(0, delim), token.substring(delim + 1)}[0];
+            }
+        } catch (Exception ignore) {
+        }
+        return clientId;
+    }
+}

+ 81 - 81
febs-auth/src/main/java/cc/mrbird/febs/auth/manager/UserManager.java

@@ -1,81 +1,81 @@
-package cc.mrbird.febs.auth.manager;
-
-import cc.mrbird.febs.auth.mapper.MenuMapper;
-import cc.mrbird.febs.auth.mapper.UserMapper;
-import cc.mrbird.febs.auth.mapper.UserRoleMapper;
-import cc.mrbird.febs.common.entity.constant.FebsConstant;
-import cc.mrbird.febs.common.entity.system.Menu;
-import cc.mrbird.febs.common.entity.system.SystemUser;
-import cc.mrbird.febs.common.entity.system.UserRole;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 用户业务逻辑
- *
- * @author MrBird
- */
-@Service
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
-public class UserManager {
-
-    @Autowired
-    private UserMapper userMapper;
-    @Autowired
-    private MenuMapper menuMapper;
-    @Autowired
-    private UserRoleMapper userRoleMapper;
-
-    /**
-     * 通过用户名查询用户信息
-     *
-     * @param username 用户名
-     * @return 用户
-     */
-    public SystemUser findByName(String username) {
-        return userMapper.findByName(username);
-    }
-
-    /**
-     * 通过用户名查询用户权限串
-     *
-     * @param username 用户名
-     * @return 权限
-     */
-    public String findUserPermissions(String username) {
-        List<Menu> userPermissions = menuMapper.findUserPermissions(username);
-        return userPermissions.stream().map(Menu::getPerms).collect(Collectors.joining(","));
-    }
-
-    /**
-     * 注册用户
-     *
-     * @param username username
-     * @param password password
-     * @return SystemUser SystemUser
-     */
-    @Transactional
-    public SystemUser registUser(String username,String password) {
-        SystemUser systemUser = new SystemUser();
-        systemUser.setUsername(username);
-        systemUser.setPassword(password);
-        systemUser.setCreateTime(new Date());
-        systemUser.setStatus(SystemUser.STATUS_VALID);
-        systemUser.setSex(SystemUser.SEX_UNKNOW);
-        systemUser.setAvatar(SystemUser.DEFAULT_AVATAR);
-        systemUser.setDescription("注册用户");
-        this.userMapper.insert(systemUser);
-
-        UserRole userRole = new UserRole();
-        userRole.setUserId(systemUser.getUserId());
-        userRole.setRoleId(FebsConstant.REGISTER_ROLE_ID); // 注册用户角色 ID
-        this.userRoleMapper.insert(userRole);
-        return systemUser;
-    }
-}
+package cc.mrbird.febs.auth.manager;
+
+import cc.mrbird.febs.auth.mapper.MenuMapper;
+import cc.mrbird.febs.auth.mapper.UserMapper;
+import cc.mrbird.febs.auth.mapper.UserRoleMapper;
+import cc.mrbird.febs.common.entity.constant.FebsConstant;
+import cc.mrbird.febs.common.entity.system.Menu;
+import cc.mrbird.febs.common.entity.system.SystemUser;
+import cc.mrbird.febs.common.entity.system.UserRole;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 用户业务逻辑
+ *
+ * @author MrBird
+ */
+@Service
+@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
+public class UserManager {
+
+    @Autowired
+    private UserMapper userMapper;
+    @Autowired
+    private MenuMapper menuMapper;
+    @Autowired
+    private UserRoleMapper userRoleMapper;
+
+    /**
+     * 通过用户名查询用户信息
+     *
+     * @param username 用户名
+     * @return 用户
+     */
+    public SystemUser findByName(String username) {
+        return userMapper.findByName(username);
+    }
+
+    /**
+     * 通过用户名查询用户权限串
+     *
+     * @param username 用户名
+     * @return 权限
+     */
+    public String findUserPermissions(String username) {
+        List<Menu> userPermissions = menuMapper.findUserPermissions(username);
+        return userPermissions.stream().map(Menu::getPerms).collect(Collectors.joining(","));
+    }
+
+    /**
+     * 注册用户
+     *
+     * @param username username
+     * @param password password
+     * @return SystemUser SystemUser
+     */
+    @Transactional
+    public SystemUser registUser(String username,String password) {
+        SystemUser systemUser = new SystemUser();
+        systemUser.setUsername(username);
+        systemUser.setPassword(password);
+        systemUser.setCreateTime(new Date());
+        systemUser.setStatus(SystemUser.STATUS_VALID);
+        systemUser.setSex(SystemUser.SEX_UNKNOW);
+        systemUser.setAvatar(SystemUser.DEFAULT_AVATAR);
+        systemUser.setDescription("注册用户");
+        this.userMapper.insert(systemUser);
+
+        UserRole userRole = new UserRole();
+        userRole.setUserId(systemUser.getUserId());
+        userRole.setRoleId(FebsConstant.REGISTER_ROLE_ID); // 注册用户角色 ID
+        this.userRoleMapper.insert(userRole);
+        return systemUser;
+    }
+}

+ 13 - 13
febs-auth/src/main/java/cc/mrbird/febs/auth/mapper/MenuMapper.java

@@ -1,14 +1,14 @@
-package cc.mrbird.febs.auth.mapper;
-
-import cc.mrbird.febs.common.entity.system.Menu;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-/**
- * @author MrBird
- */
-public interface MenuMapper extends BaseMapper<Menu> {
-
-    List<Menu> findUserPermissions(String username);
+package cc.mrbird.febs.auth.mapper;
+
+import cc.mrbird.febs.common.entity.system.Menu;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+public interface MenuMapper extends BaseMapper<Menu> {
+
+    List<Menu> findUserPermissions(String username);
 }

+ 10 - 10
febs-auth/src/main/java/cc/mrbird/febs/auth/mapper/OAuthClientDetailsMapper.java

@@ -1,10 +1,10 @@
-package cc.mrbird.febs.auth.mapper;
-
-import cc.mrbird.febs.auth.entity.OAuthClientDetails;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * @author Yuuki
- */
-public interface OAuthClientDetailsMapper extends BaseMapper<OAuthClientDetails> {
-}
+package cc.mrbird.febs.auth.mapper;
+
+import cc.mrbird.febs.auth.entity.OAuthClientDetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @author Yuuki
+ */
+public interface OAuthClientDetailsMapper extends BaseMapper<OAuthClientDetails> {
+}

+ 38 - 38
febs-auth/src/main/java/cc/mrbird/febs/auth/properties/FebsAuthProperties.java

@@ -1,38 +1,38 @@
-package cc.mrbird.febs.auth.properties;
-
-import lombok.Data;
-import org.springframework.boot.SpringBootConfiguration;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.PropertySource;
-
-/**
- * @author MrBird
- */
-@Data
-@SpringBootConfiguration
-@PropertySource(value = {"classpath:febs-auth.properties"})
-@ConfigurationProperties(prefix = "febs.auth")
-public class FebsAuthProperties {
-
-    /**
-     * 免认证访问路径
-     */
-    private String anonUrl;
-    /**
-     * 验证码配置
-     */
-    private FebsValidateCodeProperties code = new FebsValidateCodeProperties();
-    /**
-     * JWT加签密钥
-     */
-    private String jwtAccessKey;
-    /**
-     * 是否使用 JWT令牌
-     */
-    private Boolean enableJwt;
-
-    /**
-     * 社交登录所使用的 Client
-     */
-    private String socialLoginClientId;
-}
+package cc.mrbird.febs.auth.properties;
+
+import lombok.Data;
+import org.springframework.boot.SpringBootConfiguration;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * @author MrBird
+ */
+@Data
+@SpringBootConfiguration
+@PropertySource(value = {"classpath:febs-auth.properties"})
+@ConfigurationProperties(prefix = "febs.auth")
+public class FebsAuthProperties {
+
+    /**
+     * 免认证访问路径
+     */
+    private String anonUrl;
+    /**
+     * 验证码配置
+     */
+    private FebsValidateCodeProperties code = new FebsValidateCodeProperties();
+    /**
+     * JWT加签密钥
+     */
+    private String jwtAccessKey;
+    /**
+     * 是否使用 JWT令牌
+     */
+    private Boolean enableJwt;
+
+    /**
+     * 社交登录所使用的 Client
+     */
+    private String socialLoginClientId;
+}

+ 34 - 34
febs-auth/src/main/java/cc/mrbird/febs/auth/runner/StartedUpRunner.java

@@ -1,34 +1,34 @@
-package cc.mrbird.febs.auth.runner;
-
-import cc.mrbird.febs.common.entity.constant.FebsServerConstant;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.ApplicationRunner;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDateTime;
-
-@Slf4j
-@Component
-public class StartedUpRunner implements ApplicationRunner {
-
-    @Autowired
-    private ConfigurableApplicationContext context;
-
-    @Value("${spring.application.name:'" + FebsServerConstant.FEBS_AUTH + "'}")
-    private String applicationName;
-
-    @Override
-    public void run(ApplicationArguments args) {
-        if (context.isActive()) {
-            log.info("  _   _   _   _   _   _   _   _");
-            log.info(" / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\");
-            log.info("( c | o | m | p | l | e | t | e )");
-            log.info(" \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/");
-            log.info("{} 启动完毕,时间:{}", applicationName, LocalDateTime.now());
-        }
-    }
-}
+package cc.mrbird.febs.auth.runner;
+
+import cc.mrbird.febs.common.entity.constant.FebsServerConstant;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+
+@Slf4j
+@Component
+public class StartedUpRunner implements ApplicationRunner {
+
+    @Autowired
+    private ConfigurableApplicationContext context;
+
+    @Value("${spring.application.name:'" + FebsServerConstant.FEBS_AUTH + "'}")
+    private String applicationName;
+
+    @Override
+    public void run(ApplicationArguments args) {
+        if (context.isActive()) {
+            log.info("  _   _   _   _   _   _   _   _");
+            log.info(" / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\");
+            log.info("( c | o | m | p | l | e | t | e )");
+            log.info(" \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/");
+            log.info("{} 启动完毕,时间:{}", applicationName, LocalDateTime.now());
+        }
+    }
+}

+ 51 - 51
febs-auth/src/main/java/cc/mrbird/febs/auth/service/OAuthClientDetailsService.java

@@ -1,51 +1,51 @@
-package cc.mrbird.febs.auth.service;
-
-import cc.mrbird.febs.auth.entity.OAuthClientDetails;
-import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.common.exception.FebsException;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * @author Yuuki
- */
-public interface OAuthClientDetailsService extends IService<OAuthClientDetails> {
-
-    /**
-     * 查询(分页)
-     *
-     * @param request            QueryRequest
-     * @param oauthClientDetails oauthClientDetails
-     * @return IPage<OAuthClientDetails>
-     */
-    IPage<OAuthClientDetails> findOAuthClientDetails(QueryRequest request, OAuthClientDetails oauthClientDetails);
-
-    /**
-     * 根据主键查询
-     *
-     * @param clientId clientId
-     * @return OAuthClientDetails
-     */
-    OAuthClientDetails findById(String clientId);
-
-    /**
-     * 新增
-     *
-     * @param oauthClientDetails oauthClientDetails
-     */
-    void createOAuthClientDetails(OAuthClientDetails oauthClientDetails) throws FebsException;
-
-    /**
-     * 修改
-     *
-     * @param oauthClientDetails oauthClientDetails
-     */
-    void updateOAuthClientDetails(OAuthClientDetails oauthClientDetails);
-
-    /**
-     * 删除
-     *
-     * @param clientIds clientIds
-     */
-    void deleteOAuthClientDetails(String clientIds);
-}
+package cc.mrbird.febs.auth.service;
+
+import cc.mrbird.febs.auth.entity.OAuthClientDetails;
+import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.exception.FebsException;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @author Yuuki
+ */
+public interface OAuthClientDetailsService extends IService<OAuthClientDetails> {
+
+    /**
+     * 查询(分页)
+     *
+     * @param request            QueryRequest
+     * @param oauthClientDetails oauthClientDetails
+     * @return IPage<OAuthClientDetails>
+     */
+    IPage<OAuthClientDetails> findOAuthClientDetails(QueryRequest request, OAuthClientDetails oauthClientDetails);
+
+    /**
+     * 根据主键查询
+     *
+     * @param clientId clientId
+     * @return OAuthClientDetails
+     */
+    OAuthClientDetails findById(String clientId);
+
+    /**
+     * 新增
+     *
+     * @param oauthClientDetails oauthClientDetails
+     */
+    void createOAuthClientDetails(OAuthClientDetails oauthClientDetails) throws FebsException;
+
+    /**
+     * 修改
+     *
+     * @param oauthClientDetails oauthClientDetails
+     */
+    void updateOAuthClientDetails(OAuthClientDetails oauthClientDetails);
+
+    /**
+     * 删除
+     *
+     * @param clientIds clientIds
+     */
+    void deleteOAuthClientDetails(String clientIds);
+}

+ 90 - 90
febs-auth/src/main/java/cc/mrbird/febs/auth/service/SocialLoginService.java

@@ -1,90 +1,90 @@
-package cc.mrbird.febs.auth.service;
-
-import cc.mrbird.febs.auth.entity.BindUser;
-import cc.mrbird.febs.auth.entity.UserConnection;
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.exception.FebsException;
-import me.zhyd.oauth.model.AuthCallback;
-import me.zhyd.oauth.model.AuthUser;
-import me.zhyd.oauth.request.AuthRequest;
-import org.springframework.security.oauth2.common.OAuth2AccessToken;
-
-import java.util.List;
-
-public interface SocialLoginService {
-
-    /**
-     * 解析第三方登录请求
-     *
-     * @param oauthType 第三方平台类型
-     * @return AuthRequest
-     * @throws FebsException 异常
-     */
-    AuthRequest renderAuth(String oauthType) throws FebsException;
-
-    /**
-     * 处理第三方登录(绑定页面)
-     *
-     * @param oauthType 第三方平台类型
-     * @param callback  回调
-     * @return FebsResponse
-     * @throws FebsException 异常
-     */
-    FebsResponse resolveBind(String oauthType, AuthCallback callback) throws FebsException;
-
-    /**
-     * 处理第三方登录(登录页面)
-     *
-     * @param oauthType 第三方平台类型
-     * @param callback  回调
-     * @return FebsResponse
-     * @throws FebsException 异常
-     */
-    FebsResponse resolveLogin(String oauthType, AuthCallback callback) throws FebsException;
-
-    /**
-     * 绑定并登录
-     *
-     * @param bindUser 绑定用户
-     * @param authUser 第三方平台对象
-     * @return OAuth2AccessToken 令牌对象
-     * @throws FebsException 异常
-     */
-    OAuth2AccessToken bindLogin(BindUser bindUser, AuthUser authUser) throws FebsException;
-
-    /**
-     * 注册并登录
-     *
-     * @param registUser 注册用户
-     * @param authUser   第三方平台对象
-     * @return OAuth2AccessToken 令牌对象
-     * @throws FebsException 异常
-     */
-    OAuth2AccessToken signLogin(BindUser registUser, AuthUser authUser) throws FebsException;
-
-    /**
-     * 绑定
-     *
-     * @param bindUser 绑定对象
-     * @param authUser 第三方平台对象
-     * @throws FebsException 异常
-     */
-    void bind(BindUser bindUser, AuthUser authUser) throws FebsException;
-
-    /**
-     * 解绑
-     *
-     * @param bindUser  绑定对象
-     * @param oauthType 第三方平台对象
-     * @throws FebsException 异常
-     */
-    void unbind(BindUser bindUser, String oauthType) throws FebsException;
-
-    /**
-     * 根据用户名获取绑定关系
-     *
-     * @param username 用户名
-     * @return 绑定关系集合
-     */
-    List<UserConnection> findUserConnections(String username);
-}
+package cc.mrbird.febs.auth.service;
+
+import cc.mrbird.febs.auth.entity.BindUser;
+import cc.mrbird.febs.auth.entity.UserConnection;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.exception.FebsException;
+import me.zhyd.oauth.model.AuthCallback;
+import me.zhyd.oauth.model.AuthUser;
+import me.zhyd.oauth.request.AuthRequest;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+import java.util.List;
+
+public interface SocialLoginService {
+
+    /**
+     * 解析第三方登录请求
+     *
+     * @param oauthType 第三方平台类型
+     * @return AuthRequest
+     * @throws FebsException 异常
+     */
+    AuthRequest renderAuth(String oauthType) throws FebsException;
+
+    /**
+     * 处理第三方登录(绑定页面)
+     *
+     * @param oauthType 第三方平台类型
+     * @param callback  回调
+     * @return FebsResponse
+     * @throws FebsException 异常
+     */
+    FebsResponse resolveBind(String oauthType, AuthCallback callback) throws FebsException;
+
+    /**
+     * 处理第三方登录(登录页面)
+     *
+     * @param oauthType 第三方平台类型
+     * @param callback  回调
+     * @return FebsResponse
+     * @throws FebsException 异常
+     */
+    FebsResponse resolveLogin(String oauthType, AuthCallback callback) throws FebsException;
+
+    /**
+     * 绑定并登录
+     *
+     * @param bindUser 绑定用户
+     * @param authUser 第三方平台对象
+     * @return OAuth2AccessToken 令牌对象
+     * @throws FebsException 异常
+     */
+    OAuth2AccessToken bindLogin(BindUser bindUser, AuthUser authUser) throws FebsException;
+
+    /**
+     * 注册并登录
+     *
+     * @param registUser 注册用户
+     * @param authUser   第三方平台对象
+     * @return OAuth2AccessToken 令牌对象
+     * @throws FebsException 异常
+     */
+    OAuth2AccessToken signLogin(BindUser registUser, AuthUser authUser) throws FebsException;
+
+    /**
+     * 绑定
+     *
+     * @param bindUser 绑定对象
+     * @param authUser 第三方平台对象
+     * @throws FebsException 异常
+     */
+    void bind(BindUser bindUser, AuthUser authUser) throws FebsException;
+
+    /**
+     * 解绑
+     *
+     * @param bindUser  绑定对象
+     * @param oauthType 第三方平台对象
+     * @throws FebsException 异常
+     */
+    void unbind(BindUser bindUser, String oauthType) throws FebsException;
+
+    /**
+     * 根据用户名获取绑定关系
+     *
+     * @param username 用户名
+     * @return 绑定关系集合
+     */
+    List<UserConnection> findUserConnections(String username);
+}

+ 26 - 26
febs-auth/src/main/java/cc/mrbird/febs/auth/service/ValidateCodeService.java

@@ -1,26 +1,26 @@
-package cc.mrbird.febs.auth.service;
-
-import cc.mrbird.febs.common.exception.ValidateCodeException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-public interface ValidateCodeService {
-
-    /**
-     * 生成验证码
-     *
-     * @param request  HttpServletRequest
-     * @param response HttpServletResponse
-     */
-    void create(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException;
-
-    /**
-     * 校验验证码
-     *
-     * @param key   前端上送 key
-     * @param value 前端上送待校验值
-     */
-    void check(String key, String value) throws ValidateCodeException;
-}
+package cc.mrbird.febs.auth.service;
+
+import cc.mrbird.febs.common.exception.ValidateCodeException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public interface ValidateCodeService {
+
+    /**
+     * 生成验证码
+     *
+     * @param request  HttpServletRequest
+     * @param response HttpServletResponse
+     */
+    void create(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException;
+
+    /**
+     * 校验验证码
+     *
+     * @param key   前端上送 key
+     * @param value 前端上送待校验值
+     */
+    void check(String key, String value) throws ValidateCodeException;
+}

+ 55 - 55
febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/FebsUserDetailService.java

@@ -1,55 +1,55 @@
-package cc.mrbird.febs.auth.service.impl;
-
-import cc.mrbird.febs.auth.manager.UserManager;
-import cc.mrbird.febs.common.entity.FebsAuthUser;
-import cc.mrbird.febs.common.entity.constant.ParamsConstant;
-import cc.mrbird.febs.common.entity.constant.SocialConstant;
-import cc.mrbird.febs.common.entity.system.SystemUser;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.authority.AuthorityUtils;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.stereotype.Service;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author MrBird
- */
-@Service
-public class FebsUserDetailService implements UserDetailsService {
-
-    @Autowired
-    private PasswordEncoder passwordEncoder;
-    @Autowired
-    private UserManager userManager;
-
-    @Override
-    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
-        HttpServletRequest httpServletRequest = FebsUtil.getHttpServletRequest();
-        SystemUser systemUser = userManager.findByName(username);
-        if (systemUser != null) {
-            String permissions = userManager.findUserPermissions(systemUser.getUsername());
-            boolean notLocked = false;
-            if (StringUtils.equals(SystemUser.STATUS_VALID, systemUser.getStatus()))
-                notLocked = true;
-            String password = systemUser.getPassword();
-            String loginType = (String) httpServletRequest.getAttribute(ParamsConstant.LOGIN_TYPE);
-            if (StringUtils.equals(loginType, SocialConstant.SOCIAL_LOGIN)) {
-                password = passwordEncoder.encode(SocialConstant.SOCIAL_LOGIN_PASSWORD);
-            }
-            FebsAuthUser authUser = new FebsAuthUser(systemUser.getUsername(), password, true, true, true, notLocked,
-                    AuthorityUtils.commaSeparatedStringToAuthorityList(permissions));
-
-            BeanUtils.copyProperties(systemUser, authUser);
-            return authUser;
-        } else {
-            throw new UsernameNotFoundException("");
-        }
-    }
-}
+package cc.mrbird.febs.auth.service.impl;
+
+import cc.mrbird.febs.auth.manager.UserManager;
+import cc.mrbird.febs.common.entity.FebsAuthUser;
+import cc.mrbird.febs.common.entity.constant.ParamsConstant;
+import cc.mrbird.febs.common.entity.constant.SocialConstant;
+import cc.mrbird.febs.common.entity.system.SystemUser;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author MrBird
+ */
+@Service
+public class FebsUserDetailService implements UserDetailsService {
+
+    @Autowired
+    private PasswordEncoder passwordEncoder;
+    @Autowired
+    private UserManager userManager;
+
+    @Override
+    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+        HttpServletRequest httpServletRequest = FebsUtil.getHttpServletRequest();
+        SystemUser systemUser = userManager.findByName(username);
+        if (systemUser != null) {
+            String permissions = userManager.findUserPermissions(systemUser.getUsername());
+            boolean notLocked = false;
+            if (StringUtils.equals(SystemUser.STATUS_VALID, systemUser.getStatus()))
+                notLocked = true;
+            String password = systemUser.getPassword();
+            String loginType = (String) httpServletRequest.getAttribute(ParamsConstant.LOGIN_TYPE);
+            if (StringUtils.equals(loginType, SocialConstant.SOCIAL_LOGIN)) {
+                password = passwordEncoder.encode(SocialConstant.SOCIAL_LOGIN_PASSWORD);
+            }
+            FebsAuthUser authUser = new FebsAuthUser(systemUser.getUsername(), password, true, true, true, notLocked,
+                    AuthorityUtils.commaSeparatedStringToAuthorityList(permissions));
+
+            BeanUtils.copyProperties(systemUser, authUser);
+            return authUser;
+        } else {
+            throw new UsernameNotFoundException("");
+        }
+    }
+}

+ 108 - 108
febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/OAuthClientDetailsServiceImpl.java

@@ -1,108 +1,108 @@
-package cc.mrbird.febs.auth.service.impl;
-
-import cc.mrbird.febs.auth.entity.OAuthClientDetails;
-import cc.mrbird.febs.auth.mapper.OAuthClientDetailsMapper;
-import cc.mrbird.febs.auth.service.OAuthClientDetailsService;
-import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.common.exception.FebsException;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author Yuuki
- */
-@Slf4j
-@Service
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
-public class OAuthClientDetailsServiceImpl extends ServiceImpl<OAuthClientDetailsMapper, OAuthClientDetails> implements OAuthClientDetailsService {
-
-    @Autowired
-    private PasswordEncoder passwordEncoder;
-    @Autowired
-    private RedisClientDetailsService redisClientDetailsService;
-
-    @Override
-    public IPage<OAuthClientDetails> findOAuthClientDetails(QueryRequest request, OAuthClientDetails oauthClientDetails) {
-        LambdaQueryWrapper<OAuthClientDetails> queryWrapper = new LambdaQueryWrapper<>();
-        if (StringUtils.isNotBlank(oauthClientDetails.getClientId())) {
-            queryWrapper.eq(OAuthClientDetails::getClientId, oauthClientDetails.getClientId());
-        }
-        Page<OAuthClientDetails> page = new Page<>(request.getPageNum(), request.getPageSize());
-        IPage<OAuthClientDetails> result = this.page(page, queryWrapper);
-
-        List<OAuthClientDetails> records = new ArrayList<>();
-        result.getRecords().forEach(o -> {
-            o.setOriginSecret(null);
-            o.setClientSecret(null);
-            records.add(o);
-        });
-        result.setRecords(records);
-        return result;
-    }
-
-    @Override
-    public OAuthClientDetails findById(String clientId) {
-        return this.baseMapper.selectById(clientId);
-    }
-
-    @Override
-    @Transactional
-    public void createOAuthClientDetails(OAuthClientDetails oauthClientDetails) throws FebsException {
-        OAuthClientDetails byId = this.findById(oauthClientDetails.getClientId());
-        if (byId != null) {
-            throw new FebsException("该Client已存在");
-        }
-        oauthClientDetails.setOriginSecret(oauthClientDetails.getClientSecret());
-        oauthClientDetails.setClientSecret(passwordEncoder.encode(oauthClientDetails.getClientSecret()));
-        boolean saved = this.save(oauthClientDetails);
-        if (saved) {
-            log.info("缓存Client -> {}", oauthClientDetails);
-            this.redisClientDetailsService.loadClientByClientId(oauthClientDetails.getClientId());
-        }
-    }
-
-    @Override
-    @Transactional
-    public void updateOAuthClientDetails(OAuthClientDetails oauthClientDetails) {
-        String clientId = oauthClientDetails.getClientId();
-
-        LambdaQueryWrapper<OAuthClientDetails> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(OAuthClientDetails::getClientId, oauthClientDetails.getClientId());
-
-        oauthClientDetails.setClientId(null);
-        oauthClientDetails.setClientSecret(null);
-        boolean updated = this.update(oauthClientDetails, queryWrapper);
-        if (updated) {
-            log.info("更新Client -> {}", oauthClientDetails);
-            this.redisClientDetailsService.removeRedisCache(clientId);
-            this.redisClientDetailsService.loadClientByClientId(clientId);
-        }
-    }
-
-    @Override
-    @Transactional
-    public void deleteOAuthClientDetails(String clientIds) {
-        Object[] clientIdArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(clientIds, ",");
-        LambdaQueryWrapper<OAuthClientDetails> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.in(OAuthClientDetails::getClientId, clientIdArray);
-        boolean removed = this.remove(queryWrapper);
-        if (removed) {
-            log.info("删除ClientId为({})的Client", clientIds);
-            Arrays.stream(clientIdArray).forEach(c -> this.redisClientDetailsService.removeRedisCache(String.valueOf(c)));
-
-        }
-    }
-}
+package cc.mrbird.febs.auth.service.impl;
+
+import cc.mrbird.febs.auth.entity.OAuthClientDetails;
+import cc.mrbird.febs.auth.mapper.OAuthClientDetailsMapper;
+import cc.mrbird.febs.auth.service.OAuthClientDetailsService;
+import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.exception.FebsException;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Yuuki
+ */
+@Slf4j
+@Service
+@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
+public class OAuthClientDetailsServiceImpl extends ServiceImpl<OAuthClientDetailsMapper, OAuthClientDetails> implements OAuthClientDetailsService {
+
+    @Autowired
+    private PasswordEncoder passwordEncoder;
+    @Autowired
+    private RedisClientDetailsService redisClientDetailsService;
+
+    @Override
+    public IPage<OAuthClientDetails> findOAuthClientDetails(QueryRequest request, OAuthClientDetails oauthClientDetails) {
+        LambdaQueryWrapper<OAuthClientDetails> queryWrapper = new LambdaQueryWrapper<>();
+        if (StringUtils.isNotBlank(oauthClientDetails.getClientId())) {
+            queryWrapper.eq(OAuthClientDetails::getClientId, oauthClientDetails.getClientId());
+        }
+        Page<OAuthClientDetails> page = new Page<>(request.getPageNum(), request.getPageSize());
+        IPage<OAuthClientDetails> result = this.page(page, queryWrapper);
+
+        List<OAuthClientDetails> records = new ArrayList<>();
+        result.getRecords().forEach(o -> {
+            o.setOriginSecret(null);
+            o.setClientSecret(null);
+            records.add(o);
+        });
+        result.setRecords(records);
+        return result;
+    }
+
+    @Override
+    public OAuthClientDetails findById(String clientId) {
+        return this.baseMapper.selectById(clientId);
+    }
+
+    @Override
+    @Transactional
+    public void createOAuthClientDetails(OAuthClientDetails oauthClientDetails) throws FebsException {
+        OAuthClientDetails byId = this.findById(oauthClientDetails.getClientId());
+        if (byId != null) {
+            throw new FebsException("该Client已存在");
+        }
+        oauthClientDetails.setOriginSecret(oauthClientDetails.getClientSecret());
+        oauthClientDetails.setClientSecret(passwordEncoder.encode(oauthClientDetails.getClientSecret()));
+        boolean saved = this.save(oauthClientDetails);
+        if (saved) {
+            log.info("缓存Client -> {}", oauthClientDetails);
+            this.redisClientDetailsService.loadClientByClientId(oauthClientDetails.getClientId());
+        }
+    }
+
+    @Override
+    @Transactional
+    public void updateOAuthClientDetails(OAuthClientDetails oauthClientDetails) {
+        String clientId = oauthClientDetails.getClientId();
+
+        LambdaQueryWrapper<OAuthClientDetails> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(OAuthClientDetails::getClientId, oauthClientDetails.getClientId());
+
+        oauthClientDetails.setClientId(null);
+        oauthClientDetails.setClientSecret(null);
+        boolean updated = this.update(oauthClientDetails, queryWrapper);
+        if (updated) {
+            log.info("更新Client -> {}", oauthClientDetails);
+            this.redisClientDetailsService.removeRedisCache(clientId);
+            this.redisClientDetailsService.loadClientByClientId(clientId);
+        }
+    }
+
+    @Override
+    @Transactional
+    public void deleteOAuthClientDetails(String clientIds) {
+        Object[] clientIdArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(clientIds, ",");
+        LambdaQueryWrapper<OAuthClientDetails> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(OAuthClientDetails::getClientId, clientIdArray);
+        boolean removed = this.remove(queryWrapper);
+        if (removed) {
+            log.info("删除ClientId为({})的Client", clientIds);
+            Arrays.stream(clientIdArray).forEach(c -> this.redisClientDetailsService.removeRedisCache(String.valueOf(c)));
+
+        }
+    }
+}

+ 88 - 88
febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/RedisClientDetailsService.java

@@ -1,88 +1,88 @@
-package cc.mrbird.febs.auth.service.impl;
-
-import cc.mrbird.febs.common.service.RedisService;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
-import org.springframework.security.oauth2.provider.ClientDetails;
-import org.springframework.security.oauth2.provider.client.BaseClientDetails;
-import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
-import org.springframework.stereotype.Service;
-
-import javax.sql.DataSource;
-import java.util.List;
-
-/**
- * @author Yuuki
- */
-@Slf4j
-@Service
-public class RedisClientDetailsService extends JdbcClientDetailsService {
-    /**
-     * 缓存 client的 redis key,这里是 hash结构存储
-     */
-    private static final String CACHE_CLIENT_KEY = "client_details";
-
-    @Autowired
-    RedisService redisService;
-
-    public RedisClientDetailsService(DataSource dataSource) {
-        super(dataSource);
-    }
-
-    @Override
-    public ClientDetails loadClientByClientId(String clientId) throws InvalidClientException {
-        ClientDetails clientDetails = null;
-        String value = (String) redisService.hget(CACHE_CLIENT_KEY, clientId);
-        if (StringUtils.isBlank(value)) {
-            clientDetails = cacheAndGetClient(clientId);
-        } else {
-            clientDetails = JSONObject.parseObject(value, BaseClientDetails.class);
-        }
-
-        return clientDetails;
-    }
-
-    /**
-     * 缓存 client并返回 client
-     *
-     * @param clientId clientId
-     */
-    public ClientDetails cacheAndGetClient(String clientId) {
-        ClientDetails clientDetails = null;
-        clientDetails = super.loadClientByClientId(clientId);
-        if (clientDetails != null) {
-            redisService.hset(CACHE_CLIENT_KEY, clientId, JSONObject.toJSONString(clientDetails));
-        }
-        return clientDetails;
-    }
-
-    /**
-     * 删除 redis缓存
-     *
-     * @param clientId clientId
-     */
-    public void removeRedisCache(String clientId) {
-        redisService.hdel(CACHE_CLIENT_KEY, clientId);
-    }
-
-    /**
-     * 将 oauth_client_details全表刷入 redis
-     */
-    public void loadAllClientToCache() {
-        if (redisService.hasKey(CACHE_CLIENT_KEY)) {
-            return;
-        }
-        log.info("将oauth_client_details全表刷入redis");
-
-        List<ClientDetails> list = super.listClientDetails();
-        if (CollectionUtils.isEmpty(list)) {
-            log.error("oauth_client_details表数据为空,请检查");
-            return;
-        }
-        list.forEach(client -> redisService.hset(CACHE_CLIENT_KEY, client.getClientId(), JSONObject.toJSONString(client)));
-    }
-}
+package cc.mrbird.febs.auth.service.impl;
+
+import cc.mrbird.febs.common.service.RedisService;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
+import org.springframework.security.oauth2.provider.ClientDetails;
+import org.springframework.security.oauth2.provider.client.BaseClientDetails;
+import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
+import org.springframework.stereotype.Service;
+
+import javax.sql.DataSource;
+import java.util.List;
+
+/**
+ * @author Yuuki
+ */
+@Slf4j
+@Service
+public class RedisClientDetailsService extends JdbcClientDetailsService {
+    /**
+     * 缓存 client的 redis key,这里是 hash结构存储
+     */
+    private static final String CACHE_CLIENT_KEY = "client_details";
+
+    @Autowired
+    RedisService redisService;
+
+    public RedisClientDetailsService(DataSource dataSource) {
+        super(dataSource);
+    }
+
+    @Override
+    public ClientDetails loadClientByClientId(String clientId) throws InvalidClientException {
+        ClientDetails clientDetails = null;
+        String value = (String) redisService.hget(CACHE_CLIENT_KEY, clientId);
+        if (StringUtils.isBlank(value)) {
+            clientDetails = cacheAndGetClient(clientId);
+        } else {
+            clientDetails = JSONObject.parseObject(value, BaseClientDetails.class);
+        }
+
+        return clientDetails;
+    }
+
+    /**
+     * 缓存 client并返回 client
+     *
+     * @param clientId clientId
+     */
+    public ClientDetails cacheAndGetClient(String clientId) {
+        ClientDetails clientDetails = null;
+        clientDetails = super.loadClientByClientId(clientId);
+        if (clientDetails != null) {
+            redisService.hset(CACHE_CLIENT_KEY, clientId, JSONObject.toJSONString(clientDetails));
+        }
+        return clientDetails;
+    }
+
+    /**
+     * 删除 redis缓存
+     *
+     * @param clientId clientId
+     */
+    public void removeRedisCache(String clientId) {
+        redisService.hdel(CACHE_CLIENT_KEY, clientId);
+    }
+
+    /**
+     * 将 oauth_client_details全表刷入 redis
+     */
+    public void loadAllClientToCache() {
+        if (redisService.hasKey(CACHE_CLIENT_KEY)) {
+            return;
+        }
+        log.info("将oauth_client_details全表刷入redis");
+
+        List<ClientDetails> list = super.listClientDetails();
+        if (CollectionUtils.isEmpty(list)) {
+            log.error("oauth_client_details表数据为空,请检查");
+            return;
+        }
+        list.forEach(client -> redisService.hset(CACHE_CLIENT_KEY, client.getClientId(), JSONObject.toJSONString(client)));
+    }
+}

+ 216 - 216
febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/SocialLoginServiceImpl.java

@@ -1,216 +1,216 @@
-package cc.mrbird.febs.auth.service.impl;
-
-import cc.mrbird.febs.auth.entity.BindUser;
-import cc.mrbird.febs.auth.entity.UserConnection;
-import cc.mrbird.febs.auth.manager.UserManager;
-import cc.mrbird.febs.auth.properties.FebsAuthProperties;
-import cc.mrbird.febs.auth.service.SocialLoginService;
-import cc.mrbird.febs.auth.service.UserConnectionService;
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.entity.constant.GrantTypeConstant;
-import cc.mrbird.febs.common.entity.constant.ParamsConstant;
-import cc.mrbird.febs.common.entity.constant.SocialConstant;
-import cc.mrbird.febs.common.entity.system.SystemUser;
-import cc.mrbird.febs.common.exception.FebsException;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import cn.hutool.core.util.StrUtil;
-import com.xkcoding.justauth.AuthRequestFactory;
-import me.zhyd.oauth.config.AuthSource;
-import me.zhyd.oauth.model.AuthCallback;
-import me.zhyd.oauth.model.AuthResponse;
-import me.zhyd.oauth.model.AuthUser;
-import me.zhyd.oauth.request.AuthRequest;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.oauth2.common.OAuth2AccessToken;
-import org.springframework.security.oauth2.provider.ClientDetails;
-import org.springframework.security.oauth2.provider.TokenRequest;
-import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter;
-import org.springframework.stereotype.Service;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author MrBird
- */
-@Service
-public class SocialLoginServiceImpl implements SocialLoginService {
-
-    private static final String USERNAME = "username";
-    private static final String PASSWORD = "password";
-
-    private static final String NOT_BIND = "not_bind";
-    private static final String SOCIAL_LOGIN_SUCCESS = "social_login_success";
-
-    @Autowired
-    private UserManager userManager;
-    @Autowired
-    private AuthRequestFactory factory;
-    @Autowired
-    private FebsAuthProperties properties;
-    @Autowired
-    private PasswordEncoder passwordEncoder;
-    @Autowired
-    private UserConnectionService userConnectionService;
-    @Autowired
-    private ResourceOwnerPasswordTokenGranter granter;
-    @Autowired
-    private RedisClientDetailsService redisClientDetailsService;
-
-    @Override
-    public AuthRequest renderAuth(String oauthType) throws FebsException {
-        return factory.get(getAuthSource(oauthType));
-    }
-
-    @Override
-    public FebsResponse resolveBind(String oauthType, AuthCallback callback) throws FebsException {
-        FebsResponse febsResponse = new FebsResponse();
-        AuthRequest authRequest = factory.get(getAuthSource(oauthType));
-        AuthResponse<?> response = authRequest.login(resolveAuthCallback(callback));
-        if (response.ok()) {
-            febsResponse.data(response.getData());
-        } else {
-            throw new FebsException(String.format("第三方登录失败,%s", response.getMsg()));
-        }
-        return febsResponse;
-    }
-
-    @Override
-    public FebsResponse resolveLogin(String oauthType, AuthCallback callback) throws FebsException {
-        FebsResponse febsResponse = new FebsResponse();
-        AuthRequest authRequest = factory.get(getAuthSource(oauthType));
-        AuthResponse<?> response = authRequest.login(resolveAuthCallback(callback));
-        if (response.ok()) {
-            AuthUser authUser = (AuthUser) response.getData();
-            UserConnection userConnection = userConnectionService.selectByCondition(authUser.getSource().toString(), authUser.getUuid());
-            if (userConnection == null) {
-                febsResponse.message(NOT_BIND).data(authUser);
-            } else {
-                SystemUser user = userManager.findByName(userConnection.getUserName());
-                if (user == null) {
-                    throw new FebsException("系统中未找到与第三方账号对应的账户");
-                }
-                OAuth2AccessToken oAuth2AccessToken = getOAuth2AccessToken(user);
-                febsResponse.message(SOCIAL_LOGIN_SUCCESS).data(oAuth2AccessToken);
-                febsResponse.put(USERNAME, user.getUsername());
-            }
-        } else {
-            throw new FebsException(String.format("第三方登录失败,%s", response.getMsg()));
-        }
-        return febsResponse;
-    }
-
-    @Override
-    public OAuth2AccessToken bindLogin(BindUser bindUser, AuthUser authUser) throws FebsException {
-        SystemUser systemUser = userManager.findByName(bindUser.getBindUsername());
-        if (systemUser == null || !passwordEncoder.matches(bindUser.getBindPassword(), systemUser.getPassword())) {
-            throw new FebsException("绑定系统账号失败,用户名或密码错误!");
-        }
-        this.createConnection(systemUser, authUser);
-        return this.getOAuth2AccessToken(systemUser);
-    }
-
-    @Override
-    public OAuth2AccessToken signLogin(BindUser registUser, AuthUser authUser) throws FebsException {
-        SystemUser user = this.userManager.findByName(registUser.getBindUsername());
-        if (user != null) {
-            throw new FebsException("该用户名已存在!");
-        }
-        String encryptPassword = passwordEncoder.encode(registUser.getBindPassword());
-        SystemUser systemUser = this.userManager.registUser(registUser.getBindUsername(), encryptPassword);
-        this.createConnection(systemUser, authUser);
-        return this.getOAuth2AccessToken(systemUser);
-    }
-
-    @Override
-    public void bind(BindUser bindUser, AuthUser authUser) throws FebsException {
-        String username = bindUser.getBindUsername();
-        if (isCurrentUser(username)) {
-            UserConnection userConnection = userConnectionService.selectByCondition(authUser.getSource().toString(), authUser.getUuid());
-            if (userConnection != null) {
-                throw new FebsException("绑定失败,该第三方账号已绑定" + userConnection.getUserName() + "系统账户");
-            }
-            SystemUser systemUser = new SystemUser();
-            systemUser.setUsername(username);
-            this.createConnection(systemUser, authUser);
-        } else {
-            throw new FebsException("绑定失败,您无权绑定别人的账号");
-        }
-    }
-
-    @Override
-    public void unbind(BindUser bindUser, String oauthType) throws FebsException {
-        String username = bindUser.getBindUsername();
-        if (isCurrentUser(username)) {
-            this.userConnectionService.deleteByCondition(username, oauthType);
-        } else {
-            throw new FebsException("解绑失败,您无权解绑别人的账号");
-        }
-    }
-
-    @Override
-    public List<UserConnection> findUserConnections(String username) {
-        return this.userConnectionService.selectByCondition(username);
-    }
-
-    private void createConnection(SystemUser systemUser, AuthUser authUser) {
-        UserConnection userConnection = new UserConnection();
-        userConnection.setUserName(systemUser.getUsername());
-        userConnection.setProviderName(authUser.getSource().toString());
-        userConnection.setProviderUserId(authUser.getUuid());
-        userConnection.setProviderUserName(authUser.getUsername());
-        userConnection.setImageUrl(authUser.getAvatar());
-        userConnection.setNickName(authUser.getNickname());
-        userConnection.setLocation(authUser.getLocation());
-        this.userConnectionService.createUserConnection(userConnection);
-    }
-
-    private AuthCallback resolveAuthCallback(AuthCallback callback) {
-        String state = callback.getState();
-        String[] strings = StringUtils.splitByWholeSeparatorPreserveAllTokens(state, "::");
-        if (strings.length == 3) {
-            callback.setState(strings[0] + "::" + strings[1]);
-        }
-        return callback;
-    }
-
-    private AuthSource getAuthSource(String type) throws FebsException {
-        if (StrUtil.isNotBlank(type)) {
-            return AuthSource.valueOf(type.toUpperCase());
-        } else {
-            throw new FebsException(String.format("暂不支持%s第三方登录", type));
-        }
-    }
-
-    private boolean isCurrentUser(String username) {
-        String currentUsername = FebsUtil.getCurrentUsername();
-        return StringUtils.equalsIgnoreCase(username, currentUsername);
-    }
-
-    private OAuth2AccessToken getOAuth2AccessToken(SystemUser user) throws FebsException {
-        final HttpServletRequest httpServletRequest = FebsUtil.getHttpServletRequest();
-        httpServletRequest.setAttribute(ParamsConstant.LOGIN_TYPE, SocialConstant.SOCIAL_LOGIN);
-        String socialLoginClientId = properties.getSocialLoginClientId();
-        ClientDetails clientDetails = null;
-        try {
-            clientDetails = redisClientDetailsService.loadClientByClientId(socialLoginClientId);
-        } catch (Exception e) {
-            throw new FebsException("获取第三方登录可用的Client失败");
-        }
-        if (clientDetails == null) {
-            throw new FebsException("未找到第三方登录可用的Client");
-        }
-        Map<String, String> requestParameters = new HashMap<>(5);
-        requestParameters.put(ParamsConstant.GRANT_TYPE, GrantTypeConstant.PASSWORD);
-        requestParameters.put(USERNAME, user.getUsername());
-        requestParameters.put(PASSWORD, SocialConstant.SOCIAL_LOGIN_PASSWORD);
-
-        String grantTypes = String.join(",", clientDetails.getAuthorizedGrantTypes());
-        TokenRequest tokenRequest = new TokenRequest(requestParameters, clientDetails.getClientId(), clientDetails.getScope(), grantTypes);
-        return granter.grant(GrantTypeConstant.PASSWORD, tokenRequest);
-    }
-}
+package cc.mrbird.febs.auth.service.impl;
+
+import cc.mrbird.febs.auth.entity.BindUser;
+import cc.mrbird.febs.auth.entity.UserConnection;
+import cc.mrbird.febs.auth.manager.UserManager;
+import cc.mrbird.febs.auth.properties.FebsAuthProperties;
+import cc.mrbird.febs.auth.service.SocialLoginService;
+import cc.mrbird.febs.auth.service.UserConnectionService;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.entity.constant.GrantTypeConstant;
+import cc.mrbird.febs.common.entity.constant.ParamsConstant;
+import cc.mrbird.febs.common.entity.constant.SocialConstant;
+import cc.mrbird.febs.common.entity.system.SystemUser;
+import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import cn.hutool.core.util.StrUtil;
+import com.xkcoding.justauth.AuthRequestFactory;
+import me.zhyd.oauth.config.AuthSource;
+import me.zhyd.oauth.model.AuthCallback;
+import me.zhyd.oauth.model.AuthResponse;
+import me.zhyd.oauth.model.AuthUser;
+import me.zhyd.oauth.request.AuthRequest;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import org.springframework.security.oauth2.provider.ClientDetails;
+import org.springframework.security.oauth2.provider.TokenRequest;
+import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author MrBird
+ */
+@Service
+public class SocialLoginServiceImpl implements SocialLoginService {
+
+    private static final String USERNAME = "username";
+    private static final String PASSWORD = "password";
+
+    private static final String NOT_BIND = "not_bind";
+    private static final String SOCIAL_LOGIN_SUCCESS = "social_login_success";
+
+    @Autowired
+    private UserManager userManager;
+    @Autowired
+    private AuthRequestFactory factory;
+    @Autowired
+    private FebsAuthProperties properties;
+    @Autowired
+    private PasswordEncoder passwordEncoder;
+    @Autowired
+    private UserConnectionService userConnectionService;
+    @Autowired
+    private ResourceOwnerPasswordTokenGranter granter;
+    @Autowired
+    private RedisClientDetailsService redisClientDetailsService;
+
+    @Override
+    public AuthRequest renderAuth(String oauthType) throws FebsException {
+        return factory.get(getAuthSource(oauthType));
+    }
+
+    @Override
+    public FebsResponse resolveBind(String oauthType, AuthCallback callback) throws FebsException {
+        FebsResponse febsResponse = new FebsResponse();
+        AuthRequest authRequest = factory.get(getAuthSource(oauthType));
+        AuthResponse<?> response = authRequest.login(resolveAuthCallback(callback));
+        if (response.ok()) {
+            febsResponse.data(response.getData());
+        } else {
+            throw new FebsException(String.format("第三方登录失败,%s", response.getMsg()));
+        }
+        return febsResponse;
+    }
+
+    @Override
+    public FebsResponse resolveLogin(String oauthType, AuthCallback callback) throws FebsException {
+        FebsResponse febsResponse = new FebsResponse();
+        AuthRequest authRequest = factory.get(getAuthSource(oauthType));
+        AuthResponse<?> response = authRequest.login(resolveAuthCallback(callback));
+        if (response.ok()) {
+            AuthUser authUser = (AuthUser) response.getData();
+            UserConnection userConnection = userConnectionService.selectByCondition(authUser.getSource().toString(), authUser.getUuid());
+            if (userConnection == null) {
+                febsResponse.message(NOT_BIND).data(authUser);
+            } else {
+                SystemUser user = userManager.findByName(userConnection.getUserName());
+                if (user == null) {
+                    throw new FebsException("系统中未找到与第三方账号对应的账户");
+                }
+                OAuth2AccessToken oAuth2AccessToken = getOAuth2AccessToken(user);
+                febsResponse.message(SOCIAL_LOGIN_SUCCESS).data(oAuth2AccessToken);
+                febsResponse.put(USERNAME, user.getUsername());
+            }
+        } else {
+            throw new FebsException(String.format("第三方登录失败,%s", response.getMsg()));
+        }
+        return febsResponse;
+    }
+
+    @Override
+    public OAuth2AccessToken bindLogin(BindUser bindUser, AuthUser authUser) throws FebsException {
+        SystemUser systemUser = userManager.findByName(bindUser.getBindUsername());
+        if (systemUser == null || !passwordEncoder.matches(bindUser.getBindPassword(), systemUser.getPassword())) {
+            throw new FebsException("绑定系统账号失败,用户名或密码错误!");
+        }
+        this.createConnection(systemUser, authUser);
+        return this.getOAuth2AccessToken(systemUser);
+    }
+
+    @Override
+    public OAuth2AccessToken signLogin(BindUser registUser, AuthUser authUser) throws FebsException {
+        SystemUser user = this.userManager.findByName(registUser.getBindUsername());
+        if (user != null) {
+            throw new FebsException("该用户名已存在!");
+        }
+        String encryptPassword = passwordEncoder.encode(registUser.getBindPassword());
+        SystemUser systemUser = this.userManager.registUser(registUser.getBindUsername(), encryptPassword);
+        this.createConnection(systemUser, authUser);
+        return this.getOAuth2AccessToken(systemUser);
+    }
+
+    @Override
+    public void bind(BindUser bindUser, AuthUser authUser) throws FebsException {
+        String username = bindUser.getBindUsername();
+        if (isCurrentUser(username)) {
+            UserConnection userConnection = userConnectionService.selectByCondition(authUser.getSource().toString(), authUser.getUuid());
+            if (userConnection != null) {
+                throw new FebsException("绑定失败,该第三方账号已绑定" + userConnection.getUserName() + "系统账户");
+            }
+            SystemUser systemUser = new SystemUser();
+            systemUser.setUsername(username);
+            this.createConnection(systemUser, authUser);
+        } else {
+            throw new FebsException("绑定失败,您无权绑定别人的账号");
+        }
+    }
+
+    @Override
+    public void unbind(BindUser bindUser, String oauthType) throws FebsException {
+        String username = bindUser.getBindUsername();
+        if (isCurrentUser(username)) {
+            this.userConnectionService.deleteByCondition(username, oauthType);
+        } else {
+            throw new FebsException("解绑失败,您无权解绑别人的账号");
+        }
+    }
+
+    @Override
+    public List<UserConnection> findUserConnections(String username) {
+        return this.userConnectionService.selectByCondition(username);
+    }
+
+    private void createConnection(SystemUser systemUser, AuthUser authUser) {
+        UserConnection userConnection = new UserConnection();
+        userConnection.setUserName(systemUser.getUsername());
+        userConnection.setProviderName(authUser.getSource().toString());
+        userConnection.setProviderUserId(authUser.getUuid());
+        userConnection.setProviderUserName(authUser.getUsername());
+        userConnection.setImageUrl(authUser.getAvatar());
+        userConnection.setNickName(authUser.getNickname());
+        userConnection.setLocation(authUser.getLocation());
+        this.userConnectionService.createUserConnection(userConnection);
+    }
+
+    private AuthCallback resolveAuthCallback(AuthCallback callback) {
+        String state = callback.getState();
+        String[] strings = StringUtils.splitByWholeSeparatorPreserveAllTokens(state, "::");
+        if (strings.length == 3) {
+            callback.setState(strings[0] + "::" + strings[1]);
+        }
+        return callback;
+    }
+
+    private AuthSource getAuthSource(String type) throws FebsException {
+        if (StrUtil.isNotBlank(type)) {
+            return AuthSource.valueOf(type.toUpperCase());
+        } else {
+            throw new FebsException(String.format("暂不支持%s第三方登录", type));
+        }
+    }
+
+    private boolean isCurrentUser(String username) {
+        String currentUsername = FebsUtil.getCurrentUsername();
+        return StringUtils.equalsIgnoreCase(username, currentUsername);
+    }
+
+    private OAuth2AccessToken getOAuth2AccessToken(SystemUser user) throws FebsException {
+        final HttpServletRequest httpServletRequest = FebsUtil.getHttpServletRequest();
+        httpServletRequest.setAttribute(ParamsConstant.LOGIN_TYPE, SocialConstant.SOCIAL_LOGIN);
+        String socialLoginClientId = properties.getSocialLoginClientId();
+        ClientDetails clientDetails = null;
+        try {
+            clientDetails = redisClientDetailsService.loadClientByClientId(socialLoginClientId);
+        } catch (Exception e) {
+            throw new FebsException("获取第三方登录可用的Client失败");
+        }
+        if (clientDetails == null) {
+            throw new FebsException("未找到第三方登录可用的Client");
+        }
+        Map<String, String> requestParameters = new HashMap<>(5);
+        requestParameters.put(ParamsConstant.GRANT_TYPE, GrantTypeConstant.PASSWORD);
+        requestParameters.put(USERNAME, user.getUsername());
+        requestParameters.put(PASSWORD, SocialConstant.SOCIAL_LOGIN_PASSWORD);
+
+        String grantTypes = String.join(",", clientDetails.getAuthorizedGrantTypes());
+        TokenRequest tokenRequest = new TokenRequest(requestParameters, clientDetails.getClientId(), clientDetails.getScope(), grantTypes);
+        return granter.grant(GrantTypeConstant.PASSWORD, tokenRequest);
+    }
+}

+ 51 - 51
febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/UserConnectionServiceImpl.java

@@ -1,51 +1,51 @@
-package cc.mrbird.febs.auth.service.impl;
-
-import cc.mrbird.febs.auth.entity.UserConnection;
-import cc.mrbird.febs.auth.mapper.UserConnectionMapper;
-import cc.mrbird.febs.auth.service.UserConnectionService;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-
-/**
- * @author MrBird
- */
-@Service
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
-public class UserConnectionServiceImpl extends ServiceImpl<UserConnectionMapper, UserConnection> implements UserConnectionService {
-
-    @Override
-    public UserConnection selectByCondition(String providerName, String providerUserId) {
-        LambdaQueryWrapper<UserConnection> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(UserConnection::getProviderName, providerName)
-                .eq(UserConnection::getProviderUserId, providerUserId);
-        return this.baseMapper.selectOne(queryWrapper);
-    }
-
-    @Override
-    public List<UserConnection> selectByCondition(String username) {
-        LambdaQueryWrapper<UserConnection> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(UserConnection::getUserName, username);
-        return this.baseMapper.selectList(queryWrapper);
-    }
-
-    @Override
-    @Transactional
-    public void createUserConnection(UserConnection userConnection) {
-        this.baseMapper.insert(userConnection);
-    }
-
-    @Override
-    @Transactional
-    public void deleteByCondition(String username, String providerName) {
-        LambdaQueryWrapper<UserConnection> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(UserConnection::getUserName, username);
-        queryWrapper.eq(UserConnection::getProviderName, providerName);
-        this.remove(queryWrapper);
-    }
-
-}
+package cc.mrbird.febs.auth.service.impl;
+
+import cc.mrbird.febs.auth.entity.UserConnection;
+import cc.mrbird.febs.auth.mapper.UserConnectionMapper;
+import cc.mrbird.febs.auth.service.UserConnectionService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+@Service
+@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
+public class UserConnectionServiceImpl extends ServiceImpl<UserConnectionMapper, UserConnection> implements UserConnectionService {
+
+    @Override
+    public UserConnection selectByCondition(String providerName, String providerUserId) {
+        LambdaQueryWrapper<UserConnection> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UserConnection::getProviderName, providerName)
+                .eq(UserConnection::getProviderUserId, providerUserId);
+        return this.baseMapper.selectOne(queryWrapper);
+    }
+
+    @Override
+    public List<UserConnection> selectByCondition(String username) {
+        LambdaQueryWrapper<UserConnection> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UserConnection::getUserName, username);
+        return this.baseMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    @Transactional
+    public void createUserConnection(UserConnection userConnection) {
+        this.baseMapper.insert(userConnection);
+    }
+
+    @Override
+    @Transactional
+    public void deleteByCondition(String username, String providerName) {
+        LambdaQueryWrapper<UserConnection> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UserConnection::getUserName, username);
+        queryWrapper.eq(UserConnection::getProviderName, providerName);
+        this.remove(queryWrapper);
+    }
+
+}

+ 86 - 86
febs-auth/src/main/java/cc/mrbird/febs/auth/service/impl/ValidateCodeServiceImpl.java

@@ -1,86 +1,86 @@
-package cc.mrbird.febs.auth.service.impl;
-
-import cc.mrbird.febs.auth.properties.FebsAuthProperties;
-import cc.mrbird.febs.auth.properties.FebsValidateCodeProperties;
-import cc.mrbird.febs.auth.service.ValidateCodeService;
-import cc.mrbird.febs.common.entity.constant.FebsConstant;
-import cc.mrbird.febs.common.entity.constant.ImageTypeConstant;
-import cc.mrbird.febs.common.entity.constant.ParamsConstant;
-import cc.mrbird.febs.common.exception.ValidateCodeException;
-import cc.mrbird.febs.common.service.RedisService;
-import com.wf.captcha.GifCaptcha;
-import com.wf.captcha.SpecCaptcha;
-import com.wf.captcha.base.Captcha;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Service;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * 验证码服务
- *
- * @author MrBird
- */
-@Service
-public class ValidateCodeServiceImpl implements ValidateCodeService {
-
-    @Autowired
-    private RedisService redisService;
-    @Autowired
-    private FebsAuthProperties properties;
-
-    @Override
-    public void create(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException {
-        String key = request.getParameter(ParamsConstant.VALIDATE_CODE_KEY);
-        if (StringUtils.isBlank(key)) {
-            throw new ValidateCodeException("验证码key不能为空");
-        }
-        FebsValidateCodeProperties code = properties.getCode();
-        setHeader(response, code.getType());
-
-        Captcha captcha = createCaptcha(code);
-        redisService.set(FebsConstant.CODE_PREFIX + key, StringUtils.lowerCase(captcha.text()), code.getTime());
-        captcha.out(response.getOutputStream());
-    }
-
-    @Override
-    public void check(String key, String value) throws ValidateCodeException {
-        Object codeInRedis = redisService.get(FebsConstant.CODE_PREFIX + key);
-        if (StringUtils.isBlank(value)) {
-            throw new ValidateCodeException("请输入验证码");
-        }
-        if (codeInRedis == null) {
-            throw new ValidateCodeException("验证码已过期");
-        }
-        if (!StringUtils.equalsIgnoreCase(value, String.valueOf(codeInRedis))) {
-            throw new ValidateCodeException("验证码不正确");
-        }
-    }
-
-    private Captcha createCaptcha(FebsValidateCodeProperties code) {
-        Captcha captcha = null;
-        if (StringUtils.equalsIgnoreCase(code.getType(), ImageTypeConstant.GIF)) {
-            captcha = new GifCaptcha(code.getWidth(), code.getHeight(), code.getLength());
-        } else {
-            captcha = new SpecCaptcha(code.getWidth(), code.getHeight(), code.getLength());
-        }
-        captcha.setCharType(code.getCharType());
-        return captcha;
-    }
-
-    private void setHeader(HttpServletResponse response, String type) {
-        if (StringUtils.equalsIgnoreCase(type, ImageTypeConstant.GIF)) {
-            response.setContentType(MediaType.IMAGE_GIF_VALUE);
-        } else {
-            response.setContentType(MediaType.IMAGE_PNG_VALUE);
-        }
-        response.setHeader(HttpHeaders.PRAGMA, "No-cache");
-        response.setHeader(HttpHeaders.CACHE_CONTROL, "No-cache");
-        response.setDateHeader(HttpHeaders.EXPIRES, 0L);
-    }
-}
+package cc.mrbird.febs.auth.service.impl;
+
+import cc.mrbird.febs.auth.properties.FebsAuthProperties;
+import cc.mrbird.febs.auth.properties.FebsValidateCodeProperties;
+import cc.mrbird.febs.auth.service.ValidateCodeService;
+import cc.mrbird.febs.common.entity.constant.FebsConstant;
+import cc.mrbird.febs.common.entity.constant.ImageTypeConstant;
+import cc.mrbird.febs.common.entity.constant.ParamsConstant;
+import cc.mrbird.febs.common.exception.ValidateCodeException;
+import cc.mrbird.febs.common.service.RedisService;
+import com.wf.captcha.GifCaptcha;
+import com.wf.captcha.SpecCaptcha;
+import com.wf.captcha.base.Captcha;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 验证码服务
+ *
+ * @author MrBird
+ */
+@Service
+public class ValidateCodeServiceImpl implements ValidateCodeService {
+
+    @Autowired
+    private RedisService redisService;
+    @Autowired
+    private FebsAuthProperties properties;
+
+    @Override
+    public void create(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException {
+        String key = request.getParameter(ParamsConstant.VALIDATE_CODE_KEY);
+        if (StringUtils.isBlank(key)) {
+            throw new ValidateCodeException("验证码key不能为空");
+        }
+        FebsValidateCodeProperties code = properties.getCode();
+        setHeader(response, code.getType());
+
+        Captcha captcha = createCaptcha(code);
+        redisService.set(FebsConstant.CODE_PREFIX + key, StringUtils.lowerCase(captcha.text()), code.getTime());
+        captcha.out(response.getOutputStream());
+    }
+
+    @Override
+    public void check(String key, String value) throws ValidateCodeException {
+        Object codeInRedis = redisService.get(FebsConstant.CODE_PREFIX + key);
+        if (StringUtils.isBlank(value)) {
+            throw new ValidateCodeException("请输入验证码");
+        }
+        if (codeInRedis == null) {
+            throw new ValidateCodeException("验证码已过期");
+        }
+        if (!StringUtils.equalsIgnoreCase(value, String.valueOf(codeInRedis))) {
+            throw new ValidateCodeException("验证码不正确");
+        }
+    }
+
+    private Captcha createCaptcha(FebsValidateCodeProperties code) {
+        Captcha captcha = null;
+        if (StringUtils.equalsIgnoreCase(code.getType(), ImageTypeConstant.GIF)) {
+            captcha = new GifCaptcha(code.getWidth(), code.getHeight(), code.getLength());
+        } else {
+            captcha = new SpecCaptcha(code.getWidth(), code.getHeight(), code.getLength());
+        }
+        captcha.setCharType(code.getCharType());
+        return captcha;
+    }
+
+    private void setHeader(HttpServletResponse response, String type) {
+        if (StringUtils.equalsIgnoreCase(type, ImageTypeConstant.GIF)) {
+            response.setContentType(MediaType.IMAGE_GIF_VALUE);
+        } else {
+            response.setContentType(MediaType.IMAGE_PNG_VALUE);
+        }
+        response.setHeader(HttpHeaders.PRAGMA, "No-cache");
+        response.setHeader(HttpHeaders.CACHE_CONTROL, "No-cache");
+        response.setDateHeader(HttpHeaders.EXPIRES, 0L);
+    }
+}

+ 57 - 57
febs-auth/src/main/java/cc/mrbird/febs/auth/translator/FebsWebResponseExceptionTranslator.java

@@ -1,57 +1,57 @@
-package cc.mrbird.febs.auth.translator;
-
-import cc.mrbird.febs.common.entity.FebsResponse;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
-import org.springframework.security.oauth2.common.exceptions.InvalidScopeException;
-import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
-import org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException;
-import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator;
-import org.springframework.stereotype.Component;
-
-/**
- * 异常翻译
- *
- * @author MrBird
- */
-@Slf4j
-@Component
-public class FebsWebResponseExceptionTranslator implements WebResponseExceptionTranslator {
-
-    @Override
-    public ResponseEntity<?> translate(Exception e) {
-        ResponseEntity.BodyBuilder status = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR);
-        FebsResponse response = new FebsResponse();
-        String message = "认证失败";
-        log.error(message, e);
-        if (e instanceof UnsupportedGrantTypeException) {
-            message = "不支持该认证类型";
-            return status.body(response.message(message));
-        }
-        if (e instanceof InvalidTokenException
-                && StringUtils.containsIgnoreCase(e.getMessage(), "Invalid refresh token (expired)")) {
-            message = "刷新令牌已过期,请重新登录";
-            return status.body(response.message(message));
-        }
-        if (e instanceof InvalidScopeException) {
-            message = "不是有效的scope值";
-            return status.body(response.message(message));
-        }
-        if (e instanceof InvalidGrantException) {
-            if (StringUtils.containsIgnoreCase(e.getMessage(), "Invalid refresh token")) {
-                message = "refresh token无效";
-                return status.body(response.message(message));
-            }
-            if (StringUtils.containsIgnoreCase(e.getMessage(), "locked")) {
-                message = "用户已被锁定,请联系管理员";
-                return status.body(response.message(message));
-            }
-            message = "用户名或密码错误";
-            return status.body(response.message(message));
-        }
-        return status.body(response.message(message));
-    }
-}
+package cc.mrbird.febs.auth.translator;
+
+import cc.mrbird.febs.common.entity.FebsResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
+import org.springframework.security.oauth2.common.exceptions.InvalidScopeException;
+import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
+import org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException;
+import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator;
+import org.springframework.stereotype.Component;
+
+/**
+ * 异常翻译
+ *
+ * @author MrBird
+ */
+@Slf4j
+@Component
+public class FebsWebResponseExceptionTranslator implements WebResponseExceptionTranslator {
+
+    @Override
+    public ResponseEntity<?> translate(Exception e) {
+        ResponseEntity.BodyBuilder status = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR);
+        FebsResponse response = new FebsResponse();
+        String message = "认证失败";
+        log.error(message, e);
+        if (e instanceof UnsupportedGrantTypeException) {
+            message = "不支持该认证类型";
+            return status.body(response.message(message));
+        }
+        if (e instanceof InvalidTokenException
+                && StringUtils.containsIgnoreCase(e.getMessage(), "Invalid refresh token (expired)")) {
+            message = "刷新令牌已过期,请重新登录";
+            return status.body(response.message(message));
+        }
+        if (e instanceof InvalidScopeException) {
+            message = "不是有效的scope值";
+            return status.body(response.message(message));
+        }
+        if (e instanceof InvalidGrantException) {
+            if (StringUtils.containsIgnoreCase(e.getMessage(), "Invalid refresh token")) {
+                message = "refresh token无效";
+                return status.body(response.message(message));
+            }
+            if (StringUtils.containsIgnoreCase(e.getMessage(), "locked")) {
+                message = "用户已被锁定,请联系管理员";
+                return status.body(response.message(message));
+            }
+            message = "用户名或密码错误";
+            return status.body(response.message(message));
+        }
+        return status.body(response.message(message));
+    }
+}

+ 22 - 22
febs-auth/src/main/resources/bootstrap.yml

@@ -1,23 +1,23 @@
-spring:
-  application:
-    name: FEBS-Auth
-  profiles:
-    active: dev
-  cloud:
-    nacos:
-      config:
-        server-addr: ${nacos.url}:8001
-        group: DEFAULT_GROUP
-        prefix: febs-auth
-        file-extension: yaml
-      discovery:
-        server-addr: ${nacos.url}:8001
-
-logging:
-  level:
-    com:
-      alibaba:
-        cloud:
-          nacos:
-            client:
+spring:
+  application:
+    name: FEBS-Auth
+  profiles:
+    active: dev
+  cloud:
+    nacos:
+      config:
+        server-addr: ${nacos.url}:8001
+        group: DEFAULT_GROUP
+        prefix: febs-auth
+        file-extension: yaml
+      discovery:
+        server-addr: ${nacos.url}:8001
+
+logging:
+  level:
+    com:
+      alibaba:
+        cloud:
+          nacos:
+            client:
               NacosPropertySourceBuilder: error

+ 11 - 11
febs-auth/src/main/resources/febs-auth.properties

@@ -1,12 +1,12 @@
-febs.auth.anonUrl=/actuator/**,/captcha,/social/**
-febs.auth.enableJwt=false
-febs.auth.jwtAccessKey=febs
-
-febs.auth.socialLoginClientId=app
-
-febs.auth.code.time=120
-febs.auth.code.type=png
-febs.auth.code.width=115
-febs.auth.code.height=42
-febs.auth.code.length=4
+febs.auth.anonUrl=/actuator/**,/captcha,/social/**
+febs.auth.enableJwt=false
+febs.auth.jwtAccessKey=febs
+
+febs.auth.socialLoginClientId=app
+
+febs.auth.code.time=120
+febs.auth.code.type=png
+febs.auth.code.width=115
+febs.auth.code.height=42
+febs.auth.code.length=4
 febs.auth.code.charType=2

+ 60 - 60
febs-auth/src/main/resources/logback-spring.xml

@@ -1,61 +1,61 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration scan="true" scanPeriod="60 seconds" debug="false">
-    <contextName>febs</contextName>
-    <property name="log.path" value="log/febs-auth" />
-    <property name="log.maxHistory" value="15" />
-    <property name="log.colorPattern" value="%magenta(%d{yyyy-MM-dd HH:mm:ss}) %highlight(%-5level) %yellow(%thread) %green(%logger) %msg%n"/>
-    <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5level %thread %logger %msg%n"/>
-
-    <!--输出到控制台-->
-    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>${log.colorPattern}</pattern>
-        </encoder>
-    </appender>
-
-    <!--输出到文件-->
-    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${log.path}/info/info.%d{yyyy-MM-dd}.log</fileNamePattern>
-            <MaxHistory>${log.maxHistory}</MaxHistory>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${log.pattern}</pattern>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>INFO</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-    </appender>
-
-    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${log.path}/error/error.%d{yyyy-MM-dd}.log</fileNamePattern>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${log.pattern}</pattern>
-        </encoder>
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>ERROR</level>
-            <onMatch>ACCEPT</onMatch>
-            <onMismatch>DENY</onMismatch>
-        </filter>
-    </appender>
-
-    <!--输出到 logstash的 appender-->
-<!--    <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
-<!--        <destination>${logstash.url}:4560</destination>-->
-<!--        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>-->
-<!--    </appender>-->
-
-    <root level="debug">
-        <appender-ref ref="console" />
-    </root>
-
-    <root level="info">
-        <appender-ref ref="file_info" />
-        <appender-ref ref="file_error" />
-<!--        <appender-ref ref="logstash" />-->
-    </root>
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <contextName>febs</contextName>
+    <property name="log.path" value="log/febs-auth" />
+    <property name="log.maxHistory" value="15" />
+    <property name="log.colorPattern" value="%magenta(%d{yyyy-MM-dd HH:mm:ss}) %highlight(%-5level) %yellow(%thread) %green(%logger) %msg%n"/>
+    <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5level %thread %logger %msg%n"/>
+
+    <!--输出到控制台-->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${log.colorPattern}</pattern>
+        </encoder>
+    </appender>
+
+    <!--输出到文件-->
+    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}/info/info.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <MaxHistory>${log.maxHistory}</MaxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>INFO</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}/error/error.%d{yyyy-MM-dd}.log</fileNamePattern>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>ERROR</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--输出到 logstash的 appender-->
+<!--    <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
+<!--        <destination>${logstash.url}:4560</destination>-->
+<!--        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>-->
+<!--    </appender>-->
+
+    <root level="debug">
+        <appender-ref ref="console" />
+    </root>
+
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+<!--        <appender-ref ref="logstash" />-->
+    </root>
 </configuration>

+ 15 - 15
febs-auth/src/main/resources/mapper/MenuMapper.xml

@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cc.mrbird.febs.auth.mapper.MenuMapper">
-
-    <select id="findUserPermissions" resultType="menu">
-        select distinct m.perms
-        from t_role r
-                 left join t_user_role ur on (r.role_id = ur.role_id)
-                 left join t_user u on (u.user_id = ur.user_id)
-                 left join t_role_menu rm on (rm.role_id = r.role_id)
-                 left join t_menu m on (m.menu_id = rm.menu_id)
-        where u.username = #{userName}
-          and m.perms is not null
-          and m.perms &lt;&gt; ''
-    </select>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cc.mrbird.febs.auth.mapper.MenuMapper">
+
+    <select id="findUserPermissions" resultType="menu">
+        select distinct m.perms
+        from t_role r
+                 left join t_user_role ur on (r.role_id = ur.role_id)
+                 left join t_user u on (u.user_id = ur.user_id)
+                 left join t_role_menu rm on (rm.role_id = r.role_id)
+                 left join t_menu m on (m.menu_id = rm.menu_id)
+        where u.username = #{userName}
+          and m.perms is not null
+          and m.perms &lt;&gt; ''
+    </select>
 </mapper>

+ 31 - 31
febs-auth/src/main/resources/mapper/UserMapper.xml

@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cc.mrbird.febs.auth.mapper.UserMapper">
-    <select id="findByName" parameterType="string" resultType="systemUser">
-        SELECT
-        u.user_id userId,
-        u.username,
-        u.email,
-        u.mobile,
-        u.password,
-        u.status,
-        u.create_time createTime,
-        u.ssex sex,
-        u.dept_id deptId,
-        u.last_login_time lastLoginTime,
-        u.modify_time modifyTime,
-        u.description,
-        u.avatar,
-        d.dept_name deptName,
-        GROUP_CONCAT(r.role_id) roleId,
-        GROUP_CONCAT(r.ROLE_NAME) roleName
-        FROM
-        t_user u
-        LEFT JOIN t_dept d ON (u.dept_id = d.dept_id)
-        LEFT JOIN t_user_role ur ON (u.user_id = ur.user_id)
-        LEFT JOIN t_role r ON r.role_id = ur.role_id
-        WHERE  u.username = #{username}
-        group by u.username,u.user_id,u.email,u.mobile,u.password, u.status,u.create_time,u.ssex,u.dept_id
-				,u.last_login_time,u.modify_time,u.description,u.avatar
-    </select>
-</mapper>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cc.mrbird.febs.auth.mapper.UserMapper">
+    <select id="findByName" parameterType="string" resultType="systemUser">
+        SELECT
+        u.user_id userId,
+        u.username,
+        u.email,
+        u.mobile,
+        u.password,
+        u.status,
+        u.create_time createTime,
+        u.ssex sex,
+        u.dept_id deptId,
+        u.last_login_time lastLoginTime,
+        u.modify_time modifyTime,
+        u.description,
+        u.avatar,
+        d.dept_name deptName,
+        GROUP_CONCAT(r.role_id) roleId,
+        GROUP_CONCAT(r.ROLE_NAME) roleName
+        FROM
+        t_user u
+        LEFT JOIN t_dept d ON (u.dept_id = d.dept_id)
+        LEFT JOIN t_user_role ur ON (u.user_id = ur.user_id)
+        LEFT JOIN t_role r ON r.role_id = ur.role_id
+        WHERE  u.username = #{username}
+        group by u.username,u.user_id,u.email,u.mobile,u.password, u.status,u.create_time,u.ssex,u.dept_id
+				,u.last_login_time,u.modify_time,u.description,u.avatar
+    </select>
+</mapper>

+ 19 - 19
febs-auth/src/main/resources/templates/error.html

@@ -1,20 +1,20 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org" lang="ch">
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport"
-          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>第三方登录失败</title>
-</head>
-<style>
-    span {
-        font-size: .9rem;
-        font-weight: bold;
-        color: #42b983;
-    }
-</style>
-<body>
-    <span>[[${error}]]</span>
-</body>
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" lang="ch">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>第三方登录失败</title>
+</head>
+<style>
+    span {
+        font-size: .9rem;
+        font-weight: bold;
+        color: #42b983;
+    }
+</style>
+<body>
+    <span>[[${error}]]</span>
+</body>
 </html>

+ 20 - 20
febs-auth/src/main/resources/templates/result.html

@@ -1,21 +1,21 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org" lang="ch">
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport"
-          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>登录跳转中</title>
-</head>
-<body>
-    登录中..
-<script th:inline="javascript">
-    var response = [[${response}]];
-    var frontUrl = [[${frontUrl}]];
-    window.onload = function () {
-        window.opener.postMessage(response, frontUrl);
-        window.close();
-    }
-</script>
-</body>
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" lang="ch">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>登录跳转中</title>
+</head>
+<body>
+    登录中..
+<script th:inline="javascript">
+    var response = [[${response}]];
+    var frontUrl = [[${frontUrl}]];
+    window.onload = function () {
+        window.opener.postMessage(response, frontUrl);
+        window.close();
+    }
+</script>
+</body>
 </html>

+ 21 - 21
febs-cloud/config/alertmanager.yml

@@ -1,22 +1,22 @@
-global:
-  smtp_smarthost: 'smtp.126.com:465'
-  smtp_from: 'wuyouzhuguli@126.com'
-  smtp_auth_username: 'wuyouzhuguli'
-  smtp_auth_password: '123456'
-  smtp_require_tls: false
-
-#templates:
-#  - '/alertmanager/template/*.tmpl'
-
-route:
-  group_by: ['alertname']
-  group_wait: 10s
-  group_interval: 5m
-  repeat_interval: 5m
-  receiver: 'default-receiver'
-
-receivers:
-  - name: 'default-receiver'
-    email_configs:
-      - to: '852252810@qq.com'
+global:
+  smtp_smarthost: 'smtp.126.com:465'
+  smtp_from: 'wuyouzhuguli@126.com'
+  smtp_auth_username: 'wuyouzhuguli'
+  smtp_auth_password: '123456'
+  smtp_require_tls: false
+
+#templates:
+#  - '/alertmanager/template/*.tmpl'
+
+route:
+  group_by: ['alertname']
+  group_wait: 10s
+  group_interval: 5m
+  repeat_interval: 5m
+  receiver: 'default-receiver'
+
+receivers:
+  - name: 'default-receiver'
+    email_configs:
+      - to: '852252810@qq.com'
         send_resolved: true

+ 6 - 6
febs-cloud/config/elasticsearch.yml

@@ -1,7 +1,7 @@
-http.host: 0.0.0.0
-http.cors.enabled: true
-http.cors.allow-origin: "*"
-# Uncomment the following lines for a production cluster deployment
-#transport.host: 0.0.0.0
-#discovery.zen.minimum_master_nodes: 1
+http.host: 0.0.0.0
+http.cors.enabled: true
+http.cors.allow-origin: "*"
+# Uncomment the following lines for a production cluster deployment
+#transport.host: 0.0.0.0
+#discovery.zen.minimum_master_nodes: 1
 transport.host: 0.0.0.0

+ 10 - 10
febs-cloud/config/memory_over.yml

@@ -1,11 +1,11 @@
-groups:
-  - name: memory_over
-    rules:
-      - alert: NodeMemoryUsage
-        expr: (node_memory_MemTotal_bytes - (node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes )) / node_memory_MemTotal_bytes * 100 > 80
-        for: 20s
-        labels:
-          user: MrBird
-        annotations:
-          summary: "{{$labels.instance}}: High Memory usage detected"
+groups:
+  - name: memory_over
+    rules:
+      - alert: NodeMemoryUsage
+        expr: (node_memory_MemTotal_bytes - (node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes )) / node_memory_MemTotal_bytes * 100 > 80
+        for: 20s
+        labels:
+          user: MrBird
+        annotations:
+          summary: "{{$labels.instance}}: High Memory usage detected"
           description: "{{$labels.instance}}: Memory usage is above 80% (current value is:{{ $value }})"

+ 56 - 56
febs-cloud/config/prometheus.yml

@@ -1,57 +1,57 @@
-global:
-  scrape_interval:     15s
-  evaluation_interval: 15s
-
-scrape_configs:
-  - job_name: 'prometheus'
-    static_configs:
-      - targets: ['YOUR-IP:8403']
-  - job_name: 'node_exporter'
-    static_configs:
-      - targets: ['YOUR-IP:8405']
-        labels:
-          instance: 'node_exporter'
-  - job_name: 'redis_exporter'
-    static_configs:
-      - targets: ['YOUR-IP:8408']
-        labels:
-          instance: 'redis_exporter'
-  - job_name: 'mysql_exporter'
-    static_configs:
-      - targets: ['YOUR-IP:8409']
-        labels:
-          instance: 'mysql_exporter'
-  - job_name: 'cadvisor'
-    static_configs:
-      - targets: ['YOUR-IP:8407']
-        labels:
-          instance: 'cadvisor'
-
-  - job_name: 'febs-server-system-actuator'
-    metrics_path: '/actuator/prometheus'
-    scrape_interval: 5s
-    static_configs:
-      - targets: ['YOUR-IP:8201']
-        labels:
-          instance: 'febs-server-system'
-  - job_name: 'febs-server-auth-actuator'
-    metrics_path: '/actuator/prometheus'
-    scrape_interval: 5s
-    static_configs:
-      - targets: ['YOUR-IP:8101']
-        labels:
-          instance: 'febs-auth'
-  - job_name: 'febs-server-test-actuator'
-    metrics_path: '/actuator/prometheus'
-    scrape_interval: 5s
-    static_configs:
-      - targets: ['YOUR-IP:8202']
-        labels:
-          instance: 'febs-server-test'
-rule_files:
-  - 'memory_over.yml'
-  - 'server_down.yml'
-alerting:
-  alertmanagers:
-    - static_configs:
+global:
+  scrape_interval:     15s
+  evaluation_interval: 15s
+
+scrape_configs:
+  - job_name: 'prometheus'
+    static_configs:
+      - targets: ['YOUR-IP:8403']
+  - job_name: 'node_exporter'
+    static_configs:
+      - targets: ['YOUR-IP:8405']
+        labels:
+          instance: 'node_exporter'
+  - job_name: 'redis_exporter'
+    static_configs:
+      - targets: ['YOUR-IP:8408']
+        labels:
+          instance: 'redis_exporter'
+  - job_name: 'mysql_exporter'
+    static_configs:
+      - targets: ['YOUR-IP:8409']
+        labels:
+          instance: 'mysql_exporter'
+  - job_name: 'cadvisor'
+    static_configs:
+      - targets: ['YOUR-IP:8407']
+        labels:
+          instance: 'cadvisor'
+
+  - job_name: 'febs-server-system-actuator'
+    metrics_path: '/actuator/prometheus'
+    scrape_interval: 5s
+    static_configs:
+      - targets: ['YOUR-IP:8201']
+        labels:
+          instance: 'febs-server-system'
+  - job_name: 'febs-server-auth-actuator'
+    metrics_path: '/actuator/prometheus'
+    scrape_interval: 5s
+    static_configs:
+      - targets: ['YOUR-IP:8101']
+        labels:
+          instance: 'febs-auth'
+  - job_name: 'febs-server-test-actuator'
+    metrics_path: '/actuator/prometheus'
+    scrape_interval: 5s
+    static_configs:
+      - targets: ['YOUR-IP:8202']
+        labels:
+          instance: 'febs-server-test'
+rule_files:
+  - 'memory_over.yml'
+  - 'server_down.yml'
+alerting:
+  alertmanagers:
+    - static_configs:
         - targets: ["YOUR-IP:8406"]

+ 10 - 10
febs-cloud/config/server_down.yml

@@ -1,11 +1,11 @@
-groups:
-  - name: server_down
-    rules:
-      - alert: InstanceDown
-        expr: up == 0
-        for: 20s
-        labels:
-          user: MrBird
-        annotations:
-          summary: "Instance {{ $labels.instance }} down"
+groups:
+  - name: server_down
+    rules:
+      - alert: InstanceDown
+        expr: up == 0
+        for: 20s
+        labels:
+          user: MrBird
+        annotations:
+          summary: "Instance {{ $labels.instance }} down"
           description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 20 s."

+ 110 - 110
febs-cloud/config/skywalking_application.yml

@@ -1,111 +1,111 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-cluster:
-  standalone:
-  # Please check your ZooKeeper is 3.5+, However, it is also compatible with ZooKeeper 3.4.x. Replace the ZooKeeper 3.5+
-  # library the oap-libs folder with your ZooKeeper 3.4.x library.
-#  zookeeper:
-#    nameSpace: ${SW_NAMESPACE:""}
-#    hostPort: ${SW_CLUSTER_ZK_HOST_PORT:localhost:2181}
-#    #Retry Policy
-#    baseSleepTimeMs: ${SW_CLUSTER_ZK_SLEEP_TIME:1000} # initial amount of time to wait between retries
-#    maxRetries: ${SW_CLUSTER_ZK_MAX_RETRIES:3} # max number of times to retry
-#  kubernetes:
-#    watchTimeoutSeconds: ${SW_CLUSTER_K8S_WATCH_TIMEOUT:60}
-#    namespace: ${SW_CLUSTER_K8S_NAMESPACE:default}
-#    labelSelector: ${SW_CLUSTER_K8S_LABEL:app=collector,release=skywalking}
-#    uidEnvName: ${SW_CLUSTER_K8S_UID:SKYWALKING_COLLECTOR_UID}
-#  consul:
-#    serviceName: ${SW_SERVICE_NAME:"SkyWalking_OAP_Cluster"}
-#     Consul cluster nodes, example: 10.0.0.1:8500,10.0.0.2:8500,10.0.0.3:8500
-#    hostPort: ${SW_CLUSTER_CONSUL_HOST_PORT:localhost:8500}
-core:
-  default:
-    # Mixed: Receive agent data, Level 1 aggregate, Level 2 aggregate
-    # Aggregator: Level 2 aggregate
-    role: ${SW_CORE_ROLE:Mixed} # Mixed/Receiver/Aggregator
-    restHost: ${SW_CORE_REST_HOST:0.0.0.0}
-    restPort: ${SW_CORE_REST_PORT:12800}
-    restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/}
-    gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0}
-    gRPCPort: ${SW_CORE_GRPC_PORT:11800}
-    downsampling:
-      - Hour
-      - Day
-      - Month
-    # Set a timeout on metric data. After the timeout has expired, the metric data will automatically be deleted.
-    recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute
-    minuteMetricsDataTTL: ${SW_CORE_MINUTE_METRIC_DATA_TTL:90} # Unit is minute
-    hourMetricsDataTTL: ${SW_CORE_HOUR_METRIC_DATA_TTL:36} # Unit is hour
-    dayMetricsDataTTL: ${SW_CORE_DAY_METRIC_DATA_TTL:45} # Unit is day
-    monthMetricsDataTTL: ${SW_CORE_MONTH_METRIC_DATA_TTL:18} # Unit is month
-storage:
-  elasticsearch:
-    # set the namespace in elasticsearch
-    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:elasticsearch:9200}
-    indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
-    indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
-    # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
-    bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:2000} # Execute the bulk every 2000 requests
-    bulkSize: ${SW_STORAGE_ES_BULK_SIZE:20} # flush the bulk every 20mb
-    flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
-    concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
-    metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000}
-    segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200}
-#  h2:
-#    driver: ${SW_STORAGE_H2_DRIVER:org.h2.jdbcx.JdbcDataSource}
-#    url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db}
-#    user: ${SW_STORAGE_H2_USER:sa}
-#    metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
-#  mysql:
-#    metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
-receiver-sharing-server:
-  default:
-receiver-register:
-  default:
-receiver-trace:
-  default:
-    bufferPath: ${SW_RECEIVER_BUFFER_PATH:../trace-buffer/}  # Path to trace buffer files, suggest to use absolute path
-    bufferOffsetMaxFileSize: ${SW_RECEIVER_BUFFER_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
-    bufferDataMaxFileSize: ${SW_RECEIVER_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
-    bufferFileCleanWhenRestart: ${SW_RECEIVER_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
-    sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default.
-    slowDBAccessThreshold: ${SW_SLOW_DB_THRESHOLD:default:200,mongodb:100} # The slow database access thresholds. Unit ms.
-receiver-jvm:
-  default:
-service-mesh:
-  default:
-    bufferPath: ${SW_SERVICE_MESH_BUFFER_PATH:../mesh-buffer/}  # Path to trace buffer files, suggest to use absolute path
-    bufferOffsetMaxFileSize: ${SW_SERVICE_MESH_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
-    bufferDataMaxFileSize: ${SW_SERVICE_MESH_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
-    bufferFileCleanWhenRestart: ${SW_SERVICE_MESH_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
-istio-telemetry:
-  default:
-envoy-metric:
-  default:
-# receiver_zipkin:
-#   default:
-#     host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
-#     port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
-#     contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}
-query:
-  graphql:
-    path: ${SW_QUERY_GRAPHQL_PATH:/graphql}
-alarm:
-  default:
-telemetry:
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cluster:
+  standalone:
+  # Please check your ZooKeeper is 3.5+, However, it is also compatible with ZooKeeper 3.4.x. Replace the ZooKeeper 3.5+
+  # library the oap-libs folder with your ZooKeeper 3.4.x library.
+#  zookeeper:
+#    nameSpace: ${SW_NAMESPACE:""}
+#    hostPort: ${SW_CLUSTER_ZK_HOST_PORT:localhost:2181}
+#    #Retry Policy
+#    baseSleepTimeMs: ${SW_CLUSTER_ZK_SLEEP_TIME:1000} # initial amount of time to wait between retries
+#    maxRetries: ${SW_CLUSTER_ZK_MAX_RETRIES:3} # max number of times to retry
+#  kubernetes:
+#    watchTimeoutSeconds: ${SW_CLUSTER_K8S_WATCH_TIMEOUT:60}
+#    namespace: ${SW_CLUSTER_K8S_NAMESPACE:default}
+#    labelSelector: ${SW_CLUSTER_K8S_LABEL:app=collector,release=skywalking}
+#    uidEnvName: ${SW_CLUSTER_K8S_UID:SKYWALKING_COLLECTOR_UID}
+#  consul:
+#    serviceName: ${SW_SERVICE_NAME:"SkyWalking_OAP_Cluster"}
+#     Consul cluster nodes, example: 10.0.0.1:8500,10.0.0.2:8500,10.0.0.3:8500
+#    hostPort: ${SW_CLUSTER_CONSUL_HOST_PORT:localhost:8500}
+core:
+  default:
+    # Mixed: Receive agent data, Level 1 aggregate, Level 2 aggregate
+    # Aggregator: Level 2 aggregate
+    role: ${SW_CORE_ROLE:Mixed} # Mixed/Receiver/Aggregator
+    restHost: ${SW_CORE_REST_HOST:0.0.0.0}
+    restPort: ${SW_CORE_REST_PORT:12800}
+    restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/}
+    gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0}
+    gRPCPort: ${SW_CORE_GRPC_PORT:11800}
+    downsampling:
+      - Hour
+      - Day
+      - Month
+    # Set a timeout on metric data. After the timeout has expired, the metric data will automatically be deleted.
+    recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute
+    minuteMetricsDataTTL: ${SW_CORE_MINUTE_METRIC_DATA_TTL:90} # Unit is minute
+    hourMetricsDataTTL: ${SW_CORE_HOUR_METRIC_DATA_TTL:36} # Unit is hour
+    dayMetricsDataTTL: ${SW_CORE_DAY_METRIC_DATA_TTL:45} # Unit is day
+    monthMetricsDataTTL: ${SW_CORE_MONTH_METRIC_DATA_TTL:18} # Unit is month
+storage:
+  elasticsearch:
+    # set the namespace in elasticsearch
+    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:elasticsearch:9200}
+    indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
+    indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
+    # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
+    bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:2000} # Execute the bulk every 2000 requests
+    bulkSize: ${SW_STORAGE_ES_BULK_SIZE:20} # flush the bulk every 20mb
+    flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
+    concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
+    metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000}
+    segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200}
+#  h2:
+#    driver: ${SW_STORAGE_H2_DRIVER:org.h2.jdbcx.JdbcDataSource}
+#    url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db}
+#    user: ${SW_STORAGE_H2_USER:sa}
+#    metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
+#  mysql:
+#    metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}
+receiver-sharing-server:
+  default:
+receiver-register:
+  default:
+receiver-trace:
+  default:
+    bufferPath: ${SW_RECEIVER_BUFFER_PATH:../trace-buffer/}  # Path to trace buffer files, suggest to use absolute path
+    bufferOffsetMaxFileSize: ${SW_RECEIVER_BUFFER_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
+    bufferDataMaxFileSize: ${SW_RECEIVER_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
+    bufferFileCleanWhenRestart: ${SW_RECEIVER_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
+    sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default.
+    slowDBAccessThreshold: ${SW_SLOW_DB_THRESHOLD:default:200,mongodb:100} # The slow database access thresholds. Unit ms.
+receiver-jvm:
+  default:
+service-mesh:
+  default:
+    bufferPath: ${SW_SERVICE_MESH_BUFFER_PATH:../mesh-buffer/}  # Path to trace buffer files, suggest to use absolute path
+    bufferOffsetMaxFileSize: ${SW_SERVICE_MESH_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
+    bufferDataMaxFileSize: ${SW_SERVICE_MESH_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
+    bufferFileCleanWhenRestart: ${SW_SERVICE_MESH_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
+istio-telemetry:
+  default:
+envoy-metric:
+  default:
+# receiver_zipkin:
+#   default:
+#     host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
+#     port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
+#     contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}
+query:
+  graphql:
+    path: ${SW_QUERY_GRAPHQL_PATH:/graphql}
+alarm:
+  default:
+telemetry:
   none:

+ 70 - 70
febs-cloud/docker compose/elk-skywalking/docker-compose.yml

@@ -1,71 +1,71 @@
-version: '3'
-
-services:
-  elasticsearch:
-    image: elasticsearch:6.4.1
-    container_name: elasticsearch
-    restart: always
-    environment:
-      - cluster.name=elasticsearch
-      - xpack.security.enabled=false
-      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
-      - node.name=elasticsearch_node_1
-      - "TZ=Asia/Shanghai"
-    volumes:
-      - /febs/elasticsearch/data:/usr/share/elasticsearch/data
-      - /febs/elasticsearch/logs:/usr/share/elasticsearch/logs
-      - /febs/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
-    ports:
-      - 9200:9200
-      - 9300:9300
-  kibana:
-    image: kibana:6.4.1
-    container_name: kibana
-    links:
-      - elasticsearch:es #配置elasticsearch域名为 es
-    depends_on:
-      - elasticsearch
-    environment:
-      - "elasticsearch.hosts=http://es:9200" #因为上面配置了域名,所以这里可以简写为 http://es:9200
-    ports:
-      - 5601:5601
-  logstash:
-    image: logstash:6.4.1
-    container_name: logstash
-    volumes:
-      - /febs/logstash/logstash-febs.conf:/usr/share/logstash/pipeline/logstash.conf
-    depends_on:
-      - elasticsearch
-    links:
-      - elasticsearch:es
-    ports:
-      - 4560:4560
-  skywalking-oap:
-    image: apache/skywalking-oap-server:6.4.0
-    container_name: skywalking-oap
-    depends_on:
-      - elasticsearch
-    links:
-      - elasticsearch
-    restart: always
-    ports:
-      - 11800:11800
-      - 12800:12800
-    environment:
-      - "TZ=Asia/Shanghai"
-    volumes:
-      - /febs/skywalking/config:/apache-skywalking-apm-bin/config:ro
-
-  skywalking-ui:
-    image: apache/skywalking-ui:6.4.0
-    container_name: skywalking-ui
-    depends_on:
-      - skywalking-oap
-    links:
-      - skywalking-oap
-    restart: always
-    ports:
-      - 8080:8080
-    environment:
-      - "collector.ribbon.listOfServers=skywalking-oap:12800"
+version: '3'
+
+services:
+  elasticsearch:
+    image: elasticsearch:6.4.1
+    container_name: elasticsearch
+    restart: always
+    environment:
+      - cluster.name=elasticsearch
+      - xpack.security.enabled=false
+      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+      - node.name=elasticsearch_node_1
+      - "TZ=Asia/Shanghai"
+    volumes:
+      - /febs/elasticsearch/data:/usr/share/elasticsearch/data
+      - /febs/elasticsearch/logs:/usr/share/elasticsearch/logs
+      - /febs/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
+    ports:
+      - 9200:9200
+      - 9300:9300
+  kibana:
+    image: kibana:6.4.1
+    container_name: kibana
+    links:
+      - elasticsearch:es #配置elasticsearch域名为 es
+    depends_on:
+      - elasticsearch
+    environment:
+      - "elasticsearch.hosts=http://es:9200" #因为上面配置了域名,所以这里可以简写为 http://es:9200
+    ports:
+      - 5601:5601
+  logstash:
+    image: logstash:6.4.1
+    container_name: logstash
+    volumes:
+      - /febs/logstash/logstash-febs.conf:/usr/share/logstash/pipeline/logstash.conf
+    depends_on:
+      - elasticsearch
+    links:
+      - elasticsearch:es
+    ports:
+      - 4560:4560
+  skywalking-oap:
+    image: apache/skywalking-oap-server:6.4.0
+    container_name: skywalking-oap
+    depends_on:
+      - elasticsearch
+    links:
+      - elasticsearch
+    restart: always
+    ports:
+      - 11800:11800
+      - 12800:12800
+    environment:
+      - "TZ=Asia/Shanghai"
+    volumes:
+      - /febs/skywalking/config:/apache-skywalking-apm-bin/config:ro
+
+  skywalking-ui:
+    image: apache/skywalking-ui:6.4.0
+    container_name: skywalking-ui
+    depends_on:
+      - skywalking-oap
+    links:
+      - skywalking-oap
+    restart: always
+    ports:
+      - 8080:8080
+    environment:
+      - "collector.ribbon.listOfServers=skywalking-oap:12800"
       - "TZ=Asia/Shanghai"

+ 105 - 105
febs-cloud/docker compose/febs-cloud/docker-compose.yml

@@ -1,105 +1,105 @@
-version: '3'
-
-services:
-  febs-monitor-admin:
-    image: febs-monitor-admin:latest
-    container_name: febs-monitor-admin
-    volumes:
-      - "/febs/log:/log"
-    command:
-      - "--nacos.url=127.0.0.1"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 8401:8401
-    restart: on-failure
-  febs-gateway:
-    image: febs-gateway:latest
-    container_name: febs-gateway
-    volumes:
-      - "/febs/log:/log"
-    command:
-      - "--febs-monitor-admin=127.0.0.1"
-      - "--nacos.url=127.0.0.1"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 8301:8301
-    restart: on-failure
-  febs-auth:
-    image: febs-auth:latest
-    container_name: febs-auth
-    volumes:
-      - "/febs/log:/log"
-    command:
-      - "--febs-monitor-admin=127.0.0.1"
-      - "--nacos.url=127.0.0.1"
-      - "--mysql.url=127.0.0.1"
-      - "--redis.url=127.0.0.1"
-      - "--spring.profiles.active=prod"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 8101:8101
-    restart: on-failure
-  febs-server-system:
-    image: febs-server-system:latest
-    container_name: febs-server-system
-    volumes:
-      - "/febs/log:/log"
-    command:
-      - "--febs-monitor-admin=127.0.0.1"
-      - "--febs-gateway=127.0.0.1"
-      - "--nacos.url=127.0.0.1"
-      - "--mysql.url=127.0.0.1"
-      - "--rabbitmq.url=127.0.0.1"
-      - "--spring.profiles.active=prod"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 8201:8201
-    restart: on-failure
-  febs-server-test:
-    image: febs-server-test:latest
-    container_name: febs-server-test
-    volumes:
-      - "/febs/log:/log"
-    command:
-      - "--rabbitmq.url=127.0.0.1"
-      - "--nacos.url=127.0.0.1"
-      - "--febs-monitor-admin=127.0.0.1"
-      - "--febs-gateway=127.0.0.1"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 8202:8202
-    restart: on-failure
-  zipkin-server:
-    image: zipkin-server
-    container_name: zipkin-server
-    command:
-      - "--server.port=8402"
-      - "--zipkin.storage.type=mysql"
-      - "--zipkin.storage.mysql.db=febs_cloud_base"
-      - "--zipkin.storage.mysql.username=root"
-      - "--zipkin.storage.mysql.password=123456"
-      - "--zipkin.storage.mysql.host=127.0.0.1"
-      - "--zipkin.storage.mysql.port=3306"
-      - "--zipkin.collector.rabbitmq.addresses=127.0.0.1:5672"
-      - "--zipkin.collector.rabbitmq.username=febs"
-      - "--zipkin.collector.rabbitmq.password=123456"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 8402:8402
-    restart: on-failure
-  febs-cloud-web:
-    image: febs-cloud-web
-    container_name: febs-cloud-web
-    volumes:
-      - "/febs/log:/log"
-    environment:
-      - "TZ=Asia/Shanghai"
-    ports:
-      - 9527:80
-    restart: on-failure
+version: '3'
+
+services:
+  febs-monitor-admin:
+    image: febs-monitor-admin:latest
+    container_name: febs-monitor-admin
+    volumes:
+      - "/febs/log:/log"
+    command:
+      - "--nacos.url=127.0.0.1"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 8401:8401
+    restart: on-failure
+  febs-gateway:
+    image: febs-gateway:latest
+    container_name: febs-gateway
+    volumes:
+      - "/febs/log:/log"
+    command:
+      - "--febs-monitor-admin=127.0.0.1"
+      - "--nacos.url=127.0.0.1"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 8301:8301
+    restart: on-failure
+  febs-auth:
+    image: febs-auth:latest
+    container_name: febs-auth
+    volumes:
+      - "/febs/log:/log"
+    command:
+      - "--febs-monitor-admin=127.0.0.1"
+      - "--nacos.url=127.0.0.1"
+      - "--mysql.url=127.0.0.1"
+      - "--redis.url=127.0.0.1"
+      - "--spring.profiles.active=prod"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 8101:8101
+    restart: on-failure
+  febs-server-system:
+    image: febs-server-system:latest
+    container_name: febs-server-system
+    volumes:
+      - "/febs/log:/log"
+    command:
+      - "--febs-monitor-admin=127.0.0.1"
+      - "--febs-gateway=127.0.0.1"
+      - "--nacos.url=127.0.0.1"
+      - "--mysql.url=127.0.0.1"
+      - "--rabbitmq.url=127.0.0.1"
+      - "--spring.profiles.active=prod"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 8201:8201
+    restart: on-failure
+  febs-server-test:
+    image: febs-server-test:latest
+    container_name: febs-server-test
+    volumes:
+      - "/febs/log:/log"
+    command:
+      - "--rabbitmq.url=127.0.0.1"
+      - "--nacos.url=127.0.0.1"
+      - "--febs-monitor-admin=127.0.0.1"
+      - "--febs-gateway=127.0.0.1"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 8202:8202
+    restart: on-failure
+  zipkin-server:
+    image: zipkin-server
+    container_name: zipkin-server
+    command:
+      - "--server.port=8402"
+      - "--zipkin.storage.type=mysql"
+      - "--zipkin.storage.mysql.db=febs_cloud_base"
+      - "--zipkin.storage.mysql.username=root"
+      - "--zipkin.storage.mysql.password=123456"
+      - "--zipkin.storage.mysql.host=127.0.0.1"
+      - "--zipkin.storage.mysql.port=3306"
+      - "--zipkin.collector.rabbitmq.addresses=127.0.0.1:5672"
+      - "--zipkin.collector.rabbitmq.username=febs"
+      - "--zipkin.collector.rabbitmq.password=123456"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 8402:8402
+    restart: on-failure
+  febs-cloud-web:
+    image: febs-cloud-web
+    container_name: febs-cloud-web
+    volumes:
+      - "/febs/log:/log"
+    environment:
+      - "TZ=Asia/Shanghai"
+    ports:
+      - 9527:80
+    restart: on-failure

+ 22 - 22
febs-cloud/docker compose/nacos/docker-compose.yml

@@ -1,23 +1,23 @@
-version: '3'
-
-services:
-  nacos:
-    image: nacos/nacos-server:latest
-    container_name: nacos-standalone-mysql
-    environment:
-      - "PREFER_HOST_MODE=hostname"
-      - "MODE=standalone"
-      - "SPRING_DATASOURCE_PLATFORM=mysql"
-      - "MYSQL_MASTER_SERVICE_HOST=127.0.0.1"
-      - "MYSQL_MASTER_SERVICE_DB_NAME=febs_nacos"
-      - "MYSQL_MASTER_SERVICE_PORT=3306"
-      - "MYSQL_MASTER_SERVICE_USER=root"
-      - "MYSQL_MASTER_SERVICE_PASSWORD=123456"
-      - "MYSQL_SLAVE_SERVICE_HOST=127.0.0.1"
-      - "MYSQL_SLAVE_SERVICE_PORT=3306"
-    volumes:
-      - /febs/nacos/standalone-logs/:/home/nacos/logs
-      - /febs/nacos/custom.properties:/home/nacos/init.d/custom.properties
-    ports:
-      - 8001:8848
+version: '3'
+
+services:
+  nacos:
+    image: nacos/nacos-server:latest
+    container_name: nacos-standalone-mysql
+    environment:
+      - "PREFER_HOST_MODE=hostname"
+      - "MODE=standalone"
+      - "SPRING_DATASOURCE_PLATFORM=mysql"
+      - "MYSQL_MASTER_SERVICE_HOST=127.0.0.1"
+      - "MYSQL_MASTER_SERVICE_DB_NAME=febs_nacos"
+      - "MYSQL_MASTER_SERVICE_PORT=3306"
+      - "MYSQL_MASTER_SERVICE_USER=root"
+      - "MYSQL_MASTER_SERVICE_PASSWORD=123456"
+      - "MYSQL_SLAVE_SERVICE_HOST=127.0.0.1"
+      - "MYSQL_SLAVE_SERVICE_PORT=3306"
+    volumes:
+      - /febs/nacos/standalone-logs/:/home/nacos/logs
+      - /febs/nacos/custom.properties:/home/nacos/init.d/custom.properties
+    ports:
+      - 8001:8848
     restart: on-failure

+ 53 - 53
febs-cloud/docker compose/prometheus/docker-compose.yml

@@ -1,54 +1,54 @@
-version: '3'
-
-services:
-  prometheus:
-    image: prom/prometheus
-    container_name: prometheus
-    volumes:
-      - /febs/prometheus/:/etc/prometheus/
-    ports:
-      - 8403:9090
-    restart: on-failure
-  node_exporter:
-    image: prom/node-exporter
-    container_name: node_exporter
-    ports:
-      - 8405:9100
-  redis_exporter:
-    image: oliver006/redis_exporter
-    container_name: redis_exporter
-    command:
-      - '--redis.addr=redis://ip:port'
-      - '--redis.password=password'
-    ports:
-      - 8408:9121
-    restart: on-failure
-  mysql_exporter:
-    image: prom/mysqld-exporter
-    container_name: mysql_exporter
-    environment:
-      - DATA_SOURCE_NAME=username:password@(ip:port)/
-    ports:
-      - 8409:9104
-  cadvisor:
-    image: google/cadvisor
-    container_name: cadvisor
-    volumes:
-      - /:/rootfs:ro
-      - /var/run:/var/run:rw
-      - /sys:/sys:ro
-      - /var/lib/docker/:/var/lib/docker:ro
-    ports:
-      - 8407:8080
-  alertmanager:
-    image: prom/alertmanager
-    container_name: alertmanager
-    volumes:
-      - /febs/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
-    ports:
-      - 8406:9093
-  grafana:
-    image: grafana/grafana
-    container_name: grafana
-    ports:
+version: '3'
+
+services:
+  prometheus:
+    image: prom/prometheus
+    container_name: prometheus
+    volumes:
+      - /febs/prometheus/:/etc/prometheus/
+    ports:
+      - 8403:9090
+    restart: on-failure
+  node_exporter:
+    image: prom/node-exporter
+    container_name: node_exporter
+    ports:
+      - 8405:9100
+  redis_exporter:
+    image: oliver006/redis_exporter
+    container_name: redis_exporter
+    command:
+      - '--redis.addr=redis://ip:port'
+      - '--redis.password=password'
+    ports:
+      - 8408:9121
+    restart: on-failure
+  mysql_exporter:
+    image: prom/mysqld-exporter
+    container_name: mysql_exporter
+    environment:
+      - DATA_SOURCE_NAME=username:password@(ip:port)/
+    ports:
+      - 8409:9104
+  cadvisor:
+    image: google/cadvisor
+    container_name: cadvisor
+    volumes:
+      - /:/rootfs:ro
+      - /var/run:/var/run:rw
+      - /sys:/sys:ro
+      - /var/lib/docker/:/var/lib/docker:ro
+    ports:
+      - 8407:8080
+  alertmanager:
+    image: prom/alertmanager
+    container_name: alertmanager
+    volumes:
+      - /febs/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
+    ports:
+      - 8406:9093
+  grafana:
+    image: grafana/grafana
+    container_name: grafana
+    ports:
       - 8404:3000

+ 54 - 54
febs-cloud/pom.xml

@@ -1,55 +1,55 @@
-<?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>cc.mrbird</groupId>
-    <artifactId>febs-cloud</artifactId>
-    <version>1.6-RELEASE</version>
-    <packaging>pom</packaging>
-
-    <name>FEBS-Cloud</name>
-    <description>FEBS-Cloud:Spring Cloud,Spring Security OAuth2 微服务权限管理系统</description>
-
-    <modules>
-        <module>../febs-auth</module>
-        <module>../febs-common</module>
-        <module>../febs-server</module>
-        <module>../febs-gateway</module>
-        <module>../febs-monitor</module>
-    </modules>
-
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.2.0.RELEASE</version>
-        <relativePath/> <!-- lookup parent from repository -->
-    </parent>
-
-    <properties>
-        <java.version>1.8</java.version>
-        <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
-        <com-alibaba-cloud.version>2.1.1.RELEASE</com-alibaba-cloud.version>
-    </properties>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.springframework.cloud</groupId>
-                <artifactId>spring-cloud-dependencies</artifactId>
-                <version>${spring-cloud.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>com.alibaba.cloud</groupId>
-                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
-                <version>${com-alibaba-cloud.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
+<?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>cc.mrbird</groupId>
+    <artifactId>febs-cloud</artifactId>
+    <version>1.6-RELEASE</version>
+    <packaging>pom</packaging>
+
+    <name>FEBS-Cloud</name>
+    <description>FEBS-Cloud:Spring Cloud,Spring Security OAuth2 微服务权限管理系统</description>
+
+    <modules>
+        <module>../febs-auth</module>
+        <module>../febs-common</module>
+        <module>../febs-server</module>
+        <module>../febs-gateway</module>
+        <module>../febs-monitor</module>
+    </modules>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.2.0.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+
+    <properties>
+        <java.version>1.8</java.version>
+        <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
+        <com-alibaba-cloud.version>2.1.1.RELEASE</com-alibaba-cloud.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>${spring-cloud.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba.cloud</groupId>
+                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
+                <version>${com-alibaba-cloud.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
 </project>

+ 506 - 506
febs-cloud/sql/febs_cloud_base.sql

@@ -1,506 +1,506 @@
-/*
- Navicat Premium Data Transfer
-
- Source Server         : localhost_3306
- Source Server Type    : MySQL
- Source Server Version : 50726
- Source Host           : localhost:3306
- Source Schema         : febs_cloud_base
-
- Target Server Type    : MySQL
- Target Server Version : 50726
- File Encoding         : 65001
-
- Date: 16/01/2020 14:03:23
-*/
-
-SET NAMES utf8mb4;
-SET FOREIGN_KEY_CHECKS = 0;
-
--- ----------------------------
--- Table structure for oauth_client_details
--- ----------------------------
-DROP TABLE IF EXISTS `oauth_client_details`;
-CREATE TABLE `oauth_client_details`  (
-                                         `client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                         `resource_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
-                                         `client_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                         `scope` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                         `authorized_grant_types` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
-                                         `web_server_redirect_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
-                                         `authorities` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
-                                         `access_token_validity` int(11) NOT NULL,
-                                         `refresh_token_validity` int(11) NULL DEFAULT NULL,
-                                         `additional_information` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
-                                         `autoapprove` tinyint(4) NULL DEFAULT NULL,
-                                         `origin_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
-                                         PRIMARY KEY (`client_id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of oauth_client_details
--- ----------------------------
-INSERT INTO `oauth_client_details` VALUES ('app', '', '$2a$10$88IWBHS3PUn9.NSeA1cMbeotMCbc2tOposnW7efm4ed1T4ZCay2ei', 'all', 'password,refresh_token', '', NULL, 86400, 8640000, NULL, 1, '123456');
-INSERT INTO `oauth_client_details` VALUES ('febs', NULL, '$2a$10$aSZTvMOtUAYUQ.75z2n3ceJd6dCIk9Vy3J/SKZUE4hBLd6sz7.6ge', 'all', 'password,refresh_token', NULL, NULL, 86400, 8640000, NULL, 1, '123456');
-INSERT INTO `oauth_client_details` VALUES ('swagger', '', '$2a$10$HSXh7gb19pngr8gcvzkODOvhQ048m6mrlXtaHJmBUE2jca7RvjEBa', 'test', 'password,refresh_token', '', NULL, 86400, 86400, '', 0, '123456');
-
--- ----------------------------
--- Table structure for t_dept
--- ----------------------------
-DROP TABLE IF EXISTS `t_dept`;
-CREATE TABLE `t_dept`  (
-                           `DEPT_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门ID',
-                           `PARENT_ID` bigint(20) NOT NULL COMMENT '上级部门ID',
-                           `DEPT_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门名称',
-                           `ORDER_NUM` double(20, 0) NULL DEFAULT NULL COMMENT '排序',
-                           `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
-                           PRIMARY KEY (`DEPT_ID`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_dept
--- ----------------------------
-INSERT INTO `t_dept` VALUES (1, 0, '开发部', 1, '2018-01-04 15:42:26', '2019-01-05 21:08:27');
-INSERT INTO `t_dept` VALUES (2, 1, '开发一部', 1, '2018-01-04 15:42:34', '2019-01-18 00:59:37');
-INSERT INTO `t_dept` VALUES (3, 1, '开发二部', 2, '2018-01-04 15:42:29', '2019-01-05 14:09:39');
-INSERT INTO `t_dept` VALUES (4, 0, '市场部', 2, '2018-01-04 15:42:36', '2019-01-23 06:27:56');
-INSERT INTO `t_dept` VALUES (5, 0, '人事部', 3, '2018-01-04 15:42:32', '2019-01-23 06:27:59');
-INSERT INTO `t_dept` VALUES (6, 0, '测试部', 4, '2018-01-04 15:42:38', '2019-01-17 08:15:47');
-
--- ----------------------------
--- Table structure for t_eximport
--- ----------------------------
-DROP TABLE IF EXISTS `t_eximport`;
-CREATE TABLE `t_eximport`  (
-                               `FIELD1` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
-                               `FIELD2` int(11) NOT NULL,
-                               `FIELD3` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
-                               `CREATE_TIME` datetime(0) NOT NULL
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Excel导入导出测试' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_eximport
--- ----------------------------
-INSERT INTO `t_eximport` VALUES ('字段1', 1, 'mrbird0@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 2, 'mrbird1@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 3, 'mrbird2@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 4, 'mrbird3@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 5, 'mrbird4@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 6, 'mrbird5@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 7, 'mrbird6@gmail.com', '2019-07-25 19:08:01');
-INSERT INTO `t_eximport` VALUES ('字段1', 8, 'mrbird7@gmail.com', '2019-07-25 19:08:01');
-
--- ----------------------------
--- Table structure for t_generator_config
--- ----------------------------
-DROP TABLE IF EXISTS `t_generator_config`;
-CREATE TABLE `t_generator_config`  (
-                                       `id` int(11) NOT NULL COMMENT '主键',
-                                       `author` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '作者',
-                                       `base_package` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '基础包名',
-                                       `entity_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'entity文件存放路径',
-                                       `mapper_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'mapper文件存放路径',
-                                       `mapper_xml_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'mapper xml文件存放路径',
-                                       `service_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'servcie文件存放路径',
-                                       `service_impl_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'serviceImpl文件存放路径',
-                                       `controller_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'controller文件存放路径',
-                                       `is_trim` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否去除前缀 1是 0否',
-                                       `trim_value` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前缀内容',
-                                       PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成配置表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_generator_config
--- ----------------------------
-INSERT INTO `t_generator_config` VALUES (1, 'MrBird', 'cc.mrbird.febs.gen', 'entity', 'mapper', 'mapper', 'service', 'service.impl', 'controller', '1', 't_');
-
--- ----------------------------
--- Table structure for t_log
--- ----------------------------
-DROP TABLE IF EXISTS `t_log`;
-CREATE TABLE `t_log`  (
-                          `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志ID',
-                          `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作用户',
-                          `OPERATION` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '操作内容',
-                          `TIME` decimal(11, 0) NULL DEFAULT NULL COMMENT '耗时',
-                          `METHOD` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '操作方法',
-                          `PARAMS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数',
-                          `IP` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作者IP',
-                          `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-                          `location` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作地点',
-                          PRIMARY KEY (`ID`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户操作日志表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Table structure for t_login_log
--- ----------------------------
-DROP TABLE IF EXISTS `t_login_log`;
-CREATE TABLE `t_login_log`  (
-                                `ID` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
-                                `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
-                                `LOGIN_TIME` datetime(0) NOT NULL COMMENT '登录时间',
-                                `LOCATION` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '登录地点',
-                                `IP` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'IP地址',
-                                `SYSTEM` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作系统',
-                                `BROWSER` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '浏览器',
-                                PRIMARY KEY (`ID`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '登录日志表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Table structure for t_menu
--- ----------------------------
-DROP TABLE IF EXISTS `t_menu`;
-CREATE TABLE `t_menu`  (
-                           `MENU_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '菜单/按钮ID',
-                           `PARENT_ID` bigint(20) NOT NULL COMMENT '上级菜单ID',
-                           `MENU_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单/按钮名称',
-                           `PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应路由path',
-                           `COMPONENT` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应路由组件component',
-                           `PERMS` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限标识',
-                           `ICON` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标',
-                           `TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型 0菜单 1按钮',
-                           `ORDER_NUM` double(20, 0) NULL DEFAULT NULL COMMENT '排序',
-                           `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
-                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
-                           PRIMARY KEY (`MENU_ID`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 180 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_menu
--- ----------------------------
-INSERT INTO `t_menu` VALUES (1, 0, '系统管理', '/system', 'Layout', NULL, 'el-icon-set-up', '0', 1, '2017-12-27 16:39:07', '2019-07-20 16:19:04');
-INSERT INTO `t_menu` VALUES (2, 0, '系统监控', '/monitor', 'Layout', NULL, 'el-icon-data-line', '0', 2, '2017-12-27 16:45:51', '2019-01-23 06:27:12');
-INSERT INTO `t_menu` VALUES (3, 1, '用户管理', '/system/user', 'febs/system/user/Index', 'user:view', '', '0', 1, '2017-12-27 16:47:13', '2019-01-22 06:45:55');
-INSERT INTO `t_menu` VALUES (4, 1, '角色管理', '/system/role', 'febs/system/role/Index', 'role:view', '', '0', 2, '2017-12-27 16:48:09', '2018-04-25 09:01:12');
-INSERT INTO `t_menu` VALUES (5, 1, '菜单管理', '/system/menu', 'febs/system/menu/Index', 'menu:view', '', '0', 3, '2017-12-27 16:48:57', '2018-04-25 09:01:30');
-INSERT INTO `t_menu` VALUES (6, 1, '部门管理', '/system/dept', 'febs/system/dept/Index', 'dept:view', '', '0', 4, '2017-12-27 16:57:33', '2018-04-25 09:01:40');
-INSERT INTO `t_menu` VALUES (10, 2, '系统日志', '/monitor/systemlog', 'febs/monitor/systemlog/Index', 'log:view', '', '0', 1, '2017-12-27 17:00:50', '2019-07-22 20:22:31');
-INSERT INTO `t_menu` VALUES (11, 3, '新增用户', '', '', 'user:add', NULL, '1', NULL, '2017-12-27 17:02:58', NULL);
-INSERT INTO `t_menu` VALUES (12, 3, '修改用户', '', '', 'user:update', NULL, '1', NULL, '2017-12-27 17:04:07', NULL);
-INSERT INTO `t_menu` VALUES (13, 3, '删除用户', '', '', 'user:delete', NULL, '1', NULL, '2017-12-27 17:04:58', NULL);
-INSERT INTO `t_menu` VALUES (14, 4, '新增角色', '', '', 'role:add', NULL, '1', NULL, '2017-12-27 17:06:38', NULL);
-INSERT INTO `t_menu` VALUES (15, 4, '修改角色', '', '', 'role:update', NULL, '1', NULL, '2017-12-27 17:06:38', NULL);
-INSERT INTO `t_menu` VALUES (16, 4, '删除角色', '', '', 'role:delete', NULL, '1', NULL, '2017-12-27 17:06:38', NULL);
-INSERT INTO `t_menu` VALUES (17, 5, '新增菜单', '', '', 'menu:add', NULL, '1', NULL, '2017-12-27 17:08:02', NULL);
-INSERT INTO `t_menu` VALUES (18, 5, '修改菜单', '', '', 'menu:update', NULL, '1', NULL, '2017-12-27 17:08:02', NULL);
-INSERT INTO `t_menu` VALUES (19, 5, '删除菜单', '', '', 'menu:delete', NULL, '1', NULL, '2017-12-27 17:08:02', NULL);
-INSERT INTO `t_menu` VALUES (20, 6, '新增部门', '', '', 'dept:add', NULL, '1', NULL, '2017-12-27 17:09:24', NULL);
-INSERT INTO `t_menu` VALUES (21, 6, '修改部门', '', '', 'dept:update', NULL, '1', NULL, '2017-12-27 17:09:24', NULL);
-INSERT INTO `t_menu` VALUES (22, 6, '删除部门', '', '', 'dept:delete', NULL, '1', NULL, '2017-12-27 17:09:24', NULL);
-INSERT INTO `t_menu` VALUES (24, 10, '删除日志', '', '', 'log:delete', NULL, '1', NULL, '2017-12-27 17:11:45', NULL);
-INSERT INTO `t_menu` VALUES (130, 3, '导出Excel', NULL, NULL, 'user:export', NULL, '1', NULL, '2019-01-23 06:35:16', NULL);
-INSERT INTO `t_menu` VALUES (131, 4, '导出Excel', NULL, NULL, 'role:export', NULL, '1', NULL, '2019-01-23 06:35:36', NULL);
-INSERT INTO `t_menu` VALUES (132, 5, '导出Excel', NULL, NULL, 'menu:export', NULL, '1', NULL, '2019-01-23 06:36:05', NULL);
-INSERT INTO `t_menu` VALUES (133, 6, '导出Excel', NULL, NULL, 'dept:export', NULL, '1', NULL, '2019-01-23 06:36:25', NULL);
-INSERT INTO `t_menu` VALUES (135, 3, '密码重置', NULL, NULL, 'user:reset', NULL, '1', NULL, '2019-01-23 06:37:00', NULL);
-INSERT INTO `t_menu` VALUES (136, 10, '导出Excel', NULL, NULL, 'log:export', NULL, '1', NULL, '2019-01-23 06:37:27', NULL);
-INSERT INTO `t_menu` VALUES (148, 2, '监控中心', '/monitor/admin', 'febs/monitor/admin/Index', 'mobitor:admin', '', '0', 6, '2019-07-20 19:42:07', '2019-09-01 10:48:12');
-INSERT INTO `t_menu` VALUES (149, 2, '注册中心', 'http://localhost:8001/nacos', 'Layout', 'monitor:register', '', '0', 3, '2019-07-20 20:07:00', '2019-07-22 20:22:43');
-INSERT INTO `t_menu` VALUES (150, 2, '登录日志', '/monitor/loginlog', 'febs/monitor/loginlog/Index', 'monitor:loginlog', '', '0', 2, '2019-07-22 13:41:17', '2019-07-22 20:22:35');
-INSERT INTO `t_menu` VALUES (151, 150, '删除日志', NULL, NULL, 'loginlog:delete', NULL, '1', NULL, '2019-07-22 13:43:04', NULL);
-INSERT INTO `t_menu` VALUES (152, 150, '导出Excel', NULL, NULL, 'loginlog:export', NULL, '1', NULL, '2019-07-22 13:43:30', NULL);
-INSERT INTO `t_menu` VALUES (153, 2, '接口文档', '/monitor/swagger', 'febs/monitor/swagger/Index', 'monitor:swagger', '', '0', 7, '2019-07-22 20:59:46', '2019-09-01 10:48:16');
-INSERT INTO `t_menu` VALUES (154, 0, '其他模块', '/others', 'Layout', '', 'el-icon-present', '0', 5, '2019-07-25 10:16:16', '2020-01-16 13:59:52');
-INSERT INTO `t_menu` VALUES (155, 154, '导入导出', '/others/eximport', 'febs/others/eximport/Index', 'others:eximport', '', '0', 1, '2019-07-25 10:19:31', NULL);
-INSERT INTO `t_menu` VALUES (156, 0, '代码生成', '/gen', 'Layout', '', 'el-icon-printer', '0', 4, '2019-07-25 10:24:03', '2020-01-16 13:59:49');
-INSERT INTO `t_menu` VALUES (157, 156, '生成配置', '/gen/config', 'febs/gen/config/Index', 'gen:config', '', '0', 1, '2019-07-25 10:24:55', NULL);
-INSERT INTO `t_menu` VALUES (158, 156, '生成代码', '/gen/generate', 'febs/gen/generate/Index', 'gen:generate', '', '0', 2, '2019-07-25 10:25:26', '2019-07-25 11:13:20');
-INSERT INTO `t_menu` VALUES (159, 157, '修改配置', NULL, NULL, 'gen:config:update', NULL, '1', NULL, '2019-07-26 16:22:56', NULL);
-INSERT INTO `t_menu` VALUES (160, 158, '打包生成', NULL, NULL, 'gen:generate:gen', NULL, '1', NULL, '2019-07-26 16:23:38', '2019-07-26 16:23:53');
-INSERT INTO `t_menu` VALUES (161, 2, '请求追踪', '/monitor/zipkin', 'febs/monitor/zipkin/Index', 'monitor:zipkin', '', '0', 4, '2019-09-01 10:41:49', NULL);
-INSERT INTO `t_menu` VALUES (162, 2, '日志收集', '/monitor/kibana', 'febs/monitor/kibana/Index', 'monitor:kibana', '', '0', 5, '2019-09-01 10:48:07', NULL);
-INSERT INTO `t_menu` VALUES (163, 1, '客户端管理', '/client', 'febs/system/client/Index', 'client:view', '', '0', 5, '2019-09-26 22:58:09', NULL);
-INSERT INTO `t_menu` VALUES (164, 163, '新增', NULL, NULL, 'client:add', NULL, '1', NULL, '2019-09-26 22:58:21', NULL);
-INSERT INTO `t_menu` VALUES (165, 163, '修改', NULL, NULL, 'client:update', NULL, '1', NULL, '2019-09-26 22:58:43', NULL);
-INSERT INTO `t_menu` VALUES (166, 163, '删除', NULL, NULL, 'client:delete', NULL, '1', NULL, '2019-09-26 22:58:55', NULL);
-INSERT INTO `t_menu` VALUES (167, 163, '解密', NULL, NULL, 'client:decrypt', NULL, '1', NULL, '2019-09-26 22:59:08', NULL);
-INSERT INTO `t_menu` VALUES (168, 0, '静态组件', '/components', 'Layout', '', 'el-icon-present', '0', 6, '2019-12-02 16:41:28', '2020-01-16 13:59:55');
-INSERT INTO `t_menu` VALUES (169, 168, '二级菜单', '/two', 'demos/two/Index', '', '', '0', 1, '2019-12-02 16:41:51', NULL);
-INSERT INTO `t_menu` VALUES (170, 169, '三级菜单', '/three', 'demos/two/three/Index', '', '', '0', 1, '2019-12-02 16:42:09', NULL);
-INSERT INTO `t_menu` VALUES (171, 168, 'MarkDown', '/components/markdown', 'demos/markdown', '', '', '0', 2, '2019-12-02 16:42:34', NULL);
-INSERT INTO `t_menu` VALUES (172, 168, '富文本编辑器', '/components/tinymce', 'demos/tinymce', '', '', '0', 3, '2019-12-02 16:42:50', NULL);
-INSERT INTO `t_menu` VALUES (173, 0, '网关管理', '/route', 'Layout', '', 'el-icon-odometer', '0', 3, '2020-01-16 14:00:15', NULL);
-INSERT INTO `t_menu` VALUES (174, 173, '网关用户', '/route/user', 'febs/route/routeuser/Index', '', '', '0', 1, '2020-01-16 14:00:32', NULL);
-INSERT INTO `t_menu` VALUES (175, 173, '网关日志', '/route/log', 'febs/route/routelog/Index', '', '', '0', 2, '2020-01-16 14:00:47', NULL);
-INSERT INTO `t_menu` VALUES (176, 173, '限流规则', '/route/ratelimitrule', 'febs/route/ratelimitrule/Index', '', '', '0', 3, '2020-01-16 14:01:01', NULL);
-INSERT INTO `t_menu` VALUES (177, 173, '限流日志', '/route/ratelimitlog', 'febs/route/ratelimitlog/Index', '', '', '0', 4, '2020-01-16 14:01:17', NULL);
-INSERT INTO `t_menu` VALUES (178, 173, '黑名单管理', '/route/blacklist', 'febs/route/blacklist/Index', '', '', '0', 5, '2020-01-16 14:01:32', NULL);
-INSERT INTO `t_menu` VALUES (179, 173, '黑名单日志', '/route/blocklog', 'febs/route/blocklog/Index', '', '', '0', 6, '2020-01-16 14:01:49', NULL);
-
--- ----------------------------
--- Table structure for t_role
--- ----------------------------
-DROP TABLE IF EXISTS `t_role`;
-CREATE TABLE `t_role`  (
-                           `ROLE_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
-                           `ROLE_NAME` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称',
-                           `REMARK` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色描述',
-                           `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
-                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
-                           PRIMARY KEY (`ROLE_ID`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_role
--- ----------------------------
-INSERT INTO `t_role` VALUES (1, '管理员', '管理员', '2017-12-27 16:23:11', '2020-01-16 14:02:06');
-INSERT INTO `t_role` VALUES (2, '注册用户', '可查看,新增,导出', '2019-01-04 14:11:28', '2020-01-16 14:02:21');
-INSERT INTO `t_role` VALUES (3, '系统监控员', '负责系统监控模块', '2019-09-01 10:30:25', '2019-09-01 10:30:37');
-
--- ----------------------------
--- Table structure for t_role_menu
--- ----------------------------
-DROP TABLE IF EXISTS `t_role_menu`;
-CREATE TABLE `t_role_menu`  (
-                                `ROLE_ID` bigint(20) NOT NULL,
-                                `MENU_ID` bigint(20) NOT NULL
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色菜单关联表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_role_menu
--- ----------------------------
-INSERT INTO `t_role_menu` VALUES (3, 2);
-INSERT INTO `t_role_menu` VALUES (3, 10);
-INSERT INTO `t_role_menu` VALUES (3, 24);
-INSERT INTO `t_role_menu` VALUES (3, 136);
-INSERT INTO `t_role_menu` VALUES (3, 150);
-INSERT INTO `t_role_menu` VALUES (3, 151);
-INSERT INTO `t_role_menu` VALUES (3, 152);
-INSERT INTO `t_role_menu` VALUES (3, 149);
-INSERT INTO `t_role_menu` VALUES (3, 148);
-INSERT INTO `t_role_menu` VALUES (3, 153);
-INSERT INTO `t_role_menu` VALUES (1, 1);
-INSERT INTO `t_role_menu` VALUES (1, 3);
-INSERT INTO `t_role_menu` VALUES (1, 11);
-INSERT INTO `t_role_menu` VALUES (1, 12);
-INSERT INTO `t_role_menu` VALUES (1, 13);
-INSERT INTO `t_role_menu` VALUES (1, 130);
-INSERT INTO `t_role_menu` VALUES (1, 135);
-INSERT INTO `t_role_menu` VALUES (1, 4);
-INSERT INTO `t_role_menu` VALUES (1, 14);
-INSERT INTO `t_role_menu` VALUES (1, 15);
-INSERT INTO `t_role_menu` VALUES (1, 16);
-INSERT INTO `t_role_menu` VALUES (1, 131);
-INSERT INTO `t_role_menu` VALUES (1, 5);
-INSERT INTO `t_role_menu` VALUES (1, 17);
-INSERT INTO `t_role_menu` VALUES (1, 18);
-INSERT INTO `t_role_menu` VALUES (1, 19);
-INSERT INTO `t_role_menu` VALUES (1, 132);
-INSERT INTO `t_role_menu` VALUES (1, 6);
-INSERT INTO `t_role_menu` VALUES (1, 20);
-INSERT INTO `t_role_menu` VALUES (1, 21);
-INSERT INTO `t_role_menu` VALUES (1, 22);
-INSERT INTO `t_role_menu` VALUES (1, 133);
-INSERT INTO `t_role_menu` VALUES (1, 163);
-INSERT INTO `t_role_menu` VALUES (1, 164);
-INSERT INTO `t_role_menu` VALUES (1, 165);
-INSERT INTO `t_role_menu` VALUES (1, 166);
-INSERT INTO `t_role_menu` VALUES (1, 167);
-INSERT INTO `t_role_menu` VALUES (1, 2);
-INSERT INTO `t_role_menu` VALUES (1, 10);
-INSERT INTO `t_role_menu` VALUES (1, 24);
-INSERT INTO `t_role_menu` VALUES (1, 136);
-INSERT INTO `t_role_menu` VALUES (1, 150);
-INSERT INTO `t_role_menu` VALUES (1, 151);
-INSERT INTO `t_role_menu` VALUES (1, 152);
-INSERT INTO `t_role_menu` VALUES (1, 149);
-INSERT INTO `t_role_menu` VALUES (1, 161);
-INSERT INTO `t_role_menu` VALUES (1, 162);
-INSERT INTO `t_role_menu` VALUES (1, 148);
-INSERT INTO `t_role_menu` VALUES (1, 153);
-INSERT INTO `t_role_menu` VALUES (1, 173);
-INSERT INTO `t_role_menu` VALUES (1, 174);
-INSERT INTO `t_role_menu` VALUES (1, 175);
-INSERT INTO `t_role_menu` VALUES (1, 176);
-INSERT INTO `t_role_menu` VALUES (1, 177);
-INSERT INTO `t_role_menu` VALUES (1, 178);
-INSERT INTO `t_role_menu` VALUES (1, 179);
-INSERT INTO `t_role_menu` VALUES (1, 156);
-INSERT INTO `t_role_menu` VALUES (1, 157);
-INSERT INTO `t_role_menu` VALUES (1, 159);
-INSERT INTO `t_role_menu` VALUES (1, 158);
-INSERT INTO `t_role_menu` VALUES (1, 160);
-INSERT INTO `t_role_menu` VALUES (1, 154);
-INSERT INTO `t_role_menu` VALUES (1, 155);
-INSERT INTO `t_role_menu` VALUES (1, 168);
-INSERT INTO `t_role_menu` VALUES (1, 169);
-INSERT INTO `t_role_menu` VALUES (1, 170);
-INSERT INTO `t_role_menu` VALUES (1, 171);
-INSERT INTO `t_role_menu` VALUES (1, 172);
-INSERT INTO `t_role_menu` VALUES (2, 1);
-INSERT INTO `t_role_menu` VALUES (2, 3);
-INSERT INTO `t_role_menu` VALUES (2, 4);
-INSERT INTO `t_role_menu` VALUES (2, 5);
-INSERT INTO `t_role_menu` VALUES (2, 6);
-INSERT INTO `t_role_menu` VALUES (2, 2);
-INSERT INTO `t_role_menu` VALUES (2, 10);
-INSERT INTO `t_role_menu` VALUES (2, 150);
-INSERT INTO `t_role_menu` VALUES (2, 149);
-INSERT INTO `t_role_menu` VALUES (2, 148);
-INSERT INTO `t_role_menu` VALUES (2, 153);
-INSERT INTO `t_role_menu` VALUES (2, 173);
-INSERT INTO `t_role_menu` VALUES (2, 174);
-INSERT INTO `t_role_menu` VALUES (2, 175);
-INSERT INTO `t_role_menu` VALUES (2, 176);
-INSERT INTO `t_role_menu` VALUES (2, 177);
-INSERT INTO `t_role_menu` VALUES (2, 178);
-INSERT INTO `t_role_menu` VALUES (2, 179);
-INSERT INTO `t_role_menu` VALUES (2, 156);
-INSERT INTO `t_role_menu` VALUES (2, 157);
-INSERT INTO `t_role_menu` VALUES (2, 158);
-INSERT INTO `t_role_menu` VALUES (2, 154);
-INSERT INTO `t_role_menu` VALUES (2, 155);
-INSERT INTO `t_role_menu` VALUES (2, 168);
-INSERT INTO `t_role_menu` VALUES (2, 169);
-INSERT INTO `t_role_menu` VALUES (2, 170);
-INSERT INTO `t_role_menu` VALUES (2, 171);
-INSERT INTO `t_role_menu` VALUES (2, 172);
-
--- ----------------------------
--- Table structure for t_trade_log
--- ----------------------------
-DROP TABLE IF EXISTS `t_trade_log`;
-CREATE TABLE `t_trade_log`  (
-                                `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
-                                `goods_id` int(11) NOT NULL COMMENT '商品ID',
-                                `goods_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品名称',
-                                `status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态',
-                                `create_time` datetime(0) NOT NULL COMMENT '创建时间',
-                                PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Table structure for t_user
--- ----------------------------
-DROP TABLE IF EXISTS `t_user`;
-CREATE TABLE `t_user`  (
-                           `USER_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
-                           `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
-                           `PASSWORD` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
-                           `DEPT_ID` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
-                           `EMAIL` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
-                           `MOBILE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
-                           `STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态 0锁定 1有效',
-                           `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
-                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
-                           `LAST_LOGIN_TIME` datetime(0) NULL DEFAULT NULL COMMENT '最近访问时间',
-                           `SSEX` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别 0男 1女 2保密',
-                           `IS_TAB` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否开启tab,0关闭 1开启',
-                           `THEME` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主题',
-                           `AVATAR` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像',
-                           `DESCRIPTION` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述',
-                           PRIMARY KEY (`USER_ID`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_user
--- ----------------------------
-INSERT INTO `t_user` VALUES (1, 'MrBird', '$2a$10$gzhiUb1ldc1Rf3lka4k/WOoFKKGPepHSzJxzcPSN5/65SzkMdc.SK', 2, 'mrbird@qq.com', '17788888888', '1', '2019-06-14 20:39:22', '2019-07-19 10:18:36', '2020-01-16 13:58:28', '0', '1', 'white', 'gaOngJwsRYRaVAuXXcmB.png', '我是帅比作者。');
-INSERT INTO `t_user` VALUES (15, 'scott', '$2a$10$7tATi2STciLHnEgO/RfIxOYf2MQBu/SDVMRDs54rlSYVj2VmwwCHC', 5, 'scott@hotmail.com', '17720888888', '1', '2019-07-20 19:00:32', '2019-07-31 10:14:29', '2019-09-01 10:35:31', '2', NULL, NULL, 'BiazfanxmamNRoxxVxka.png', NULL);
-INSERT INTO `t_user` VALUES (16, 'Jane', '$2a$10$ECkfipOPY7hORVdlSzIOX.8hnig0shAZQPG8pQ7D5iVP.uVogmmHy', 4, 'Jane@hotmail.com', '13489898989', '1', '2019-09-01 10:31:21', '2019-09-01 10:32:10', '2019-09-01 10:32:27', '1', NULL, NULL, '2dd7a2d09fa94bf8b5c52e5318868b4d9.jpg', NULL);
-
--- ----------------------------
--- Table structure for t_user_connection
--- ----------------------------
-DROP TABLE IF EXISTS `t_user_connection`;
-CREATE TABLE `t_user_connection`  (
-                                      `USER_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FEBS系统用户名',
-                                      `PROVIDER_NAME` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '第三方平台名称',
-                                      `PROVIDER_USER_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '第三方平台账户ID',
-                                      `PROVIDER_USER_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方平台用户名',
-                                      `NICK_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方平台昵称',
-                                      `IMAGE_URL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方平台头像',
-                                      `LOCATION` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
-                                      `REMARK` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
-                                      PRIMARY KEY (`USER_NAME`, `PROVIDER_NAME`, `PROVIDER_USER_ID`) USING BTREE,
-                                      UNIQUE INDEX `UserConnectionRank`(`USER_NAME`, `PROVIDER_NAME`, `PROVIDER_USER_ID`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Table structure for t_user_role
--- ----------------------------
-DROP TABLE IF EXISTS `t_user_role`;
-CREATE TABLE `t_user_role`  (
-                                `USER_ID` bigint(20) NOT NULL COMMENT '用户ID',
-                                `ROLE_ID` bigint(20) NOT NULL COMMENT '角色ID'
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户角色关联表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of t_user_role
--- ----------------------------
-INSERT INTO `t_user_role` VALUES (1, 1);
-INSERT INTO `t_user_role` VALUES (15, 2);
-INSERT INTO `t_user_role` VALUES (16, 3);
-
--- ----------------------------
--- Table structure for zipkin_annotations
--- ----------------------------
-DROP TABLE IF EXISTS `zipkin_annotations`;
-CREATE TABLE `zipkin_annotations`  (
-                                       `trace_id_high` bigint(20) NOT NULL DEFAULT 0 COMMENT 'If non zero, this means the trace uses 128 bit traceIds instead of 64 bit',
-                                       `trace_id` bigint(20) NOT NULL COMMENT 'coincides with zipkin_spans.trace_id',
-                                       `span_id` bigint(20) NOT NULL COMMENT 'coincides with zipkin_spans.id',
-                                       `a_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'BinaryAnnotation.key or Annotation.value if type == -1',
-                                       `a_value` blob NULL COMMENT 'BinaryAnnotation.value(), which must be smaller than 64KB',
-                                       `a_type` int(11) NOT NULL COMMENT 'BinaryAnnotation.type() or -1 if Annotation',
-                                       `a_timestamp` bigint(20) NULL DEFAULT NULL COMMENT 'Used to implement TTL; Annotation.timestamp or zipkin_spans.timestamp',
-                                       `endpoint_ipv4` int(11) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
-                                       `endpoint_ipv6` binary(16) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null, or no IPv6 address',
-                                       `endpoint_port` smallint(6) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
-                                       `endpoint_service_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
-                                       UNIQUE INDEX `trace_id_high`(`trace_id_high`, `trace_id`, `span_id`, `a_key`, `a_timestamp`) USING BTREE COMMENT 'Ignore insert on duplicate',
-                                       UNIQUE INDEX `trace_id_high_4`(`trace_id_high`, `trace_id`, `span_id`, `a_key`, `a_timestamp`) USING BTREE COMMENT 'Ignore insert on duplicate',
-                                       INDEX `trace_id_high_2`(`trace_id_high`, `trace_id`, `span_id`) USING BTREE COMMENT 'for joining with zipkin_spans',
-                                       INDEX `trace_id_high_3`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTraces/ByIds',
-                                       INDEX `endpoint_service_name`(`endpoint_service_name`) USING BTREE COMMENT 'for getTraces and getServiceNames',
-                                       INDEX `a_type`(`a_type`) USING BTREE COMMENT 'for getTraces and autocomplete values',
-                                       INDEX `a_key`(`a_key`) USING BTREE COMMENT 'for getTraces and autocomplete values',
-                                       INDEX `trace_id`(`trace_id`, `span_id`, `a_key`) USING BTREE COMMENT 'for dependencies job',
-                                       INDEX `trace_id_high_5`(`trace_id_high`, `trace_id`, `span_id`) USING BTREE COMMENT 'for joining with zipkin_spans',
-                                       INDEX `trace_id_high_6`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTraces/ByIds',
-                                       INDEX `endpoint_service_name_2`(`endpoint_service_name`) USING BTREE COMMENT 'for getTraces and getServiceNames',
-                                       INDEX `a_type_2`(`a_type`) USING BTREE COMMENT 'for getTraces and autocomplete values',
-                                       INDEX `a_key_2`(`a_key`) USING BTREE COMMENT 'for getTraces and autocomplete values',
-                                       INDEX `trace_id_2`(`trace_id`, `span_id`, `a_key`) USING BTREE COMMENT 'for dependencies job'
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
-
--- ----------------------------
--- Table structure for zipkin_dependencies
--- ----------------------------
-DROP TABLE IF EXISTS `zipkin_dependencies`;
-CREATE TABLE `zipkin_dependencies`  (
-                                        `day` date NOT NULL,
-                                        `parent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
-                                        `child` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
-                                        `call_count` bigint(20) NULL DEFAULT NULL,
-                                        `error_count` bigint(20) NULL DEFAULT NULL,
-                                        PRIMARY KEY (`day`, `parent`, `child`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
-
--- ----------------------------
--- Table structure for zipkin_spans
--- ----------------------------
-DROP TABLE IF EXISTS `zipkin_spans`;
-CREATE TABLE `zipkin_spans`  (
-                                 `trace_id_high` bigint(20) NOT NULL DEFAULT 0 COMMENT 'If non zero, this means the trace uses 128 bit traceIds instead of 64 bit',
-                                 `trace_id` bigint(20) NOT NULL,
-                                 `id` bigint(20) NOT NULL,
-                                 `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
-                                 `remote_service_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-                                 `parent_id` bigint(20) NULL DEFAULT NULL,
-                                 `debug` bit(1) NULL DEFAULT NULL,
-                                 `start_ts` bigint(20) NULL DEFAULT NULL COMMENT 'Span.timestamp(): epoch micros used for endTs query and to implement TTL',
-                                 `duration` bigint(20) NULL DEFAULT NULL COMMENT 'Span.duration(): micros used for minDuration and maxDuration query',
-                                 PRIMARY KEY (`trace_id_high`, `trace_id`, `id`) USING BTREE,
-                                 INDEX `trace_id_high`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTracesByIds',
-                                 INDEX `name`(`name`) USING BTREE COMMENT 'for getTraces and getSpanNames',
-                                 INDEX `remote_service_name`(`remote_service_name`) USING BTREE COMMENT 'for getTraces and getRemoteServiceNames',
-                                 INDEX `start_ts`(`start_ts`) USING BTREE COMMENT 'for getTraces ordering and range',
-                                 INDEX `trace_id_high_2`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTracesByIds',
-                                 INDEX `name_2`(`name`) USING BTREE COMMENT 'for getTraces and getSpanNames',
-                                 INDEX `remote_service_name_2`(`remote_service_name`) USING BTREE COMMENT 'for getTraces and getRemoteServiceNames',
-                                 INDEX `start_ts_2`(`start_ts`) USING BTREE COMMENT 'for getTraces ordering and range'
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
-
-SET FOREIGN_KEY_CHECKS = 1;
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : localhost_3306
+ Source Server Type    : MySQL
+ Source Server Version : 50726
+ Source Host           : localhost:3306
+ Source Schema         : febs_cloud_base
+
+ Target Server Type    : MySQL
+ Target Server Version : 50726
+ File Encoding         : 65001
+
+ Date: 16/01/2020 14:03:23
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for oauth_client_details
+-- ----------------------------
+DROP TABLE IF EXISTS `oauth_client_details`;
+CREATE TABLE `oauth_client_details`  (
+                                         `client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+                                         `resource_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+                                         `client_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+                                         `scope` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+                                         `authorized_grant_types` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+                                         `web_server_redirect_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+                                         `authorities` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+                                         `access_token_validity` int(11) NOT NULL,
+                                         `refresh_token_validity` int(11) NULL DEFAULT NULL,
+                                         `additional_information` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+                                         `autoapprove` tinyint(4) NULL DEFAULT NULL,
+                                         `origin_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+                                         PRIMARY KEY (`client_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of oauth_client_details
+-- ----------------------------
+INSERT INTO `oauth_client_details` VALUES ('app', '', '$2a$10$88IWBHS3PUn9.NSeA1cMbeotMCbc2tOposnW7efm4ed1T4ZCay2ei', 'all', 'password,refresh_token', '', NULL, 86400, 8640000, NULL, 1, '123456');
+INSERT INTO `oauth_client_details` VALUES ('febs', NULL, '$2a$10$aSZTvMOtUAYUQ.75z2n3ceJd6dCIk9Vy3J/SKZUE4hBLd6sz7.6ge', 'all', 'password,refresh_token', NULL, NULL, 86400, 8640000, NULL, 1, '123456');
+INSERT INTO `oauth_client_details` VALUES ('swagger', '', '$2a$10$HSXh7gb19pngr8gcvzkODOvhQ048m6mrlXtaHJmBUE2jca7RvjEBa', 'test', 'password,refresh_token', '', NULL, 86400, 86400, '', 0, '123456');
+
+-- ----------------------------
+-- Table structure for t_dept
+-- ----------------------------
+DROP TABLE IF EXISTS `t_dept`;
+CREATE TABLE `t_dept`  (
+                           `DEPT_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门ID',
+                           `PARENT_ID` bigint(20) NOT NULL COMMENT '上级部门ID',
+                           `DEPT_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门名称',
+                           `ORDER_NUM` double(20, 0) NULL DEFAULT NULL COMMENT '排序',
+                           `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+                           PRIMARY KEY (`DEPT_ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_dept
+-- ----------------------------
+INSERT INTO `t_dept` VALUES (1, 0, '开发部', 1, '2018-01-04 15:42:26', '2019-01-05 21:08:27');
+INSERT INTO `t_dept` VALUES (2, 1, '开发一部', 1, '2018-01-04 15:42:34', '2019-01-18 00:59:37');
+INSERT INTO `t_dept` VALUES (3, 1, '开发二部', 2, '2018-01-04 15:42:29', '2019-01-05 14:09:39');
+INSERT INTO `t_dept` VALUES (4, 0, '市场部', 2, '2018-01-04 15:42:36', '2019-01-23 06:27:56');
+INSERT INTO `t_dept` VALUES (5, 0, '人事部', 3, '2018-01-04 15:42:32', '2019-01-23 06:27:59');
+INSERT INTO `t_dept` VALUES (6, 0, '测试部', 4, '2018-01-04 15:42:38', '2019-01-17 08:15:47');
+
+-- ----------------------------
+-- Table structure for t_eximport
+-- ----------------------------
+DROP TABLE IF EXISTS `t_eximport`;
+CREATE TABLE `t_eximport`  (
+                               `FIELD1` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
+                               `FIELD2` int(11) NOT NULL,
+                               `FIELD3` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
+                               `CREATE_TIME` datetime(0) NOT NULL
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Excel导入导出测试' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_eximport
+-- ----------------------------
+INSERT INTO `t_eximport` VALUES ('字段1', 1, 'mrbird0@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 2, 'mrbird1@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 3, 'mrbird2@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 4, 'mrbird3@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 5, 'mrbird4@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 6, 'mrbird5@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 7, 'mrbird6@gmail.com', '2019-07-25 19:08:01');
+INSERT INTO `t_eximport` VALUES ('字段1', 8, 'mrbird7@gmail.com', '2019-07-25 19:08:01');
+
+-- ----------------------------
+-- Table structure for t_generator_config
+-- ----------------------------
+DROP TABLE IF EXISTS `t_generator_config`;
+CREATE TABLE `t_generator_config`  (
+                                       `id` int(11) NOT NULL COMMENT '主键',
+                                       `author` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '作者',
+                                       `base_package` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '基础包名',
+                                       `entity_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'entity文件存放路径',
+                                       `mapper_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'mapper文件存放路径',
+                                       `mapper_xml_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'mapper xml文件存放路径',
+                                       `service_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'servcie文件存放路径',
+                                       `service_impl_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'serviceImpl文件存放路径',
+                                       `controller_package` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'controller文件存放路径',
+                                       `is_trim` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否去除前缀 1是 0否',
+                                       `trim_value` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前缀内容',
+                                       PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成配置表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_generator_config
+-- ----------------------------
+INSERT INTO `t_generator_config` VALUES (1, 'MrBird', 'cc.mrbird.febs.gen', 'entity', 'mapper', 'mapper', 'service', 'service.impl', 'controller', '1', 't_');
+
+-- ----------------------------
+-- Table structure for t_log
+-- ----------------------------
+DROP TABLE IF EXISTS `t_log`;
+CREATE TABLE `t_log`  (
+                          `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志ID',
+                          `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作用户',
+                          `OPERATION` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '操作内容',
+                          `TIME` decimal(11, 0) NULL DEFAULT NULL COMMENT '耗时',
+                          `METHOD` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '操作方法',
+                          `PARAMS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数',
+                          `IP` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作者IP',
+                          `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+                          `location` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作地点',
+                          PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户操作日志表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for t_login_log
+-- ----------------------------
+DROP TABLE IF EXISTS `t_login_log`;
+CREATE TABLE `t_login_log`  (
+                                `ID` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
+                                `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
+                                `LOGIN_TIME` datetime(0) NOT NULL COMMENT '登录时间',
+                                `LOCATION` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '登录地点',
+                                `IP` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'IP地址',
+                                `SYSTEM` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作系统',
+                                `BROWSER` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '浏览器',
+                                PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '登录日志表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for t_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `t_menu`;
+CREATE TABLE `t_menu`  (
+                           `MENU_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '菜单/按钮ID',
+                           `PARENT_ID` bigint(20) NOT NULL COMMENT '上级菜单ID',
+                           `MENU_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单/按钮名称',
+                           `PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应路由path',
+                           `COMPONENT` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应路由组件component',
+                           `PERMS` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限标识',
+                           `ICON` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标',
+                           `TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型 0菜单 1按钮',
+                           `ORDER_NUM` double(20, 0) NULL DEFAULT NULL COMMENT '排序',
+                           `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+                           PRIMARY KEY (`MENU_ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 180 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_menu
+-- ----------------------------
+INSERT INTO `t_menu` VALUES (1, 0, '系统管理', '/system', 'Layout', NULL, 'el-icon-set-up', '0', 1, '2017-12-27 16:39:07', '2019-07-20 16:19:04');
+INSERT INTO `t_menu` VALUES (2, 0, '系统监控', '/monitor', 'Layout', NULL, 'el-icon-data-line', '0', 2, '2017-12-27 16:45:51', '2019-01-23 06:27:12');
+INSERT INTO `t_menu` VALUES (3, 1, '用户管理', '/system/user', 'febs/system/user/Index', 'user:view', '', '0', 1, '2017-12-27 16:47:13', '2019-01-22 06:45:55');
+INSERT INTO `t_menu` VALUES (4, 1, '角色管理', '/system/role', 'febs/system/role/Index', 'role:view', '', '0', 2, '2017-12-27 16:48:09', '2018-04-25 09:01:12');
+INSERT INTO `t_menu` VALUES (5, 1, '菜单管理', '/system/menu', 'febs/system/menu/Index', 'menu:view', '', '0', 3, '2017-12-27 16:48:57', '2018-04-25 09:01:30');
+INSERT INTO `t_menu` VALUES (6, 1, '部门管理', '/system/dept', 'febs/system/dept/Index', 'dept:view', '', '0', 4, '2017-12-27 16:57:33', '2018-04-25 09:01:40');
+INSERT INTO `t_menu` VALUES (10, 2, '系统日志', '/monitor/systemlog', 'febs/monitor/systemlog/Index', 'log:view', '', '0', 1, '2017-12-27 17:00:50', '2019-07-22 20:22:31');
+INSERT INTO `t_menu` VALUES (11, 3, '新增用户', '', '', 'user:add', NULL, '1', NULL, '2017-12-27 17:02:58', NULL);
+INSERT INTO `t_menu` VALUES (12, 3, '修改用户', '', '', 'user:update', NULL, '1', NULL, '2017-12-27 17:04:07', NULL);
+INSERT INTO `t_menu` VALUES (13, 3, '删除用户', '', '', 'user:delete', NULL, '1', NULL, '2017-12-27 17:04:58', NULL);
+INSERT INTO `t_menu` VALUES (14, 4, '新增角色', '', '', 'role:add', NULL, '1', NULL, '2017-12-27 17:06:38', NULL);
+INSERT INTO `t_menu` VALUES (15, 4, '修改角色', '', '', 'role:update', NULL, '1', NULL, '2017-12-27 17:06:38', NULL);
+INSERT INTO `t_menu` VALUES (16, 4, '删除角色', '', '', 'role:delete', NULL, '1', NULL, '2017-12-27 17:06:38', NULL);
+INSERT INTO `t_menu` VALUES (17, 5, '新增菜单', '', '', 'menu:add', NULL, '1', NULL, '2017-12-27 17:08:02', NULL);
+INSERT INTO `t_menu` VALUES (18, 5, '修改菜单', '', '', 'menu:update', NULL, '1', NULL, '2017-12-27 17:08:02', NULL);
+INSERT INTO `t_menu` VALUES (19, 5, '删除菜单', '', '', 'menu:delete', NULL, '1', NULL, '2017-12-27 17:08:02', NULL);
+INSERT INTO `t_menu` VALUES (20, 6, '新增部门', '', '', 'dept:add', NULL, '1', NULL, '2017-12-27 17:09:24', NULL);
+INSERT INTO `t_menu` VALUES (21, 6, '修改部门', '', '', 'dept:update', NULL, '1', NULL, '2017-12-27 17:09:24', NULL);
+INSERT INTO `t_menu` VALUES (22, 6, '删除部门', '', '', 'dept:delete', NULL, '1', NULL, '2017-12-27 17:09:24', NULL);
+INSERT INTO `t_menu` VALUES (24, 10, '删除日志', '', '', 'log:delete', NULL, '1', NULL, '2017-12-27 17:11:45', NULL);
+INSERT INTO `t_menu` VALUES (130, 3, '导出Excel', NULL, NULL, 'user:export', NULL, '1', NULL, '2019-01-23 06:35:16', NULL);
+INSERT INTO `t_menu` VALUES (131, 4, '导出Excel', NULL, NULL, 'role:export', NULL, '1', NULL, '2019-01-23 06:35:36', NULL);
+INSERT INTO `t_menu` VALUES (132, 5, '导出Excel', NULL, NULL, 'menu:export', NULL, '1', NULL, '2019-01-23 06:36:05', NULL);
+INSERT INTO `t_menu` VALUES (133, 6, '导出Excel', NULL, NULL, 'dept:export', NULL, '1', NULL, '2019-01-23 06:36:25', NULL);
+INSERT INTO `t_menu` VALUES (135, 3, '密码重置', NULL, NULL, 'user:reset', NULL, '1', NULL, '2019-01-23 06:37:00', NULL);
+INSERT INTO `t_menu` VALUES (136, 10, '导出Excel', NULL, NULL, 'log:export', NULL, '1', NULL, '2019-01-23 06:37:27', NULL);
+INSERT INTO `t_menu` VALUES (148, 2, '监控中心', '/monitor/admin', 'febs/monitor/admin/Index', 'mobitor:admin', '', '0', 6, '2019-07-20 19:42:07', '2019-09-01 10:48:12');
+INSERT INTO `t_menu` VALUES (149, 2, '注册中心', 'http://localhost:8001/nacos', 'Layout', 'monitor:register', '', '0', 3, '2019-07-20 20:07:00', '2019-07-22 20:22:43');
+INSERT INTO `t_menu` VALUES (150, 2, '登录日志', '/monitor/loginlog', 'febs/monitor/loginlog/Index', 'monitor:loginlog', '', '0', 2, '2019-07-22 13:41:17', '2019-07-22 20:22:35');
+INSERT INTO `t_menu` VALUES (151, 150, '删除日志', NULL, NULL, 'loginlog:delete', NULL, '1', NULL, '2019-07-22 13:43:04', NULL);
+INSERT INTO `t_menu` VALUES (152, 150, '导出Excel', NULL, NULL, 'loginlog:export', NULL, '1', NULL, '2019-07-22 13:43:30', NULL);
+INSERT INTO `t_menu` VALUES (153, 2, '接口文档', '/monitor/swagger', 'febs/monitor/swagger/Index', 'monitor:swagger', '', '0', 7, '2019-07-22 20:59:46', '2019-09-01 10:48:16');
+INSERT INTO `t_menu` VALUES (154, 0, '其他模块', '/others', 'Layout', '', 'el-icon-present', '0', 5, '2019-07-25 10:16:16', '2020-01-16 13:59:52');
+INSERT INTO `t_menu` VALUES (155, 154, '导入导出', '/others/eximport', 'febs/others/eximport/Index', 'others:eximport', '', '0', 1, '2019-07-25 10:19:31', NULL);
+INSERT INTO `t_menu` VALUES (156, 0, '代码生成', '/gen', 'Layout', '', 'el-icon-printer', '0', 4, '2019-07-25 10:24:03', '2020-01-16 13:59:49');
+INSERT INTO `t_menu` VALUES (157, 156, '生成配置', '/gen/config', 'febs/gen/config/Index', 'gen:config', '', '0', 1, '2019-07-25 10:24:55', NULL);
+INSERT INTO `t_menu` VALUES (158, 156, '生成代码', '/gen/generate', 'febs/gen/generate/Index', 'gen:generate', '', '0', 2, '2019-07-25 10:25:26', '2019-07-25 11:13:20');
+INSERT INTO `t_menu` VALUES (159, 157, '修改配置', NULL, NULL, 'gen:config:update', NULL, '1', NULL, '2019-07-26 16:22:56', NULL);
+INSERT INTO `t_menu` VALUES (160, 158, '打包生成', NULL, NULL, 'gen:generate:gen', NULL, '1', NULL, '2019-07-26 16:23:38', '2019-07-26 16:23:53');
+INSERT INTO `t_menu` VALUES (161, 2, '请求追踪', '/monitor/zipkin', 'febs/monitor/zipkin/Index', 'monitor:zipkin', '', '0', 4, '2019-09-01 10:41:49', NULL);
+INSERT INTO `t_menu` VALUES (162, 2, '日志收集', '/monitor/kibana', 'febs/monitor/kibana/Index', 'monitor:kibana', '', '0', 5, '2019-09-01 10:48:07', NULL);
+INSERT INTO `t_menu` VALUES (163, 1, '客户端管理', '/client', 'febs/system/client/Index', 'client:view', '', '0', 5, '2019-09-26 22:58:09', NULL);
+INSERT INTO `t_menu` VALUES (164, 163, '新增', NULL, NULL, 'client:add', NULL, '1', NULL, '2019-09-26 22:58:21', NULL);
+INSERT INTO `t_menu` VALUES (165, 163, '修改', NULL, NULL, 'client:update', NULL, '1', NULL, '2019-09-26 22:58:43', NULL);
+INSERT INTO `t_menu` VALUES (166, 163, '删除', NULL, NULL, 'client:delete', NULL, '1', NULL, '2019-09-26 22:58:55', NULL);
+INSERT INTO `t_menu` VALUES (167, 163, '解密', NULL, NULL, 'client:decrypt', NULL, '1', NULL, '2019-09-26 22:59:08', NULL);
+INSERT INTO `t_menu` VALUES (168, 0, '静态组件', '/components', 'Layout', '', 'el-icon-present', '0', 6, '2019-12-02 16:41:28', '2020-01-16 13:59:55');
+INSERT INTO `t_menu` VALUES (169, 168, '二级菜单', '/two', 'demos/two/Index', '', '', '0', 1, '2019-12-02 16:41:51', NULL);
+INSERT INTO `t_menu` VALUES (170, 169, '三级菜单', '/three', 'demos/two/three/Index', '', '', '0', 1, '2019-12-02 16:42:09', NULL);
+INSERT INTO `t_menu` VALUES (171, 168, 'MarkDown', '/components/markdown', 'demos/markdown', '', '', '0', 2, '2019-12-02 16:42:34', NULL);
+INSERT INTO `t_menu` VALUES (172, 168, '富文本编辑器', '/components/tinymce', 'demos/tinymce', '', '', '0', 3, '2019-12-02 16:42:50', NULL);
+INSERT INTO `t_menu` VALUES (173, 0, '网关管理', '/route', 'Layout', '', 'el-icon-odometer', '0', 3, '2020-01-16 14:00:15', NULL);
+INSERT INTO `t_menu` VALUES (174, 173, '网关用户', '/route/user', 'febs/route/routeuser/Index', '', '', '0', 1, '2020-01-16 14:00:32', NULL);
+INSERT INTO `t_menu` VALUES (175, 173, '网关日志', '/route/log', 'febs/route/routelog/Index', '', '', '0', 2, '2020-01-16 14:00:47', NULL);
+INSERT INTO `t_menu` VALUES (176, 173, '限流规则', '/route/ratelimitrule', 'febs/route/ratelimitrule/Index', '', '', '0', 3, '2020-01-16 14:01:01', NULL);
+INSERT INTO `t_menu` VALUES (177, 173, '限流日志', '/route/ratelimitlog', 'febs/route/ratelimitlog/Index', '', '', '0', 4, '2020-01-16 14:01:17', NULL);
+INSERT INTO `t_menu` VALUES (178, 173, '黑名单管理', '/route/blacklist', 'febs/route/blacklist/Index', '', '', '0', 5, '2020-01-16 14:01:32', NULL);
+INSERT INTO `t_menu` VALUES (179, 173, '黑名单日志', '/route/blocklog', 'febs/route/blocklog/Index', '', '', '0', 6, '2020-01-16 14:01:49', NULL);
+
+-- ----------------------------
+-- Table structure for t_role
+-- ----------------------------
+DROP TABLE IF EXISTS `t_role`;
+CREATE TABLE `t_role`  (
+                           `ROLE_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
+                           `ROLE_NAME` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称',
+                           `REMARK` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色描述',
+                           `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+                           PRIMARY KEY (`ROLE_ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_role
+-- ----------------------------
+INSERT INTO `t_role` VALUES (1, '管理员', '管理员', '2017-12-27 16:23:11', '2020-01-16 14:02:06');
+INSERT INTO `t_role` VALUES (2, '注册用户', '可查看,新增,导出', '2019-01-04 14:11:28', '2020-01-16 14:02:21');
+INSERT INTO `t_role` VALUES (3, '系统监控员', '负责系统监控模块', '2019-09-01 10:30:25', '2019-09-01 10:30:37');
+
+-- ----------------------------
+-- Table structure for t_role_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `t_role_menu`;
+CREATE TABLE `t_role_menu`  (
+                                `ROLE_ID` bigint(20) NOT NULL,
+                                `MENU_ID` bigint(20) NOT NULL
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色菜单关联表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_role_menu
+-- ----------------------------
+INSERT INTO `t_role_menu` VALUES (3, 2);
+INSERT INTO `t_role_menu` VALUES (3, 10);
+INSERT INTO `t_role_menu` VALUES (3, 24);
+INSERT INTO `t_role_menu` VALUES (3, 136);
+INSERT INTO `t_role_menu` VALUES (3, 150);
+INSERT INTO `t_role_menu` VALUES (3, 151);
+INSERT INTO `t_role_menu` VALUES (3, 152);
+INSERT INTO `t_role_menu` VALUES (3, 149);
+INSERT INTO `t_role_menu` VALUES (3, 148);
+INSERT INTO `t_role_menu` VALUES (3, 153);
+INSERT INTO `t_role_menu` VALUES (1, 1);
+INSERT INTO `t_role_menu` VALUES (1, 3);
+INSERT INTO `t_role_menu` VALUES (1, 11);
+INSERT INTO `t_role_menu` VALUES (1, 12);
+INSERT INTO `t_role_menu` VALUES (1, 13);
+INSERT INTO `t_role_menu` VALUES (1, 130);
+INSERT INTO `t_role_menu` VALUES (1, 135);
+INSERT INTO `t_role_menu` VALUES (1, 4);
+INSERT INTO `t_role_menu` VALUES (1, 14);
+INSERT INTO `t_role_menu` VALUES (1, 15);
+INSERT INTO `t_role_menu` VALUES (1, 16);
+INSERT INTO `t_role_menu` VALUES (1, 131);
+INSERT INTO `t_role_menu` VALUES (1, 5);
+INSERT INTO `t_role_menu` VALUES (1, 17);
+INSERT INTO `t_role_menu` VALUES (1, 18);
+INSERT INTO `t_role_menu` VALUES (1, 19);
+INSERT INTO `t_role_menu` VALUES (1, 132);
+INSERT INTO `t_role_menu` VALUES (1, 6);
+INSERT INTO `t_role_menu` VALUES (1, 20);
+INSERT INTO `t_role_menu` VALUES (1, 21);
+INSERT INTO `t_role_menu` VALUES (1, 22);
+INSERT INTO `t_role_menu` VALUES (1, 133);
+INSERT INTO `t_role_menu` VALUES (1, 163);
+INSERT INTO `t_role_menu` VALUES (1, 164);
+INSERT INTO `t_role_menu` VALUES (1, 165);
+INSERT INTO `t_role_menu` VALUES (1, 166);
+INSERT INTO `t_role_menu` VALUES (1, 167);
+INSERT INTO `t_role_menu` VALUES (1, 2);
+INSERT INTO `t_role_menu` VALUES (1, 10);
+INSERT INTO `t_role_menu` VALUES (1, 24);
+INSERT INTO `t_role_menu` VALUES (1, 136);
+INSERT INTO `t_role_menu` VALUES (1, 150);
+INSERT INTO `t_role_menu` VALUES (1, 151);
+INSERT INTO `t_role_menu` VALUES (1, 152);
+INSERT INTO `t_role_menu` VALUES (1, 149);
+INSERT INTO `t_role_menu` VALUES (1, 161);
+INSERT INTO `t_role_menu` VALUES (1, 162);
+INSERT INTO `t_role_menu` VALUES (1, 148);
+INSERT INTO `t_role_menu` VALUES (1, 153);
+INSERT INTO `t_role_menu` VALUES (1, 173);
+INSERT INTO `t_role_menu` VALUES (1, 174);
+INSERT INTO `t_role_menu` VALUES (1, 175);
+INSERT INTO `t_role_menu` VALUES (1, 176);
+INSERT INTO `t_role_menu` VALUES (1, 177);
+INSERT INTO `t_role_menu` VALUES (1, 178);
+INSERT INTO `t_role_menu` VALUES (1, 179);
+INSERT INTO `t_role_menu` VALUES (1, 156);
+INSERT INTO `t_role_menu` VALUES (1, 157);
+INSERT INTO `t_role_menu` VALUES (1, 159);
+INSERT INTO `t_role_menu` VALUES (1, 158);
+INSERT INTO `t_role_menu` VALUES (1, 160);
+INSERT INTO `t_role_menu` VALUES (1, 154);
+INSERT INTO `t_role_menu` VALUES (1, 155);
+INSERT INTO `t_role_menu` VALUES (1, 168);
+INSERT INTO `t_role_menu` VALUES (1, 169);
+INSERT INTO `t_role_menu` VALUES (1, 170);
+INSERT INTO `t_role_menu` VALUES (1, 171);
+INSERT INTO `t_role_menu` VALUES (1, 172);
+INSERT INTO `t_role_menu` VALUES (2, 1);
+INSERT INTO `t_role_menu` VALUES (2, 3);
+INSERT INTO `t_role_menu` VALUES (2, 4);
+INSERT INTO `t_role_menu` VALUES (2, 5);
+INSERT INTO `t_role_menu` VALUES (2, 6);
+INSERT INTO `t_role_menu` VALUES (2, 2);
+INSERT INTO `t_role_menu` VALUES (2, 10);
+INSERT INTO `t_role_menu` VALUES (2, 150);
+INSERT INTO `t_role_menu` VALUES (2, 149);
+INSERT INTO `t_role_menu` VALUES (2, 148);
+INSERT INTO `t_role_menu` VALUES (2, 153);
+INSERT INTO `t_role_menu` VALUES (2, 173);
+INSERT INTO `t_role_menu` VALUES (2, 174);
+INSERT INTO `t_role_menu` VALUES (2, 175);
+INSERT INTO `t_role_menu` VALUES (2, 176);
+INSERT INTO `t_role_menu` VALUES (2, 177);
+INSERT INTO `t_role_menu` VALUES (2, 178);
+INSERT INTO `t_role_menu` VALUES (2, 179);
+INSERT INTO `t_role_menu` VALUES (2, 156);
+INSERT INTO `t_role_menu` VALUES (2, 157);
+INSERT INTO `t_role_menu` VALUES (2, 158);
+INSERT INTO `t_role_menu` VALUES (2, 154);
+INSERT INTO `t_role_menu` VALUES (2, 155);
+INSERT INTO `t_role_menu` VALUES (2, 168);
+INSERT INTO `t_role_menu` VALUES (2, 169);
+INSERT INTO `t_role_menu` VALUES (2, 170);
+INSERT INTO `t_role_menu` VALUES (2, 171);
+INSERT INTO `t_role_menu` VALUES (2, 172);
+
+-- ----------------------------
+-- Table structure for t_trade_log
+-- ----------------------------
+DROP TABLE IF EXISTS `t_trade_log`;
+CREATE TABLE `t_trade_log`  (
+                                `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
+                                `goods_id` int(11) NOT NULL COMMENT '商品ID',
+                                `goods_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品名称',
+                                `status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态',
+                                `create_time` datetime(0) NOT NULL COMMENT '创建时间',
+                                PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for t_user
+-- ----------------------------
+DROP TABLE IF EXISTS `t_user`;
+CREATE TABLE `t_user`  (
+                           `USER_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
+                           `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
+                           `PASSWORD` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
+                           `DEPT_ID` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+                           `EMAIL` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
+                           `MOBILE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
+                           `STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态 0锁定 1有效',
+                           `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+                           `MODIFY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+                           `LAST_LOGIN_TIME` datetime(0) NULL DEFAULT NULL COMMENT '最近访问时间',
+                           `SSEX` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别 0男 1女 2保密',
+                           `IS_TAB` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否开启tab,0关闭 1开启',
+                           `THEME` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主题',
+                           `AVATAR` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像',
+                           `DESCRIPTION` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述',
+                           PRIMARY KEY (`USER_ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_user
+-- ----------------------------
+INSERT INTO `t_user` VALUES (1, 'MrBird', '$2a$10$gzhiUb1ldc1Rf3lka4k/WOoFKKGPepHSzJxzcPSN5/65SzkMdc.SK', 2, 'mrbird@qq.com', '17788888888', '1', '2019-06-14 20:39:22', '2019-07-19 10:18:36', '2020-01-16 13:58:28', '0', '1', 'white', 'gaOngJwsRYRaVAuXXcmB.png', '我是帅比作者。');
+INSERT INTO `t_user` VALUES (15, 'scott', '$2a$10$7tATi2STciLHnEgO/RfIxOYf2MQBu/SDVMRDs54rlSYVj2VmwwCHC', 5, 'scott@hotmail.com', '17720888888', '1', '2019-07-20 19:00:32', '2019-07-31 10:14:29', '2019-09-01 10:35:31', '2', NULL, NULL, 'BiazfanxmamNRoxxVxka.png', NULL);
+INSERT INTO `t_user` VALUES (16, 'Jane', '$2a$10$ECkfipOPY7hORVdlSzIOX.8hnig0shAZQPG8pQ7D5iVP.uVogmmHy', 4, 'Jane@hotmail.com', '13489898989', '1', '2019-09-01 10:31:21', '2019-09-01 10:32:10', '2019-09-01 10:32:27', '1', NULL, NULL, '2dd7a2d09fa94bf8b5c52e5318868b4d9.jpg', NULL);
+
+-- ----------------------------
+-- Table structure for t_user_connection
+-- ----------------------------
+DROP TABLE IF EXISTS `t_user_connection`;
+CREATE TABLE `t_user_connection`  (
+                                      `USER_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FEBS系统用户名',
+                                      `PROVIDER_NAME` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '第三方平台名称',
+                                      `PROVIDER_USER_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '第三方平台账户ID',
+                                      `PROVIDER_USER_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方平台用户名',
+                                      `NICK_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方平台昵称',
+                                      `IMAGE_URL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方平台头像',
+                                      `LOCATION` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
+                                      `REMARK` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+                                      PRIMARY KEY (`USER_NAME`, `PROVIDER_NAME`, `PROVIDER_USER_ID`) USING BTREE,
+                                      UNIQUE INDEX `UserConnectionRank`(`USER_NAME`, `PROVIDER_NAME`, `PROVIDER_USER_ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for t_user_role
+-- ----------------------------
+DROP TABLE IF EXISTS `t_user_role`;
+CREATE TABLE `t_user_role`  (
+                                `USER_ID` bigint(20) NOT NULL COMMENT '用户ID',
+                                `ROLE_ID` bigint(20) NOT NULL COMMENT '角色ID'
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户角色关联表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_user_role
+-- ----------------------------
+INSERT INTO `t_user_role` VALUES (1, 1);
+INSERT INTO `t_user_role` VALUES (15, 2);
+INSERT INTO `t_user_role` VALUES (16, 3);
+
+-- ----------------------------
+-- Table structure for zipkin_annotations
+-- ----------------------------
+DROP TABLE IF EXISTS `zipkin_annotations`;
+CREATE TABLE `zipkin_annotations`  (
+                                       `trace_id_high` bigint(20) NOT NULL DEFAULT 0 COMMENT 'If non zero, this means the trace uses 128 bit traceIds instead of 64 bit',
+                                       `trace_id` bigint(20) NOT NULL COMMENT 'coincides with zipkin_spans.trace_id',
+                                       `span_id` bigint(20) NOT NULL COMMENT 'coincides with zipkin_spans.id',
+                                       `a_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'BinaryAnnotation.key or Annotation.value if type == -1',
+                                       `a_value` blob NULL COMMENT 'BinaryAnnotation.value(), which must be smaller than 64KB',
+                                       `a_type` int(11) NOT NULL COMMENT 'BinaryAnnotation.type() or -1 if Annotation',
+                                       `a_timestamp` bigint(20) NULL DEFAULT NULL COMMENT 'Used to implement TTL; Annotation.timestamp or zipkin_spans.timestamp',
+                                       `endpoint_ipv4` int(11) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
+                                       `endpoint_ipv6` binary(16) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null, or no IPv6 address',
+                                       `endpoint_port` smallint(6) NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
+                                       `endpoint_service_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Null when Binary/Annotation.endpoint is null',
+                                       UNIQUE INDEX `trace_id_high`(`trace_id_high`, `trace_id`, `span_id`, `a_key`, `a_timestamp`) USING BTREE COMMENT 'Ignore insert on duplicate',
+                                       UNIQUE INDEX `trace_id_high_4`(`trace_id_high`, `trace_id`, `span_id`, `a_key`, `a_timestamp`) USING BTREE COMMENT 'Ignore insert on duplicate',
+                                       INDEX `trace_id_high_2`(`trace_id_high`, `trace_id`, `span_id`) USING BTREE COMMENT 'for joining with zipkin_spans',
+                                       INDEX `trace_id_high_3`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTraces/ByIds',
+                                       INDEX `endpoint_service_name`(`endpoint_service_name`) USING BTREE COMMENT 'for getTraces and getServiceNames',
+                                       INDEX `a_type`(`a_type`) USING BTREE COMMENT 'for getTraces and autocomplete values',
+                                       INDEX `a_key`(`a_key`) USING BTREE COMMENT 'for getTraces and autocomplete values',
+                                       INDEX `trace_id`(`trace_id`, `span_id`, `a_key`) USING BTREE COMMENT 'for dependencies job',
+                                       INDEX `trace_id_high_5`(`trace_id_high`, `trace_id`, `span_id`) USING BTREE COMMENT 'for joining with zipkin_spans',
+                                       INDEX `trace_id_high_6`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTraces/ByIds',
+                                       INDEX `endpoint_service_name_2`(`endpoint_service_name`) USING BTREE COMMENT 'for getTraces and getServiceNames',
+                                       INDEX `a_type_2`(`a_type`) USING BTREE COMMENT 'for getTraces and autocomplete values',
+                                       INDEX `a_key_2`(`a_key`) USING BTREE COMMENT 'for getTraces and autocomplete values',
+                                       INDEX `trace_id_2`(`trace_id`, `span_id`, `a_key`) USING BTREE COMMENT 'for dependencies job'
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
+
+-- ----------------------------
+-- Table structure for zipkin_dependencies
+-- ----------------------------
+DROP TABLE IF EXISTS `zipkin_dependencies`;
+CREATE TABLE `zipkin_dependencies`  (
+                                        `day` date NOT NULL,
+                                        `parent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
+                                        `child` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
+                                        `call_count` bigint(20) NULL DEFAULT NULL,
+                                        `error_count` bigint(20) NULL DEFAULT NULL,
+                                        PRIMARY KEY (`day`, `parent`, `child`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
+
+-- ----------------------------
+-- Table structure for zipkin_spans
+-- ----------------------------
+DROP TABLE IF EXISTS `zipkin_spans`;
+CREATE TABLE `zipkin_spans`  (
+                                 `trace_id_high` bigint(20) NOT NULL DEFAULT 0 COMMENT 'If non zero, this means the trace uses 128 bit traceIds instead of 64 bit',
+                                 `trace_id` bigint(20) NOT NULL,
+                                 `id` bigint(20) NOT NULL,
+                                 `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
+                                 `remote_service_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+                                 `parent_id` bigint(20) NULL DEFAULT NULL,
+                                 `debug` bit(1) NULL DEFAULT NULL,
+                                 `start_ts` bigint(20) NULL DEFAULT NULL COMMENT 'Span.timestamp(): epoch micros used for endTs query and to implement TTL',
+                                 `duration` bigint(20) NULL DEFAULT NULL COMMENT 'Span.duration(): micros used for minDuration and maxDuration query',
+                                 PRIMARY KEY (`trace_id_high`, `trace_id`, `id`) USING BTREE,
+                                 INDEX `trace_id_high`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTracesByIds',
+                                 INDEX `name`(`name`) USING BTREE COMMENT 'for getTraces and getSpanNames',
+                                 INDEX `remote_service_name`(`remote_service_name`) USING BTREE COMMENT 'for getTraces and getRemoteServiceNames',
+                                 INDEX `start_ts`(`start_ts`) USING BTREE COMMENT 'for getTraces ordering and range',
+                                 INDEX `trace_id_high_2`(`trace_id_high`, `trace_id`) USING BTREE COMMENT 'for getTracesByIds',
+                                 INDEX `name_2`(`name`) USING BTREE COMMENT 'for getTraces and getSpanNames',
+                                 INDEX `remote_service_name_2`(`remote_service_name`) USING BTREE COMMENT 'for getTraces and getRemoteServiceNames',
+                                 INDEX `start_ts_2`(`start_ts`) USING BTREE COMMENT 'for getTraces ordering and range'
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compressed;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 104 - 104
febs-cloud/sql/febs_cloud_route.sql

@@ -1,104 +1,104 @@
-/*
- Navicat Premium Data Transfer
-
- Source Server         : localhost
- Source Server Type    : MongoDB
- Source Server Version : 40202
- Source Host           : localhost:27017
- Source Schema         : febs_cloud_route
-
- Target Server Type    : MongoDB
- Target Server Version : 40202
- File Encoding         : 65001
-
- Date: 14/01/2020 11:04:22
-*/
-
-
-// ----------------------------
-// Collection structure for blackList
-// ----------------------------
-db.getCollection("blackList").drop();
-db.createCollection("blackList");
-
-// ----------------------------
-// Documents of blackList
-// ----------------------------
-db.getCollection("blackList").insert([ {
-    _id: ObjectId("5e1425e7a548e77106e43b40"),
-    ip: "",
-    requestUri: "/**/actuator/**",
-    requestMethod: "ALL",
-    limitFrom: "",
-    limitTo: "",
-    location: "",
-    status: "1",
-    createTime: "2020-01-07 14:32:07",
-    _class: "cc.mrbird.febs.gateway.entity.BlackList"
-} ]);
-
-// ----------------------------
-// Collection structure for blockLog
-// ----------------------------
-db.getCollection("blockLog").drop();
-db.createCollection("blockLog");
-
-// ----------------------------
-// Collection structure for rateLimitLog
-// ----------------------------
-db.getCollection("rateLimitLog").drop();
-db.createCollection("rateLimitLog");
-
-// ----------------------------
-// Collection structure for rateLimitRule
-// ----------------------------
-db.getCollection("rateLimitRule").drop();
-db.createCollection("rateLimitRule");
-
-// ----------------------------
-// Documents of rateLimitRule
-// ----------------------------
-db.getCollection("rateLimitRule").insert([ {
-    _id: ObjectId("5e1abc9ef51708123d94b1f8"),
-    requestUri: "/auth/captcha",
-    requestMethod: "GET",
-    limitFrom: "06:00:00",
-    limitTo: "22:30:00",
-    count: "3",
-    intervalSec: "10",
-    status: "1",
-    createTime: "2020-01-12 14:28:46",
-    _class: "cc.mrbird.febs.gateway.enhance.entity.RateLimitRule"
-} ]);
-
-// ----------------------------
-// Collection structure for routeLog
-// ----------------------------
-db.getCollection("routeLog").drop();
-db.createCollection("routeLog");
-
-// ----------------------------
-// Collection structure for routeUser
-// ----------------------------
-db.getCollection("routeUser").drop();
-db.createCollection("routeUser");
-
-// ----------------------------
-// Documents of routeUser
-// ----------------------------
-db.getCollection("routeUser").insert([ {
-    _id: ObjectId("5e1d2ee055165e6516c23057"),
-    username: "Jack",
-    password: "$2a$10$NBv548VFJ6OyTkxcHy9o5uRNaYSMPHWHW9fL3ZRlS1Hy5kxlR1qdy",
-    roles: "user",
-    createTime: "2020-01-14 11:00:48",
-    _class: "cc.mrbird.febs.gateway.enhance.entity.RouteUser"
-} ]);
-db.getCollection("routeUser").insert([ {
-    _id: ObjectId("5e1d2eee55165e6516c23058"),
-    username: "admin",
-    password: "$2a$10$WeUSapCOv8uDb2MrUu19cOo6O.Xb4PAJN/4GdAfIcgJ3SAWw.NY3m",
-    roles: "admin",
-    createTime: "2020-01-14 11:01:02",
-    _class: "cc.mrbird.febs.gateway.enhance.entity.RouteUser"
-} ]);
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : localhost
+ Source Server Type    : MongoDB
+ Source Server Version : 40202
+ Source Host           : localhost:27017
+ Source Schema         : febs_cloud_route
+
+ Target Server Type    : MongoDB
+ Target Server Version : 40202
+ File Encoding         : 65001
+
+ Date: 14/01/2020 11:04:22
+*/
+
+
+// ----------------------------
+// Collection structure for blackList
+// ----------------------------
+db.getCollection("blackList").drop();
+db.createCollection("blackList");
+
+// ----------------------------
+// Documents of blackList
+// ----------------------------
+db.getCollection("blackList").insert([ {
+    _id: ObjectId("5e1425e7a548e77106e43b40"),
+    ip: "",
+    requestUri: "/**/actuator/**",
+    requestMethod: "ALL",
+    limitFrom: "",
+    limitTo: "",
+    location: "",
+    status: "1",
+    createTime: "2020-01-07 14:32:07",
+    _class: "cc.mrbird.febs.gateway.entity.BlackList"
+} ]);
+
+// ----------------------------
+// Collection structure for blockLog
+// ----------------------------
+db.getCollection("blockLog").drop();
+db.createCollection("blockLog");
+
+// ----------------------------
+// Collection structure for rateLimitLog
+// ----------------------------
+db.getCollection("rateLimitLog").drop();
+db.createCollection("rateLimitLog");
+
+// ----------------------------
+// Collection structure for rateLimitRule
+// ----------------------------
+db.getCollection("rateLimitRule").drop();
+db.createCollection("rateLimitRule");
+
+// ----------------------------
+// Documents of rateLimitRule
+// ----------------------------
+db.getCollection("rateLimitRule").insert([ {
+    _id: ObjectId("5e1abc9ef51708123d94b1f8"),
+    requestUri: "/auth/captcha",
+    requestMethod: "GET",
+    limitFrom: "06:00:00",
+    limitTo: "22:30:00",
+    count: "3",
+    intervalSec: "10",
+    status: "1",
+    createTime: "2020-01-12 14:28:46",
+    _class: "cc.mrbird.febs.gateway.enhance.entity.RateLimitRule"
+} ]);
+
+// ----------------------------
+// Collection structure for routeLog
+// ----------------------------
+db.getCollection("routeLog").drop();
+db.createCollection("routeLog");
+
+// ----------------------------
+// Collection structure for routeUser
+// ----------------------------
+db.getCollection("routeUser").drop();
+db.createCollection("routeUser");
+
+// ----------------------------
+// Documents of routeUser
+// ----------------------------
+db.getCollection("routeUser").insert([ {
+    _id: ObjectId("5e1d2ee055165e6516c23057"),
+    username: "Jack",
+    password: "$2a$10$NBv548VFJ6OyTkxcHy9o5uRNaYSMPHWHW9fL3ZRlS1Hy5kxlR1qdy",
+    roles: "user",
+    createTime: "2020-01-14 11:00:48",
+    _class: "cc.mrbird.febs.gateway.enhance.entity.RouteUser"
+} ]);
+db.getCollection("routeUser").insert([ {
+    _id: ObjectId("5e1d2eee55165e6516c23058"),
+    username: "admin",
+    password: "$2a$10$WeUSapCOv8uDb2MrUu19cOo6O.Xb4PAJN/4GdAfIcgJ3SAWw.NY3m",
+    roles: "admin",
+    createTime: "2020-01-14 11:01:02",
+    _class: "cc.mrbird.febs.gateway.enhance.entity.RouteUser"
+} ]);

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 47
febs-cloud/sql/febs_nacos.sql


+ 103 - 103
febs-common/pom.xml

@@ -1,103 +1,103 @@
-<?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>cc.mrbird</groupId>
-        <artifactId>febs-cloud</artifactId>
-        <version>1.6-RELEASE</version>
-        <relativePath>../febs-cloud/pom.xml</relativePath>
-    </parent>
-
-    <artifactId>febs-common</artifactId>
-    <version>1.6-RELEASE</version>
-    <name>FEBS-Common</name>
-    <description>FEBS-Common通用模块</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>1.2.62</version>
-        </dependency>
-        <dependency>
-            <groupId>xml-apis</groupId>
-            <artifactId>xml-apis</artifactId>
-            <version>1.4.01</version>
-        </dependency>
-        <dependency>
-            <groupId>org.lionsoul</groupId>
-            <artifactId>ip2region</artifactId>
-            <version>1.7</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>27.0-jre</version>
-        </dependency>
-        <dependency>
-            <groupId>com.wuwenze</groupId>
-            <artifactId>ExcelKit</artifactId>
-            <version>2.0.71</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-oauth2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-security</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-alibaba-nacos-config</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-alibaba-nacos-discovery</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-openfeign</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-configuration-processor</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>de.codecentric</groupId>
-            <artifactId>spring-boot-admin-starter-client</artifactId>
-            <version>2.2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.micrometer</groupId>
-            <artifactId>micrometer-registry-prometheus</artifactId>
-        </dependency>
-    </dependencies>
-</project>
+<?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>cc.mrbird</groupId>
+        <artifactId>febs-cloud</artifactId>
+        <version>1.6-RELEASE</version>
+        <relativePath>../febs-cloud/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>febs-common</artifactId>
+    <version>1.6-RELEASE</version>
+    <name>FEBS-Common</name>
+    <description>FEBS-Common通用模块</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.62</version>
+        </dependency>
+        <dependency>
+            <groupId>xml-apis</groupId>
+            <artifactId>xml-apis</artifactId>
+            <version>1.4.01</version>
+        </dependency>
+        <dependency>
+            <groupId>org.lionsoul</groupId>
+            <artifactId>ip2region</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>27.0-jre</version>
+        </dependency>
+        <dependency>
+            <groupId>com.wuwenze</groupId>
+            <artifactId>ExcelKit</artifactId>
+            <version>2.0.71</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-oauth2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-alibaba-nacos-config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>de.codecentric</groupId>
+            <artifactId>spring-boot-admin-starter-client</artifactId>
+            <version>2.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.micrometer</groupId>
+            <artifactId>micrometer-registry-prometheus</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 17 - 17
febs-common/src/main/java/cc/mrbird/febs/common/annotation/ControllerEndpoint.java

@@ -1,17 +1,17 @@
-package cc.mrbird.febs.common.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author MrBird
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ControllerEndpoint {
-
-    String operation() default "";
-    String exceptionMessage() default "FEBS系统内部异常";
-}
+package cc.mrbird.febs.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author MrBird
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ControllerEndpoint {
+
+    String operation() default "";
+    String exceptionMessage() default "FEBS系统内部异常";
+}

+ 26 - 26
febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsAuthExceptionConfigure.java

@@ -1,26 +1,26 @@
-package cc.mrbird.febs.common.configure;
-
-import cc.mrbird.febs.common.handler.FebsAccessDeniedHandler;
-import cc.mrbird.febs.common.handler.FebsAuthExceptionEntryPoint;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-
-/**
- * 异常翻译配置
- *
- * @author MrBird
- */
-public class FebsAuthExceptionConfigure {
-
-    @Bean
-    @ConditionalOnMissingBean(name = "accessDeniedHandler")
-    public FebsAccessDeniedHandler accessDeniedHandler() {
-        return new FebsAccessDeniedHandler();
-    }
-
-    @Bean
-    @ConditionalOnMissingBean(name = "authenticationEntryPoint")
-    public FebsAuthExceptionEntryPoint authenticationEntryPoint() {
-        return new FebsAuthExceptionEntryPoint();
-    }
-}
+package cc.mrbird.febs.common.configure;
+
+import cc.mrbird.febs.common.handler.FebsAccessDeniedHandler;
+import cc.mrbird.febs.common.handler.FebsAuthExceptionEntryPoint;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+
+/**
+ * 异常翻译配置
+ *
+ * @author MrBird
+ */
+public class FebsAuthExceptionConfigure {
+
+    @Bean
+    @ConditionalOnMissingBean(name = "accessDeniedHandler")
+    public FebsAccessDeniedHandler accessDeniedHandler() {
+        return new FebsAccessDeniedHandler();
+    }
+
+    @Bean
+    @ConditionalOnMissingBean(name = "authenticationEntryPoint")
+    public FebsAuthExceptionEntryPoint authenticationEntryPoint() {
+        return new FebsAuthExceptionEntryPoint();
+    }
+}

+ 55 - 55
febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsLettuceRedisConfigure.java

@@ -1,55 +1,55 @@
-package cc.mrbird.febs.common.configure;
-
-import cc.mrbird.febs.common.service.RedisService;
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.context.annotation.Bean;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.RedisOperations;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
-
-/**
- * Lettuce Redis配置
- *
- * @author MrBird
- */
-public class FebsLettuceRedisConfigure {
-
-    @Bean
-    @ConditionalOnClass(RedisOperations.class)
-    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
-        RedisTemplate<String, Object> template = new RedisTemplate<>();
-        template.setConnectionFactory(factory);
-
-        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
-        ObjectMapper mapper = new ObjectMapper();
-        mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
-        mapper.activateDefaultTyping(mapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL);
-        jackson2JsonRedisSerializer.setObjectMapper(mapper);
-
-        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
-        // key采用 String的序列化方式
-        template.setKeySerializer(stringRedisSerializer);
-        // hash的 key也采用 String的序列化方式
-        template.setHashKeySerializer(stringRedisSerializer);
-        // value序列化方式采用 jackson
-        template.setValueSerializer(jackson2JsonRedisSerializer);
-        // hash的 value序列化方式采用 jackson
-        template.setHashValueSerializer(jackson2JsonRedisSerializer);
-        template.afterPropertiesSet();
-
-        return template;
-    }
-
-    @Bean
-    @ConditionalOnBean(name = "redisTemplate")
-    public RedisService redisService() {
-        return new RedisService();
-    }
-
-}
+package cc.mrbird.febs.common.configure;
+
+import cc.mrbird.febs.common.service.RedisService;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisOperations;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+/**
+ * Lettuce Redis配置
+ *
+ * @author MrBird
+ */
+public class FebsLettuceRedisConfigure {
+
+    @Bean
+    @ConditionalOnClass(RedisOperations.class)
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
+        RedisTemplate<String, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(factory);
+
+        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        mapper.activateDefaultTyping(mapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL);
+        jackson2JsonRedisSerializer.setObjectMapper(mapper);
+
+        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
+        // key采用 String的序列化方式
+        template.setKeySerializer(stringRedisSerializer);
+        // hash的 key也采用 String的序列化方式
+        template.setHashKeySerializer(stringRedisSerializer);
+        // value序列化方式采用 jackson
+        template.setValueSerializer(jackson2JsonRedisSerializer);
+        // hash的 value序列化方式采用 jackson
+        template.setHashValueSerializer(jackson2JsonRedisSerializer);
+        template.afterPropertiesSet();
+
+        return template;
+    }
+
+    @Bean
+    @ConditionalOnBean(name = "redisTemplate")
+    public RedisService redisService() {
+        return new RedisService();
+    }
+
+}

+ 28 - 28
febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsOAuth2FeignConfigure.java

@@ -1,28 +1,28 @@
-package cc.mrbird.febs.common.configure;
-
-import cc.mrbird.febs.common.entity.constant.FebsConstant;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import com.google.common.net.HttpHeaders;
-import feign.RequestInterceptor;
-import org.springframework.context.annotation.Bean;
-import org.springframework.util.Base64Utils;
-
-/**
- * OAuth2 Feign配置
- *
- * @author MrBird
- */
-public class FebsOAuth2FeignConfigure {
-
-    @Bean
-    public RequestInterceptor oauth2FeignRequestInterceptor() {
-        return requestTemplate -> {
-            // 请求头中添加 Gateway Token
-            String zuulToken = new String(Base64Utils.encode(FebsConstant.GATEWAY_TOKEN_VALUE.getBytes()));
-            requestTemplate.header(FebsConstant.GATEWAY_TOKEN_HEADER, zuulToken);
-            // 请求头中添加原请求头中的 Token
-            String authorizationToken = FebsUtil.getCurrentTokenValue();
-            requestTemplate.header(HttpHeaders.AUTHORIZATION, FebsConstant.OAUTH2_TOKEN_TYPE + authorizationToken);
-        };
-    }
-}
+package cc.mrbird.febs.common.configure;
+
+import cc.mrbird.febs.common.entity.constant.FebsConstant;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import com.google.common.net.HttpHeaders;
+import feign.RequestInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.util.Base64Utils;
+
+/**
+ * OAuth2 Feign配置
+ *
+ * @author MrBird
+ */
+public class FebsOAuth2FeignConfigure {
+
+    @Bean
+    public RequestInterceptor oauth2FeignRequestInterceptor() {
+        return requestTemplate -> {
+            // 请求头中添加 Gateway Token
+            String zuulToken = new String(Base64Utils.encode(FebsConstant.GATEWAY_TOKEN_VALUE.getBytes()));
+            requestTemplate.header(FebsConstant.GATEWAY_TOKEN_HEADER, zuulToken);
+            // 请求头中添加原请求头中的 Token
+            String authorizationToken = FebsUtil.getCurrentTokenValue();
+            requestTemplate.header(HttpHeaders.AUTHORIZATION, FebsConstant.OAUTH2_TOKEN_TYPE + authorizationToken);
+        };
+    }
+}

+ 34 - 34
febs-common/src/main/java/cc/mrbird/febs/common/configure/FebsServerProtectConfigure.java

@@ -1,34 +1,34 @@
-package cc.mrbird.febs.common.configure;
-
-import cc.mrbird.febs.common.interceptor.FebsServerProtectInterceptor;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.web.servlet.HandlerInterceptor;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * 微服务防护配置
- *
- * @author MrBird
- */
-public class FebsServerProtectConfigure implements WebMvcConfigurer {
-
-    @Bean
-    @ConditionalOnMissingBean(value = PasswordEncoder.class)
-    public PasswordEncoder passwordEncoder() {
-        return new BCryptPasswordEncoder();
-    }
-
-    @Bean
-    public HandlerInterceptor febsServerProtectInterceptor() {
-        return new FebsServerProtectInterceptor();
-    }
-
-    @Override
-    public void addInterceptors(InterceptorRegistry registry) {
-        registry.addInterceptor(febsServerProtectInterceptor());
-    }
-}
+package cc.mrbird.febs.common.configure;
+
+import cc.mrbird.febs.common.interceptor.FebsServerProtectInterceptor;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 微服务防护配置
+ *
+ * @author MrBird
+ */
+public class FebsServerProtectConfigure implements WebMvcConfigurer {
+
+    @Bean
+    @ConditionalOnMissingBean(value = PasswordEncoder.class)
+    public PasswordEncoder passwordEncoder() {
+        return new BCryptPasswordEncoder();
+    }
+
+    @Bean
+    public HandlerInterceptor febsServerProtectInterceptor() {
+        return new FebsServerProtectInterceptor();
+    }
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(febsServerProtectInterceptor());
+    }
+}

+ 45 - 45
febs-common/src/main/java/cc/mrbird/febs/common/entity/CurrentUser.java

@@ -1,45 +1,45 @@
-package cc.mrbird.febs.common.entity;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.springframework.security.core.GrantedAuthority;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Set;
-
-/**
- * @author MrBird
- */
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class CurrentUser implements Serializable {
-
-    private static long serialVersionUID = 761748087824726463L;
-
-    @JsonIgnore
-    private String password;
-    private String username;
-    @JsonIgnore
-    private Set<GrantedAuthority> authorities;
-    private boolean accountNonExpired;
-    private boolean accountNonLocked;
-    private boolean credentialsNonExpired;
-    private boolean enabled;
-    private Long userId;
-    private String avatar;
-    private String email;
-    private String mobile;
-    private String sex;
-    private Long deptId;
-    private String deptName;
-    private String roleId;
-    private String roleName;
-    @JsonIgnore
-    private Date lastLoginTime;
-    private String description;
-    private String status;
-}
+package cc.mrbird.febs.common.entity;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.security.core.GrantedAuthority;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * @author MrBird
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CurrentUser implements Serializable {
+
+    private static long serialVersionUID = 761748087824726463L;
+
+    @JsonIgnore
+    private String password;
+    private String username;
+    @JsonIgnore
+    private Set<GrantedAuthority> authorities;
+    private boolean accountNonExpired;
+    private boolean accountNonLocked;
+    private boolean credentialsNonExpired;
+    private boolean enabled;
+    private Long userId;
+    private String avatar;
+    private String email;
+    private String mobile;
+    private String sex;
+    private Long deptId;
+    private String deptName;
+    private String roleId;
+    private String roleName;
+    @JsonIgnore
+    private Date lastLoginTime;
+    private String description;
+    private String status;
+}

+ 15 - 15
febs-common/src/main/java/cc/mrbird/febs/common/entity/DeptTree.java

@@ -1,15 +1,15 @@
-package cc.mrbird.febs.common.entity;
-
-import cc.mrbird.febs.common.entity.system.Dept;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * @author MrBird
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class DeptTree extends Tree<Dept>{
-
-    private Integer orderNum;
-}
+package cc.mrbird.febs.common.entity;
+
+import cc.mrbird.febs.common.entity.system.Dept;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author MrBird
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DeptTree extends Tree<Dept>{
+
+    private Integer orderNum;
+}

+ 51 - 51
febs-common/src/main/java/cc/mrbird/febs/common/entity/FebsAuthUser.java

@@ -1,51 +1,51 @@
-package cc.mrbird.febs.common.entity;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.User;
-
-import java.util.Collection;
-import java.util.Date;
-
-/**
- * @author MrBird
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class FebsAuthUser extends User {
-
-    private static final long serialVersionUID = -6411066541689297219L;
-
-    private Long userId;
-
-    private String avatar;
-
-    private String email;
-
-    private String mobile;
-
-    private String sex;
-
-    private Long deptId;
-
-    private String deptName;
-
-    private String roleId;
-
-    private String roleName;
-
-    private Date lastLoginTime;
-
-    private String description;
-
-    private String status;
-
-    public FebsAuthUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
-        super(username, password, authorities);
-    }
-
-    public FebsAuthUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
-        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
-    }
-}
+package cc.mrbird.febs.common.entity;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.User;
+
+import java.util.Collection;
+import java.util.Date;
+
+/**
+ * @author MrBird
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FebsAuthUser extends User {
+
+    private static final long serialVersionUID = -6411066541689297219L;
+
+    private Long userId;
+
+    private String avatar;
+
+    private String email;
+
+    private String mobile;
+
+    private String sex;
+
+    private Long deptId;
+
+    private String deptName;
+
+    private String roleId;
+
+    private String roleName;
+
+    private Date lastLoginTime;
+
+    private String description;
+
+    private String status;
+
+    public FebsAuthUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
+        super(username, password, authorities);
+    }
+
+    public FebsAuthUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
+        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
+    }
+}

+ 20 - 20
febs-common/src/main/java/cc/mrbird/febs/common/entity/MenuTree.java

@@ -1,20 +1,20 @@
-package cc.mrbird.febs.common.entity;
-
-import cc.mrbird.febs.common.entity.system.Menu;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * @author MrBird
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class MenuTree extends Tree<Menu>{
-
-    private String path;
-    private String component;
-    private String perms;
-    private String icon;
-    private String type;
-    private Integer orderNum;
-}
+package cc.mrbird.febs.common.entity;
+
+import cc.mrbird.febs.common.entity.system.Menu;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author MrBird
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MenuTree extends Tree<Menu>{
+
+    private String path;
+    private String component;
+    private String perms;
+    private String icon;
+    private String type;
+    private Integer orderNum;
+}

+ 32 - 32
febs-common/src/main/java/cc/mrbird/febs/common/entity/QueryRequest.java

@@ -1,32 +1,32 @@
-package cc.mrbird.febs.common.entity;
-
-import lombok.Data;
-import lombok.ToString;
-
-import java.io.Serializable;
-
-/**
- * @author MrBird
- */
-@Data
-@ToString
-public class QueryRequest implements Serializable {
-
-    private static final long serialVersionUID = -4869594085374385813L;
-    /**
-     * 当前页面数据量
-     */
-    private int pageSize = 10;
-    /**
-     * 当前页码
-     */
-    private int pageNum = 1;
-    /**
-     * 排序字段
-     */
-    private String field;
-    /**
-     * 排序规则,asc升序,desc降序
-     */
-    private String order;
-}
+package cc.mrbird.febs.common.entity;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author MrBird
+ */
+@Data
+@ToString
+public class QueryRequest implements Serializable {
+
+    private static final long serialVersionUID = -4869594085374385813L;
+    /**
+     * 当前页面数据量
+     */
+    private int pageSize = 10;
+    /**
+     * 当前页码
+     */
+    private int pageNum = 1;
+    /**
+     * 排序字段
+     */
+    private String field;
+    /**
+     * 排序规则,asc升序,desc降序
+     */
+    private String order;
+}

+ 32 - 32
febs-common/src/main/java/cc/mrbird/febs/common/entity/Tree.java

@@ -1,32 +1,32 @@
-package cc.mrbird.febs.common.entity;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import lombok.Data;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author MrBird
- */
-@Data
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Tree<T> {
-
-    private String id;
-
-    private String label;
-
-    private List<Tree<T>> children;
-
-    private String parentId;
-
-    private boolean hasParent = false;
-
-    private boolean hasChildren = false;
-
-    public void initChildren(){
-        this.children = new ArrayList<>();
-    }
-
-}
+package cc.mrbird.febs.common.entity;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Tree<T> {
+
+    private String id;
+
+    private String label;
+
+    private List<Tree<T>> children;
+
+    private String parentId;
+
+    private boolean hasParent = false;
+
+    private boolean hasChildren = false;
+
+    public void initChildren(){
+        this.children = new ArrayList<>();
+    }
+
+}

+ 85 - 85
febs-common/src/main/java/cc/mrbird/febs/common/entity/auth/OauthCliendetails.java

@@ -1,86 +1,86 @@
-package cc.mrbird.febs.common.entity.auth;
-
-
-import lombok.Data;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-/**
- *  Entity
- *
- * @author MrBird
- * @date 2019-09-09 14:13:23
- */
-@Data
-@TableName("oauth_client_details")
-public class OauthCliendetails {
-
-    /**
-     * 
-     */
-    @TableId(value = "client_id", type = IdType.AUTO)
-    private String clientId;
-
-    /**
-     * 
-     */
-    @TableField("resource_ids")
-    private String resourceIds;
-
-    /**
-     * 
-     */
-    @TableField("client_secret")
-    private String clientSecret;
-
-    /**
-     * 
-     */
-    @TableField("scope")
-    private String scope;
-
-    /**
-     * 
-     */
-    @TableField("authorized_grant_types")
-    private String authorizedGrantTypes;
-
-    /**
-     * 
-     */
-    @TableField("web_server_redirect_uri")
-    private String webServerRedirectUri;
-
-    /**
-     * 
-     */
-    @TableField("authorities")
-    private String authorities;
-
-    /**
-     * 
-     */
-    @TableField("access_token_validity")
-    private Integer accessTokenValidity;
-
-    /**
-     * 
-     */
-    @TableField("refresh_token_validity")
-    private Integer refreshTokenValidity;
-
-    /**
-     * 
-     */
-    @TableField("additional_information")
-    private String additionalInformation;
-
-    /**
-     * 
-     */
-    @TableField("autoapprove")
-    private Byte autoapprove;
-
+package cc.mrbird.febs.common.entity.auth;
+
+
+import lombok.Data;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+/**
+ *  Entity
+ *
+ * @author MrBird
+ * @date 2019-09-09 14:13:23
+ */
+@Data
+@TableName("oauth_client_details")
+public class OauthCliendetails {
+
+    /**
+     * 
+     */
+    @TableId(value = "client_id", type = IdType.AUTO)
+    private String clientId;
+
+    /**
+     * 
+     */
+    @TableField("resource_ids")
+    private String resourceIds;
+
+    /**
+     * 
+     */
+    @TableField("client_secret")
+    private String clientSecret;
+
+    /**
+     * 
+     */
+    @TableField("scope")
+    private String scope;
+
+    /**
+     * 
+     */
+    @TableField("authorized_grant_types")
+    private String authorizedGrantTypes;
+
+    /**
+     * 
+     */
+    @TableField("web_server_redirect_uri")
+    private String webServerRedirectUri;
+
+    /**
+     * 
+     */
+    @TableField("authorities")
+    private String authorities;
+
+    /**
+     * 
+     */
+    @TableField("access_token_validity")
+    private Integer accessTokenValidity;
+
+    /**
+     * 
+     */
+    @TableField("refresh_token_validity")
+    private Integer refreshTokenValidity;
+
+    /**
+     * 
+     */
+    @TableField("additional_information")
+    private String additionalInformation;
+
+    /**
+     * 
+     */
+    @TableField("autoapprove")
+    private Byte autoapprove;
+
 }

+ 25 - 25
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/EndpointConstant.java

@@ -1,25 +1,25 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * 端点常量
- *
- * @author MrBird
- */
-public class EndpointConstant {
-
-    public static final String ALL = "/**";
-
-    public static final String OAUTH_ALL = "/oauth/**";
-
-    public static final String OAUTH_AUTHORIZE = "/oauth/authorize";
-
-    public static final String OAUTH_CHECK_TOKEN = "/oauth/check_token";
-
-    public static final String OAUTH_CONFIRM_ACCESS = "/oauth/confirm_access";
-
-    public static final String OAUTH_TOKEN = "/oauth/token";
-
-    public static final String OAUTH_TOKEN_KEY = "/oauth/token_key";
-
-    public static final String OAUTH_ERROR = "/oauth/error";
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * 端点常量
+ *
+ * @author MrBird
+ */
+public class EndpointConstant {
+
+    public static final String ALL = "/**";
+
+    public static final String OAUTH_ALL = "/oauth/**";
+
+    public static final String OAUTH_AUTHORIZE = "/oauth/authorize";
+
+    public static final String OAUTH_CHECK_TOKEN = "/oauth/check_token";
+
+    public static final String OAUTH_CONFIRM_ACCESS = "/oauth/confirm_access";
+
+    public static final String OAUTH_TOKEN = "/oauth/token";
+
+    public static final String OAUTH_TOKEN_KEY = "/oauth/token_key";
+
+    public static final String OAUTH_ERROR = "/oauth/error";
+}

+ 63 - 63
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/FebsConstant.java

@@ -1,63 +1,63 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * FEBS系统常量类
- *
- * @author MrBird
- */
-public class FebsConstant {
-
-    /**
-     * 排序规则:降序
-     */
-    public static final String ORDER_DESC = "descending";
-    /**
-     * 排序规则:升序
-     */
-    public static final String ORDER_ASC = "ascending";
-
-    /**
-     * Gateway请求头TOKEN名称(不要有空格)
-     */
-    public static final String GATEWAY_TOKEN_HEADER = "GatewayToken";
-    /**
-     * Gateway请求头TOKEN值
-     */
-    public static final String GATEWAY_TOKEN_VALUE = "febs:gateway:123456";
-
-    /**
-     * 允许下载的文件类型,根据需求自己添加(小写)
-     */
-    public static final String[] VALID_FILE_TYPE = {"xlsx", "zip"};
-
-    /**
-     * 验证码 key前缀
-     */
-    public static final String CODE_PREFIX = "febs.captcha.";
-
-    /**
-     * 异步线程池名称
-     */
-    public static final String ASYNC_POOL = "febsAsyncThreadPool";
-
-    /**
-     * OAUTH2 令牌类型 https://oauth.net/2/bearer-tokens/
-     */
-    public static final String OAUTH2_TOKEN_TYPE = "bearer";
-    /**
-     * Java默认临时目录
-     */
-    public static final String JAVA_TEMP_DIR = "java.io.tmpdir";
-    /**
-     * utf-8
-     */
-    public static final String UTF8 = "utf-8";
-    /**
-     * 注册用户角色ID
-     */
-    public static final Long REGISTER_ROLE_ID = 2L;
-
-    public static final String LOCALHOST = "localhost";
-    public static final String LOCALHOST_IP = "127.0.0.1";
-
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * FEBS系统常量类
+ *
+ * @author MrBird
+ */
+public class FebsConstant {
+
+    /**
+     * 排序规则:降序
+     */
+    public static final String ORDER_DESC = "descending";
+    /**
+     * 排序规则:升序
+     */
+    public static final String ORDER_ASC = "ascending";
+
+    /**
+     * Gateway请求头TOKEN名称(不要有空格)
+     */
+    public static final String GATEWAY_TOKEN_HEADER = "GatewayToken";
+    /**
+     * Gateway请求头TOKEN值
+     */
+    public static final String GATEWAY_TOKEN_VALUE = "febs:gateway:123456";
+
+    /**
+     * 允许下载的文件类型,根据需求自己添加(小写)
+     */
+    public static final String[] VALID_FILE_TYPE = {"xlsx", "zip"};
+
+    /**
+     * 验证码 key前缀
+     */
+    public static final String CODE_PREFIX = "febs.captcha.";
+
+    /**
+     * 异步线程池名称
+     */
+    public static final String ASYNC_POOL = "febsAsyncThreadPool";
+
+    /**
+     * OAUTH2 令牌类型 https://oauth.net/2/bearer-tokens/
+     */
+    public static final String OAUTH2_TOKEN_TYPE = "bearer";
+    /**
+     * Java默认临时目录
+     */
+    public static final String JAVA_TEMP_DIR = "java.io.tmpdir";
+    /**
+     * utf-8
+     */
+    public static final String UTF8 = "utf-8";
+    /**
+     * 注册用户角色ID
+     */
+    public static final Long REGISTER_ROLE_ID = 2L;
+
+    public static final String LOCALHOST = "localhost";
+    public static final String LOCALHOST_IP = "127.0.0.1";
+
+}

+ 17 - 17
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/FebsServerConstant.java

@@ -1,17 +1,17 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * @author MrBird
- */
-public class FebsServerConstant {
-
-    public static final String FEBS_AUTH = "FEBS-Auth";
-    public static final String FEBS_CLOUD = "FEBS-Cloud";
-    public static final String FEBS_COMMON = "FEBS-Common";
-    public static final String FEBS_GATEWAY = "FEBS-Gateway";
-    public static final String FEBS_MONITOR = "FEBS-Monitor";
-    public static final String FEBS_MONITOR_ADMIN = "FEBS-Monitor_Admin";
-    public static final String FEBS_SERVER = "FEBS-Server";
-    public static final String FEBS_SERVER_SYSTEM= "FEBS-Server-System";
-    public static final String FEBS_SERVER_TEST= "FEBS-Server-Test";
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * @author MrBird
+ */
+public class FebsServerConstant {
+
+    public static final String FEBS_AUTH = "FEBS-Auth";
+    public static final String FEBS_CLOUD = "FEBS-Cloud";
+    public static final String FEBS_COMMON = "FEBS-Common";
+    public static final String FEBS_GATEWAY = "FEBS-Gateway";
+    public static final String FEBS_MONITOR = "FEBS-Monitor";
+    public static final String FEBS_MONITOR_ADMIN = "FEBS-Monitor_Admin";
+    public static final String FEBS_SERVER = "FEBS-Server";
+    public static final String FEBS_SERVER_SYSTEM= "FEBS-Server-System";
+    public static final String FEBS_SERVER_TEST= "FEBS-Server-Test";
+}

+ 30 - 30
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/GrantTypeConstant.java

@@ -1,30 +1,30 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * 认证类型常量类
- *
- * @author MrBird
- */
-public class GrantTypeConstant {
-
-    /**
-     * 刷新模式
-     */
-    public static final String REFRESH_TOKEN = "refresh_token";
-    /**
-     * 授权码模式
-     */
-    public static final String AUTHORIZATION_CODE = "authorization_code";
-    /**
-     * 客户端模式
-     */
-    public static final String CLIENT_CREDENTIALS = "client_credentials";
-    /**
-     * 密码模式
-     */
-    public static final String PASSWORD = "password";
-    /**
-     * 简化模式
-     */
-    public static final String IMPLICIT = "implicit";
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * 认证类型常量类
+ *
+ * @author MrBird
+ */
+public class GrantTypeConstant {
+
+    /**
+     * 刷新模式
+     */
+    public static final String REFRESH_TOKEN = "refresh_token";
+    /**
+     * 授权码模式
+     */
+    public static final String AUTHORIZATION_CODE = "authorization_code";
+    /**
+     * 客户端模式
+     */
+    public static final String CLIENT_CREDENTIALS = "client_credentials";
+    /**
+     * 密码模式
+     */
+    public static final String PASSWORD = "password";
+    /**
+     * 简化模式
+     */
+    public static final String IMPLICIT = "implicit";
+}

+ 18 - 18
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/ImageTypeConstant.java

@@ -1,18 +1,18 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * 图片类型常量类
- *
- * @author MrBird
- */
-public class ImageTypeConstant {
-
-    /**
-     * gif类型
-     */
-    public static final String GIF = "gif";
-    /**
-     * png类型
-     */
-    public static final String PNG = "png";
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * 图片类型常量类
+ *
+ * @author MrBird
+ */
+public class ImageTypeConstant {
+
+    /**
+     * gif类型
+     */
+    public static final String GIF = "gif";
+    /**
+     * png类型
+     */
+    public static final String PNG = "png";
+}

+ 12 - 12
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/PageConstant.java

@@ -1,12 +1,12 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * 分页常量
- *
- * @author MrBird
- */
-public class PageConstant {
-
-    public static final String ROWS = "rows";
-    public static final String TOTAL = "total";
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * 分页常量
+ *
+ * @author MrBird
+ */
+public class PageConstant {
+
+    public static final String ROWS = "rows";
+    public static final String TOTAL = "total";
+}

+ 27 - 27
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/ParamsConstant.java

@@ -1,27 +1,27 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * 请求参数常量
- *
- * @author MrBird
- */
-public class ParamsConstant {
-
-    /**
-     * 验证码 key
-     */
-    public static final String VALIDATE_CODE_KEY = "key";
-    /**
-     * 验证码 code
-     */
-    public static final String VALIDATE_CODE_CODE = "code";
-    /**
-     * 认证类型参数 key
-     */
-    public static final String GRANT_TYPE = "grant_type";
-    /**
-     * 登录类型
-     */
-    public static final String LOGIN_TYPE = "login_type";
-
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * 请求参数常量
+ *
+ * @author MrBird
+ */
+public class ParamsConstant {
+
+    /**
+     * 验证码 key
+     */
+    public static final String VALIDATE_CODE_KEY = "key";
+    /**
+     * 验证码 code
+     */
+    public static final String VALIDATE_CODE_CODE = "code";
+    /**
+     * 认证类型参数 key
+     */
+    public static final String GRANT_TYPE = "grant_type";
+    /**
+     * 登录类型
+     */
+    public static final String LOGIN_TYPE = "login_type";
+
+}

+ 10 - 10
febs-common/src/main/java/cc/mrbird/febs/common/entity/constant/SocialConstant.java

@@ -1,10 +1,10 @@
-package cc.mrbird.febs.common.entity.constant;
-
-/**
- * @author MrBird
- */
-public class SocialConstant {
-
-    public static final String SOCIAL_LOGIN = "social_login";
-    public static final String SOCIAL_LOGIN_PASSWORD = "febs_social_login_password";
-}
+package cc.mrbird.febs.common.entity.constant;
+
+/**
+ * @author MrBird
+ */
+public class SocialConstant {
+
+    public static final String SOCIAL_LOGIN = "social_login";
+    public static final String SOCIAL_LOGIN_PASSWORD = "febs_social_login_password";
+}

+ 44 - 44
febs-common/src/main/java/cc/mrbird/febs/common/entity/router/VueRouter.java

@@ -1,44 +1,44 @@
-package cc.mrbird.febs.common.entity.router;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 构建 Vue路由
- */
-@Data
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class VueRouter<T> implements Serializable {
-
-    private static final long serialVersionUID = -3327478146308500708L;
-
-    @JsonIgnore
-    private String id;
-    @JsonIgnore
-    private String parentId;
-
-    private String path;
-    private String name;
-    private String component;
-    private String redirect;
-    private RouterMeta meta;
-    private Boolean hidden = false;
-    private Boolean alwaysShow = false;
-    private List<VueRouter<T>> children;
-
-    @JsonIgnore
-    private Boolean hasParent = false;
-
-    @JsonIgnore
-    private Boolean hasChildren = false;
-
-    public void initChildren(){
-        this.children = new ArrayList<>();
-    }
-
-}
+package cc.mrbird.febs.common.entity.router;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 构建 Vue路由
+ */
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class VueRouter<T> implements Serializable {
+
+    private static final long serialVersionUID = -3327478146308500708L;
+
+    @JsonIgnore
+    private String id;
+    @JsonIgnore
+    private String parentId;
+
+    private String path;
+    private String name;
+    private String component;
+    private String redirect;
+    private RouterMeta meta;
+    private Boolean hidden = false;
+    private Boolean alwaysShow = false;
+    private List<VueRouter<T>> children;
+
+    @JsonIgnore
+    private Boolean hasParent = false;
+
+    @JsonIgnore
+    private Boolean hasChildren = false;
+
+    public void initChildren(){
+        this.children = new ArrayList<>();
+    }
+
+}

+ 89 - 89
febs-common/src/main/java/cc/mrbird/febs/common/entity/system/Log.java

@@ -1,89 +1,89 @@
-package cc.mrbird.febs.common.entity.system;
-
-import cc.mrbird.febs.common.converter.TimeConverter;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.wuwenze.poi.annotation.Excel;
-import com.wuwenze.poi.annotation.ExcelField;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @author MrBird
- */
-@Data
-@TableName("t_log")
-@Excel("系统日志表")
-public class Log implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 日志ID
-     */
-    @TableId(value = "ID", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 操作用户
-     */
-    @TableField("USERNAME")
-    @ExcelField(value = "操作用户")
-    private String username;
-
-    /**
-     * 操作内容
-     */
-    @TableField("OPERATION")
-    @ExcelField(value = "操作内容")
-    private String operation;
-
-    /**
-     * 耗时
-     */
-    @TableField("TIME")
-    @ExcelField(value = "耗时(毫秒)")
-    private Long time;
-
-    /**
-     * 操作方法
-     */
-    @TableField("METHOD")
-    @ExcelField(value = "操作方法")
-    private String method;
-
-    /**
-     * 方法参数
-     */
-    @TableField("PARAMS")
-    @ExcelField(value = "方法参数")
-    private String params;
-
-    /**
-     * 操作者IP
-     */
-    @TableField("IP")
-    @ExcelField(value = "操作者IP")
-    private String ip;
-
-    /**
-     * 创建时间
-     */
-    @TableField("CREATE_TIME")
-    @ExcelField(value = "操作时间", writeConverter = TimeConverter.class)
-    private Date createTime;
-
-    /**
-     * 操作地点
-     */
-    @TableField("LOCATION")
-    @ExcelField(value = "操作地点")
-    private String location;
-
-    private transient String createTimeFrom;
-    private transient String createTimeTo;
-}
+package cc.mrbird.febs.common.entity.system;
+
+import cc.mrbird.febs.common.converter.TimeConverter;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.wuwenze.poi.annotation.Excel;
+import com.wuwenze.poi.annotation.ExcelField;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author MrBird
+ */
+@Data
+@TableName("t_log")
+@Excel("系统日志表")
+public class Log implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 日志ID
+     */
+    @TableId(value = "ID", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 操作用户
+     */
+    @TableField("USERNAME")
+    @ExcelField(value = "操作用户")
+    private String username;
+
+    /**
+     * 操作内容
+     */
+    @TableField("OPERATION")
+    @ExcelField(value = "操作内容")
+    private String operation;
+
+    /**
+     * 耗时
+     */
+    @TableField("TIME")
+    @ExcelField(value = "耗时(毫秒)")
+    private Long time;
+
+    /**
+     * 操作方法
+     */
+    @TableField("METHOD")
+    @ExcelField(value = "操作方法")
+    private String method;
+
+    /**
+     * 方法参数
+     */
+    @TableField("PARAMS")
+    @ExcelField(value = "方法参数")
+    private String params;
+
+    /**
+     * 操作者IP
+     */
+    @TableField("IP")
+    @ExcelField(value = "操作者IP")
+    private String ip;
+
+    /**
+     * 创建时间
+     */
+    @TableField("CREATE_TIME")
+    @ExcelField(value = "操作时间", writeConverter = TimeConverter.class)
+    private Date createTime;
+
+    /**
+     * 操作地点
+     */
+    @TableField("LOCATION")
+    @ExcelField(value = "操作地点")
+    private String location;
+
+    private transient String createTimeFrom;
+    private transient String createTimeTo;
+}

+ 163 - 163
febs-common/src/main/java/cc/mrbird/febs/common/entity/system/LoginLog.java

@@ -1,163 +1,163 @@
-package cc.mrbird.febs.common.entity.system;
-
-import cc.mrbird.febs.common.converter.TimeConverter;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.wuwenze.poi.annotation.Excel;
-import com.wuwenze.poi.annotation.ExcelField;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @author MrBird
- */
-@Slf4j
-@Data
-@TableName("t_login_log")
-@Excel("登录日志")
-public class LoginLog implements Serializable {
-
-    private static final long serialVersionUID = 921991157363932095L;
-    /**
-     * id
-     */
-    @TableId(value = "ID", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 登录用户
-     */
-    @TableField("USERNAME")
-    @ExcelField("登录用户")
-    private String username;
-
-    /**
-     * 登录时间
-     */
-    @TableField("LOGIN_TIME")
-    @ExcelField(value = "登录时间", writeConverter = TimeConverter.class)
-    private Date loginTime;
-
-    /**
-     * 登录地点
-     */
-    @TableField("LOCATION")
-    @ExcelField(value = "登录地点")
-    private String location;
-    /**
-     * 登录 IP
-     */
-    @TableField("IP")
-    @ExcelField("登录IP")
-    private String ip;
-    /**
-     * 操作系统
-     */
-    @TableField("`SYSTEM`")
-    @ExcelField("操作系统")
-    private String system;
-    /**
-     * 登录浏览器
-     */
-    @TableField("BROWSER")
-    @ExcelField("登录浏览器")
-    private String browser;
-
-    private transient String loginTimeFrom;
-    private transient String loginTimeTo;
-
-    public void setSystemBrowserInfo(String ua) {
-        try {
-            StringBuilder userAgent = new StringBuilder("[");
-            userAgent.append(ua);
-            userAgent.append("]");
-            int indexOfMac = userAgent.indexOf("Mac OS X");
-            int indexOfWindows = userAgent.indexOf("Windows NT");
-            int indexOfIE = userAgent.indexOf("MSIE");
-            int indexOfIE11 = userAgent.indexOf("rv:");
-            int indexOfFF = userAgent.indexOf("Firefox");
-            int indexOfSogou = userAgent.indexOf("MetaSr");
-            int indexOfChrome = userAgent.indexOf("Chrome");
-            int indexOfSafari = userAgent.indexOf("Safari");
-            boolean isMac = indexOfMac > 0;
-            boolean isWindows = indexOfWindows > 0;
-            boolean isLinux = userAgent.indexOf("Linux") > 0;
-            boolean containIE = indexOfIE > 0 || (isWindows && (indexOfIE11 > 0));
-            boolean containFF = indexOfFF > 0;
-            boolean containSogou = indexOfSogou > 0;
-            boolean containChrome = indexOfChrome > 0;
-            boolean containSafari = indexOfSafari > 0;
-            String browser = "";
-            if (containSogou) {
-                if (containIE) {
-                    browser = "搜狗" + userAgent.substring(indexOfIE, indexOfIE + "IE x.x".length());
-                } else if (containChrome) {
-                    browser = "搜狗" + userAgent.substring(indexOfChrome, indexOfChrome + "Chrome/xx".length());
-                }
-            } else if (containChrome) {
-                browser = userAgent.substring(indexOfChrome, indexOfChrome + "Chrome/xx".length());
-            } else if (containSafari) {
-                int indexOfSafariVersion = userAgent.indexOf("Version");
-                browser = "Safari "
-                        + userAgent.substring(indexOfSafariVersion, indexOfSafariVersion + "Version/x.x.x.x".length());
-            } else if (containFF) {
-                browser = userAgent.substring(indexOfFF, indexOfFF + "Firefox/xx".length());
-            } else if (containIE) {
-                if (indexOfIE11 > 0) {
-                    browser = "IE 11";
-                } else {
-                    browser = userAgent.substring(indexOfIE, indexOfIE + "IE x.x".length());
-                }
-            }
-            String os = "";
-            if (isMac) {
-                os = userAgent.substring(indexOfMac, indexOfMac + "MacOS X xxxxxxxx".length());
-            } else if (isLinux) {
-                os = "Linux";
-            } else if (isWindows) {
-                os = "Windows ";
-                String version = userAgent.substring(indexOfWindows + "Windows NT".length(), indexOfWindows
-                        + "Windows NTx.x".length());
-                switch (version.trim()) {
-                    case "5.0":
-                        os += "2000";
-                        break;
-                    case "5.1":
-                        os += "XP";
-                        break;
-                    case "5.2":
-                        os += "2003";
-                        break;
-                    case "6.0":
-                        os += "Vista";
-                        break;
-                    case "6.1":
-                        os += "7";
-                        break;
-                    case "6.2":
-                        os += "8";
-                        break;
-                    case "6.3":
-                        os += "8.1";
-                        break;
-                    case "10":
-                        os += "10";
-                        break;
-                }
-            }
-            this.system = os;
-            this.browser = StringUtils.replace(browser, "/", " ");
-        } catch (Exception e) {
-            log.error("获取登录信息失败:{}", e.getMessage());
-            this.system = "";
-            this.browser = "";
-        }
-
-    }
-}
+package cc.mrbird.febs.common.entity.system;
+
+import cc.mrbird.febs.common.converter.TimeConverter;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.wuwenze.poi.annotation.Excel;
+import com.wuwenze.poi.annotation.ExcelField;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author MrBird
+ */
+@Slf4j
+@Data
+@TableName("t_login_log")
+@Excel("登录日志")
+public class LoginLog implements Serializable {
+
+    private static final long serialVersionUID = 921991157363932095L;
+    /**
+     * id
+     */
+    @TableId(value = "ID", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 登录用户
+     */
+    @TableField("USERNAME")
+    @ExcelField("登录用户")
+    private String username;
+
+    /**
+     * 登录时间
+     */
+    @TableField("LOGIN_TIME")
+    @ExcelField(value = "登录时间", writeConverter = TimeConverter.class)
+    private Date loginTime;
+
+    /**
+     * 登录地点
+     */
+    @TableField("LOCATION")
+    @ExcelField(value = "登录地点")
+    private String location;
+    /**
+     * 登录 IP
+     */
+    @TableField("IP")
+    @ExcelField("登录IP")
+    private String ip;
+    /**
+     * 操作系统
+     */
+    @TableField("`SYSTEM`")
+    @ExcelField("操作系统")
+    private String system;
+    /**
+     * 登录浏览器
+     */
+    @TableField("BROWSER")
+    @ExcelField("登录浏览器")
+    private String browser;
+
+    private transient String loginTimeFrom;
+    private transient String loginTimeTo;
+
+    public void setSystemBrowserInfo(String ua) {
+        try {
+            StringBuilder userAgent = new StringBuilder("[");
+            userAgent.append(ua);
+            userAgent.append("]");
+            int indexOfMac = userAgent.indexOf("Mac OS X");
+            int indexOfWindows = userAgent.indexOf("Windows NT");
+            int indexOfIE = userAgent.indexOf("MSIE");
+            int indexOfIE11 = userAgent.indexOf("rv:");
+            int indexOfFF = userAgent.indexOf("Firefox");
+            int indexOfSogou = userAgent.indexOf("MetaSr");
+            int indexOfChrome = userAgent.indexOf("Chrome");
+            int indexOfSafari = userAgent.indexOf("Safari");
+            boolean isMac = indexOfMac > 0;
+            boolean isWindows = indexOfWindows > 0;
+            boolean isLinux = userAgent.indexOf("Linux") > 0;
+            boolean containIE = indexOfIE > 0 || (isWindows && (indexOfIE11 > 0));
+            boolean containFF = indexOfFF > 0;
+            boolean containSogou = indexOfSogou > 0;
+            boolean containChrome = indexOfChrome > 0;
+            boolean containSafari = indexOfSafari > 0;
+            String browser = "";
+            if (containSogou) {
+                if (containIE) {
+                    browser = "搜狗" + userAgent.substring(indexOfIE, indexOfIE + "IE x.x".length());
+                } else if (containChrome) {
+                    browser = "搜狗" + userAgent.substring(indexOfChrome, indexOfChrome + "Chrome/xx".length());
+                }
+            } else if (containChrome) {
+                browser = userAgent.substring(indexOfChrome, indexOfChrome + "Chrome/xx".length());
+            } else if (containSafari) {
+                int indexOfSafariVersion = userAgent.indexOf("Version");
+                browser = "Safari "
+                        + userAgent.substring(indexOfSafariVersion, indexOfSafariVersion + "Version/x.x.x.x".length());
+            } else if (containFF) {
+                browser = userAgent.substring(indexOfFF, indexOfFF + "Firefox/xx".length());
+            } else if (containIE) {
+                if (indexOfIE11 > 0) {
+                    browser = "IE 11";
+                } else {
+                    browser = userAgent.substring(indexOfIE, indexOfIE + "IE x.x".length());
+                }
+            }
+            String os = "";
+            if (isMac) {
+                os = userAgent.substring(indexOfMac, indexOfMac + "MacOS X xxxxxxxx".length());
+            } else if (isLinux) {
+                os = "Linux";
+            } else if (isWindows) {
+                os = "Windows ";
+                String version = userAgent.substring(indexOfWindows + "Windows NT".length(), indexOfWindows
+                        + "Windows NTx.x".length());
+                switch (version.trim()) {
+                    case "5.0":
+                        os += "2000";
+                        break;
+                    case "5.1":
+                        os += "XP";
+                        break;
+                    case "5.2":
+                        os += "2003";
+                        break;
+                    case "6.0":
+                        os += "Vista";
+                        break;
+                    case "6.1":
+                        os += "7";
+                        break;
+                    case "6.2":
+                        os += "8";
+                        break;
+                    case "6.3":
+                        os += "8.1";
+                        break;
+                    case "10":
+                        os += "10";
+                        break;
+                }
+            }
+            this.system = os;
+            this.browser = StringUtils.replace(browser, "/", " ");
+        } catch (Exception e) {
+            log.error("获取登录信息失败:{}", e.getMessage());
+            this.system = "";
+            this.browser = "";
+        }
+
+    }
+}

+ 21 - 21
febs-common/src/main/java/cc/mrbird/febs/common/entity/system/RoleMenu.java

@@ -1,22 +1,22 @@
-package cc.mrbird.febs.common.entity.system;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author MrBird
- */
-@TableName("t_role_menu")
-@Data
-public class RoleMenu implements Serializable {
-	
-	private static final long serialVersionUID = -7573904024872252113L;
-
-	@TableField(value = "ROLE_ID")
-    private Long roleId;
-    @TableField(value = "MENU_ID")
-    private Long menuId;
+package cc.mrbird.febs.common.entity.system;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author MrBird
+ */
+@TableName("t_role_menu")
+@Data
+public class RoleMenu implements Serializable {
+	
+	private static final long serialVersionUID = -7573904024872252113L;
+
+	@TableField(value = "ROLE_ID")
+    private Long roleId;
+    @TableField(value = "MENU_ID")
+    private Long menuId;
 }

+ 158 - 158
febs-common/src/main/java/cc/mrbird/febs/common/entity/system/SystemUser.java

@@ -1,158 +1,158 @@
-package cc.mrbird.febs.common.entity.system;
-
-import cc.mrbird.febs.common.annotation.IsMobile;
-import cc.mrbird.febs.common.converter.TimeConverter;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.wuwenze.poi.annotation.Excel;
-import com.wuwenze.poi.annotation.ExcelField;
-import lombok.Data;
-
-import javax.validation.constraints.Email;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Size;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @author MrBird
- */
-@Data
-@TableName("t_user")
-@Excel("用户信息表")
-public class SystemUser implements Serializable {
-
-    private static final long serialVersionUID = -4352868070794165001L;
-
-    // 用户状态:有效
-    public static final String STATUS_VALID = "1";
-    // 用户状态:锁定
-    public static final String STATUS_LOCK = "0";
-    // 默认头像
-    public static final String DEFAULT_AVATAR = "default.jpg";
-    // 默认密码
-    public static final String DEFAULT_PASSWORD = "1234qwer";
-    // 性别男
-    public static final String SEX_MALE = "0";
-    // 性别女
-    public static final String SEX_FEMALE = "1";
-    // 性别保密
-    public static final String SEX_UNKNOW = "2";
-
-    /**
-     * 用户 ID
-     */
-    @TableId(value = "USER_ID", type = IdType.AUTO)
-    private Long userId;
-
-    /**
-     * 用户名
-     */
-    @TableField("USERNAME")
-    @Size(min = 4, max = 10, message = "{range}")
-    @ExcelField(value = "用户名")
-    private String username;
-
-    /**
-     * 密码
-     */
-    @TableField("PASSWORD")
-    private String password;
-
-    /**
-     * 部门 ID
-     */
-    @TableField("DEPT_ID")
-    private Long deptId;
-
-    /**
-     * 邮箱
-     */
-    @TableField("EMAIL")
-    @Size(max = 50, message = "{noMoreThan}")
-    @Email(message = "{email}")
-    @ExcelField(value = "邮箱")
-    private String email;
-
-    /**
-     * 联系电话
-     */
-    @TableField("MOBILE")
-    @IsMobile(message = "{mobile}")
-    @ExcelField(value = "联系电话")
-    private String mobile;
-
-    /**
-     * 状态 0锁定 1有效
-     */
-    @TableField("STATUS")
-    @NotBlank(message = "{required}")
-    @ExcelField(value = "状态", writeConverterExp = "0=锁定,1=有效")
-    private String status;
-
-    /**
-     * 创建时间
-     */
-    @TableField("CREATE_TIME")
-    @ExcelField(value = "创建时间", writeConverter = TimeConverter.class)
-    private Date createTime;
-
-    /**
-     * 修改时间
-     */
-    @TableField("MODIFY_TIME")
-    @ExcelField(value = "修改时间", writeConverter = TimeConverter.class)
-    private Date modifyTime;
-
-    /**
-     * 最近访问时间
-     */
-    @TableField("LAST_LOGIN_TIME")
-    @ExcelField(value = "最近访问时间", writeConverter = TimeConverter.class)
-    private Date lastLoginTime;
-
-    /**
-     * 性别 0男 1女 2 保密
-     */
-    @TableField("SSEX")
-    @NotBlank(message = "{required}")
-    @ExcelField(value = "性别", writeConverterExp = "0=男,1=女,2=保密")
-    private String sex;
-
-    /**
-     * 头像
-     */
-    @TableField("AVATAR")
-    private String avatar;
-
-    /**
-     * 描述
-     */
-    @TableField("DESCRIPTION")
-    @Size(max = 100, message = "{noMoreThan}")
-    @ExcelField(value = "个人描述")
-    private String description;
-
-    /**
-     * 部门名称
-     */
-    @TableField(exist = false)
-    private String deptName;
-
-    @TableField(exist = false)
-    private String createTimeFrom;
-    @TableField(exist = false)
-    private String createTimeTo;
-    /**
-     * 角色 ID
-     */
-    @NotBlank(message = "{required}")
-    @TableField(exist = false)
-    private String roleId;
-
-    @TableField(exist = false)
-    private String roleName;
-
-}
+package cc.mrbird.febs.common.entity.system;
+
+import cc.mrbird.febs.common.annotation.IsMobile;
+import cc.mrbird.febs.common.converter.TimeConverter;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.wuwenze.poi.annotation.Excel;
+import com.wuwenze.poi.annotation.ExcelField;
+import lombok.Data;
+
+import javax.validation.constraints.Email;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author MrBird
+ */
+@Data
+@TableName("t_user")
+@Excel("用户信息表")
+public class SystemUser implements Serializable {
+
+    private static final long serialVersionUID = -4352868070794165001L;
+
+    // 用户状态:有效
+    public static final String STATUS_VALID = "1";
+    // 用户状态:锁定
+    public static final String STATUS_LOCK = "0";
+    // 默认头像
+    public static final String DEFAULT_AVATAR = "default.jpg";
+    // 默认密码
+    public static final String DEFAULT_PASSWORD = "1234qwer";
+    // 性别男
+    public static final String SEX_MALE = "0";
+    // 性别女
+    public static final String SEX_FEMALE = "1";
+    // 性别保密
+    public static final String SEX_UNKNOW = "2";
+
+    /**
+     * 用户 ID
+     */
+    @TableId(value = "USER_ID", type = IdType.AUTO)
+    private Long userId;
+
+    /**
+     * 用户名
+     */
+    @TableField("USERNAME")
+    @Size(min = 4, max = 10, message = "{range}")
+    @ExcelField(value = "用户名")
+    private String username;
+
+    /**
+     * 密码
+     */
+    @TableField("PASSWORD")
+    private String password;
+
+    /**
+     * 部门 ID
+     */
+    @TableField("DEPT_ID")
+    private Long deptId;
+
+    /**
+     * 邮箱
+     */
+    @TableField("EMAIL")
+    @Size(max = 50, message = "{noMoreThan}")
+    @Email(message = "{email}")
+    @ExcelField(value = "邮箱")
+    private String email;
+
+    /**
+     * 联系电话
+     */
+    @TableField("MOBILE")
+    @IsMobile(message = "{mobile}")
+    @ExcelField(value = "联系电话")
+    private String mobile;
+
+    /**
+     * 状态 0锁定 1有效
+     */
+    @TableField("STATUS")
+    @NotBlank(message = "{required}")
+    @ExcelField(value = "状态", writeConverterExp = "0=锁定,1=有效")
+    private String status;
+
+    /**
+     * 创建时间
+     */
+    @TableField("CREATE_TIME")
+    @ExcelField(value = "创建时间", writeConverter = TimeConverter.class)
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField("MODIFY_TIME")
+    @ExcelField(value = "修改时间", writeConverter = TimeConverter.class)
+    private Date modifyTime;
+
+    /**
+     * 最近访问时间
+     */
+    @TableField("LAST_LOGIN_TIME")
+    @ExcelField(value = "最近访问时间", writeConverter = TimeConverter.class)
+    private Date lastLoginTime;
+
+    /**
+     * 性别 0男 1女 2 保密
+     */
+    @TableField("SSEX")
+    @NotBlank(message = "{required}")
+    @ExcelField(value = "性别", writeConverterExp = "0=男,1=女,2=保密")
+    private String sex;
+
+    /**
+     * 头像
+     */
+    @TableField("AVATAR")
+    private String avatar;
+
+    /**
+     * 描述
+     */
+    @TableField("DESCRIPTION")
+    @Size(max = 100, message = "{noMoreThan}")
+    @ExcelField(value = "个人描述")
+    private String description;
+
+    /**
+     * 部门名称
+     */
+    @TableField(exist = false)
+    private String deptName;
+
+    @TableField(exist = false)
+    private String createTimeFrom;
+    @TableField(exist = false)
+    private String createTimeTo;
+    /**
+     * 角色 ID
+     */
+    @NotBlank(message = "{required}")
+    @TableField(exist = false)
+    private String roleId;
+
+    @TableField(exist = false)
+    private String roleName;
+
+}

+ 23 - 23
febs-common/src/main/java/cc/mrbird/febs/common/entity/system/UserRole.java

@@ -1,24 +1,24 @@
-package cc.mrbird.febs.common.entity.system;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author MrBird
- */
-@Data
-@TableName("t_user_role")
-public class UserRole implements Serializable {
-
-    private static final long serialVersionUID = -3166012934498268403L;
-
-    @TableField(value = "USER_ID")
-    private Long userId;
-
-    @TableField(value = "ROLE_ID")
-    private Long roleId;
-
+package cc.mrbird.febs.common.entity.system;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author MrBird
+ */
+@Data
+@TableName("t_user_role")
+public class UserRole implements Serializable {
+
+    private static final long serialVersionUID = -3166012934498268403L;
+
+    @TableField(value = "USER_ID")
+    private Long userId;
+
+    @TableField(value = "ROLE_ID")
+    private Long roleId;
+
 }

+ 15 - 15
febs-common/src/main/java/cc/mrbird/febs/common/exception/FebsException.java

@@ -1,15 +1,15 @@
-package cc.mrbird.febs.common.exception;
-
-/**
- * FEBS系统异常
- *
- * @author MrBird
- */
-public class FebsException extends Exception {
-
-    private static final long serialVersionUID = -6916154462432027437L;
-
-    public FebsException(String message) {
-        super(message);
-    }
-}
+package cc.mrbird.febs.common.exception;
+
+/**
+ * FEBS系统异常
+ *
+ * @author MrBird
+ */
+public class FebsException extends Exception {
+
+    private static final long serialVersionUID = -6916154462432027437L;
+
+    public FebsException(String message) {
+        super(message);
+    }
+}

+ 15 - 15
febs-common/src/main/java/cc/mrbird/febs/common/exception/ValidateCodeException.java

@@ -1,15 +1,15 @@
-package cc.mrbird.febs.common.exception;
-
-/**
- * 验证码类型异常
- *
- * @author MrBird
- */
-public class ValidateCodeException extends Exception {
-
-    private static final long serialVersionUID = 7514854456967620043L;
-
-    public ValidateCodeException(String message) {
-        super(message);
-    }
-}
+package cc.mrbird.febs.common.exception;
+
+/**
+ * 验证码类型异常
+ *
+ * @author MrBird
+ */
+public class ValidateCodeException extends Exception {
+
+    private static final long serialVersionUID = 7514854456967620043L;
+
+    public ValidateCodeException(String message) {
+        super(message);
+    }
+}

+ 105 - 105
febs-common/src/main/java/cc/mrbird/febs/common/handler/BaseExceptionHandler.java

@@ -1,105 +1,105 @@
-package cc.mrbird.febs.common.handler;
-
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.exception.FebsException;
-import cc.mrbird.febs.common.exception.FileDownloadException;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.validation.BindException;
-import org.springframework.validation.FieldError;
-import org.springframework.web.HttpMediaTypeNotSupportedException;
-import org.springframework.web.HttpRequestMethodNotSupportedException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.ConstraintViolationException;
-import javax.validation.Path;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author MrBird
- */
-@Slf4j
-public class BaseExceptionHandler {
-
-    @ExceptionHandler(value = Exception.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public FebsResponse handleException(Exception e) {
-        log.error("系统内部异常,异常信息", e);
-        return new FebsResponse().message("系统内部异常");
-    }
-
-    @ExceptionHandler(value = FebsException.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public FebsResponse handleFebsException(FebsException e) {
-        log.error("系统错误", e);
-        return new FebsResponse().message(e.getMessage());
-    }
-
-    /**
-     * 统一处理请求参数校验(实体对象传参)
-     *
-     * @param e BindException
-     * @return FebsResponse
-     */
-    @ExceptionHandler(BindException.class)
-    @ResponseStatus(HttpStatus.BAD_REQUEST)
-    public FebsResponse handleBindException(BindException e) {
-        StringBuilder message = new StringBuilder();
-        List<FieldError> fieldErrors = e.getBindingResult().getFieldErrors();
-        for (FieldError error : fieldErrors) {
-            message.append(error.getField()).append(error.getDefaultMessage()).append(",");
-        }
-        message = new StringBuilder(message.substring(0, message.length() - 1));
-        return new FebsResponse().message(message.toString());
-    }
-
-    /**
-     * 统一处理请求参数校验(普通传参)
-     *
-     * @param e ConstraintViolationException
-     * @return FebsResponse
-     */
-    @ExceptionHandler(value = ConstraintViolationException.class)
-    @ResponseStatus(HttpStatus.BAD_REQUEST)
-    public FebsResponse handleConstraintViolationException(ConstraintViolationException e) {
-        StringBuilder message = new StringBuilder();
-        Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
-        for (ConstraintViolation<?> violation : violations) {
-            Path path = violation.getPropertyPath();
-            String[] pathArr = StringUtils.splitByWholeSeparatorPreserveAllTokens(path.toString(), ".");
-            message.append(pathArr[1]).append(violation.getMessage()).append(",");
-        }
-        message = new StringBuilder(message.substring(0, message.length() - 1));
-        return new FebsResponse().message(message.toString());
-    }
-
-    @ExceptionHandler(value = FileDownloadException.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public void handleFileDownloadException(FileDownloadException e) {
-        log.error("FileDownloadException", e);
-    }
-
-    @ExceptionHandler(value = AccessDeniedException.class)
-    @ResponseStatus(HttpStatus.FORBIDDEN)
-    public FebsResponse handleAccessDeniedException() {
-        return new FebsResponse().message("没有权限访问该资源");
-    }
-
-    @ExceptionHandler(value = HttpMediaTypeNotSupportedException.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public FebsResponse handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e) {
-        return new FebsResponse().message("改方法不支持" + StringUtils.substringBetween(e.getMessage(), "'", "'") + "媒体类型");
-    }
-
-    @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public FebsResponse handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
-        return new FebsResponse().message("该方法不支持" + StringUtils.substringBetween(e.getMessage(), "'", "'") + "请求方法");
-    }
-
-}
+package cc.mrbird.febs.common.handler;
+
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.common.exception.FileDownloadException;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.validation.BindException;
+import org.springframework.validation.FieldError;
+import org.springframework.web.HttpMediaTypeNotSupportedException;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import javax.validation.Path;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author MrBird
+ */
+@Slf4j
+public class BaseExceptionHandler {
+
+    @ExceptionHandler(value = Exception.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    public FebsResponse handleException(Exception e) {
+        log.error("系统内部异常,异常信息", e);
+        return new FebsResponse().message("系统内部异常");
+    }
+
+    @ExceptionHandler(value = FebsException.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    public FebsResponse handleFebsException(FebsException e) {
+        log.error("系统错误", e);
+        return new FebsResponse().message(e.getMessage());
+    }
+
+    /**
+     * 统一处理请求参数校验(实体对象传参)
+     *
+     * @param e BindException
+     * @return FebsResponse
+     */
+    @ExceptionHandler(BindException.class)
+    @ResponseStatus(HttpStatus.BAD_REQUEST)
+    public FebsResponse handleBindException(BindException e) {
+        StringBuilder message = new StringBuilder();
+        List<FieldError> fieldErrors = e.getBindingResult().getFieldErrors();
+        for (FieldError error : fieldErrors) {
+            message.append(error.getField()).append(error.getDefaultMessage()).append(",");
+        }
+        message = new StringBuilder(message.substring(0, message.length() - 1));
+        return new FebsResponse().message(message.toString());
+    }
+
+    /**
+     * 统一处理请求参数校验(普通传参)
+     *
+     * @param e ConstraintViolationException
+     * @return FebsResponse
+     */
+    @ExceptionHandler(value = ConstraintViolationException.class)
+    @ResponseStatus(HttpStatus.BAD_REQUEST)
+    public FebsResponse handleConstraintViolationException(ConstraintViolationException e) {
+        StringBuilder message = new StringBuilder();
+        Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
+        for (ConstraintViolation<?> violation : violations) {
+            Path path = violation.getPropertyPath();
+            String[] pathArr = StringUtils.splitByWholeSeparatorPreserveAllTokens(path.toString(), ".");
+            message.append(pathArr[1]).append(violation.getMessage()).append(",");
+        }
+        message = new StringBuilder(message.substring(0, message.length() - 1));
+        return new FebsResponse().message(message.toString());
+    }
+
+    @ExceptionHandler(value = FileDownloadException.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    public void handleFileDownloadException(FileDownloadException e) {
+        log.error("FileDownloadException", e);
+    }
+
+    @ExceptionHandler(value = AccessDeniedException.class)
+    @ResponseStatus(HttpStatus.FORBIDDEN)
+    public FebsResponse handleAccessDeniedException() {
+        return new FebsResponse().message("没有权限访问该资源");
+    }
+
+    @ExceptionHandler(value = HttpMediaTypeNotSupportedException.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    public FebsResponse handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e) {
+        return new FebsResponse().message("改方法不支持" + StringUtils.substringBetween(e.getMessage(), "'", "'") + "媒体类型");
+    }
+
+    @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    public FebsResponse handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
+        return new FebsResponse().message("该方法不支持" + StringUtils.substringBetween(e.getMessage(), "'", "'") + "请求方法");
+    }
+
+}

+ 27 - 27
febs-common/src/main/java/cc/mrbird/febs/common/handler/FebsAuthExceptionEntryPoint.java

@@ -1,27 +1,27 @@
-package cc.mrbird.febs.common.handler;
-
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import org.springframework.http.MediaType;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.AuthenticationEntryPoint;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author MrBird
- */
-public class FebsAuthExceptionEntryPoint implements AuthenticationEntryPoint {
-
-    @Override
-    public void commence(HttpServletRequest request, HttpServletResponse response,
-                         AuthenticationException authException) throws IOException {
-        FebsResponse febsResponse = new FebsResponse();
-        FebsUtil.makeResponse(
-                response, MediaType.APPLICATION_JSON_VALUE,
-                HttpServletResponse.SC_UNAUTHORIZED, febsResponse.message("token无效")
-        );
-    }
-}
+package cc.mrbird.febs.common.handler;
+
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import org.springframework.http.MediaType;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.AuthenticationEntryPoint;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author MrBird
+ */
+public class FebsAuthExceptionEntryPoint implements AuthenticationEntryPoint {
+
+    @Override
+    public void commence(HttpServletRequest request, HttpServletResponse response,
+                         AuthenticationException authException) throws IOException {
+        FebsResponse febsResponse = new FebsResponse();
+        FebsUtil.makeResponse(
+                response, MediaType.APPLICATION_JSON_VALUE,
+                HttpServletResponse.SC_UNAUTHORIZED, febsResponse.message("token无效")
+        );
+    }
+}

+ 35 - 35
febs-common/src/main/java/cc/mrbird/febs/common/interceptor/FebsServerProtectInterceptor.java

@@ -1,35 +1,35 @@
-package cc.mrbird.febs.common.interceptor;
-
-import cc.mrbird.febs.common.entity.constant.FebsConstant;
-import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.common.utils.FebsUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.http.MediaType;
-import org.springframework.util.Base64Utils;
-import org.springframework.web.servlet.HandlerInterceptor;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author MrBird
- */
-public class FebsServerProtectInterceptor implements HandlerInterceptor {
-
-    @Override
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
-        // 从请求头中获取 Gateway Token
-        String token = request.getHeader(FebsConstant.GATEWAY_TOKEN_HEADER);
-        String zuulToken = new String(Base64Utils.encode(FebsConstant.GATEWAY_TOKEN_VALUE.getBytes()));
-        // 校验 Gateway Token的正确性
-        if (StringUtils.equals(zuulToken, token)) {
-            return true;
-        } else {
-            FebsResponse febsResponse = new FebsResponse();
-            FebsUtil.makeResponse(response,MediaType.APPLICATION_JSON_VALUE,
-                    HttpServletResponse.SC_FORBIDDEN, febsResponse.message("请通过网关获取资源"));
-            return false;
-        }
-    }
-}
+package cc.mrbird.febs.common.interceptor;
+
+import cc.mrbird.febs.common.entity.constant.FebsConstant;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.utils.FebsUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.MediaType;
+import org.springframework.util.Base64Utils;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author MrBird
+ */
+public class FebsServerProtectInterceptor implements HandlerInterceptor {
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
+        // 从请求头中获取 Gateway Token
+        String token = request.getHeader(FebsConstant.GATEWAY_TOKEN_HEADER);
+        String zuulToken = new String(Base64Utils.encode(FebsConstant.GATEWAY_TOKEN_VALUE.getBytes()));
+        // 校验 Gateway Token的正确性
+        if (StringUtils.equals(zuulToken, token)) {
+            return true;
+        } else {
+            FebsResponse febsResponse = new FebsResponse();
+            FebsUtil.makeResponse(response,MediaType.APPLICATION_JSON_VALUE,
+                    HttpServletResponse.SC_FORBIDDEN, febsResponse.message("请通过网关获取资源"));
+            return false;
+        }
+    }
+}

+ 556 - 556
febs-common/src/main/java/cc/mrbird/febs/common/service/RedisService.java

@@ -1,557 +1,557 @@
-package cc.mrbird.febs.common.service;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 定义常用的 Redis操作
- *
- * @author MrBird
- */
-public class RedisService {
-
-    @Autowired
-    private RedisTemplate<String, Object> redisTemplate;
-
-    /**
-     * 指定缓存失效时间
-     *
-     * @param key  键
-     * @param time 时间(秒)
-     * @return Boolean
-     */
-    public Boolean expire(String key, Long time) {
-        try {
-            if (time > 0) {
-                redisTemplate.expire(key, time, TimeUnit.SECONDS);
-            }
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 根据key获取过期时间
-     *
-     * @param key 键 不能为 null
-     * @return 时间(秒) 返回 0代表为永久有效
-     */
-    public Long getExpire(String key) {
-        return redisTemplate.getExpire(key, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 判断 key是否存在
-     *
-     * @param key 键
-     * @return true 存在 false不存在
-     */
-    public Boolean hasKey(String key) {
-        try {
-            return redisTemplate.hasKey(key);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 删除缓存
-     *
-     * @param key 可以传一个值 或多个
-     */
-    public void del(String... key) {
-        if (key != null && key.length > 0) {
-            if (key.length == 1) {
-                redisTemplate.delete(key[0]);
-            } else {
-                redisTemplate.delete(Arrays.asList(key));
-            }
-        }
-    }
-
-    /**
-     * 普通缓存获取
-     *
-     * @param key 键
-     * @return 值
-     */
-    public Object get(String key) {
-        return key == null ? null : redisTemplate.opsForValue().get(key);
-    }
-
-    /**
-     * 普通缓存放入
-     *
-     * @param key   键
-     * @param value 值
-     * @return true成功 false失败
-     */
-    public Boolean set(String key, Object value) {
-        try {
-            redisTemplate.opsForValue().set(key, value);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 普通缓存放入并设置时间
-     *
-     * @param key   键
-     * @param value 值
-     * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
-     * @return true成功 false 失败
-     */
-    public Boolean set(String key, Object value, Long time) {
-        try {
-            if (time > 0) {
-                redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
-            } else {
-                set(key, value);
-            }
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 递增
-     *
-     * @param key   键
-     * @param delta 要增加几(大于0)
-     * @return Long
-     */
-    public Long incr(String key, Long delta) {
-        if (delta < 0) {
-            throw new RuntimeException("递增因子必须大于0");
-        }
-        return redisTemplate.opsForValue().increment(key, delta);
-    }
-
-    /**
-     * 递减
-     *
-     * @param key   键
-     * @param delta 要减少几(小于0)
-     * @return Long
-     */
-    public Long decr(String key, Long delta) {
-        if (delta < 0) {
-            throw new RuntimeException("递减因子必须大于0");
-        }
-        return redisTemplate.opsForValue().increment(key, -delta);
-    }
-
-    /**
-     * HashGet
-     *
-     * @param key  键 不能为 null
-     * @param item 项 不能为 null
-     * @return 值
-     */
-    public Object hget(String key, String item) {
-        return redisTemplate.opsForHash().get(key, item);
-    }
-
-    /**
-     * 获取 hashKey对应的所有键值
-     *
-     * @param key 键
-     * @return 对应的多个键值
-     */
-    public Map<Object, Object> hmget(String key) {
-        return redisTemplate.opsForHash().entries(key);
-    }
-
-    /**
-     * HashSet
-     *
-     * @param key 键
-     * @param map 对应多个键值
-     * @return true 成功 false 失败
-     */
-    public Boolean hmset(String key, Map<String, Object> map) {
-        try {
-            redisTemplate.opsForHash().putAll(key, map);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * HashSet 并设置时间
-     *
-     * @param key  键
-     * @param map  对应多个键值
-     * @param time 时间(秒)
-     * @return true成功 false失败
-     */
-    public Boolean hmset(String key, Map<String, Object> map, Long time) {
-        try {
-            redisTemplate.opsForHash().putAll(key, map);
-            if (time > 0) {
-                expire(key, time);
-            }
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 向一张hash表中放入数据,如果不存在将创建
-     *
-     * @param key   键
-     * @param item  项
-     * @param value 值
-     * @return true 成功 false失败
-     */
-    public Boolean hset(String key, String item, Object value) {
-        try {
-            redisTemplate.opsForHash().put(key, item, value);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 向一张hash表中放入数据,如果不存在将创建
-     *
-     * @param key   键
-     * @param item  项
-     * @param value 值
-     * @param time  时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
-     * @return true 成功 false失败
-     */
-    public Boolean hset(String key, String item, Object value, Long time) {
-        try {
-            redisTemplate.opsForHash().put(key, item, value);
-            if (time > 0) {
-                expire(key, time);
-            }
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 删除hash表中的值
-     *
-     * @param key  键 不能为 null
-     * @param item 项 可以使多个不能为 null
-     */
-    public void hdel(String key, Object... item) {
-        redisTemplate.opsForHash().delete(key, item);
-    }
-
-    /**
-     * 判断hash表中是否有该项的值
-     *
-     * @param key  键 不能为 null
-     * @param item 项 不能为 null
-     * @return true 存在 false不存在
-     */
-    public Boolean hHasKey(String key, String item) {
-        return redisTemplate.opsForHash().hasKey(key, item);
-    }
-
-    /**
-     * hash递增 如果不存在,就会创建一个 并把新增后的值返回
-     *
-     * @param key  键
-     * @param item 项
-     * @param by   要增加几(大于0)
-     * @return Double
-     */
-    public Double hincr(String key, String item, Double by) {
-        return redisTemplate.opsForHash().increment(key, item, by);
-    }
-
-    /**
-     * hash递减
-     *
-     * @param key  键
-     * @param item 项
-     * @param by   要减少记(小于0)
-     * @return Double
-     */
-    public Double hdecr(String key, String item, Double by) {
-        return redisTemplate.opsForHash().increment(key, item, -by);
-    }
-
-    /**
-     * 根据 key获取 Set中的所有值
-     *
-     * @param key 键
-     * @return Set
-     */
-    public Set<Object> sGet(String key) {
-        try {
-            return redisTemplate.opsForSet().members(key);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * 根据value从一个set中查询,是否存在
-     *
-     * @param key   键
-     * @param value 值
-     * @return true 存在 false不存在
-     */
-    public Boolean sHasKey(String key, Object value) {
-        try {
-            return redisTemplate.opsForSet().isMember(key, value);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 将数据放入set缓存
-     *
-     * @param key    键
-     * @param values 值 可以是多个
-     * @return 成功个数
-     */
-    public Long sSet(String key, Object... values) {
-        try {
-            return redisTemplate.opsForSet().add(key, values);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0L;
-        }
-    }
-
-    /**
-     * 将set数据放入缓存
-     *
-     * @param key    键
-     * @param time   时间(秒)
-     * @param values 值 可以是多个
-     * @return 成功个数
-     */
-    public Long sSetAndTime(String key, Long time, Object... values) {
-        try {
-            Long count = redisTemplate.opsForSet().add(key, values);
-            if (time > 0)
-                expire(key, time);
-            return count;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0L;
-        }
-    }
-
-    /**
-     * 获取set缓存的长度
-     *
-     * @param key 键
-     * @return Long
-     */
-    public Long sGetSetSize(String key) {
-        try {
-            return redisTemplate.opsForSet().size(key);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0L;
-        }
-    }
-
-    /**
-     * 移除值为value的
-     *
-     * @param key    键
-     * @param values 值 可以是多个
-     * @return 移除的个数
-     */
-    public Long setRemove(String key, Object... values) {
-        try {
-            return redisTemplate.opsForSet().remove(key, values);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0L;
-        }
-    }
-
-    /**
-     * 获取list缓存的内容
-     *
-     * @param key   键
-     * @param start 开始
-     * @param end   结束 0 到 -1代表所有值
-     * @return List
-     */
-    public List<Object> lGet(String key, Long start, Long end) {
-        try {
-            return redisTemplate.opsForList().range(key, start, end);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * 获取list缓存的长度
-     *
-     * @param key 键
-     * @return Long
-     */
-    public Long lGetListSize(String key) {
-        try {
-            return redisTemplate.opsForList().size(key);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0L;
-        }
-    }
-
-    /**
-     * 通过索引 获取list中的值
-     *
-     * @param key   键
-     * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;
-     *              index<0时,-1,表尾,-2倒数第二个元素,依次类推
-     * @return Object
-     */
-    public Object lGetIndex(String key, Long index) {
-        try {
-            return redisTemplate.opsForList().index(key, index);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * 将list放入缓存
-     *
-     * @param key   键
-     * @param value 值
-     * @return Boolean
-     */
-    public Boolean lSet(String key, Object value) {
-        try {
-            redisTemplate.opsForList().rightPush(key, value);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 将list放入缓存
-     *
-     * @param key   键
-     * @param value 值
-     * @param time  时间(秒)
-     * @return Boolean
-     */
-    public Boolean lSet(String key, Object value, Long time) {
-        try {
-            redisTemplate.opsForList().rightPush(key, value);
-            if (time > 0)
-                expire(key, time);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 将list放入缓存
-     *
-     * @param key   键
-     * @param value 值
-     * @return Boolean
-     */
-    public Boolean lSet(String key, List<Object> value) {
-        try {
-            redisTemplate.opsForList().rightPushAll(key, value);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 将list放入缓存
-     *
-     * @param key   键
-     * @param value 值
-     * @param time  时间(秒)
-     * @return Boolean
-     */
-    public Boolean lSet(String key, List<Object> value, Long time) {
-        try {
-            redisTemplate.opsForList().rightPushAll(key, value);
-            if (time > 0)
-                expire(key, time);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 根据索引修改list中的某条数据
-     *
-     * @param key   键
-     * @param index 索引
-     * @param value 值
-     * @return Boolean
-     */
-    public Boolean lUpdateIndex(String key, Long index, Object value) {
-        try {
-            redisTemplate.opsForList().set(key, index, value);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 移除N个值为value
-     *
-     * @param key   键
-     * @param count 移除多少个
-     * @param value 值
-     * @return 移除的个数
-     */
-    public Long lRemove(String key, Long count, Object value) {
-        try {
-            return redisTemplate.opsForList().remove(key, count, value);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0L;
-        }
-    }
+package cc.mrbird.febs.common.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 定义常用的 Redis操作
+ *
+ * @author MrBird
+ */
+public class RedisService {
+
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+    /**
+     * 指定缓存失效时间
+     *
+     * @param key  键
+     * @param time 时间(秒)
+     * @return Boolean
+     */
+    public Boolean expire(String key, Long time) {
+        try {
+            if (time > 0) {
+                redisTemplate.expire(key, time, TimeUnit.SECONDS);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 根据key获取过期时间
+     *
+     * @param key 键 不能为 null
+     * @return 时间(秒) 返回 0代表为永久有效
+     */
+    public Long getExpire(String key) {
+        return redisTemplate.getExpire(key, TimeUnit.SECONDS);
+    }
+
+    /**
+     * 判断 key是否存在
+     *
+     * @param key 键
+     * @return true 存在 false不存在
+     */
+    public Boolean hasKey(String key) {
+        try {
+            return redisTemplate.hasKey(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 删除缓存
+     *
+     * @param key 可以传一个值 或多个
+     */
+    public void del(String... key) {
+        if (key != null && key.length > 0) {
+            if (key.length == 1) {
+                redisTemplate.delete(key[0]);
+            } else {
+                redisTemplate.delete(Arrays.asList(key));
+            }
+        }
+    }
+
+    /**
+     * 普通缓存获取
+     *
+     * @param key 键
+     * @return 值
+     */
+    public Object get(String key) {
+        return key == null ? null : redisTemplate.opsForValue().get(key);
+    }
+
+    /**
+     * 普通缓存放入
+     *
+     * @param key   键
+     * @param value 值
+     * @return true成功 false失败
+     */
+    public Boolean set(String key, Object value) {
+        try {
+            redisTemplate.opsForValue().set(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 普通缓存放入并设置时间
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
+     * @return true成功 false 失败
+     */
+    public Boolean set(String key, Object value, Long time) {
+        try {
+            if (time > 0) {
+                redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
+            } else {
+                set(key, value);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 递增
+     *
+     * @param key   键
+     * @param delta 要增加几(大于0)
+     * @return Long
+     */
+    public Long incr(String key, Long delta) {
+        if (delta < 0) {
+            throw new RuntimeException("递增因子必须大于0");
+        }
+        return redisTemplate.opsForValue().increment(key, delta);
+    }
+
+    /**
+     * 递减
+     *
+     * @param key   键
+     * @param delta 要减少几(小于0)
+     * @return Long
+     */
+    public Long decr(String key, Long delta) {
+        if (delta < 0) {
+            throw new RuntimeException("递减因子必须大于0");
+        }
+        return redisTemplate.opsForValue().increment(key, -delta);
+    }
+
+    /**
+     * HashGet
+     *
+     * @param key  键 不能为 null
+     * @param item 项 不能为 null
+     * @return 值
+     */
+    public Object hget(String key, String item) {
+        return redisTemplate.opsForHash().get(key, item);
+    }
+
+    /**
+     * 获取 hashKey对应的所有键值
+     *
+     * @param key 键
+     * @return 对应的多个键值
+     */
+    public Map<Object, Object> hmget(String key) {
+        return redisTemplate.opsForHash().entries(key);
+    }
+
+    /**
+     * HashSet
+     *
+     * @param key 键
+     * @param map 对应多个键值
+     * @return true 成功 false 失败
+     */
+    public Boolean hmset(String key, Map<String, Object> map) {
+        try {
+            redisTemplate.opsForHash().putAll(key, map);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * HashSet 并设置时间
+     *
+     * @param key  键
+     * @param map  对应多个键值
+     * @param time 时间(秒)
+     * @return true成功 false失败
+     */
+    public Boolean hmset(String key, Map<String, Object> map, Long time) {
+        try {
+            redisTemplate.opsForHash().putAll(key, map);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 向一张hash表中放入数据,如果不存在将创建
+     *
+     * @param key   键
+     * @param item  项
+     * @param value 值
+     * @return true 成功 false失败
+     */
+    public Boolean hset(String key, String item, Object value) {
+        try {
+            redisTemplate.opsForHash().put(key, item, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 向一张hash表中放入数据,如果不存在将创建
+     *
+     * @param key   键
+     * @param item  项
+     * @param value 值
+     * @param time  时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
+     * @return true 成功 false失败
+     */
+    public Boolean hset(String key, String item, Object value, Long time) {
+        try {
+            redisTemplate.opsForHash().put(key, item, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 删除hash表中的值
+     *
+     * @param key  键 不能为 null
+     * @param item 项 可以使多个不能为 null
+     */
+    public void hdel(String key, Object... item) {
+        redisTemplate.opsForHash().delete(key, item);
+    }
+
+    /**
+     * 判断hash表中是否有该项的值
+     *
+     * @param key  键 不能为 null
+     * @param item 项 不能为 null
+     * @return true 存在 false不存在
+     */
+    public Boolean hHasKey(String key, String item) {
+        return redisTemplate.opsForHash().hasKey(key, item);
+    }
+
+    /**
+     * hash递增 如果不存在,就会创建一个 并把新增后的值返回
+     *
+     * @param key  键
+     * @param item 项
+     * @param by   要增加几(大于0)
+     * @return Double
+     */
+    public Double hincr(String key, String item, Double by) {
+        return redisTemplate.opsForHash().increment(key, item, by);
+    }
+
+    /**
+     * hash递减
+     *
+     * @param key  键
+     * @param item 项
+     * @param by   要减少记(小于0)
+     * @return Double
+     */
+    public Double hdecr(String key, String item, Double by) {
+        return redisTemplate.opsForHash().increment(key, item, -by);
+    }
+
+    /**
+     * 根据 key获取 Set中的所有值
+     *
+     * @param key 键
+     * @return Set
+     */
+    public Set<Object> sGet(String key) {
+        try {
+            return redisTemplate.opsForSet().members(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 根据value从一个set中查询,是否存在
+     *
+     * @param key   键
+     * @param value 值
+     * @return true 存在 false不存在
+     */
+    public Boolean sHasKey(String key, Object value) {
+        try {
+            return redisTemplate.opsForSet().isMember(key, value);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将数据放入set缓存
+     *
+     * @param key    键
+     * @param values 值 可以是多个
+     * @return 成功个数
+     */
+    public Long sSet(String key, Object... values) {
+        try {
+            return redisTemplate.opsForSet().add(key, values);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0L;
+        }
+    }
+
+    /**
+     * 将set数据放入缓存
+     *
+     * @param key    键
+     * @param time   时间(秒)
+     * @param values 值 可以是多个
+     * @return 成功个数
+     */
+    public Long sSetAndTime(String key, Long time, Object... values) {
+        try {
+            Long count = redisTemplate.opsForSet().add(key, values);
+            if (time > 0)
+                expire(key, time);
+            return count;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0L;
+        }
+    }
+
+    /**
+     * 获取set缓存的长度
+     *
+     * @param key 键
+     * @return Long
+     */
+    public Long sGetSetSize(String key) {
+        try {
+            return redisTemplate.opsForSet().size(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0L;
+        }
+    }
+
+    /**
+     * 移除值为value的
+     *
+     * @param key    键
+     * @param values 值 可以是多个
+     * @return 移除的个数
+     */
+    public Long setRemove(String key, Object... values) {
+        try {
+            return redisTemplate.opsForSet().remove(key, values);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0L;
+        }
+    }
+
+    /**
+     * 获取list缓存的内容
+     *
+     * @param key   键
+     * @param start 开始
+     * @param end   结束 0 到 -1代表所有值
+     * @return List
+     */
+    public List<Object> lGet(String key, Long start, Long end) {
+        try {
+            return redisTemplate.opsForList().range(key, start, end);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 获取list缓存的长度
+     *
+     * @param key 键
+     * @return Long
+     */
+    public Long lGetListSize(String key) {
+        try {
+            return redisTemplate.opsForList().size(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0L;
+        }
+    }
+
+    /**
+     * 通过索引 获取list中的值
+     *
+     * @param key   键
+     * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;
+     *              index<0时,-1,表尾,-2倒数第二个元素,依次类推
+     * @return Object
+     */
+    public Object lGetIndex(String key, Long index) {
+        try {
+            return redisTemplate.opsForList().index(key, index);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @return Boolean
+     */
+    public Boolean lSet(String key, Object value) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒)
+     * @return Boolean
+     */
+    public Boolean lSet(String key, Object value, Long time) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            if (time > 0)
+                expire(key, time);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @return Boolean
+     */
+    public Boolean lSet(String key, List<Object> value) {
+        try {
+            redisTemplate.opsForList().rightPushAll(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 将list放入缓存
+     *
+     * @param key   键
+     * @param value 值
+     * @param time  时间(秒)
+     * @return Boolean
+     */
+    public Boolean lSet(String key, List<Object> value, Long time) {
+        try {
+            redisTemplate.opsForList().rightPushAll(key, value);
+            if (time > 0)
+                expire(key, time);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 根据索引修改list中的某条数据
+     *
+     * @param key   键
+     * @param index 索引
+     * @param value 值
+     * @return Boolean
+     */
+    public Boolean lUpdateIndex(String key, Long index, Object value) {
+        try {
+            redisTemplate.opsForList().set(key, index, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * 移除N个值为value
+     *
+     * @param key   键
+     * @param count 移除多少个
+     * @param value 值
+     * @return 移除的个数
+     */
+    public Long lRemove(String key, Long count, Object value) {
+        try {
+            return redisTemplate.opsForList().remove(key, count, value);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0L;
+        }
+    }
 }

+ 97 - 97
febs-common/src/main/java/cc/mrbird/febs/common/utils/DateUtil.java

@@ -1,97 +1,97 @@
-package cc.mrbird.febs.common.utils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
-import java.util.Locale;
-
-/**
- * 时间工具类
- *
- * @author MrBird
- */
-public class DateUtil {
-
-    public static final String FULL_TIME_PATTERN = "yyyyMMddHHmmss";
-
-    public static final String FULL_TIME_SPLIT_PATTERN = "yyyy-MM-dd HH:mm:ss";
-
-    public static final String CST_TIME_PATTERN = "EEE MMM dd HH:mm:ss zzz yyyy";
-
-    /**
-     * 格式化时间,格式为 yyyyMMddHHmmss
-     *
-     * @param localDateTime LocalDateTime
-     * @return 格式化后的字符串
-     */
-    public static String formatFullTime(LocalDateTime localDateTime) {
-        return formatFullTime(localDateTime, FULL_TIME_PATTERN);
-    }
-
-    /**
-     * 根据传入的格式,格式化时间
-     *
-     * @param localDateTime LocalDateTime
-     * @param format        格式
-     * @return 格式化后的字符串
-     */
-    public static String formatFullTime(LocalDateTime localDateTime, String format) {
-        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
-        return localDateTime.format(dateTimeFormatter);
-    }
-
-    /**
-     * 根据传入的格式,格式化时间
-     *
-     * @param date   Date
-     * @param format 格式
-     * @return 格式化后的字符串
-     */
-    public static String getDateFormat(Date date, String format) {
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA);
-        return simpleDateFormat.format(date);
-    }
-
-    /**
-     * 格式化 CST类型的时间字符串
-     *
-     * @param date   CST类型的时间字符串
-     * @param format 格式
-     * @return 格式化后的字符串
-     * @throws ParseException 异常
-     */
-    public static String formatCSTTime(String date, String format) throws ParseException {
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(CST_TIME_PATTERN, Locale.US);
-        Date usDate = simpleDateFormat.parse(date);
-        return getDateFormat(usDate, format);
-    }
-
-    /**
-     * 格式化 Instant
-     *
-     * @param instant Instant
-     * @param format  格式
-     * @return 格式化后的字符串
-     */
-    public static String formatInstant(Instant instant, String format) {
-        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
-        return localDateTime.format(DateTimeFormatter.ofPattern(format));
-    }
-
-    /**
-     * 判断当前时间是否在指定时间范围
-     *
-     * @param from 开始时间
-     * @param to   结束时间
-     * @return 结果
-     */
-    public static boolean between(LocalTime from, LocalTime to) {
-        LocalTime now = LocalTime.now();
-        return now.isAfter(from) && now.isBefore(to);
-    }
-}
+package cc.mrbird.febs.common.utils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * 时间工具类
+ *
+ * @author MrBird
+ */
+public class DateUtil {
+
+    public static final String FULL_TIME_PATTERN = "yyyyMMddHHmmss";
+
+    public static final String FULL_TIME_SPLIT_PATTERN = "yyyy-MM-dd HH:mm:ss";
+
+    public static final String CST_TIME_PATTERN = "EEE MMM dd HH:mm:ss zzz yyyy";
+
+    /**
+     * 格式化时间,格式为 yyyyMMddHHmmss
+     *
+     * @param localDateTime LocalDateTime
+     * @return 格式化后的字符串
+     */
+    public static String formatFullTime(LocalDateTime localDateTime) {
+        return formatFullTime(localDateTime, FULL_TIME_PATTERN);
+    }
+
+    /**
+     * 根据传入的格式,格式化时间
+     *
+     * @param localDateTime LocalDateTime
+     * @param format        格式
+     * @return 格式化后的字符串
+     */
+    public static String formatFullTime(LocalDateTime localDateTime, String format) {
+        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
+        return localDateTime.format(dateTimeFormatter);
+    }
+
+    /**
+     * 根据传入的格式,格式化时间
+     *
+     * @param date   Date
+     * @param format 格式
+     * @return 格式化后的字符串
+     */
+    public static String getDateFormat(Date date, String format) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA);
+        return simpleDateFormat.format(date);
+    }
+
+    /**
+     * 格式化 CST类型的时间字符串
+     *
+     * @param date   CST类型的时间字符串
+     * @param format 格式
+     * @return 格式化后的字符串
+     * @throws ParseException 异常
+     */
+    public static String formatCSTTime(String date, String format) throws ParseException {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(CST_TIME_PATTERN, Locale.US);
+        Date usDate = simpleDateFormat.parse(date);
+        return getDateFormat(usDate, format);
+    }
+
+    /**
+     * 格式化 Instant
+     *
+     * @param instant Instant
+     * @param format  格式
+     * @return 格式化后的字符串
+     */
+    public static String formatInstant(Instant instant, String format) {
+        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
+        return localDateTime.format(DateTimeFormatter.ofPattern(format));
+    }
+
+    /**
+     * 判断当前时间是否在指定时间范围
+     *
+     * @param from 开始时间
+     * @param to   结束时间
+     * @return 结果
+     */
+    public static boolean between(LocalTime from, LocalTime to) {
+        LocalTime now = LocalTime.now();
+        return now.isAfter(from) && now.isBefore(to);
+    }
+}

+ 277 - 277
febs-common/src/main/java/cc/mrbird/febs/common/utils/FebsUtil.java

@@ -1,277 +1,277 @@
-package cc.mrbird.febs.common.utils;
-
-import cc.mrbird.febs.common.entity.CurrentUser;
-import cc.mrbird.febs.common.entity.constant.PageConstant;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.core.io.buffer.DataBuffer;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.http.server.reactive.ServerHttpResponse;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.oauth2.provider.OAuth2Authentication;
-import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-import reactor.core.publisher.Mono;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.IntStream;
-
-/**
- * FEBS工具类
- *
- * @author MrBird
- */
-@Slf4j
-public class FebsUtil {
-
-    /**
-     * 驼峰转下划线
-     *
-     * @param value 待转换值
-     * @return 结果
-     */
-    public static String camelToUnderscore(String value) {
-        if (StringUtils.isBlank(value))
-            return value;
-        String[] arr = StringUtils.splitByCharacterTypeCamelCase(value);
-        if (arr.length == 0)
-            return value;
-        StringBuilder result = new StringBuilder();
-        IntStream.range(0, arr.length).forEach(i -> {
-            if (i != arr.length - 1)
-                result.append(arr[i]).append("_");
-            else
-                result.append(arr[i]);
-        });
-        return StringUtils.lowerCase(result.toString());
-    }
-
-    /**
-     * 下划线转驼峰
-     *
-     * @param value 待转换值
-     * @return 结果
-     */
-    public static String underscoreToCamel(String value) {
-        StringBuilder result = new StringBuilder();
-        String[] arr = value.split("_");
-        for (String s : arr) {
-            result.append((String.valueOf(s.charAt(0))).toUpperCase()).append(s.substring(1));
-        }
-        return result.toString();
-    }
-
-    /**
-     * 判断是否为 ajax请求
-     *
-     * @param request HttpServletRequest
-     * @return boolean
-     */
-    public static boolean isAjaxRequest(HttpServletRequest request) {
-        return (request.getHeader("X-Requested-With") != null
-                && "XMLHttpRequest".equals(request.getHeader("X-Requested-With")));
-    }
-
-    /**
-     * 正则校验
-     *
-     * @param regex 正则表达式字符串
-     * @param value 要匹配的字符串
-     * @return 正则校验结果
-     */
-    public static boolean match(String regex, String value) {
-        Pattern pattern = Pattern.compile(regex);
-        Matcher matcher = pattern.matcher(value);
-        return matcher.matches();
-    }
-
-    /**
-     * 设置响应
-     *
-     * @param response    HttpServletResponse
-     * @param contentType content-type
-     * @param status      http状态码
-     * @param value       响应内容
-     * @throws IOException IOException
-     */
-    public static void makeResponse(HttpServletResponse response, String contentType,
-                                    int status, Object value) throws IOException {
-        response.setContentType(contentType);
-        response.setStatus(status);
-        response.getOutputStream().write(JSONObject.toJSONString(value).getBytes());
-    }
-
-    /**
-     * 设置webflux模型响应
-     *
-     * @param response    ServerHttpResponse
-     * @param contentType content-type
-     * @param status      http状态码
-     * @param value       响应内容
-     * @return Mono<Void>
-     */
-    public static Mono<Void> makeWebFluxResponse(ServerHttpResponse response, String contentType,
-                                                 HttpStatus status, Object value) {
-        response.setStatusCode(status);
-        response.getHeaders().add(HttpHeaders.CONTENT_TYPE, contentType);
-        DataBuffer dataBuffer = response.bufferFactory().wrap(JSONObject.toJSONString(value).getBytes());
-        return response.writeWith(Mono.just(dataBuffer));
-    }
-
-    /**
-     * 封装前端分页表格所需数据
-     *
-     * @param pageInfo pageInfo
-     * @return Map<String, Object>
-     */
-    public static Map<String, Object> getDataTable(IPage<?> pageInfo) {
-        Map<String, Object> data = new HashMap<>();
-        data.put(PageConstant.ROWS, pageInfo.getRecords());
-        data.put(PageConstant.TOTAL, pageInfo.getTotal());
-        return data;
-    }
-
-    /**
-     * 获取HttpServletRequest
-     *
-     * @return HttpServletRequest
-     */
-    public static HttpServletRequest getHttpServletRequest() {
-        return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
-    }
-
-    /**
-     * 获取请求IP
-     *
-     * @return String IP
-     */
-    public static String getHttpServletRequestIpAddress() {
-        HttpServletRequest request = getHttpServletRequest();
-        String ip = request.getHeader("x-forwarded-for");
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = request.getHeader("Proxy-Client-IP");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = request.getHeader("WL-Proxy-Client-IP");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = request.getRemoteAddr();
-        }
-        return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
-    }
-
-    /**
-     * 获取请求IP
-     *
-     * @param request ServerHttpRequest
-     * @return String IP
-     */
-    public static String getServerHttpRequestIpAddress(ServerHttpRequest request) {
-        HttpHeaders headers = request.getHeaders();
-        String ip = headers.getFirst("x-forwarded-for");
-        if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {
-            if (ip.contains(",")) {
-                ip = ip.split(",")[0];
-            }
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = headers.getFirst("Proxy-Client-IP");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = headers.getFirst("WL-Proxy-Client-IP");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = headers.getFirst("HTTP_CLIENT_IP");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = headers.getFirst("HTTP_X_FORWARDED_FOR");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = headers.getFirst("X-Real-IP");
-        }
-        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
-            ip = Objects.requireNonNull(request.getRemoteAddress()).getAddress().getHostAddress();
-        }
-        return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
-    }
-
-    /**
-     * 判断是否包含中文
-     *
-     * @param value 内容
-     * @return 结果
-     */
-    public static boolean containChinese(String value) {
-        Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
-        Matcher m = p.matcher(value);
-        return m.find();
-    }
-
-    /**
-     * 获取在线用户信息
-     *
-     * @return CurrentUser 当前用户信息
-     */
-    public static CurrentUser getCurrentUser() {
-        try {
-            LinkedHashMap<String, Object> authenticationDetails = getAuthenticationDetails();
-            Object principal = authenticationDetails.get("principal");
-            ObjectMapper mapper = new ObjectMapper();
-            return mapper.readValue(mapper.writeValueAsString(principal), CurrentUser.class);
-        } catch (Exception e) {
-            log.error("获取当前用户信息失败", e);
-            return null;
-        }
-    }
-
-    /**
-     * 获取当前用户名称
-     *
-     * @return String 用户名
-     */
-    public static String getCurrentUsername() {
-        return (String) getOAuth2Authentication().getPrincipal();
-    }
-
-    /**
-     * 获取当前用户权限集
-     *
-     * @return Collection<GrantedAuthority>权限集
-     */
-    public static Collection<GrantedAuthority> getCurrentUserAuthority() {
-        return getOAuth2Authentication().getAuthorities();
-    }
-
-    /**
-     * 获取当前令牌内容
-     *
-     * @return String 令牌内容
-     */
-    public static String getCurrentTokenValue() {
-        OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) getOAuth2Authentication().getDetails();
-        return details.getTokenValue();
-    }
-
-    private static OAuth2Authentication getOAuth2Authentication() {
-        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-        return (OAuth2Authentication) authentication;
-    }
-
-    @SuppressWarnings("all")
-    private static LinkedHashMap<String, Object> getAuthenticationDetails() {
-        return (LinkedHashMap<String, Object>) getOAuth2Authentication().getUserAuthentication().getDetails();
-    }
-}
+package cc.mrbird.febs.common.utils;
+
+import cc.mrbird.febs.common.entity.CurrentUser;
+import cc.mrbird.febs.common.entity.constant.PageConstant;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.core.io.buffer.DataBuffer;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
+import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import reactor.core.publisher.Mono;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.IntStream;
+
+/**
+ * FEBS工具类
+ *
+ * @author MrBird
+ */
+@Slf4j
+public class FebsUtil {
+
+    /**
+     * 驼峰转下划线
+     *
+     * @param value 待转换值
+     * @return 结果
+     */
+    public static String camelToUnderscore(String value) {
+        if (StringUtils.isBlank(value))
+            return value;
+        String[] arr = StringUtils.splitByCharacterTypeCamelCase(value);
+        if (arr.length == 0)
+            return value;
+        StringBuilder result = new StringBuilder();
+        IntStream.range(0, arr.length).forEach(i -> {
+            if (i != arr.length - 1)
+                result.append(arr[i]).append("_");
+            else
+                result.append(arr[i]);
+        });
+        return StringUtils.lowerCase(result.toString());
+    }
+
+    /**
+     * 下划线转驼峰
+     *
+     * @param value 待转换值
+     * @return 结果
+     */
+    public static String underscoreToCamel(String value) {
+        StringBuilder result = new StringBuilder();
+        String[] arr = value.split("_");
+        for (String s : arr) {
+            result.append((String.valueOf(s.charAt(0))).toUpperCase()).append(s.substring(1));
+        }
+        return result.toString();
+    }
+
+    /**
+     * 判断是否为 ajax请求
+     *
+     * @param request HttpServletRequest
+     * @return boolean
+     */
+    public static boolean isAjaxRequest(HttpServletRequest request) {
+        return (request.getHeader("X-Requested-With") != null
+                && "XMLHttpRequest".equals(request.getHeader("X-Requested-With")));
+    }
+
+    /**
+     * 正则校验
+     *
+     * @param regex 正则表达式字符串
+     * @param value 要匹配的字符串
+     * @return 正则校验结果
+     */
+    public static boolean match(String regex, String value) {
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(value);
+        return matcher.matches();
+    }
+
+    /**
+     * 设置响应
+     *
+     * @param response    HttpServletResponse
+     * @param contentType content-type
+     * @param status      http状态码
+     * @param value       响应内容
+     * @throws IOException IOException
+     */
+    public static void makeResponse(HttpServletResponse response, String contentType,
+                                    int status, Object value) throws IOException {
+        response.setContentType(contentType);
+        response.setStatus(status);
+        response.getOutputStream().write(JSONObject.toJSONString(value).getBytes());
+    }
+
+    /**
+     * 设置webflux模型响应
+     *
+     * @param response    ServerHttpResponse
+     * @param contentType content-type
+     * @param status      http状态码
+     * @param value       响应内容
+     * @return Mono<Void>
+     */
+    public static Mono<Void> makeWebFluxResponse(ServerHttpResponse response, String contentType,
+                                                 HttpStatus status, Object value) {
+        response.setStatusCode(status);
+        response.getHeaders().add(HttpHeaders.CONTENT_TYPE, contentType);
+        DataBuffer dataBuffer = response.bufferFactory().wrap(JSONObject.toJSONString(value).getBytes());
+        return response.writeWith(Mono.just(dataBuffer));
+    }
+
+    /**
+     * 封装前端分页表格所需数据
+     *
+     * @param pageInfo pageInfo
+     * @return Map<String, Object>
+     */
+    public static Map<String, Object> getDataTable(IPage<?> pageInfo) {
+        Map<String, Object> data = new HashMap<>();
+        data.put(PageConstant.ROWS, pageInfo.getRecords());
+        data.put(PageConstant.TOTAL, pageInfo.getTotal());
+        return data;
+    }
+
+    /**
+     * 获取HttpServletRequest
+     *
+     * @return HttpServletRequest
+     */
+    public static HttpServletRequest getHttpServletRequest() {
+        return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
+    }
+
+    /**
+     * 获取请求IP
+     *
+     * @return String IP
+     */
+    public static String getHttpServletRequestIpAddress() {
+        HttpServletRequest request = getHttpServletRequest();
+        String ip = request.getHeader("x-forwarded-for");
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+        return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
+    }
+
+    /**
+     * 获取请求IP
+     *
+     * @param request ServerHttpRequest
+     * @return String IP
+     */
+    public static String getServerHttpRequestIpAddress(ServerHttpRequest request) {
+        HttpHeaders headers = request.getHeaders();
+        String ip = headers.getFirst("x-forwarded-for");
+        if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {
+            if (ip.contains(",")) {
+                ip = ip.split(",")[0];
+            }
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = headers.getFirst("Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = headers.getFirst("WL-Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = headers.getFirst("HTTP_CLIENT_IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = headers.getFirst("HTTP_X_FORWARDED_FOR");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = headers.getFirst("X-Real-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = Objects.requireNonNull(request.getRemoteAddress()).getAddress().getHostAddress();
+        }
+        return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
+    }
+
+    /**
+     * 判断是否包含中文
+     *
+     * @param value 内容
+     * @return 结果
+     */
+    public static boolean containChinese(String value) {
+        Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
+        Matcher m = p.matcher(value);
+        return m.find();
+    }
+
+    /**
+     * 获取在线用户信息
+     *
+     * @return CurrentUser 当前用户信息
+     */
+    public static CurrentUser getCurrentUser() {
+        try {
+            LinkedHashMap<String, Object> authenticationDetails = getAuthenticationDetails();
+            Object principal = authenticationDetails.get("principal");
+            ObjectMapper mapper = new ObjectMapper();
+            return mapper.readValue(mapper.writeValueAsString(principal), CurrentUser.class);
+        } catch (Exception e) {
+            log.error("获取当前用户信息失败", e);
+            return null;
+        }
+    }
+
+    /**
+     * 获取当前用户名称
+     *
+     * @return String 用户名
+     */
+    public static String getCurrentUsername() {
+        return (String) getOAuth2Authentication().getPrincipal();
+    }
+
+    /**
+     * 获取当前用户权限集
+     *
+     * @return Collection<GrantedAuthority>权限集
+     */
+    public static Collection<GrantedAuthority> getCurrentUserAuthority() {
+        return getOAuth2Authentication().getAuthorities();
+    }
+
+    /**
+     * 获取当前令牌内容
+     *
+     * @return String 令牌内容
+     */
+    public static String getCurrentTokenValue() {
+        OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) getOAuth2Authentication().getDetails();
+        return details.getTokenValue();
+    }
+
+    private static OAuth2Authentication getOAuth2Authentication() {
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+        return (OAuth2Authentication) authentication;
+    }
+
+    @SuppressWarnings("all")
+    private static LinkedHashMap<String, Object> getAuthenticationDetails() {
+        return (LinkedHashMap<String, Object>) getOAuth2Authentication().getUserAuthentication().getDetails();
+    }
+}

+ 125 - 125
febs-common/src/main/java/cc/mrbird/febs/common/utils/SortUtil.java

@@ -1,125 +1,125 @@
-package cc.mrbird.febs.common.utils;
-
-import cc.mrbird.febs.common.entity.constant.FebsConstant;
-import cc.mrbird.febs.common.entity.QueryRequest;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.OrderItem;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * 处理排序工具类
- * 
- * @author MrBird
- */
-public class SortUtil {
-    /**
-     * 处理排序(分页情况下) for mybatis-plus
-     *
-     * @param request           QueryRequest
-     * @param page              Page
-     * @param defaultSort       默认排序的字段
-     * @param defaultOrder      默认排序规则
-     * @param camelToUnderscore 是否开启驼峰转下划线
-     */
-    public static void handlePageSort(QueryRequest request, Page<?> page, String defaultSort, String defaultOrder, boolean camelToUnderscore) {
-        page.setCurrent(request.getPageNum());
-        page.setSize(request.getPageSize());
-        String sortField = request.getField();
-        if (camelToUnderscore) {
-            sortField = FebsUtil.camelToUnderscore(sortField);
-            defaultSort = FebsUtil.camelToUnderscore(defaultSort);
-        }
-        if (StringUtils.isNotBlank(request.getField())
-                && StringUtils.isNotBlank(request.getOrder())
-                && !StringUtils.equalsIgnoreCase(request.getField(), "null")
-                && !StringUtils.equalsIgnoreCase(request.getOrder(), "null")) {
-            if (StringUtils.equals(request.getOrder(), FebsConstant.ORDER_DESC))
-                page.addOrder(OrderItem.desc(sortField));
-            else
-                page.addOrder(OrderItem.asc(sortField));
-        } else {
-            if (StringUtils.isNotBlank(defaultSort)) {
-                if (StringUtils.equals(defaultOrder, FebsConstant.ORDER_DESC))
-                    page.addOrder(OrderItem.desc(defaultSort));
-                else
-                    page.addOrder(OrderItem.asc(defaultSort));
-            }
-        }
-    }
-
-    /**
-     * 处理排序 for mybatis-plus
-     *
-     * @param request QueryRequest
-     * @param page    Page
-     */
-    public static void handlePageSort(QueryRequest request, Page<?> page) {
-        handlePageSort(request, page, null, null, false);
-    }
-
-    /**
-     * 处理排序 for mybatis-plus
-     *
-     * @param request           QueryRequest
-     * @param page              Page
-     * @param camelToUnderscore 是否开启驼峰转下划线
-     */
-    public static void handlePageSort(QueryRequest request, Page<?> page, boolean camelToUnderscore) {
-        handlePageSort(request, page, null, null, camelToUnderscore);
-    }
-
-    /**
-     * 处理排序 for mybatis-plus
-     *
-     * @param request           QueryRequest
-     * @param wrapper           wrapper
-     * @param defaultSort       默认排序的字段
-     * @param defaultOrder      默认排序规则
-     * @param camelToUnderscore 是否开启驼峰转下划线
-     */
-    public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper, String defaultSort, String defaultOrder, boolean camelToUnderscore) {
-        String sortField = request.getField();
-        if (camelToUnderscore) {
-            sortField = FebsUtil.camelToUnderscore(sortField);
-            defaultSort = FebsUtil.camelToUnderscore(defaultSort);
-        }
-        if (StringUtils.isNotBlank(request.getField())
-                && StringUtils.isNotBlank(request.getOrder())
-                && !StringUtils.equalsIgnoreCase(request.getField(), "null")
-                && !StringUtils.equalsIgnoreCase(request.getOrder(), "null")) {
-            if (StringUtils.equals(request.getOrder(), FebsConstant.ORDER_DESC))
-                wrapper.orderByDesc(sortField);
-            else
-                wrapper.orderByAsc(sortField);
-        } else {
-            if (StringUtils.isNotBlank(defaultSort)) {
-                if (StringUtils.equals(defaultOrder, FebsConstant.ORDER_DESC))
-                    wrapper.orderByDesc(defaultSort);
-                else
-                    wrapper.orderByAsc(defaultSort);
-            }
-        }
-    }
-
-    /**
-     * 处理排序 for mybatis-plus
-     *
-     * @param request QueryRequest
-     * @param wrapper wrapper
-     */
-    public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper) {
-        handleWrapperSort(request, wrapper, null, null, false);
-    }
-
-    /**
-     * 处理排序 for mybatis-plus
-     *
-     * @param request           QueryRequest
-     * @param wrapper           wrapper
-     * @param camelToUnderscore 是否开启驼峰转下划线
-     */
-    public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper, boolean camelToUnderscore) {
-        handleWrapperSort(request, wrapper, null, null, camelToUnderscore);
-    }
-}
+package cc.mrbird.febs.common.utils;
+
+import cc.mrbird.febs.common.entity.constant.FebsConstant;
+import cc.mrbird.febs.common.entity.QueryRequest;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 处理排序工具类
+ * 
+ * @author MrBird
+ */
+public class SortUtil {
+    /**
+     * 处理排序(分页情况下) for mybatis-plus
+     *
+     * @param request           QueryRequest
+     * @param page              Page
+     * @param defaultSort       默认排序的字段
+     * @param defaultOrder      默认排序规则
+     * @param camelToUnderscore 是否开启驼峰转下划线
+     */
+    public static void handlePageSort(QueryRequest request, Page<?> page, String defaultSort, String defaultOrder, boolean camelToUnderscore) {
+        page.setCurrent(request.getPageNum());
+        page.setSize(request.getPageSize());
+        String sortField = request.getField();
+        if (camelToUnderscore) {
+            sortField = FebsUtil.camelToUnderscore(sortField);
+            defaultSort = FebsUtil.camelToUnderscore(defaultSort);
+        }
+        if (StringUtils.isNotBlank(request.getField())
+                && StringUtils.isNotBlank(request.getOrder())
+                && !StringUtils.equalsIgnoreCase(request.getField(), "null")
+                && !StringUtils.equalsIgnoreCase(request.getOrder(), "null")) {
+            if (StringUtils.equals(request.getOrder(), FebsConstant.ORDER_DESC))
+                page.addOrder(OrderItem.desc(sortField));
+            else
+                page.addOrder(OrderItem.asc(sortField));
+        } else {
+            if (StringUtils.isNotBlank(defaultSort)) {
+                if (StringUtils.equals(defaultOrder, FebsConstant.ORDER_DESC))
+                    page.addOrder(OrderItem.desc(defaultSort));
+                else
+                    page.addOrder(OrderItem.asc(defaultSort));
+            }
+        }
+    }
+
+    /**
+     * 处理排序 for mybatis-plus
+     *
+     * @param request QueryRequest
+     * @param page    Page
+     */
+    public static void handlePageSort(QueryRequest request, Page<?> page) {
+        handlePageSort(request, page, null, null, false);
+    }
+
+    /**
+     * 处理排序 for mybatis-plus
+     *
+     * @param request           QueryRequest
+     * @param page              Page
+     * @param camelToUnderscore 是否开启驼峰转下划线
+     */
+    public static void handlePageSort(QueryRequest request, Page<?> page, boolean camelToUnderscore) {
+        handlePageSort(request, page, null, null, camelToUnderscore);
+    }
+
+    /**
+     * 处理排序 for mybatis-plus
+     *
+     * @param request           QueryRequest
+     * @param wrapper           wrapper
+     * @param defaultSort       默认排序的字段
+     * @param defaultOrder      默认排序规则
+     * @param camelToUnderscore 是否开启驼峰转下划线
+     */
+    public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper, String defaultSort, String defaultOrder, boolean camelToUnderscore) {
+        String sortField = request.getField();
+        if (camelToUnderscore) {
+            sortField = FebsUtil.camelToUnderscore(sortField);
+            defaultSort = FebsUtil.camelToUnderscore(defaultSort);
+        }
+        if (StringUtils.isNotBlank(request.getField())
+                && StringUtils.isNotBlank(request.getOrder())
+                && !StringUtils.equalsIgnoreCase(request.getField(), "null")
+                && !StringUtils.equalsIgnoreCase(request.getOrder(), "null")) {
+            if (StringUtils.equals(request.getOrder(), FebsConstant.ORDER_DESC))
+                wrapper.orderByDesc(sortField);
+            else
+                wrapper.orderByAsc(sortField);
+        } else {
+            if (StringUtils.isNotBlank(defaultSort)) {
+                if (StringUtils.equals(defaultOrder, FebsConstant.ORDER_DESC))
+                    wrapper.orderByDesc(defaultSort);
+                else
+                    wrapper.orderByAsc(defaultSort);
+            }
+        }
+    }
+
+    /**
+     * 处理排序 for mybatis-plus
+     *
+     * @param request QueryRequest
+     * @param wrapper wrapper
+     */
+    public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper) {
+        handleWrapperSort(request, wrapper, null, null, false);
+    }
+
+    /**
+     * 处理排序 for mybatis-plus
+     *
+     * @param request           QueryRequest
+     * @param wrapper           wrapper
+     * @param camelToUnderscore 是否开启驼峰转下划线
+     */
+    public static void handleWrapperSort(QueryRequest request, QueryWrapper<?> wrapper, boolean camelToUnderscore) {
+        handleWrapperSort(request, wrapper, null, null, camelToUnderscore);
+    }
+}

+ 43 - 43
febs-common/src/main/java/cc/mrbird/febs/common/utils/SpringContextUtil.java

@@ -1,44 +1,44 @@
-package cc.mrbird.febs.common.utils;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * 用于从 IOC容器中获取 Bean
- * 
- * @author MrBird
- *
- */
-public class SpringContextUtil implements ApplicationContextAware {
-	private static ApplicationContext applicationContext;
-
-	@Override
-	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-		SpringContextUtil.applicationContext = applicationContext;
-	}
-
-	public static Object getBean(String name) {
-		return applicationContext.getBean(name);
-	}
-	public static <T> T getBean(Class<T> clazz){
-		return applicationContext.getBean(clazz);
-	}
-
-	public static <T> T getBean(String name, Class<T> requiredType) {
-		return applicationContext.getBean(name, requiredType);
-	}
-
-	public static boolean containsBean(String name) {
-		return applicationContext.containsBean(name);
-	}
-
-	public static boolean isSingleton(String name) {
-		return applicationContext.isSingleton(name);
-	}
-
-	public static Class<?> getType(String name) {
-		return applicationContext.getType(name);
-	}
-
+package cc.mrbird.febs.common.utils;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * 用于从 IOC容器中获取 Bean
+ * 
+ * @author MrBird
+ *
+ */
+public class SpringContextUtil implements ApplicationContextAware {
+	private static ApplicationContext applicationContext;
+
+	@Override
+	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+		SpringContextUtil.applicationContext = applicationContext;
+	}
+
+	public static Object getBean(String name) {
+		return applicationContext.getBean(name);
+	}
+	public static <T> T getBean(Class<T> clazz){
+		return applicationContext.getBean(clazz);
+	}
+
+	public static <T> T getBean(String name, Class<T> requiredType) {
+		return applicationContext.getBean(name, requiredType);
+	}
+
+	public static boolean containsBean(String name) {
+		return applicationContext.containsBean(name);
+	}
+
+	public static boolean isSingleton(String name) {
+		return applicationContext.isSingleton(name);
+	}
+
+	public static Class<?> getType(String name) {
+		return applicationContext.getType(name);
+	}
+
 }

+ 92 - 92
febs-common/src/main/java/cc/mrbird/febs/common/utils/TreeUtil.java

@@ -1,93 +1,93 @@
-package cc.mrbird.febs.common.utils;
-
-import cc.mrbird.febs.common.entity.Tree;
-import cc.mrbird.febs.common.entity.router.VueRouter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author MrBird
- */
-public class TreeUtil {
-
-    private final static String TOP_NODE_ID = "0";
-
-    /**
-     * 用于构建菜单或部门树
-     *
-     * @param nodes nodes
-     * @return <T> List<? extends Tree>
-     */
-    public static <T> List<? extends Tree<?>> build(List<? extends Tree<T>> nodes) {
-        if (nodes == null) {
-            return null;
-        }
-        List<Tree<T>> topNodes = new ArrayList<>();
-        nodes.forEach(node -> {
-            String pid = node.getParentId();
-            if (pid == null || TOP_NODE_ID.equals(pid)) {
-                topNodes.add(node);
-                return;
-            }
-            for (Tree<T> n : nodes) {
-                String id = n.getId();
-                if (id != null && id.equals(pid)) {
-                    if (n.getChildren() == null)
-                        n.initChildren();
-                    n.getChildren().add(node);
-                    node.setHasParent(true);
-                    n.setHasChildren(true);
-                    n.setHasParent(true);
-                    return;
-                }
-            }
-            if (topNodes.isEmpty())
-                topNodes.add(node);
-        });
-        return topNodes;
-    }
-
-
-    /**
-     * 构造前端路由
-     *
-     * @param routes routes
-     * @param <T>    T
-     * @return ArrayList<VueRouter < T>>
-     */
-    public static <T> List<VueRouter<T>> buildVueRouter(List<VueRouter<T>> routes) {
-        if (routes == null) {
-            return null;
-        }
-        List<VueRouter<T>> topRoutes = new ArrayList<>();
-        VueRouter<T> router = new VueRouter<>();
-        routes.forEach(route -> {
-            String parentId = route.getParentId();
-            if (parentId == null || TOP_NODE_ID.equals(parentId)) {
-                topRoutes.add(route);
-                return;
-            }
-            for (VueRouter<T> parent : routes) {
-                String id = parent.getId();
-                if (id != null && id.equals(parentId)) {
-                    if (parent.getChildren() == null)
-                        parent.initChildren();
-                    parent.getChildren().add(route);
-                    parent.setAlwaysShow(true);
-                    parent.setHasChildren(true);
-                    route.setHasParent(true);
-                    parent.setHasParent(true);
-                    return;
-                }
-            }
-        });
-        VueRouter<T> router404 = new VueRouter<>();
-        router404.setName("404");
-        router404.setComponent("error-page/404");
-        router404.setPath("*");
-
-        topRoutes.add(router404);
-        return topRoutes;
-    }
+package cc.mrbird.febs.common.utils;
+
+import cc.mrbird.febs.common.entity.Tree;
+import cc.mrbird.febs.common.entity.router.VueRouter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+public class TreeUtil {
+
+    private final static String TOP_NODE_ID = "0";
+
+    /**
+     * 用于构建菜单或部门树
+     *
+     * @param nodes nodes
+     * @return <T> List<? extends Tree>
+     */
+    public static <T> List<? extends Tree<?>> build(List<? extends Tree<T>> nodes) {
+        if (nodes == null) {
+            return null;
+        }
+        List<Tree<T>> topNodes = new ArrayList<>();
+        nodes.forEach(node -> {
+            String pid = node.getParentId();
+            if (pid == null || TOP_NODE_ID.equals(pid)) {
+                topNodes.add(node);
+                return;
+            }
+            for (Tree<T> n : nodes) {
+                String id = n.getId();
+                if (id != null && id.equals(pid)) {
+                    if (n.getChildren() == null)
+                        n.initChildren();
+                    n.getChildren().add(node);
+                    node.setHasParent(true);
+                    n.setHasChildren(true);
+                    n.setHasParent(true);
+                    return;
+                }
+            }
+            if (topNodes.isEmpty())
+                topNodes.add(node);
+        });
+        return topNodes;
+    }
+
+
+    /**
+     * 构造前端路由
+     *
+     * @param routes routes
+     * @param <T>    T
+     * @return ArrayList<VueRouter < T>>
+     */
+    public static <T> List<VueRouter<T>> buildVueRouter(List<VueRouter<T>> routes) {
+        if (routes == null) {
+            return null;
+        }
+        List<VueRouter<T>> topRoutes = new ArrayList<>();
+        VueRouter<T> router = new VueRouter<>();
+        routes.forEach(route -> {
+            String parentId = route.getParentId();
+            if (parentId == null || TOP_NODE_ID.equals(parentId)) {
+                topRoutes.add(route);
+                return;
+            }
+            for (VueRouter<T> parent : routes) {
+                String id = parent.getId();
+                if (id != null && id.equals(parentId)) {
+                    if (parent.getChildren() == null)
+                        parent.initChildren();
+                    parent.getChildren().add(route);
+                    parent.setAlwaysShow(true);
+                    parent.setHasChildren(true);
+                    route.setHasParent(true);
+                    parent.setHasParent(true);
+                    return;
+                }
+            }
+        });
+        VueRouter<T> router404 = new VueRouter<>();
+        router404.setName("404");
+        router404.setComponent("error-page/404");
+        router404.setPath("*");
+
+        topRoutes.add(router404);
+        return topRoutes;
+    }
 }

+ 6 - 6
febs-gateway/Dockerfile

@@ -1,7 +1,7 @@
-FROM openjdk:8u212-jre
-MAINTAINER MrBird 852252810@qq.com
-
-COPY ./target/febs-gateway-1.4-RELEASE.jar /febs/febs-gateway-1.4-RELEASE.jar
-ADD agent/ /agent
-
+FROM openjdk:8u212-jre
+MAINTAINER MrBird 852252810@qq.com
+
+COPY ./target/febs-gateway-1.4-RELEASE.jar /febs/febs-gateway-1.4-RELEASE.jar
+ADD agent/ /agent
+
 ENTRYPOINT ["java", "-javaagent:/agent/skywalking-agent.jar", "-Dskywalking.agent.service_name=febs-gateway", "-Dskywalking.collector.backend_service=${skywalking.url}:11800", "-jar", "/febs/febs-gateway-1.4-RELEASE.jar"]

+ 90 - 90
febs-gateway/pom.xml

@@ -1,90 +1,90 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>cc.mrbird</groupId>
-        <artifactId>febs-cloud</artifactId>
-        <version>1.6-RELEASE</version>
-        <relativePath>../febs-cloud/pom.xml</relativePath>
-    </parent>
-    <artifactId>febs-gateway</artifactId>
-    <version>1.6-RELEASE</version>
-    <name>FEBS-Gateway</name>
-    <description>FEBS-Gateway服务网关模块</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>cc.mrbird</groupId>
-            <artifactId>febs-common</artifactId>
-            <version>1.6-RELEASE</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-web</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.baomidou</groupId>
-                    <artifactId>mybatis-plus-boot-starter</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.springframework.cloud</groupId>
-                    <artifactId>spring-cloud-starter-oauth2</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.springframework.cloud</groupId>
-                    <artifactId>spring-cloud-starter-security</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>net.logstash.logback</groupId>
-            <artifactId>logstash-logback-encoder</artifactId>
-            <version>6.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-gateway</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-
-        <!-- 网关增强依赖 -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-pool2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-webflux</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.jsonwebtoken</groupId>
-            <artifactId>jjwt</artifactId>
-            <version>0.9.1</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>cc.mrbird</groupId>
+        <artifactId>febs-cloud</artifactId>
+        <version>1.6-RELEASE</version>
+        <relativePath>../febs-cloud/pom.xml</relativePath>
+    </parent>
+    <artifactId>febs-gateway</artifactId>
+    <version>1.6-RELEASE</version>
+    <name>FEBS-Gateway</name>
+    <description>FEBS-Gateway服务网关模块</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>cc.mrbird</groupId>
+            <artifactId>febs-common</artifactId>
+            <version>1.6-RELEASE</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-web</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.baomidou</groupId>
+                    <artifactId>mybatis-plus-boot-starter</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework.cloud</groupId>
+                    <artifactId>spring-cloud-starter-oauth2</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework.cloud</groupId>
+                    <artifactId>spring-cloud-starter-security</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+            <version>6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-gateway</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+        <!-- 网关增强依赖 -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 57 - 57
febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/configure/FebsGatewayErrorConfigure.java

@@ -1,57 +1,57 @@
-package cc.mrbird.febs.gateway.common.configure;
-
-import cc.mrbird.febs.gateway.common.handler.FebsGatewayExceptionHandler;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.boot.autoconfigure.web.ResourceProperties;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.web.reactive.error.ErrorAttributes;
-import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.http.codec.ServerCodecConfigurer;
-import org.springframework.web.reactive.result.view.ViewResolver;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author MrBird
- */
-@Configuration
-public class FebsGatewayErrorConfigure {
-
-    private final ServerProperties serverProperties;
-    private final ApplicationContext applicationContext;
-    private final ResourceProperties resourceProperties;
-    private final List<ViewResolver> viewResolvers;
-    private final ServerCodecConfigurer serverCodecConfigurer;
-
-    public FebsGatewayErrorConfigure(ServerProperties serverProperties,
-                                     ResourceProperties resourceProperties,
-                                     ObjectProvider<List<ViewResolver>> viewResolversProvider,
-                                     ServerCodecConfigurer serverCodecConfigurer,
-                                     ApplicationContext applicationContext) {
-        this.serverProperties = serverProperties;
-        this.applicationContext = applicationContext;
-        this.resourceProperties = resourceProperties;
-        this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
-        this.serverCodecConfigurer = serverCodecConfigurer;
-    }
-
-    @Bean
-    @Order(Ordered.HIGHEST_PRECEDENCE)
-    public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
-        FebsGatewayExceptionHandler exceptionHandler = new FebsGatewayExceptionHandler(
-                errorAttributes,
-                this.resourceProperties,
-                this.serverProperties.getError(),
-                this.applicationContext);
-        exceptionHandler.setViewResolvers(this.viewResolvers);
-        exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
-        exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
-        return exceptionHandler;
-    }
-}
+package cc.mrbird.febs.gateway.common.configure;
+
+import cc.mrbird.febs.gateway.common.handler.FebsGatewayExceptionHandler;
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.web.ResourceProperties;
+import org.springframework.boot.autoconfigure.web.ServerProperties;
+import org.springframework.boot.web.reactive.error.ErrorAttributes;
+import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.codec.ServerCodecConfigurer;
+import org.springframework.web.reactive.result.view.ViewResolver;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author MrBird
+ */
+@Configuration
+public class FebsGatewayErrorConfigure {
+
+    private final ServerProperties serverProperties;
+    private final ApplicationContext applicationContext;
+    private final ResourceProperties resourceProperties;
+    private final List<ViewResolver> viewResolvers;
+    private final ServerCodecConfigurer serverCodecConfigurer;
+
+    public FebsGatewayErrorConfigure(ServerProperties serverProperties,
+                                     ResourceProperties resourceProperties,
+                                     ObjectProvider<List<ViewResolver>> viewResolversProvider,
+                                     ServerCodecConfigurer serverCodecConfigurer,
+                                     ApplicationContext applicationContext) {
+        this.serverProperties = serverProperties;
+        this.applicationContext = applicationContext;
+        this.resourceProperties = resourceProperties;
+        this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
+        this.serverCodecConfigurer = serverCodecConfigurer;
+    }
+
+    @Bean
+    @Order(Ordered.HIGHEST_PRECEDENCE)
+    public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) {
+        FebsGatewayExceptionHandler exceptionHandler = new FebsGatewayExceptionHandler(
+                errorAttributes,
+                this.resourceProperties,
+                this.serverProperties.getError(),
+                this.applicationContext);
+        exceptionHandler.setViewResolvers(this.viewResolvers);
+        exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
+        exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
+        return exceptionHandler;
+    }
+}

+ 24 - 24
febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/controller/FallbackController.java

@@ -1,24 +1,24 @@
-package cc.mrbird.febs.gateway.common.controller;
-
-import cc.mrbird.febs.common.entity.FebsResponse;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
-import reactor.core.publisher.Mono;
-
-/**
- * @author MrBird
- */
-@RestController
-public class FallbackController{
-
-    @RequestMapping("fallback/{name}")
-    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
-    public Mono<FebsResponse> systemFallback(@PathVariable String name) {
-        String response = String.format("访问%s超时或者服务不可用", name);
-        return Mono.just(new FebsResponse().message(response));
-    }
-
-}
+package cc.mrbird.febs.gateway.common.controller;
+
+import cc.mrbird.febs.common.entity.FebsResponse;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
+import reactor.core.publisher.Mono;
+
+/**
+ * @author MrBird
+ */
+@RestController
+public class FallbackController{
+
+    @RequestMapping("fallback/{name}")
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    public Mono<FebsResponse> systemFallback(@PathVariable String name) {
+        String response = String.format("访问%s超时或者服务不可用", name);
+        return Mono.just(new FebsResponse().message(response));
+    }
+
+}

+ 59 - 59
febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/filter/FebsGatewayRequestFilter.java

@@ -1,59 +1,59 @@
-package cc.mrbird.febs.gateway.common.filter;
-
-import cc.mrbird.febs.common.entity.constant.FebsConstant;
-import cc.mrbird.febs.gateway.common.properties.FebsGatewayProperties;
-import cc.mrbird.febs.gateway.enhance.service.RouteEnhanceService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cloud.gateway.filter.GatewayFilterChain;
-import org.springframework.cloud.gateway.filter.GlobalFilter;
-import org.springframework.core.annotation.Order;
-import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.stereotype.Component;
-import org.springframework.util.AntPathMatcher;
-import org.springframework.util.Base64Utils;
-import org.springframework.web.server.ServerWebExchange;
-import reactor.core.publisher.Mono;
-
-/**
- * @author MrBird
- */
-@Slf4j
-@Component
-@Order(0)
-public class FebsGatewayRequestFilter implements GlobalFilter {
-
-    @Autowired
-    private FebsGatewayProperties properties;
-    @Autowired
-    private RouteEnhanceService routeEnhanceService;
-
-    @Value("${febs.gateway.enhance:false}")
-    private Boolean routeEhance;
-
-    private AntPathMatcher pathMatcher = new AntPathMatcher();
-
-    @Override
-    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
-        if (routeEhance) {
-            Mono<Void> balckListResult = routeEnhanceService.filterBalckList(exchange);
-            if (balckListResult != null) {
-                routeEnhanceService.saveBlockLogs(exchange);
-                return balckListResult;
-            }
-            Mono<Void> rateLimitResult = routeEnhanceService.filterRateLimit(exchange);
-            if (rateLimitResult != null) {
-                routeEnhanceService.saveRateLimitLogs(exchange);
-                return rateLimitResult;
-            }
-            routeEnhanceService.saveRequestLogs(exchange);
-        }
-
-        byte[] token = Base64Utils.encode((FebsConstant.GATEWAY_TOKEN_VALUE).getBytes());
-        String[] headerValues = {new String(token)};
-        ServerHttpRequest build = exchange.getRequest().mutate().header(FebsConstant.GATEWAY_TOKEN_HEADER, headerValues).build();
-        ServerWebExchange newExchange = exchange.mutate().request(build).build();
-        return chain.filter(newExchange);
-    }
-}
+package cc.mrbird.febs.gateway.common.filter;
+
+import cc.mrbird.febs.common.entity.constant.FebsConstant;
+import cc.mrbird.febs.gateway.common.properties.FebsGatewayProperties;
+import cc.mrbird.febs.gateway.enhance.service.RouteEnhanceService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.gateway.filter.GatewayFilterChain;
+import org.springframework.cloud.gateway.filter.GlobalFilter;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.stereotype.Component;
+import org.springframework.util.AntPathMatcher;
+import org.springframework.util.Base64Utils;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+/**
+ * @author MrBird
+ */
+@Slf4j
+@Component
+@Order(0)
+public class FebsGatewayRequestFilter implements GlobalFilter {
+
+    @Autowired
+    private FebsGatewayProperties properties;
+    @Autowired
+    private RouteEnhanceService routeEnhanceService;
+
+    @Value("${febs.gateway.enhance:false}")
+    private Boolean routeEhance;
+
+    private AntPathMatcher pathMatcher = new AntPathMatcher();
+
+    @Override
+    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
+        if (routeEhance) {
+            Mono<Void> balckListResult = routeEnhanceService.filterBalckList(exchange);
+            if (balckListResult != null) {
+                routeEnhanceService.saveBlockLogs(exchange);
+                return balckListResult;
+            }
+            Mono<Void> rateLimitResult = routeEnhanceService.filterRateLimit(exchange);
+            if (rateLimitResult != null) {
+                routeEnhanceService.saveRateLimitLogs(exchange);
+                return rateLimitResult;
+            }
+            routeEnhanceService.saveRequestLogs(exchange);
+        }
+
+        byte[] token = Base64Utils.encode((FebsConstant.GATEWAY_TOKEN_VALUE).getBytes());
+        String[] headerValues = {new String(token)};
+        ServerHttpRequest build = exchange.getRequest().mutate().header(FebsConstant.GATEWAY_TOKEN_HEADER, headerValues).build();
+        ServerWebExchange newExchange = exchange.mutate().request(build).build();
+        return chain.filter(newExchange);
+    }
+}

+ 70 - 70
febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/handler/FebsGatewayExceptionHandler.java

@@ -1,70 +1,70 @@
-package cc.mrbird.febs.gateway.common.handler;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.boot.autoconfigure.web.ErrorProperties;
-import org.springframework.boot.autoconfigure.web.ResourceProperties;
-import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
-import org.springframework.boot.web.reactive.error.ErrorAttributes;
-import org.springframework.cloud.gateway.support.NotFoundException;
-import org.springframework.cloud.gateway.support.TimeoutException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.reactive.function.server.*;
-import org.springframework.web.server.ResponseStatusException;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author MrBird
- */
-@Slf4j
-public class FebsGatewayExceptionHandler extends DefaultErrorWebExceptionHandler {
-
-    public FebsGatewayExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
-                                       ErrorProperties errorProperties, ApplicationContext applicationContext) {
-        super(errorAttributes, resourceProperties, errorProperties, applicationContext);
-    }
-
-    /**
-     * 异常处理,定义返回报文格式
-     */
-    @Override
-    protected Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
-        Throwable error = super.getError(request);
-        log.error(
-                "请求发生异常,请求URI:{},请求方法:{},异常信息:{}",
-                request.path(), request.methodName(), error.getMessage()
-        );
-        String errorMessage;
-        if (error instanceof NotFoundException) {
-            String serverId = StringUtils.substringAfterLast(error.getMessage(), "Unable to find instance for ");
-            serverId = StringUtils.replace(serverId, "\"", StringUtils.EMPTY);
-            errorMessage = String.format("无法找到%s服务", serverId);
-        } else if (StringUtils.containsIgnoreCase(error.getMessage(), "connection refused")) {
-            errorMessage = "目标服务拒绝连接";
-        } else if (error instanceof TimeoutException) {
-            errorMessage = "访问服务超时";
-        } else if (error instanceof ResponseStatusException
-                && StringUtils.containsIgnoreCase(error.getMessage(), HttpStatus.NOT_FOUND.toString())) {
-            errorMessage = "未找到该资源";
-        } else {
-            errorMessage = "网关转发异常";
-        }
-        Map<String, Object> errorAttributes = new HashMap<>(3);
-        errorAttributes.put("message", errorMessage);
-        return errorAttributes;
-    }
-
-    @Override
-    @SuppressWarnings("all")
-    protected RouterFunction<ServerResponse> getRoutingFunction(ErrorAttributes errorAttributes) {
-        return RouterFunctions.route(RequestPredicates.all(), this::renderErrorResponse);
-    }
-
-    @Override
-    protected int getHttpStatus(Map<String, Object> errorAttributes) {
-        return HttpStatus.INTERNAL_SERVER_ERROR.value();
-    }
-}
+package cc.mrbird.febs.gateway.common.handler;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.boot.autoconfigure.web.ErrorProperties;
+import org.springframework.boot.autoconfigure.web.ResourceProperties;
+import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
+import org.springframework.boot.web.reactive.error.ErrorAttributes;
+import org.springframework.cloud.gateway.support.NotFoundException;
+import org.springframework.cloud.gateway.support.TimeoutException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.reactive.function.server.*;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author MrBird
+ */
+@Slf4j
+public class FebsGatewayExceptionHandler extends DefaultErrorWebExceptionHandler {
+
+    public FebsGatewayExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
+                                       ErrorProperties errorProperties, ApplicationContext applicationContext) {
+        super(errorAttributes, resourceProperties, errorProperties, applicationContext);
+    }
+
+    /**
+     * 异常处理,定义返回报文格式
+     */
+    @Override
+    protected Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
+        Throwable error = super.getError(request);
+        log.error(
+                "请求发生异常,请求URI:{},请求方法:{},异常信息:{}",
+                request.path(), request.methodName(), error.getMessage()
+        );
+        String errorMessage;
+        if (error instanceof NotFoundException) {
+            String serverId = StringUtils.substringAfterLast(error.getMessage(), "Unable to find instance for ");
+            serverId = StringUtils.replace(serverId, "\"", StringUtils.EMPTY);
+            errorMessage = String.format("无法找到%s服务", serverId);
+        } else if (StringUtils.containsIgnoreCase(error.getMessage(), "connection refused")) {
+            errorMessage = "目标服务拒绝连接";
+        } else if (error instanceof TimeoutException) {
+            errorMessage = "访问服务超时";
+        } else if (error instanceof ResponseStatusException
+                && StringUtils.containsIgnoreCase(error.getMessage(), HttpStatus.NOT_FOUND.toString())) {
+            errorMessage = "未找到该资源";
+        } else {
+            errorMessage = "网关转发异常";
+        }
+        Map<String, Object> errorAttributes = new HashMap<>(3);
+        errorAttributes.put("message", errorMessage);
+        return errorAttributes;
+    }
+
+    @Override
+    @SuppressWarnings("all")
+    protected RouterFunction<ServerResponse> getRoutingFunction(ErrorAttributes errorAttributes) {
+        return RouterFunctions.route(RequestPredicates.all(), this::renderErrorResponse);
+    }
+
+    @Override
+    protected int getHttpStatus(Map<String, Object> errorAttributes) {
+        return HttpStatus.INTERNAL_SERVER_ERROR.value();
+    }
+}

+ 20 - 20
febs-gateway/src/main/java/cc/mrbird/febs/gateway/common/properties/FebsGatewayProperties.java

@@ -1,20 +1,20 @@
-package cc.mrbird.febs.gateway.common.properties;
-
-import lombok.Data;
-import org.springframework.boot.SpringBootConfiguration;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.PropertySource;
-
-/**
- * @author MrBird
- */
-@Data
-@SpringBootConfiguration
-@PropertySource(value = {"classpath:febs-gateway.properties"})
-@ConfigurationProperties(prefix = "febs.gateway")
-public class FebsGatewayProperties {
-    /**
-     * 禁止外部访问的 URI,多个值的话以逗号分隔
-     */
-    private String forbidRequestUri;
-}
+package cc.mrbird.febs.gateway.common.properties;
+
+import lombok.Data;
+import org.springframework.boot.SpringBootConfiguration;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * @author MrBird
+ */
+@Data
+@SpringBootConfiguration
+@PropertySource(value = {"classpath:febs-gateway.properties"})
+@ConfigurationProperties(prefix = "febs.gateway")
+public class FebsGatewayProperties {
+    /**
+     * 禁止外部访问的 URI,多个值的话以逗号分隔
+     */
+    private String forbidRequestUri;
+}

+ 42 - 42
febs-gateway/src/main/java/cc/mrbird/febs/gateway/enhance/auth/AuthenticationManager.java

@@ -1,42 +1,42 @@
-package cc.mrbird.febs.gateway.enhance.auth;
-
-import io.jsonwebtoken.Claims;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.ReactiveAuthenticationManager;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.authority.AuthorityUtils;
-import org.springframework.stereotype.Component;
-import reactor.core.publisher.Mono;
-
-/**
- * @author MrBird
- */
-@Component
-public class AuthenticationManager implements ReactiveAuthenticationManager {
-
-    @Autowired
-    private JWTTokenHelper tokenHelper;
-
-    @Override
-    public Mono<Authentication> authenticate(Authentication authentication) {
-        String token = authentication.getCredentials().toString();
-        String username;
-        try {
-            username = tokenHelper.getUsernameFromToken(token);
-        } catch (Exception e) {
-            username = null;
-        }
-        if (StringUtils.isNotBlank(username) && tokenHelper.validateToken(token)) {
-            Claims claims = tokenHelper.getAllClaimsFromToken(token);
-            String permissions = claims.get("permission", String.class);
-            UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(username, null,
-                    AuthorityUtils.commaSeparatedStringToAuthorityList(permissions)
-            );
-            return Mono.just(auth);
-        } else {
-            return Mono.empty();
-        }
-    }
-}
+package cc.mrbird.febs.gateway.enhance.auth;
+
+import io.jsonwebtoken.Claims;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.ReactiveAuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.stereotype.Component;
+import reactor.core.publisher.Mono;
+
+/**
+ * @author MrBird
+ */
+@Component
+public class AuthenticationManager implements ReactiveAuthenticationManager {
+
+    @Autowired
+    private JWTTokenHelper tokenHelper;
+
+    @Override
+    public Mono<Authentication> authenticate(Authentication authentication) {
+        String token = authentication.getCredentials().toString();
+        String username;
+        try {
+            username = tokenHelper.getUsernameFromToken(token);
+        } catch (Exception e) {
+            username = null;
+        }
+        if (StringUtils.isNotBlank(username) && tokenHelper.validateToken(token)) {
+            Claims claims = tokenHelper.getAllClaimsFromToken(token);
+            String permissions = claims.get("permission", String.class);
+            UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(username, null,
+                    AuthorityUtils.commaSeparatedStringToAuthorityList(permissions)
+            );
+            return Mono.just(auth);
+        } else {
+            return Mono.empty();
+        }
+    }
+}

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä