From 4c6a08438af03c5b13d128c1a668991a704ec4e0 Mon Sep 17 00:00:00 2001 From: Hanserwei Date: Thu, 2 Oct 2025 21:46:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(gateway):=20=E6=96=B0=E5=A2=9E=E7=BD=91?= =?UTF-8?q?=E5=85=B3=E6=9C=8D=E5=8A=A1=E5=8F=8A=E6=9D=83=E9=99=90=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E5=8A=9F=E8=83=BD=20-=20=E6=96=B0=E5=A2=9E=E7=BD=91?= =?UTF-8?q?=E5=85=B3=E6=9C=8D=E5=8A=A1=E6=A8=A1=E5=9D=97=20han-note-gatewa?= =?UTF-8?q?y=EF=BC=8C=E5=8C=85=E5=90=AB=E5=9F=BA=E7=A1=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=92=8C=E5=90=AF=E5=8A=A8=E7=B1=BB=20-=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=85=A8=E5=B1=80=E8=BF=87=E6=BB=A4=E5=99=A8=20AddUse?= =?UTF-8?q?rId2HeaderFilter=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=B0=86=E7=94=A8?= =?UTF-8?q?=E6=88=B7ID=E6=B7=BB=E5=8A=A0=E5=88=B0=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=A4=B4=EF=BC=88=E7=9B=AE=E5=89=8D=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=89=20-=20=E9=85=8D=E7=BD=AE=20Sa-Token=20=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=AE=A4=E8=AF=81=EF=BC=8C=E6=94=AF=E6=8C=81=20JWT=20?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E7=9A=84=20Token=20=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=92=8C=E9=89=B4=E6=9D=83=20-=20=E6=96=B0=E5=A2=9E=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E5=99=A8=20Global?= =?UTF-8?q?ExceptionHandler=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E5=92=8C=E6=9D=83=E9=99=90=E4=B8=8D?= =?UTF-8?q?=E8=B6=B3=E5=BC=82=E5=B8=B8=20-=20=E5=AE=9E=E7=8E=B0=20StpInter?= =?UTF-8?q?faceImpl=20=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BB=8E=20Redis=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2=E5=92=8C?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=BF=A1=E6=81=AF-=20=E9=85=8D=E7=BD=AE=20Re?= =?UTF-8?q?disTemplate=20=E6=94=AF=E6=8C=81=20JSON=20=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=AD=98=E5=82=A8=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=A7=92=E8=89=B2=E5=92=8C=E6=9D=83=E9=99=90=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=20-=20=E5=9C=A8=20auth=20=E6=9C=8D=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=99=BB=E5=87=BA=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=94=A8=E6=88=B7=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=EF=BC=88=E5=BE=85=E5=AE=8C=E6=88=90=EF=BC=89=20-=20?= =?UTF-8?q?=E5=BC=95=E5=85=A5=20Nacos=20=E9=85=8D=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E5=92=8C=E6=B3=A8=E5=86=8C=E4=B8=AD=E5=BF=83=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=EF=BC=8C=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=88=B7=E6=96=B0=E5=92=8C=E6=9C=8D=E5=8A=A1=E5=8F=91?= =?UTF-8?q?=E7=8E=B0=20-=20=E6=9B=B4=E6=96=B0=20Redis=20Key=20=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=BD=BF=E7=94=A8=20userId?= =?UTF-8?q?=20=E5=92=8C=20roleKey=20=E6=9B=BF=E4=BB=A3=20email=20=E5=92=8C?= =?UTF-8?q?=20roleId=20-=20=E6=96=B0=E5=A2=9E=E5=91=8A=E8=AD=A6=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=8C=E6=94=AF=E6=8C=81=E9=82=AE=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=91=8A=E8=AD=A6=E6=96=B9=E5=BC=8F=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=8E=E5=88=87=E6=8D=A2=20-=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=A7=92=E8=89=B2=E6=9D=83=E9=99=90=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BD=BF=E7=94=A8=E8=A7=92=E8=89=B2?= =?UTF-8?q?=20Key=20=E6=9B=BF=E4=BB=A3=E8=A7=92=E8=89=B2=20ID=20=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=9D=83=E9=99=90=E4=BF=A1=E6=81=AF=20-=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20bootstrap.yml=20=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=94=AF=E6=8C=81=E4=BB=8E=20Nacos=20?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 2 + .idea/inspectionProfiles/Project_Default.xml | 7 ++ han-note-auth/pom.xml | 25 ++++++ .../hannote/auth/alarm/AlarmConfig.java | 29 +++++++ .../hannote/auth/alarm/AlarmInterface.java | 12 +++ .../auth/alarm/impl/MailAlarmHelper.java | 23 +++++ .../auth/alarm/impl/SmsAlarmHelper.java | 23 +++++ .../auth/constant/RedisKeyConstants.java | 12 +-- .../auth/controller/UserController.java | 14 ++- .../auth/domain/mapper/RoleDOMapper.java | 4 +- .../PushRolePermissions2RedisRunner.java | 15 ++-- .../auth/service/impl/UserServiceImpl.java | 16 ++-- .../src/main/resources/application.yml | 8 +- .../src/main/resources/bootstrap.yml | 19 +++++ .../main/resources/mapperxml/RoleDOMapper.xml | 9 ++ han-note-gateway/pom.xml | 78 +++++++++++++++++ .../gateway/HannoteGatewayApplication.java | 11 +++ .../gateway/auth/SaTokenConfigure.java | 50 +++++++++++ .../gateway/auth/StpInterfaceImpl.java | 85 +++++++++++++++++++ .../gateway/config/RedisTemplateConfig.java | 31 +++++++ .../gateway/constants/RedisKeyConstants.java | 33 +++++++ .../gateway/enums/ResponseCodeEnum.java | 24 ++++++ .../exception/GlobalExceptionHandler.java | 64 ++++++++++++++ .../filter/AddUserId2HeaderFilter.java | 39 +++++++++ .../src/main/resources/application.yml | 43 ++++++++++ .../src/main/resources/bootstrap.yml | 12 +++ pom.xml | 6 ++ 27 files changed, 668 insertions(+), 26 deletions(-) create mode 100644 han-note-auth/src/main/java/com/hanserwei/hannote/auth/alarm/AlarmConfig.java create mode 100644 han-note-auth/src/main/java/com/hanserwei/hannote/auth/alarm/AlarmInterface.java create mode 100644 han-note-auth/src/main/java/com/hanserwei/hannote/auth/alarm/impl/MailAlarmHelper.java create mode 100644 han-note-auth/src/main/java/com/hanserwei/hannote/auth/alarm/impl/SmsAlarmHelper.java create mode 100644 han-note-auth/src/main/resources/bootstrap.yml create mode 100644 han-note-gateway/pom.xml create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/HannoteGatewayApplication.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/auth/SaTokenConfigure.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/auth/StpInterfaceImpl.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/config/RedisTemplateConfig.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/constants/RedisKeyConstants.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/enums/ResponseCodeEnum.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/exception/GlobalExceptionHandler.java create mode 100644 han-note-gateway/src/main/java/com/hanserwei/hannote/gateway/filter/AddUserId2HeaderFilter.java create mode 100644 han-note-gateway/src/main/resources/application.yml create mode 100644 han-note-gateway/src/main/resources/bootstrap.yml diff --git a/.idea/encodings.xml b/.idea/encodings.xml index c1997d2..0cf5d75 100755 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,6 +3,8 @@ + + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index f281ec3..6a3a249 100755 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,13 @@