From d6218655285d4cd3db633a5dc3287f4035bcbfa2 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Thu, 16 May 2024 08:35:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BF=AE=E6=94=B9):=20:lipstick:=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE=E6=A8=A1=E5=9D=97=E5=92=8C?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + common/common-result/pom.xml | 7 +- .../common/result/enums/ResultCodeEnum.java | 5 +- common/common-utils/pom.xml | 71 ------------ .../constant/CommonMessageConstant.java | 38 ------- .../common/constant/ExceptionConstant.java | 16 --- .../constant/LocalDateTimeConstant.java | 11 -- .../common/constant/MailMessageConstant.java | 14 --- .../common/constant/MinioMessageConstant.java | 19 ---- .../common/constant/PasswordConstant.java | 18 --- .../common/constant/RedisUserConstant.java | 11 -- .../common/constant/SQLAutoFillConstant.java | 14 --- .../common/constant/SecurityConstant.java | 12 -- .../bunny/common/constant/StatusConstant.java | 14 --- .../bunny/common/constant/UserConstant.java | 8 -- .../cn/bunny/common/generator/NewCodeGet.java | 84 -------------- .../cn/bunny/common/generator/OldCodeGet.java | 57 ---------- .../properties/SnowflakeProperties.java | 25 ---- common/pom.xml | 9 +- common/service-utils/pom.xml | 7 +- .../common/service/config/Knife4jConfig.java | 6 + .../exception/GlobalExceptionHandler.java | 4 +- .../bunny/common/service/utils/JwtHelper.java | 13 +-- .../common/service/utils/ResponseUtil.java | 11 +- .../service/utils/SnowflakeIdGenerator.java | 2 +- .../security/config/WebSecurityConfig.java | 85 -------------- .../custom/CustomPasswordEncoder.java | 28 ----- .../cn/bunny/security/custom/CustomUser.java | 23 ---- .../filter/TokenAuthenticationFilter.java | 74 ------------ .../security/filter/TokenLoginFilter.java | 80 ------------- .../handelr/SecurityAccessDeniedHandler.java | 23 ---- .../SecurityAuthenticationEntryPoint.java | 39 ------- .../SecurityAuthenticationFailureHandler.java | 26 ----- .../SecurityAuthenticationSuccessHandler.java | 29 ----- .../CustomAuthorizationManagerService.java | 7 -- .../service/CustomUserDetailsService.java | 12 -- .../service-gateway-metrics.log.2024-05-10 | 3 - ...service-gateway-metrics.log.2024-05-10.idx | 0 model/pom.xml | 17 ++- .../java/cn/bunny/entity/system/Login.java | 14 --- .../cn/bunny/entity/system/RoleByUser.java | 17 --- .../java/cn/bunny/entity/system/SysDept.java | 49 -------- .../cn/bunny/entity/system/SysLoginLog.java | 42 ------- .../java/cn/bunny/entity/system/SysMenu.java | 65 ----------- .../java/cn/bunny/entity/system/SysRole.java | 34 ------ .../java/cn/bunny/entity/system/SysUser.java | 71 ------------ .../cn/bunny/entity/system/SysUserinfo.java | 22 ---- .../main/java/cn/bunny/vo/system/LoginVo.java | 32 ++++-- .../main/java/cn/bunny/vo/system/MetaVo.java | 29 ----- .../java/cn/bunny/vo/system/RouterVo.java | 48 -------- .../cn/bunny/vo/system/SysOperLogQueryVo.java | 15 --- .../cn/bunny/vo/system/SysPostQueryVo.java | 19 ---- .../module/mail/utils/MailSendCheckUtil.java | 2 +- .../bunny/module/minio/utils/MinioUtil.java | 2 +- module/module-rabbitMQ/pom.xml | 1 - .../module-websocket}/pom.xml | 12 +- .../module}/websocket/WebSocketServer.java | 2 +- pom.xml | 66 ++++++++++- server-gateway/pom.xml | 13 ++- .../service/gateway/GatewayApplication.java | 2 + .../gateway/controller/IndexController.java | 2 +- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application.yml | 24 ++-- .../src/test/java/cn/bunny/AppTest.java | 38 ------- service-client/pom.xml | 22 +++- service/pom.xml | 8 +- service/service-main/Dockerfile | 21 ---- service/service-main/pom.xml | 107 ------------------ .../cn/bunny/service/ServiceApplication.java | 22 ---- .../service/aop/annotation/AutoFill.java | 15 --- .../service/aop/aspect/AutoFillAspect.java | 27 ----- .../service/controller/BaseController.java | 59 ---------- .../service/controller/IndexController.java | 47 -------- .../service/controller/MailController.java | 55 --------- .../service/controller/SysMenuController.java | 18 --- .../bunny/service/mapper/SysMenuMapper.java | 16 --- .../bunny/service/mapper/SysRoleMapper.java | 7 -- .../bunny/service/mapper/SysUserMapper.java | 19 ---- ...CustomAuthorizationManagerServiceImpl.java | 36 ------ .../security/CustomUserDetailsService.java | 41 ------- .../bunny/service/service/EmailService.java | 37 ------ .../bunny/service/service/SysMenuService.java | 16 --- .../bunny/service/service/SysRoleService.java | 8 -- .../bunny/service/service/SysUserService.java | 43 ------- .../service/impl/EmailServiceImpl.java | 98 ---------------- .../service/impl/SysMenuServiceImpl.java | 20 ---- .../service/impl/SysRoleServiceImpl.java | 11 -- .../service/impl/SysUserServiceImpl.java | 91 --------------- .../cn/bunny/service/task/TemplateTask.java | 14 --- .../src/main/resources/application-dev.yml | 19 ---- .../src/main/resources/application.yml | 63 ----------- .../src/main/resources/banner.txt | 16 --- .../src/main/resources/favicon.ico | Bin 17014 -> 0 bytes .../src/main/resources/logback.xml | 61 ---------- .../main/resources/mapper/SysMenuMapper.xml | 26 ----- .../main/resources/mapper/SysRoleMapper.xml | 5 - .../main/resources/mapper/SysUserMapper.xml | 5 - .../cn/bunny/CustomPasswordEncoderTest.java | 27 ----- 98 files changed, 193 insertions(+), 2433 deletions(-) delete mode 100644 common/common-utils/pom.xml delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/CommonMessageConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/ExceptionConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/LocalDateTimeConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/MailMessageConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/MinioMessageConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/PasswordConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/RedisUserConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/SQLAutoFillConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/SecurityConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/StatusConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/constant/UserConstant.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/generator/NewCodeGet.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/generator/OldCodeGet.java delete mode 100644 common/common-utils/src/main/java/cn/bunny/common/properties/SnowflakeProperties.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/custom/CustomPasswordEncoder.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/custom/CustomUser.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/filter/TokenAuthenticationFilter.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/filter/TokenLoginFilter.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAccessDeniedHandler.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationEntryPoint.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationFailureHandler.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationSuccessHandler.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/service/CustomAuthorizationManagerService.java delete mode 100644 common/spring-security/src/main/java/cn/bunny/security/service/CustomUserDetailsService.java delete mode 100644 logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10 delete mode 100644 logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10.idx delete mode 100644 model/src/main/java/cn/bunny/entity/system/Login.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/RoleByUser.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/SysDept.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/SysLoginLog.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/SysMenu.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/SysRole.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/SysUser.java delete mode 100644 model/src/main/java/cn/bunny/entity/system/SysUserinfo.java delete mode 100644 model/src/main/java/cn/bunny/vo/system/MetaVo.java delete mode 100644 model/src/main/java/cn/bunny/vo/system/RouterVo.java delete mode 100644 model/src/main/java/cn/bunny/vo/system/SysOperLogQueryVo.java delete mode 100644 model/src/main/java/cn/bunny/vo/system/SysPostQueryVo.java rename {common/spring-security => module/module-websocket}/pom.xml (70%) rename {service/service-main/src/main/java/cn/bunny/service => module/module-websocket/src/main/java/cn/bunny/module}/websocket/WebSocketServer.java (98%) delete mode 100644 server-gateway/src/test/java/cn/bunny/AppTest.java delete mode 100644 service/service-main/Dockerfile delete mode 100644 service/service-main/pom.xml delete mode 100644 service/service-main/src/main/java/cn/bunny/service/ServiceApplication.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/aop/annotation/AutoFill.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/aop/aspect/AutoFillAspect.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/controller/BaseController.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/controller/IndexController.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/controller/MailController.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/controller/SysMenuController.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/mapper/SysMenuMapper.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/mapper/SysRoleMapper.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/mapper/SysUserMapper.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/security/CustomAuthorizationManagerServiceImpl.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/security/CustomUserDetailsService.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/EmailService.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/SysMenuService.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/SysRoleService.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/SysUserService.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/impl/EmailServiceImpl.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/impl/SysMenuServiceImpl.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/impl/SysRoleServiceImpl.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/service/impl/SysUserServiceImpl.java delete mode 100644 service/service-main/src/main/java/cn/bunny/service/task/TemplateTask.java delete mode 100644 service/service-main/src/main/resources/application-dev.yml delete mode 100644 service/service-main/src/main/resources/application.yml delete mode 100644 service/service-main/src/main/resources/banner.txt delete mode 100644 service/service-main/src/main/resources/favicon.ico delete mode 100644 service/service-main/src/main/resources/logback.xml delete mode 100644 service/service-main/src/main/resources/mapper/SysMenuMapper.xml delete mode 100644 service/service-main/src/main/resources/mapper/SysRoleMapper.xml delete mode 100644 service/service-main/src/main/resources/mapper/SysUserMapper.xml delete mode 100644 service/service-main/src/test/java/cn/bunny/CustomPasswordEncoderTest.java diff --git a/.gitignore b/.gitignore index 549e00a..a23d6d0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ build/ ### VS Code ### .vscode/ +logs \ No newline at end of file diff --git a/common/common-result/pom.xml b/common/common-result/pom.xml index 436690b..b1d9bc0 100644 --- a/common/common-result/pom.xml +++ b/common/common-result/pom.xml @@ -1,4 +1,4 @@ - 4.0.0 @@ -18,6 +18,9 @@ - + + org.projectlombok + lombok + diff --git a/common/common-result/src/main/java/cn/bunny/common/result/enums/ResultCodeEnum.java b/common/common-result/src/main/java/cn/bunny/common/result/enums/ResultCodeEnum.java index dc0c7c7..68402cc 100644 --- a/common/common-result/src/main/java/cn/bunny/common/result/enums/ResultCodeEnum.java +++ b/common/common-result/src/main/java/cn/bunny/common/result/enums/ResultCodeEnum.java @@ -10,9 +10,11 @@ public enum ResultCodeEnum { SUCCESS(200, "操作成功"), SUCCESS_LOGOUT(200, "退出成功"), FAIL(201, "失败"), + USERNAME_NOT_EMPTY(201, "用户名不能为空"), + PASSWORD_NOT_EMPTY(201, "密码不能为空"), SERVICE_ERROR(2012, "服务异常"), DATA_ERROR(204, "数据异常"), - LOGIN_MOBLE_ERROR(204, "登录错误"), + LOGIN_ERROR(204, "账号或密码错误"), ILLEGAL_REQUEST(205, "非法请求"), REPEAT_SUBMIT(206, "重复提交"), @@ -24,7 +26,6 @@ public enum ResultCodeEnum { FETCH_ACCESSTOKEN_FAILD(218, "获取accessToken失败"), FETCH_USERINFO_ERROR(219, "获取用户信息失败"), - FAIL_REQUEST_NOT_AUTH(403, "用户未认证"), FAIL_NO_ACCESS_DENIED(403, "无权访问"), LOGGED_IN_FROM_ANOTHER_DEVICE(403, "没有权限访问"), diff --git a/common/common-utils/pom.xml b/common/common-utils/pom.xml deleted file mode 100644 index 8a8ecaf..0000000 --- a/common/common-utils/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - 4.0.0 - - cn.bunny - common - 0.0.1-SNAPSHOT - - - common-utils - jar - - common-utils - https://maven.apache.org - - - UTF-8 - - - - - org.apache.httpcomponents - httpclient - 4.5.14 - - - javax.xml.bind - jaxb-api - 2.1 - - - - mysql - mysql-connector-java - - - - com.zaxxer - HikariCP - 5.1.0 - - - - com.baomidou - mybatis-plus-spring-boot3-starter - - - - com.baomidou - mybatis-plus-generator - 3.5.6 - - - org.apache.velocity - velocity-engine-core - 2.3 - - - - - - - - - - - - - - - diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/CommonMessageConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/CommonMessageConstant.java deleted file mode 100644 index 910d164..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/CommonMessageConstant.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -/** - * 信息提示常量类 - */ -@Data -public class CommonMessageConstant { - public static final String PASSWORD_ERROR = "密码错误"; - public static final String OLD_PASSWORD_ERROR = "旧密码不匹配"; - public static final String OLD_PASSWORD_SAME_NEW_PASSWORD = "旧密码与新密码相同"; - public static final String ACCOUNT_NOT_FOUND = "账号不存在"; - public static final String ACCOUNT_LOCKED = "账号被锁定"; - public static final String UNKNOWN_ERROR = "未知错误"; - public static final String USER_NOT_LOGIN = "用户未登录"; - public static final String USER_TOKEN_OUT_OF_DATE = "用户登录过期"; - public static final String LOGIN_FAILED = "登录失败"; - public static final String UPLOAD_FAILED = "文件上传失败"; - public static final String PASSWORD_EDIT_FAILED = "密码修改失败"; - public static final String ALREADY_EXISTS = "已存在"; - public static final String REQUEST_NOT_EMPTY = "请求不为空"; - public static final String UPDATE_ID_IS_NOT_EMPTY = "删除id不能为空"; - public static final String DELETE_ID_IS_NOT_EMPTY = "修改id不能为空"; - public static final String MENU_IS_NOT_EXIST = "菜单不存在"; - public static final String SAVE_DTO_IS_NULL = "添加参数不能为空"; - public static final String UPDATE_DTO_IS_NULL = "修改参数不能为空"; - public static final String FIND_ID_IS_NOT_EMPTY = "查询ID不能为空"; - public static final String MESSAGE_CODE_NOT_PASS = "短信验证码未过期"; - public static final String MESSAGE_CODE_UNAUTHORIZED = "短信验证码未授权,请联系管理员"; - public static final String VERIFICATION_CODE_ERROR = "验证码错误"; - public static final String USER_DOES_NOT_EXIST = "用户不存在"; - public static final String USER_DOES_IS_EXIST = "用户已存在"; - public static final String VERIFICATION_CODE_IS_EMPTY = "请先发送验证码"; - public static final String LOGIN_DTO_IS_EMPTY = "登录参数不能为空"; - public static final String TOKEN_IS_EMPTY = "token为空"; - public static final String DATA_IS_EMPTY = "数据为空"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/ExceptionConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/ExceptionConstant.java deleted file mode 100644 index 64e0094..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/ExceptionConstant.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bunny.common.constant; - - -import lombok.Data; - -@Data -public class ExceptionConstant { - public static final String USER_NOT_FOUND = "用户不存在"; - public static final String USERNAME_IS_EMPTY = "用户名不能为空"; - public static final String PASSWORD_ERROR = "密码错误"; - public static final String PASSWORD_IS_EMPTY = "密码不能为空"; - public static final String CAPTCHA_IS_EMPTY = "提交验证码不能为空"; - public static final String KEY_IS_EMPTY = "验证码key不能为空"; - public static final String VERIFICATION_CODE_DOES_NOT_MATCH = "验证码不匹配"; - public static final String VERIFICATION_CODE_IS_EMPTY = "验证码失效或不存在"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/LocalDateTimeConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/LocalDateTimeConstant.java deleted file mode 100644 index 1494b3c..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/LocalDateTimeConstant.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -@Data -public class LocalDateTimeConstant { - public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm"; - public static final String DEFAULT_DATE_TIME_SECOND_FORMAT = "yyyy-MM-dd HH:mm:ss"; - public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/MailMessageConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/MailMessageConstant.java deleted file mode 100644 index 458ef48..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/MailMessageConstant.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -/** - * 邮箱消息 - */ -@Data -public class MailMessageConstant { - public static final String EMPTY_SEND_OBJECT = "空发送对象"; - public static final String ADDRESS_NOT_NULL = "收件人不能为空"; - public static final String TITLE_NOT_NULL = "标题不能为空"; - public static final String SEND_MESSAGE_NOT_NULL = "发送消息不能为空"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/MinioMessageConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/MinioMessageConstant.java deleted file mode 100644 index b36a35e..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/MinioMessageConstant.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -@Data -public class MinioMessageConstant { - public static final String BUCKET_EXISTS_EXCEPTION = "查询文化部对象失败"; - public static final String DELETE_BUCKET_EXCEPTION = "删除文件对象失败"; - public static final String GET_BUCKET_EXCEPTION = "获取文件信息失败"; - public static final String QUERY_BUCKET_EXCEPTION = "查询文件信息失败"; - public static final String CREATE_BUCKET_EXCEPTION = "创建文件对象失败"; - public static final String UPDATE_BUCKET_EXCEPTION = "更新文件对象失败"; - public static final String COMPOSE_OBJECT_EXCEPTION = "对象错误"; - public static final String COPY_BUCKET_EXCEPTION = "复制文件内容失败"; - public static final String DISABLE_BUCKET_EXCEPTION = "禁用文件失败"; - public static final String ENABLE_BUCKET_EXCEPTION = "启用文件失败"; - public static final String DOWNLOAD_BUCKET_EXCEPTION = "下载文件失败"; - public static final String UPLOAD_BUCKET_EXCEPTION = "上传文件失败"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/PasswordConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/PasswordConstant.java deleted file mode 100644 index 0633ea0..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/PasswordConstant.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -/** - * 密码常量 - */ -@Data -public class PasswordConstant { - // 默认密码 - public static final String DEFAULT_PASSWORD = "123456"; - // JWT密码 - public static final String DEFAULT_JWT_PASSWORD = "123456"; - // 默认头像 - public static final String AVTAR = "https://oss.aliyuncs.com/aliyun_id_photo_bucket/default_handsome.jpg"; - // 设置token过期时间 - public static final long TOKEN_EXPIRATION = 365L * 24 * 60 * 60 * 1000; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/RedisUserConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/RedisUserConstant.java deleted file mode 100644 index ca4b151..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/RedisUserConstant.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -/** - * Redis用户前缀设置 - */ -@Data -public class RedisUserConstant { - public static final String REDIS_CART_KEY = "user::"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/SQLAutoFillConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/SQLAutoFillConstant.java deleted file mode 100644 index b9b6205..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/SQLAutoFillConstant.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -/** - * 数据库中自动填充字段 - */ -@Data -public class SQLAutoFillConstant { - public static final String SET_CREATE_TIME = "setCreateTime"; - public static final String SET_UPDATE_TIME = "setUpdateTime"; - public static final String SET_CREATE_USER = "setCreateUser"; - public static final String SET_UPDATE_USER = "setUpdateUser"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/SecurityConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/SecurityConstant.java deleted file mode 100644 index da71e65..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/SecurityConstant.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -import java.util.Arrays; -import java.util.List; - -@Data -public class SecurityConstant { - public static String[] annotations = {"/", "/test/**", "/diagram-viewer/**", "/editor-app/**", "/*.html", "/admin/system/index/login", "/favicon.ico", "/swagger-resources/**", "/webjars/**", "/v3/**", "/swagger-ui.html/**", "/doc.html"}; - public static List annotationsList = Arrays.asList(annotations); -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/StatusConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/StatusConstant.java deleted file mode 100644 index d91412f..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/StatusConstant.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -/** - * 状态常量,启用或者禁用 - */ -@Data -public class StatusConstant { - // 启用为1 - public static final Integer ENABLE = 1; - // 禁用为0 - public static final Integer DISABLE = 0; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/constant/UserConstant.java b/common/common-utils/src/main/java/cn/bunny/common/constant/UserConstant.java deleted file mode 100644 index 8d2ee23..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/constant/UserConstant.java +++ /dev/null @@ -1,8 +0,0 @@ -package cn.bunny.common.constant; - -import lombok.Data; - -@Data -public class UserConstant { - public static final String USER_AVATAR = "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eoj0hHXhgJNOTSOFsS4uZs8x1ConecaVOB8eIl115xmJZcT4oCicvia7wMEufibKtTLqiaJeanU2Lpg3w/132"; -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/generator/NewCodeGet.java b/common/common-utils/src/main/java/cn/bunny/common/generator/NewCodeGet.java deleted file mode 100644 index fb3fb5d..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/generator/NewCodeGet.java +++ /dev/null @@ -1,84 +0,0 @@ -package cn.bunny.common.generator; - - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.generator.FastAutoGenerator; -import com.baomidou.mybatisplus.generator.config.OutputFile; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import org.apache.ibatis.annotations.Mapper; - -import java.util.Collections; - -public class NewCodeGet { - // 数据连接 - public static final String sqlHost = "jdbc:mysql://106.15.251.123:3305/guigu-oa?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"; - // 作者名称 - public static final String author = "Bunny"; - // 公共路径 - public static final String outputDir = "G:\\web项目\\Bunny-Cli\\Java\\java-template\\service"; - // 实体类名称 - public static final String entity = "Bunny"; - - public static void main(String[] args) { - Generation("sys_menu"); - } - - /** - * 根据表名生成相应结构代码 - * - * @param tableName 表名 - */ - public static void Generation(String... tableName) { - // TODO 修改数据库路径、账户、密码 - FastAutoGenerator.create(sqlHost, "root", "02120212") - .globalConfig(builder -> { - // 添加作者名称 - builder.author(author) - // 启用swagger - .enableSwagger() - // 指定输出目录 - .outputDir(outputDir + "/src/main/java"); - }) - .packageConfig(builder -> { - builder.entity(entity)// 实体类包名 - // TODO 父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名 - .parent("cn.bunny.service") - .controller("controller")// 控制层包名 - .mapper("mapper")// mapper层包名 - .service("service")// service层包名 - .serviceImpl("service.impl")// service实现类包名 - // 自定义mapper.xml文件输出目录 - .pathInfo(Collections.singletonMap(OutputFile.xml, outputDir + "/src/main/resources/mapper")); - }) - .strategyConfig(builder -> { - // 设置要生成的表名 - builder.addInclude(tableName) - //.addTablePrefix("sys_")// TODO 设置表前缀过滤 - .entityBuilder() - .enableLombok() - .enableChainModel() - .naming(NamingStrategy.underline_to_camel)// 数据表映射实体命名策略:默认下划线转驼峰underline_to_camel - .columnNaming(NamingStrategy.underline_to_camel)// 表字段映射实体属性命名规则:默认null,不指定按照naming执行 - .idType(IdType.AUTO)// TODO 添加全局主键类型 - .formatFileName("%s")// 格式化实体名称,%s取消首字母I, - .mapperBuilder() - .mapperAnnotation(Mapper.class)// 开启mapper注解 - .enableBaseResultMap()// 启用xml文件中的BaseResultMap 生成 - .enableBaseColumnList()// 启用xml文件中的BaseColumnList - .formatMapperFileName("%sMapper")// 格式化Dao类名称 - .formatXmlFileName("%sMapper")// 格式化xml文件名称 - .serviceBuilder() - .formatServiceFileName("%sService")// 格式化 service 接口文件名称 - .formatServiceImplFileName("%sServiceImpl")// 格式化 service 接口文件名称 - .controllerBuilder() - .enableRestStyle(); - }) - // .injectionConfig(consumer -> { - // Map customFile = new HashMap<>(); - // // 配置DTO(需要的话)但是需要有能配置Dto的模板引擎,比如freemarker,但是这里我们用的VelocityEngine,因此不多作介绍 - // customFile.put(outputDir, "/src/main/resources/templates/entityDTO.java.ftl"); - // consumer.customFile(customFile); - // }) - .execute(); - } -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/generator/OldCodeGet.java b/common/common-utils/src/main/java/cn/bunny/common/generator/OldCodeGet.java deleted file mode 100644 index d43819c..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/generator/OldCodeGet.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.bunny.common.generator; - -public class OldCodeGet { - public static void main(String[] args) { - // // 1、创建代码生成器 - // AutoGenerator mpg = new AutoGenerator(); - // - // // 2、全局配置 - // // 全局配置 - // GlobalConfig gc = new GlobalConfig(); - // // TODO 需要修改路径名称 - // gc.setOutputDir("F:\\web项目\\Bunny-Cli\\Java\\java-template\\service" + "/src/main/java"); - // gc.setServiceName("%sService"); // 去掉Service接口的首字母I - // gc.setAuthor("bunny"); - // gc.setOpen(false); - // mpg.setGlobalConfig(gc); - // - // // 3、数据源配置 - // DataSourceConfig dsc = new DataSourceConfig(); - // // TODO 需要修改数据库 - // dsc.setUrl("jdbc:mysql://106.15.251.123:3305/guigu-oa?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"); - // dsc.setDriverName("com.mysql.cj.jdbc.Driver"); - // dsc.setUsername("root"); - // dsc.setPassword("02120212"); - // dsc.setDbType(DbType.MYSQL); - // mpg.setDataSource(dsc); - // - // // 4、包配置 - // PackageConfig pc = new PackageConfig(); - // pc.setParent("cn.bunny"); - // // TODO 需要修改模块名 - // pc.setModuleName("service"); - // pc.setController("controller"); - // pc.setService("service"); - // pc.setMapper("mapper"); - // mpg.setPackageInfo(pc); - // - // // 5、策略配置 - // StrategyConfig strategy = getStrategyConfig(); - // mpg.setStrategy(strategy); - // - // // 6、执行 - // mpg.execute(); - // } - // - // private static StrategyConfig getStrategyConfig() { - // StrategyConfig strategy = new StrategyConfig(); - // // TODO 要生成的表 - // strategy.setInclude("sys_menu", "sys_role_menu"); - // strategy.setNaming(NamingStrategy.underline_to_camel);// 数据库表映射到实体的命名策略 - // strategy.setColumnNaming(NamingStrategy.underline_to_camel);// 数据库表字段映射到实体的命名策略 - // strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 - // strategy.setRestControllerStyle(true); // restful api风格控制器 - // strategy.setControllerMappingHyphenStyle(true); // url中驼峰转连字符 - // return strategy; - } -} diff --git a/common/common-utils/src/main/java/cn/bunny/common/properties/SnowflakeProperties.java b/common/common-utils/src/main/java/cn/bunny/common/properties/SnowflakeProperties.java deleted file mode 100644 index fe073ad..0000000 --- a/common/common-utils/src/main/java/cn/bunny/common/properties/SnowflakeProperties.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.bunny.common.properties; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -@Component -@ConfigurationProperties(prefix = "bunny.snowflake") -@Data -public class SnowflakeProperties { - // 数据中心id - private Long datacenterId; - // 数据中心id位数 - private Long datacenterBits; - // 机器id - private Long workerId; - // 机器id位数 - private Long workerBits; - // 序列id所占位数 - private Long sequenceBits; - // 时间戳起始点(毫秒) - private Long twepoch; - // 单次批量生成id的最大数量 - private Integer maxBatchCount; -} \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index 709f207..1971a2b 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -13,16 +13,15 @@ https://maven.apache.org service-utils - common-utils - spring-security + common-generator common-result - cn.bunny - model - 0.0.1-SNAPSHOT + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.17.0 io.jsonwebtoken diff --git a/common/service-utils/pom.xml b/common/service-utils/pom.xml index b47c877..8e4a6fe 100644 --- a/common/service-utils/pom.xml +++ b/common/service-utils/pom.xml @@ -19,7 +19,7 @@ cn.bunny - common-utils + common-generator 0.0.1-SNAPSHOT @@ -27,6 +27,11 @@ common-result 0.0.1-SNAPSHOT + + + com.github.xiaoymin + knife4j-openapi3-jakarta-spring-boot-starter + org.springframework.boot spring-boot-starter-web diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java index 00ccf95..eee1b94 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java @@ -29,6 +29,12 @@ public class Knife4jConfig { // 管理员相关分类接口 @Bean public GroupedOpenApi groupedOpenApi() { + return GroupedOpenApi.builder().group("前台接口管理").pathsToMatch("/api/**").build(); + } + + // 管理员相关分类接口 + @Bean + public GroupedOpenApi groupedOpenAdminApi() { return GroupedOpenApi.builder().group("管理员接口请求").pathsToMatch("/admin/**").build(); } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java b/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java index edd996c..34e61cb 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java @@ -1,8 +1,8 @@ package cn.bunny.common.service.exception; -import cn.bunny.common.constant.CommonMessageConstant; -import cn.bunny.common.result.utils.Result; +import cn.bunny.common.result.constant.CommonMessageConstant; import cn.bunny.common.result.enums.ResultCodeEnum; +import cn.bunny.common.result.utils.Result; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java index 318b6bb..7215eb1 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java @@ -6,13 +6,13 @@ import org.springframework.util.StringUtils; import java.util.Date; public class JwtHelper { - private static final long tokenExpiration = 365L * 24 * 60 * 60 * 1000; + private static final long tokenExpiration = 24 * 60 * 60 * 1000; private static final String tokenSignKey = "Bunny-Java-Template"; - public static String createToken(Long userId, String userName) { + public static String createToken(Long userId, String userName, Integer day) { return Jwts.builder() .setSubject("Bunny-USER") - .setExpiration(new Date(System.currentTimeMillis() + tokenExpiration)) + .setExpiration(new Date(System.currentTimeMillis() + tokenExpiration * day)) .claim("userId", userId) .claim("userName", userName) .signWith(SignatureAlgorithm.HS256, tokenSignKey) @@ -25,8 +25,7 @@ public class JwtHelper { Jws claimsJws = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token); Claims claims = claimsJws.getBody(); - Integer userId = (Integer) claims.get("userId"); - return userId.longValue(); + return (Long) claims.get("userId"); } public static String getUserName(String token) { @@ -42,8 +41,8 @@ public class JwtHelper { } public static void main(String[] args) { - String token = JwtHelper.createToken(7L, "admin"); - System.out.println(token); + String token = JwtHelper.createToken(7L, "admin", 7); + // token = "eyJhbGciOiJIUzI1NiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAA_6tWKi5NUrJScirNy6vUDQ12DVLSUUqtKFCyMjQ3MTc0NrYwNddRKi1OLfJMUbKyNDIwNLQwMDAzg4j5JeamAjUbGhtaWhoYGJqaOBQW6iXn5yrVAgCrO9jLWAAAAA.DS1wYprXGoIMrjtUWfDSN9AG5gWoRZ17oAgcvC0kwag"; System.out.println(JwtHelper.getUserId(token)); System.out.println(JwtHelper.getUserName(token)); } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseUtil.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseUtil.java index f815119..773eebe 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseUtil.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseUtil.java @@ -2,20 +2,23 @@ package cn.bunny.common.service.utils; import cn.bunny.common.result.utils.Result; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import java.io.IOException; public class ResponseUtil { - public static void out(HttpServletResponse response, Result r) { + public static void out(HttpServletResponse response, Result result) { ObjectMapper mapper = new ObjectMapper(); + + // 注册JavaTimeModule模块 + mapper.registerModule(new JavaTimeModule()); + response.setContentType("application/json;charset=UTF-8"); response.setStatus(HttpStatus.OK.value()); - response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); try { - mapper.writeValue(response.getWriter(), r); + mapper.writeValue(response.getWriter(), result); } catch (IOException e) { e.printStackTrace(); } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/SnowflakeIdGenerator.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/SnowflakeIdGenerator.java index 72215e9..8504b27 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/SnowflakeIdGenerator.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/utils/SnowflakeIdGenerator.java @@ -1,7 +1,7 @@ package cn.bunny.common.service.utils; -import cn.bunny.common.properties.SnowflakeProperties; +import cn.bunny.common.service.properties.SnowflakeProperties; import org.springframework.stereotype.Component; import java.util.ArrayList; diff --git a/common/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java b/common/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java deleted file mode 100644 index 33bc879..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/config/WebSecurityConfig.java +++ /dev/null @@ -1,85 +0,0 @@ -package cn.bunny.security.config; - -import cn.bunny.common.constant.SecurityConstant; -import cn.bunny.security.custom.CustomPasswordEncoder; -import cn.bunny.security.filter.TokenAuthenticationFilter; -import cn.bunny.security.filter.TokenLoginFilter; -import cn.bunny.security.handelr.SecurityAccessDeniedHandler; -import cn.bunny.security.handelr.SecurityAuthenticationEntryPoint; -import cn.bunny.security.service.CustomAuthorizationManagerService; -import cn.bunny.security.service.CustomUserDetailsService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; -import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; -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.configurers.AbstractHttpConfigurer; -import org.springframework.security.core.session.SessionRegistry; -import org.springframework.security.core.session.SessionRegistryImpl; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.util.matcher.RegexRequestMatcher; - -@Configuration -@EnableWebSecurity -@EnableMethodSecurity -public class WebSecurityConfig { - @Autowired - AuthenticationConfiguration authenticationConfiguration; - @Autowired - private RedisTemplate redisTemplate; - @Autowired - private CustomUserDetailsService customUserDetailsService; - @Autowired - private CustomPasswordEncoder customPasswordEncoder; - @Autowired - private CustomAuthorizationManagerService customAuthorizationManager; - - @Bean - public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { - httpSecurity - // 前端段分离不需要---禁用明文验证 - .httpBasic(AbstractHttpConfigurer::disable) - // 前端段分离不需要---禁用默认登录页 - .formLogin(AbstractHttpConfigurer::disable) - // 前端段分离不需要---禁用退出页 - .logout(AbstractHttpConfigurer::disable) - // 前端段分离不需要---csrf攻击 - .csrf(AbstractHttpConfigurer::disable) - // 跨域访问权限,如果需要可以关闭后自己配置跨域访问 - .cors(AbstractHttpConfigurer::disable) - // 前后端分离不需要---因为是无状态的 - .sessionManagement(AbstractHttpConfigurer::disable) - // 前后端分离不需要---记住我,e -> e.rememberMeParameter("rememberBunny").rememberMeCookieName("rememberBunny").key("BunnyKey") - .rememberMe(AbstractHttpConfigurer::disable) - .authorizeHttpRequests(authorize -> { - // 如果访问路径有下面的,不需要访问权限 - authorize.requestMatchers(SecurityConstant.annotations).permitAll(); - // 有样式文件,不需要访问权限 - authorize.requestMatchers(RegexRequestMatcher.regexMatcher("^\\S*[css|js]$")).permitAll(); - // 上面都不是需要鉴权访问 - authorize.anyRequest().access(customAuthorizationManager); - }) - .exceptionHandling(exception -> { - // 请求未授权接口 - exception.authenticationEntryPoint(new SecurityAuthenticationEntryPoint()); - // 没有权限访问 - exception.accessDeniedHandler(new SecurityAccessDeniedHandler()); - }) - // 自定义过滤器 - .addFilterBefore(new TokenAuthenticationFilter(redisTemplate), UsernamePasswordAuthenticationFilter.class) - .addFilterAt(new TokenLoginFilter(authenticationConfiguration, redisTemplate), UsernamePasswordAuthenticationFilter.class) - // 自定义密码加密器和用户登录 - .passwordManagement(customPasswordEncoder).userDetailsService(customUserDetailsService); - - return httpSecurity.build(); - } - - @Bean - public SessionRegistry sessionRegistry() { - return new SessionRegistryImpl(); - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/custom/CustomPasswordEncoder.java b/common/spring-security/src/main/java/cn/bunny/security/custom/CustomPasswordEncoder.java deleted file mode 100644 index 57864ed..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/custom/CustomPasswordEncoder.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.bunny.security.custom; - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.Customizer; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configurers.PasswordManagementConfigurer; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.util.DigestUtils; - -/** - * 自定义密码加密比对 - */ -@Configuration -public class CustomPasswordEncoder implements PasswordEncoder, Customizer> { - @Override - public String encode(CharSequence rawPassword) { - return DigestUtils.md5DigestAsHex(rawPassword.toString().getBytes()); - } - - @Override - public boolean matches(CharSequence rawPassword, String encodedPassword) { - return encodedPassword.matches(DigestUtils.md5DigestAsHex(rawPassword.toString().getBytes())); - } - - @Override - public void customize(PasswordManagementConfigurer httpSecurityPasswordManagementConfigurer) { - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/custom/CustomUser.java b/common/spring-security/src/main/java/cn/bunny/security/custom/CustomUser.java deleted file mode 100644 index 1ec748f..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/custom/CustomUser.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.bunny.security.custom; - -import cn.bunny.entity.system.SysUser; -import lombok.Getter; -import lombok.Setter; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.userdetails.User; - -import java.util.Collection; - -/** - * 重写自带的User - */ -@Getter -@Setter -public class CustomUser extends User { - private SysUser sysUser; - - public CustomUser(SysUser sysUser, Collection authorities) { - super(sysUser.getUsername(), sysUser.getPassword(), authorities); - this.sysUser = sysUser; - } -} \ No newline at end of file diff --git a/common/spring-security/src/main/java/cn/bunny/security/filter/TokenAuthenticationFilter.java b/common/spring-security/src/main/java/cn/bunny/security/filter/TokenAuthenticationFilter.java deleted file mode 100644 index dea5c18..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/filter/TokenAuthenticationFilter.java +++ /dev/null @@ -1,74 +0,0 @@ -package cn.bunny.security.filter; - -import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.utils.JwtHelper; -import com.alibaba.fastjson2.JSON; -import jakarta.servlet.FilterChain; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.util.StringUtils; -import org.springframework.web.filter.OncePerRequestFilter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class TokenAuthenticationFilter extends OncePerRequestFilter { - private final RedisTemplate redisTemplate; - - public TokenAuthenticationFilter(RedisTemplate redisTemplate) { - this.redisTemplate = redisTemplate; - } - - @Override - protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { - String token = request.getHeader("token"); - - // login请求就没token,直接放行,因为后边有其他的过滤器 - if (token == null) { - doFilter(request, response, chain); - return; - } - - // 如果是登录接口,直接放行 - UsernamePasswordAuthenticationToken authentication = getAuthentication(request); - SecurityContextHolder.getContext().setAuthentication(authentication); - chain.doFilter(request, response); - } - - private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request) { - // 请求头是否有token - String token = request.getHeader("token"); - if (StringUtils.hasText(token)) { - String username = JwtHelper.getUserName(token); - if (StringUtils.hasText(username)) { - // 当前用户信息放到ThreadLocal里面 - BaseContext.setUserId(JwtHelper.getUserId(token)); - BaseContext.setUsername(username); - - // 通过username从redis获取权限数据 - String authString = (String) redisTemplate.opsForValue().get(username); - // 把redis获取字符串权限数据转换要求集合类型 List - if (StringUtils.hasText(authString)) { - List maplist = JSON.parseArray(authString, Map.class); - System.out.println(maplist); - List authList = new ArrayList<>(); - for (Map map : maplist) { - String authority = (String) map.get("authority"); - authList.add(new SimpleGrantedAuthority(authority)); - } - return new UsernamePasswordAuthenticationToken(username, null, authList); - } else { - return new UsernamePasswordAuthenticationToken(username, null, new ArrayList<>()); - } - } - } - return null; - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/filter/TokenLoginFilter.java b/common/spring-security/src/main/java/cn/bunny/security/filter/TokenLoginFilter.java deleted file mode 100644 index 1a68dac..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/filter/TokenLoginFilter.java +++ /dev/null @@ -1,80 +0,0 @@ -package cn.bunny.security.filter; - -import cn.bunny.common.result.utils.Result; -import cn.bunny.common.service.utils.JwtHelper; -import cn.bunny.common.service.utils.ResponseUtil; -import cn.bunny.entity.system.Login; -import cn.bunny.common.result.enums.ResultCodeEnum; -import cn.bunny.security.custom.CustomUser; -import cn.bunny.security.handelr.SecurityAuthenticationFailureHandler; -import cn.bunny.security.handelr.SecurityAuthenticationSuccessHandler; -import cn.bunny.vo.system.LoginVo; -import com.alibaba.fastjson2.JSON; -import com.fasterxml.jackson.databind.ObjectMapper; -import jakarta.servlet.FilterChain; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import java.io.IOException; - -/** - * 由于SpringSecurity的登录只能是表单形式 并且用户名密码需要时username、password,可以通过继承 UsernamePasswordAuthenticationFilter 获取登录请求的参数 - * 再去设置到 UsernamePasswordAuthenticationToken 中 来改变请求传参方式、参数名等 或者也可以在登录的时候加入其他参数等等 - * 也可以在这里添加验证码、短信等的验证 - */ -public class TokenLoginFilter extends UsernamePasswordAuthenticationFilter { - private final RedisTemplate redisTemplate; - - // 构造方法 - public TokenLoginFilter(AuthenticationConfiguration authenticationConfiguration, RedisTemplate redisTemplate) throws Exception { - this.setAuthenticationSuccessHandler(new SecurityAuthenticationSuccessHandler()); - this.setAuthenticationFailureHandler(new SecurityAuthenticationFailureHandler()); - this.setPostOnly(false); - // 指定登录接口及提交方式,可以指定任意路径 - this.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/admin/system/index/login", "POST")); - this.setAuthenticationManager(authenticationConfiguration.getAuthenticationManager()); - this.redisTemplate = redisTemplate; - } - - // 登录认证 - // 获取输入的用户名和密码,调用方法认证 - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { - try { - // 获取用户信息 - LoginVo loginVo = new ObjectMapper().readValue(request.getInputStream(), LoginVo.class); - // 封装对象 - Authentication authenticationToken = new UsernamePasswordAuthenticationToken(loginVo.getUsername(), loginVo.getPassword()); - // 调用方法 - return this.getAuthenticationManager().authenticate(authenticationToken); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // 认证成功调用方法 - protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication auth) { - // 获取当前用户 - CustomUser customUser = (CustomUser) auth.getPrincipal(); - // 生成token - String token = JwtHelper.createToken(customUser.getSysUser().getId(), customUser.getSysUser().getUsername()); - - // 获取当前用户权限数据,放到Redis里面 key:username value:权限数据 - redisTemplate.opsForValue().set(customUser.getUsername(), JSON.toJSONString(customUser.getAuthorities())); - - // 返回 - Login login = Login.builder().token(token).build(); - ResponseUtil.out(response, Result.success(login)); - } - - // 认证失败调用方法 - protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) { - ResponseUtil.out(response, Result.error(null, ResultCodeEnum.LOGIN_MOBLE_ERROR)); - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAccessDeniedHandler.java b/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAccessDeniedHandler.java deleted file mode 100644 index f7747b0..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAccessDeniedHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.bunny.security.handelr; - -import cn.bunny.common.result.utils.Result; -import cn.bunny.common.result.enums.ResultCodeEnum; -import com.alibaba.fastjson2.JSON; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import lombok.SneakyThrows; -import org.springframework.security.access.AccessDeniedException; - -public class SecurityAccessDeniedHandler implements org.springframework.security.web.access.AccessDeniedHandler { - @SneakyThrows - @Override - public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) { - Result result = Result.error(ResultCodeEnum.FAIL_NO_ACCESS_DENIED); - - Object json = JSON.toJSON(result); - - // 返回响应 - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().println(json); - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationEntryPoint.java b/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationEntryPoint.java deleted file mode 100644 index 8fd92c3..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationEntryPoint.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.bunny.security.handelr; - -import cn.bunny.common.result.utils.Result; -import cn.bunny.common.result.enums.ResultCodeEnum; -import com.alibaba.fastjson2.JSON; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.AuthenticationEntryPoint; - -import java.io.IOException; - -/** - * 请求未认证接口 - */ -@Slf4j -public class SecurityAuthenticationEntryPoint implements AuthenticationEntryPoint { - @Override - public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException { - String token = response.getHeader("token"); - String message = authException.getMessage(); - // 创建结果对象 - Result result; - - if (token == null) { - result = Result.error(new Object(), ResultCodeEnum.LOGIN_AUTH); - log.info("请求未登录接口:{},用户id:{}", message, null); - } else { - result = Result.error(new Object(), ResultCodeEnum.LOGGED_IN_FROM_ANOTHER_DEVICE); - log.info("请求未授权接口:{},用户id:{}", message, token); - } - - - // 返回响应 - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().println(JSON.toJSON(result)); - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationFailureHandler.java b/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationFailureHandler.java deleted file mode 100644 index 34c21f6..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationFailureHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.bunny.security.handelr; - -import cn.bunny.common.result.utils.Result; -import com.alibaba.fastjson2.JSON; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.security.core.AuthenticationException; - -import java.io.IOException; - -public class SecurityAuthenticationFailureHandler implements org.springframework.security.web.authentication.AuthenticationFailureHandler { - @Override - public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { - // 错误消息 - String localizedMessage = exception.getLocalizedMessage(); - Result result = Result.error(localizedMessage); - - // 转成JSON - Object json = JSON.toJSON(result); - - // 返回响应 - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().println(json); - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationSuccessHandler.java b/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationSuccessHandler.java deleted file mode 100644 index 5a8727e..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/handelr/SecurityAuthenticationSuccessHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bunny.security.handelr; - -import cn.bunny.common.result.utils.Result; -import com.alibaba.fastjson2.JSON; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; - -import java.io.IOException; - -public class SecurityAuthenticationSuccessHandler implements AuthenticationSuccessHandler { - @Override - public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { - // 获取用户身份信息 - Object principal = authentication.getPrincipal(); - // 获取用户凭证信息 - // Object credentials = authentication.getCredentials(); - // 获取用户权限信息 - // Collection authorities = authentication.getAuthorities(); - - Result result = Result.success(principal); - - // 返回 - response.setContentType("application/json;charset=UTF-8"); - response.getWriter().println(JSON.toJSON(result)); - } -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/service/CustomAuthorizationManagerService.java b/common/spring-security/src/main/java/cn/bunny/security/service/CustomAuthorizationManagerService.java deleted file mode 100644 index 3c1f939..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/service/CustomAuthorizationManagerService.java +++ /dev/null @@ -1,7 +0,0 @@ -package cn.bunny.security.service; - -import org.springframework.security.authorization.AuthorizationManager; -import org.springframework.security.web.access.intercept.RequestAuthorizationContext; - -public interface CustomAuthorizationManagerService extends AuthorizationManager { -} diff --git a/common/spring-security/src/main/java/cn/bunny/security/service/CustomUserDetailsService.java b/common/spring-security/src/main/java/cn/bunny/security/service/CustomUserDetailsService.java deleted file mode 100644 index 7786e8c..0000000 --- a/common/spring-security/src/main/java/cn/bunny/security/service/CustomUserDetailsService.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.bunny.security.service; - -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UsernameNotFoundException; - -public interface CustomUserDetailsService extends org.springframework.security.core.userdetails.UserDetailsService { - /** - * 根据用户名获取用户对象(获取不到直接抛异常) - */ - @Override - UserDetails loadUserByUsername(String username) throws UsernameNotFoundException; -} diff --git a/logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10 b/logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10 deleted file mode 100644 index 1b52818..0000000 --- a/logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10 +++ /dev/null @@ -1,3 +0,0 @@ -1715325213000|2024-05-10 15:13:33|/favicon.ico|1|0|1|1|14|0|0|1 -1715325213000|2024-05-10 15:13:33|/|1|0|1|0|52|0|0|1 -1715325213000|2024-05-10 15:13:33|__total_inbound_traffic__|2|0|2|1|33|0|0|0 diff --git a/logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10.idx b/logs/service-gateway/sentinel/service-gateway-metrics.log.2024-05-10.idx deleted file mode 100644 index e69de29..0000000 diff --git a/model/pom.xml b/model/pom.xml index d08cb29..31dcd47 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -22,6 +22,12 @@ org.projectlombok lombok + + + cn.hutool + hutool-all + + com.alibaba.fastjson2 fastjson2 @@ -36,15 +42,6 @@ com.github.xiaoymin knife4j-openapi3-jakarta-spring-boot-starter - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.security - spring-security-test - + diff --git a/model/src/main/java/cn/bunny/entity/system/Login.java b/model/src/main/java/cn/bunny/entity/system/Login.java deleted file mode 100644 index 140f575..0000000 --- a/model/src/main/java/cn/bunny/entity/system/Login.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bunny.entity.system; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class Login { - private String token; -} diff --git a/model/src/main/java/cn/bunny/entity/system/RoleByUser.java b/model/src/main/java/cn/bunny/entity/system/RoleByUser.java deleted file mode 100644 index 4b1b929..0000000 --- a/model/src/main/java/cn/bunny/entity/system/RoleByUser.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bunny.entity.system; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class RoleByUser { - private List assginRoleList; - private List allRolesList; -} diff --git a/model/src/main/java/cn/bunny/entity/system/SysDept.java b/model/src/main/java/cn/bunny/entity/system/SysDept.java deleted file mode 100644 index 4565f40..0000000 --- a/model/src/main/java/cn/bunny/entity/system/SysDept.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.bunny.entity.system; - -import cn.bunny.entity.base.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.util.List; - -@Data -@Schema(description = "部门") -@TableName("sys_dept") -public class SysDept extends BaseEntity { - - private static final long serialVersionUID = 1L; - - @Schema(description = "部门名称") - @TableField("name") - private String name; - - @Schema(description = "上级部门id") - @TableField("parent_id") - private Long parentId; - - @Schema(description = "树结构") - @TableField("tree_path") - private String treePath; - - @Schema(description = "排序") - @TableField("sort_value") - private Integer sortValue; - - @Schema(description = "负责人") - @TableField("leader") - private String leader; - - @Schema(description = "电话") - @TableField("phone") - private String phone; - - @Schema(description = "状态(1正常 0停用)") - @TableField("status") - private Integer status; - - @Schema(description = "下级部门") - @TableField(exist = false) - private List children; -} \ No newline at end of file diff --git a/model/src/main/java/cn/bunny/entity/system/SysLoginLog.java b/model/src/main/java/cn/bunny/entity/system/SysLoginLog.java deleted file mode 100644 index 4675fbf..0000000 --- a/model/src/main/java/cn/bunny/entity/system/SysLoginLog.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.bunny.entity.system; - -import cn.bunny.entity.base.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serial; -import java.util.Date; - -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(description = "SysLoginLog") -@TableName("sys_login_log") -public class SysLoginLog extends BaseEntity { - - @Serial - private static final long serialVersionUID = 1L; - - @Schema(description = "用户账号") - @TableField("username") - private String username; - - @Schema(description = "登录IP地址") - @TableField("ipaddr") - private String ipaddr; - - @Schema(description = "登录状态(0成功 1失败)") - @TableField("status") - private Integer status; - - @Schema(description = "提示信息") - @TableField("msg") - private String msg; - - @Schema(description = "访问时间") - @TableField("access_time") - private Date accessTime; - -} \ No newline at end of file diff --git a/model/src/main/java/cn/bunny/entity/system/SysMenu.java b/model/src/main/java/cn/bunny/entity/system/SysMenu.java deleted file mode 100644 index 75e4dde..0000000 --- a/model/src/main/java/cn/bunny/entity/system/SysMenu.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.bunny.entity.system; - -import cn.bunny.entity.base.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serial; -import java.util.List; - -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(description = "菜单") -@TableName("sys_menu") -public class SysMenu extends BaseEntity { - - @Serial - private static final long serialVersionUID = 1L; - - @Schema(description = "所属上级") - @TableField("parent_id") - private Long parentId; - - @Schema(description = "名称") - @TableField("name") - private String name; - - @Schema(description = "类型(1:菜单,2:按钮)") - @TableField("type") - private Integer type; - - @Schema(description = "路由地址") - @TableField("path") - private String path; - - @Schema(description = "组件路径") - @TableField("component") - private String component; - - @Schema(description = "权限标识") - @TableField("perms") - private String perms; - - @Schema(description = "图标") - @TableField("icon") - private String icon; - - @Schema(description = "排序") - @TableField("sort_description") - private Integer sortdescription; - - @Schema(description = "状态(0:禁止,1:正常)") - @TableField("status") - private Integer status; - - // 下级列表 - @TableField(exist = false) - private List children; - // 是否选中 - @TableField(exist = false) - private boolean isSelect; -} - diff --git a/model/src/main/java/cn/bunny/entity/system/SysRole.java b/model/src/main/java/cn/bunny/entity/system/SysRole.java deleted file mode 100644 index 28b720d..0000000 --- a/model/src/main/java/cn/bunny/entity/system/SysRole.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.bunny.entity.system; - -import cn.bunny.entity.base.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serial; - - -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(description = "角色") -@TableName("sys_role") -public class SysRole extends BaseEntity { - @Serial - private static final long serialVersionUID = 1L; - - //@NotBlank(message = "角色名称不能为空") - @Schema(description = "角色名称") - @TableField("role_name") - private String roleName; - - @Schema(description = "角色编码") - @TableField("role_code") - private String roleCode; - - @Schema(description = "描述") - @TableField("description") - private String description; -} - diff --git a/model/src/main/java/cn/bunny/entity/system/SysUser.java b/model/src/main/java/cn/bunny/entity/system/SysUser.java deleted file mode 100644 index 1000b92..0000000 --- a/model/src/main/java/cn/bunny/entity/system/SysUser.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.bunny.entity.system; - -import cn.bunny.entity.base.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serial; -import java.util.List; - -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(description = "用户") -@TableName("sys_user") -public class SysUser extends BaseEntity { - - @Serial - private static final long serialVersionUID = 1L; - - @Schema(description = "用户名") - @TableField("username") - private String username; - - @Schema(description = "密码") - @TableField("password") - private String password; - - @Schema(description = "姓名") - @TableField("name") - private String name; - - @Schema(description = "手机") - @TableField("phone") - private String phone; - - @Schema(description = "头像地址") - @TableField("head_url") - private String headUrl; - - @Schema(description = "部门id") - @TableField("dept_id") - private Long deptId; - - @Schema(description = "岗位id") - @TableField("post_id") - private Long postId; - - @Schema(description = "描述") - @TableField("description") - private String description; - - @Schema(description = "openId") - @TableField("open_id") - private String openId; - - @Schema(description = "状态(1:正常 0:停用)") - @TableField("status") - private Integer status; - - @TableField(exist = false) - private List roleList; - // 岗位 - @TableField(exist = false) - private String postName; - // 部门 - @TableField(exist = false) - private String deptName; -} - diff --git a/model/src/main/java/cn/bunny/entity/system/SysUserinfo.java b/model/src/main/java/cn/bunny/entity/system/SysUserinfo.java deleted file mode 100644 index 731524f..0000000 --- a/model/src/main/java/cn/bunny/entity/system/SysUserinfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bunny.entity.system; - -import cn.bunny.vo.system.RouterVo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.HashSet; -import java.util.List; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class SysUserinfo { - private HashSet roles; - private String name; - private String avatar; - private List buttons; - private List routers; -} diff --git a/model/src/main/java/cn/bunny/vo/system/LoginVo.java b/model/src/main/java/cn/bunny/vo/system/LoginVo.java index 1630ed7..e884fc7 100644 --- a/model/src/main/java/cn/bunny/vo/system/LoginVo.java +++ b/model/src/main/java/cn/bunny/vo/system/LoginVo.java @@ -1,26 +1,34 @@ package cn.bunny.vo.system; - +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.time.LocalDateTime; + /** - * 登录对象 + * 用户登录返回内容 */ @Data -@Builder @AllArgsConstructor @NoArgsConstructor +@Builder public class LoginVo { - /** - * 手机号 - */ - private String username; - - /** - * 密码 - */ - private String password; + private String userId; + private String nickName; + private String email; + private Integer sex; + private String personDescription; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime joinTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime lastLoginTime; + private String lastLoginIp; + private String lastLoginIpAddress; + private Integer totalIntegral; + private Integer currentIntegral; + private Byte status; + private String token; } diff --git a/model/src/main/java/cn/bunny/vo/system/MetaVo.java b/model/src/main/java/cn/bunny/vo/system/MetaVo.java deleted file mode 100644 index 9e9b567..0000000 --- a/model/src/main/java/cn/bunny/vo/system/MetaVo.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bunny.vo.system; - -import lombok.Data; - -/** - * 路由显示信息 - */ -@Data -public class MetaVo { - /** - * 设置该路由在侧边栏和面包屑中展示的名字 - */ - private String title; - - /** - * 设置该路由的图标,对应路径src/assets/icons/svg - */ - private String icon; - - public MetaVo() { - } - - public MetaVo(String title, String icon) { - this.title = title; - this.icon = icon; - } - -} - diff --git a/model/src/main/java/cn/bunny/vo/system/RouterVo.java b/model/src/main/java/cn/bunny/vo/system/RouterVo.java deleted file mode 100644 index 97f63dc..0000000 --- a/model/src/main/java/cn/bunny/vo/system/RouterVo.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bunny.vo.system; - -import lombok.Data; - -import java.util.List; - -/** - * 路由配置信息 - */ -@Data -public class RouterVo { - /** - * 路由名字 - */ - // private String name; - - /** - * 路由地址 - */ - private String path; - - /** - * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 - */ - private boolean hidden; - - /** - * 组件地址 - */ - private String component; - - /** - * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 - */ - private Boolean alwaysShow; - - /** - * 其他元素 - */ - private MetaVo meta; - - /** - * 子路由 - */ - private List children; - - -} diff --git a/model/src/main/java/cn/bunny/vo/system/SysOperLogQueryVo.java b/model/src/main/java/cn/bunny/vo/system/SysOperLogQueryVo.java deleted file mode 100644 index ee61375..0000000 --- a/model/src/main/java/cn/bunny/vo/system/SysOperLogQueryVo.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bunny.vo.system; - -import lombok.Data; - -@Data -public class SysOperLogQueryVo { - - private String title; - private String operName; - - private String createTimeBegin; - private String createTimeEnd; - -} - diff --git a/model/src/main/java/cn/bunny/vo/system/SysPostQueryVo.java b/model/src/main/java/cn/bunny/vo/system/SysPostQueryVo.java deleted file mode 100644 index d57396a..0000000 --- a/model/src/main/java/cn/bunny/vo/system/SysPostQueryVo.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bunny.vo.system; - -import lombok.Data; - -@Data -public class SysPostQueryVo { - - //@ApiModelProperty(value = "岗位编码") - private String postCode; - - //@ApiModelProperty(value = "岗位名称") - private String name; - - //@ApiModelProperty(value = "状态(1正常 0停用)") - private Boolean status; - - -} - diff --git a/module/module-mail/src/main/java/cn/bunny/module/mail/utils/MailSendCheckUtil.java b/module/module-mail/src/main/java/cn/bunny/module/mail/utils/MailSendCheckUtil.java index 6ac37b5..4d2de49 100644 --- a/module/module-mail/src/main/java/cn/bunny/module/mail/utils/MailSendCheckUtil.java +++ b/module/module-mail/src/main/java/cn/bunny/module/mail/utils/MailSendCheckUtil.java @@ -1,6 +1,6 @@ package cn.bunny.module.mail.utils; -import cn.bunny.common.constant.MailMessageConstant; +import cn.bunny.common.result.constant.MailMessageConstant; import cn.bunny.common.service.utils.EmptyUtil; import cn.bunny.entity.email.EmailSend; diff --git a/module/module-minio/src/main/java/cn/bunny/module/minio/utils/MinioUtil.java b/module/module-minio/src/main/java/cn/bunny/module/minio/utils/MinioUtil.java index 41eb90f..f60fa1c 100644 --- a/module/module-minio/src/main/java/cn/bunny/module/minio/utils/MinioUtil.java +++ b/module/module-minio/src/main/java/cn/bunny/module/minio/utils/MinioUtil.java @@ -1,6 +1,6 @@ package cn.bunny.module.minio.utils; -import cn.bunny.common.constant.MinioMessageConstant; +import cn.bunny.common.result.constant.MinioMessageConstant; import cn.bunny.common.service.exception.BunnyException; import io.minio.*; import io.minio.messages.*; diff --git a/module/module-rabbitMQ/pom.xml b/module/module-rabbitMQ/pom.xml index 29884a1..e949a2f 100644 --- a/module/module-rabbitMQ/pom.xml +++ b/module/module-rabbitMQ/pom.xml @@ -29,7 +29,6 @@ com.fasterxml.jackson.dataformat jackson-dataformat-xml - 2.16.0-rc1 diff --git a/common/spring-security/pom.xml b/module/module-websocket/pom.xml similarity index 70% rename from common/spring-security/pom.xml rename to module/module-websocket/pom.xml index bcaa7a1..e3b9b40 100644 --- a/common/spring-security/pom.xml +++ b/module/module-websocket/pom.xml @@ -3,14 +3,14 @@ 4.0.0 cn.bunny - common + module 0.0.1-SNAPSHOT - spring-security + module-websocket jar - spring-security + module-websocket https://maven.apache.org @@ -18,10 +18,10 @@ + - cn.bunny - service-utils - 0.0.1-SNAPSHOT + org.springframework.boot + spring-boot-starter-websocket diff --git a/service/service-main/src/main/java/cn/bunny/service/websocket/WebSocketServer.java b/module/module-websocket/src/main/java/cn/bunny/module/websocket/WebSocketServer.java similarity index 98% rename from service/service-main/src/main/java/cn/bunny/service/websocket/WebSocketServer.java rename to module/module-websocket/src/main/java/cn/bunny/module/websocket/WebSocketServer.java index d528711..2d84cc6 100644 --- a/service/service-main/src/main/java/cn/bunny/service/websocket/WebSocketServer.java +++ b/module/module-websocket/src/main/java/cn/bunny/module/websocket/WebSocketServer.java @@ -1,4 +1,4 @@ -package cn.bunny.service.websocket; +package cn.bunny.module.websocket; import jakarta.websocket.OnClose; import jakarta.websocket.OnMessage; diff --git a/pom.xml b/pom.xml index c6bfcbb..64fa9da 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -30,6 +30,7 @@ 22 22 21 + 3.8.1 3.5.6 8.0.30 4.5.0 @@ -39,10 +40,22 @@ 0.9.1 3.3.3 2.10.1 - 1.9.21 + 1.9.21 + 2023.0.1 + 2.16.0-rc1 + 2023.0.1.0 + 2023.0.0.0-RC1 + 4.1.2 + 6.1.0 + + + junit + junit + ${junit.version} + com.baomidou @@ -83,7 +96,7 @@ cn.hutool hutool-all - 5.8.25 + 5.8.27 @@ -101,19 +114,62 @@ org.aspectj aspectjrt - ${aspectj} + ${aspectj.version} org.aspectj aspectjweaver - ${aspectj} + ${aspectj.version} joda-time joda-time ${jodatime.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson-dataformat.version} + + + + org.springframework.cloud + spring-cloud-dependencies + ${cloud.version} + pom + import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${alibaba.version} + pom + import + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + ${discovery.version} + + + + org.springframework.cloud + spring-cloud-starter-loadbalancer + ${loadbalancer.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.12.3 + + + com.github.pagehelper + pagehelper + ${pagehelper.version} + diff --git a/server-gateway/pom.xml b/server-gateway/pom.xml index d60d984..9efc13e 100644 --- a/server-gateway/pom.xml +++ b/server-gateway/pom.xml @@ -1,4 +1,4 @@ - 4.0.0 @@ -21,6 +21,17 @@ + + cn.bunny + common-result + 0.0.1-SNAPSHOT + + + com.baomidou + mybatis-plus-spring-boot3-starter + + + org.springframework.cloud diff --git a/server-gateway/src/main/java/cn/bunny/service/gateway/GatewayApplication.java b/server-gateway/src/main/java/cn/bunny/service/gateway/GatewayApplication.java index a45d16e..7f27648 100644 --- a/server-gateway/src/main/java/cn/bunny/service/gateway/GatewayApplication.java +++ b/server-gateway/src/main/java/cn/bunny/service/gateway/GatewayApplication.java @@ -4,8 +4,10 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication +@EnableScheduling// 定时任务 @ComponentScan("cn.bunny") @Slf4j public class GatewayApplication { diff --git a/server-gateway/src/main/java/cn/bunny/service/gateway/controller/IndexController.java b/server-gateway/src/main/java/cn/bunny/service/gateway/controller/IndexController.java index 1f232cd..4936f98 100644 --- a/server-gateway/src/main/java/cn/bunny/service/gateway/controller/IndexController.java +++ b/server-gateway/src/main/java/cn/bunny/service/gateway/controller/IndexController.java @@ -1,6 +1,6 @@ package cn.bunny.service.gateway.controller; -import com.alibaba.nacos.api.model.v2.Result; +import cn.bunny.common.result.utils.Result; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/server-gateway/src/main/resources/application-dev.yml b/server-gateway/src/main/resources/application-dev.yml index e1f8308..25ba079 100644 --- a/server-gateway/src/main/resources/application-dev.yml +++ b/server-gateway/src/main/resources/application-dev.yml @@ -2,7 +2,7 @@ bunny: nacos: server-addr: z-bunny.cn:8848 discovery: - namespace: spzx + namespace: bunnyBBS redis: host: 47.120.65.66 diff --git a/server-gateway/src/main/resources/application.yml b/server-gateway/src/main/resources/application.yml index f9b812f..88a1647 100644 --- a/server-gateway/src/main/resources/application.yml +++ b/server-gateway/src/main/resources/application.yml @@ -1,14 +1,13 @@ server: - port: 8500 + port: 8800 spring: profiles: active: dev application: name: service-gateway -# main: -# web-application-type: reactive - # allow-bean-definition-overriding: true - + main: + web-application-type: reactive + allow-bean-definition-overriding: true cloud: sentinel: log: @@ -24,11 +23,16 @@ spring: locator: enabled: true # 路由 -# routes: -# - id: service-product -# uri: lb://service-product -# predicates: -# - Path=/*/product/** + routes: + - id: service-web + uri: lb://service-web + predicates: + - Path=/api/** + - id: service-admin + uri: lb://service-admin + predicates: + - Path=/admin/** + data: redis: host: ${bunny.redis.host} diff --git a/server-gateway/src/test/java/cn/bunny/AppTest.java b/server-gateway/src/test/java/cn/bunny/AppTest.java deleted file mode 100644 index 34b54ff..0000000 --- a/server-gateway/src/test/java/cn/bunny/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.bunny; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/service-client/pom.xml b/service-client/pom.xml index cc8e314..55bac23 100644 --- a/service-client/pom.xml +++ b/service-client/pom.xml @@ -1,4 +1,4 @@ - 4.0.0 @@ -18,6 +18,26 @@ + + cn.bunny + model + 0.0.1-SNAPSHOT + + + cn.bunny + common-result + 0.0.1-SNAPSHOT + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.cloud + spring-cloud-loadbalancer + diff --git a/service/pom.xml b/service/pom.xml index e96729f..d3d3c9d 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -12,19 +12,19 @@ service https://maven.apache.org - service-main + service-web + service-admin UTF-8 - + - + junit junit - 3.8.1 diff --git a/service/service-main/Dockerfile b/service/service-main/Dockerfile deleted file mode 100644 index 447a2bc..0000000 --- a/service/service-main/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM openjdk:21 -MAINTAINER bunny - -#系统编码 -ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 - -# 设置时区,构建镜像时执行的命令 -RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -RUN echo "Asia/Shanghai" > /etc/timezone - -# 设定工作目录 -WORKDIR /home/bunny - -# 复制jar包 -COPY target/*.jar /home/bunny/app.jar - -#启动容器时的进程 -ENTRYPOINT ["java","-jar","/home/bunny/app.jar"] - -#暴露 8800 端口 -EXPOSE 8800 \ No newline at end of file diff --git a/service/service-main/pom.xml b/service/service-main/pom.xml deleted file mode 100644 index 61996d4..0000000 --- a/service/service-main/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - 4.0.0 - - cn.bunny - service - 0.0.1-SNAPSHOT - - - service-main - jar - - service-main - https://maven.apache.org - - - UTF-8 - 192.168.3.98:1100 - 192.168.3.98:2375 - bunny-service - - - - - cn.bunny - spring-security - 0.0.1-SNAPSHOT - - - - cn.bunny - service-utils - 0.0.1-SNAPSHOT - - - cn.bunny - module-mail - 0.0.1-SNAPSHOT - - - cn.bunny - module-minio - 0.0.1-SNAPSHOT - - - - org.springframework.boot - spring-boot-starter-websocket - - - - org.aspectj - aspectjrt - - - org.aspectj - aspectjweaver - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - com.spotify - docker-maven-plugin - 1.2.2 - - - - build-image - - package - - build - push - - - - - harbor - http://${docker.repostory} - - http://${docker.host} - - - ${docker.repostory}/${docker.registry.name}/${project.artifactId}:${project.version} - - - ${project.basedir} - - false - - - - - diff --git a/service/service-main/src/main/java/cn/bunny/service/ServiceApplication.java b/service/service-main/src/main/java/cn/bunny/service/ServiceApplication.java deleted file mode 100644 index 9ad3a84..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/ServiceApplication.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bunny.service; - -import lombok.extern.slf4j.Slf4j; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.scheduling.annotation.EnableScheduling; - -@ComponentScan(basePackages = {"cn.bunny"}) -@MapperScan("cn.bunny.service.mapper") -@EnableScheduling// 定时任务 -@EnableCaching// 开启缓存注解 -@SpringBootApplication -@Slf4j -public class ServiceApplication { - public static void main(String[] args) { - log.info("ServiceApplication启动..."); - SpringApplication.run(ServiceApplication.class, args); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/aop/annotation/AutoFill.java b/service/service-main/src/main/java/cn/bunny/service/aop/annotation/AutoFill.java deleted file mode 100644 index 8c26d32..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/aop/annotation/AutoFill.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bunny.service.aop.annotation; - -import cn.bunny.enums.OperationType; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface AutoFill { - // 数据库操作类型 - OperationType value(); -} diff --git a/service/service-main/src/main/java/cn/bunny/service/aop/aspect/AutoFillAspect.java b/service/service-main/src/main/java/cn/bunny/service/aop/aspect/AutoFillAspect.java deleted file mode 100644 index 7d2fc45..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/aop/aspect/AutoFillAspect.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bunny.service.aop.aspect; - -import lombok.extern.slf4j.Slf4j; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; -import org.springframework.stereotype.Component; - -@Aspect -@Component -@Slf4j -public class AutoFillAspect { - @Pointcut("execution(* cn.bunny.service.*.*(..))") - public void autoFillPointcut() { - } - - /** - * 之前操作 - * - * @param joinPoint 参数 - */ - @Before("autoFillPointcut()") - public void autoFill(JoinPoint joinPoint) { - log.info("开始进行自动填充"); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/controller/BaseController.java b/service/service-main/src/main/java/cn/bunny/service/controller/BaseController.java deleted file mode 100644 index c383e52..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/controller/BaseController.java +++ /dev/null @@ -1,59 +0,0 @@ -package cn.bunny.service.controller; - -import cn.bunny.common.result.utils.Result; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.session.SessionInformation; -import org.springframework.security.core.session.SessionRegistry; -import org.springframework.security.core.userdetails.User; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@Tag(name = "后台登录管理") -@RestController -@RequestMapping("/") -public class BaseController { - @Autowired - private SessionRegistry sessionRegistry; - - @GetMapping() - public String index() { - return "欢迎访问"; - } - - @Operation(summary = "Security上下文对象", description = "Security上下文对象") - @GetMapping("/test/getSecurityHolder") - public Result getSecurityHolder() { - SecurityContext context = SecurityContextHolder.getContext(); - return Result.success(context); - } - - @Operation(summary = "当前所有登录的用户", description = "当前所有登录的用户") - @GetMapping("/test/getAllUserLogin") - public Result getAllUserLogin() { - return Result.success(sessionRegistry.getAllPrincipals()); - } - - @Operation(summary = "剔除下线", description = "剔除下线") - @GetMapping("/test/killOut") - public Result killOut(String userId) { - List allPrincipals = sessionRegistry.getAllPrincipals(); - for (Object allPrincipal : allPrincipals) { - // 获取当前所有已经登录session会话:未失效的session - List allSessions = sessionRegistry.getAllSessions(allPrincipal, false); - User user = (User) allPrincipals; - - // 如果用户名匹配将这个用户下线 - if (user.getUsername().equals(userId)) { - allSessions.forEach(SessionInformation::expireNow); - } - } - return Result.success(); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/controller/IndexController.java b/service/service-main/src/main/java/cn/bunny/service/controller/IndexController.java deleted file mode 100644 index dfaa2dc..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/controller/IndexController.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.bunny.service.controller; - -import cn.bunny.common.result.utils.Result; -import cn.bunny.entity.system.Login; -import cn.bunny.entity.system.SysUserinfo; -import cn.bunny.service.service.SysUserService; -import cn.bunny.vo.system.LoginVo; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.servlet.http.HttpServletRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - *

- * 后台登录登出 - *

- */ -@Tag(name = "后台登录管理") -@RestController -@RequestMapping("/admin/system/index") -public class IndexController { - @Autowired - private SysUserService sysUserService; - - @Operation(summary = "登录", description = "登录") - @PostMapping("login") - public Result login(@RequestBody LoginVo loginVo) { - Login login = sysUserService.login(loginVo); - return Result.success(login); - } - - @Operation(summary = "获取用户信息", description = "获取用户信息") - @GetMapping("info") - public Result info(HttpServletRequest request) { - SysUserinfo userinfo = sysUserService.getUserinfo(request); - return Result.success(userinfo); - } - - @Operation(summary = "退出", description = "退出") - @GetMapping("logout") - public Result> logout() { - return Result.success(); - } -} \ No newline at end of file diff --git a/service/service-main/src/main/java/cn/bunny/service/controller/MailController.java b/service/service-main/src/main/java/cn/bunny/service/controller/MailController.java deleted file mode 100644 index 58f363f..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/controller/MailController.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.bunny.service.controller; - -import cn.bunny.common.result.utils.Result; -import cn.bunny.entity.email.EmailSend; -import cn.bunny.service.service.EmailService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@Tag(name = "发送邮件") -@RequestMapping("/test/mail") -@Slf4j -public class MailController { - @Autowired - private EmailService emailService; - - @Operation(summary = "发送简单邮件", description = "发送简单邮件") - @PostMapping("/send-text") - public Result sendText(@RequestBody EmailSend emailSend) { - log.info("发送简单邮件"); - emailService.sendSimpleEmail(emailSend); - return Result.success(); - } - - @Operation(summary = "发送带附件邮件", description = "发送带附件邮件") - @PostMapping("send-attachment") - public Result sendAttachment(@RequestBody EmailSend emailSend) { - log.info("发送带附件邮件"); - boolean isSuccess = emailService.sendAttachmentEmail(emailSend); - return isSuccess ? Result.success() : Result.error(); - } - - @Operation(summary = "发送富文本邮件", description = "发送富文本邮件") - @PostMapping("send-rich") - public Result sendRich(@RequestBody EmailSend emailSend) { - log.info("发送富文本邮件"); - - boolean isSuccess = emailService.sendRich(emailSend); - return isSuccess ? Result.success() : Result.error(); - } - - @Operation(summary = "发送带抄送的邮件", description = "发送带抄送的邮件") - @PostMapping("send-cc") - public Result sendCC(@RequestBody EmailSend emailSend) { - log.info("发送带抄送的邮件"); - boolean isSuccess = emailService.sendCC(emailSend); - return isSuccess ? Result.success() : Result.error(); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/controller/SysMenuController.java b/service/service-main/src/main/java/cn/bunny/service/controller/SysMenuController.java deleted file mode 100644 index a596845..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/controller/SysMenuController.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bunny.service.controller; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - *

- * 菜单表 前端控制器 - *

- * - * @author Bunny - * @since 2024-05-06 - */ -@RestController -@RequestMapping("/sysMenu") -public class SysMenuController { - -} diff --git a/service/service-main/src/main/java/cn/bunny/service/mapper/SysMenuMapper.java b/service/service-main/src/main/java/cn/bunny/service/mapper/SysMenuMapper.java deleted file mode 100644 index 505d0f9..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/mapper/SysMenuMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bunny.service.mapper; - -import cn.bunny.entity.system.SysMenu; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 菜单表 Mapper 接口 - *

- * - * @author Bunny - * @since 2024-05-06 - */ -public interface SysMenuMapper extends BaseMapper { - -} diff --git a/service/service-main/src/main/java/cn/bunny/service/mapper/SysRoleMapper.java b/service/service-main/src/main/java/cn/bunny/service/mapper/SysRoleMapper.java deleted file mode 100644 index c80954c..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/mapper/SysRoleMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package cn.bunny.service.mapper; - -import cn.bunny.entity.system.SysRole; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -public interface SysRoleMapper extends BaseMapper { -} diff --git a/service/service-main/src/main/java/cn/bunny/service/mapper/SysUserMapper.java b/service/service-main/src/main/java/cn/bunny/service/mapper/SysUserMapper.java deleted file mode 100644 index 345d10f..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/mapper/SysUserMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bunny.service.mapper; - - -import cn.bunny.entity.system.SysUser; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - *

- * 用户表 Mapper 接口 - *

- * - * @author bunny - * @since 2024-04-22 - */ -@Mapper -public interface SysUserMapper extends BaseMapper { - -} diff --git a/service/service-main/src/main/java/cn/bunny/service/security/CustomAuthorizationManagerServiceImpl.java b/service/service-main/src/main/java/cn/bunny/service/security/CustomAuthorizationManagerServiceImpl.java deleted file mode 100644 index 6c3fccb..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/security/CustomAuthorizationManagerServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.bunny.service.security; - -import cn.bunny.security.service.CustomAuthorizationManagerService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.authorization.AuthorizationDecision; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.access.intercept.RequestAuthorizationContext; -import org.springframework.stereotype.Service; - -import java.util.function.Supplier; - - -/** - * 自定义权限判断 - * 判断用户有哪些权限 - */ -@Service -@Slf4j -public class CustomAuthorizationManagerServiceImpl implements CustomAuthorizationManagerService { - @Override - public void verify(Supplier authentication, RequestAuthorizationContext requestAuthorizationContext) { - CustomAuthorizationManagerService.super.verify(authentication, requestAuthorizationContext); - } - - @Override - public AuthorizationDecision check(Supplier authentication, RequestAuthorizationContext object) { - String token = object.getRequest().getHeader("token"); - - if (token == null) { - throw new AccessDeniedException(""); - } - - return new AuthorizationDecision(true); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/security/CustomUserDetailsService.java b/service/service-main/src/main/java/cn/bunny/service/security/CustomUserDetailsService.java deleted file mode 100644 index b4d248b..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/security/CustomUserDetailsService.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.bunny.service.security; - -import cn.bunny.common.constant.CommonMessageConstant; -import cn.bunny.common.service.exception.BunnyException; -import cn.bunny.entity.system.SysRole; -import cn.bunny.entity.system.SysUser; -import cn.bunny.security.custom.CustomUser; -import cn.bunny.service.mapper.SysRoleMapper; -import cn.bunny.service.mapper.SysUserMapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.core.authority.AuthorityUtils; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UsernameNotFoundException; - -import java.util.List; - -@Configuration -public class CustomUserDetailsService implements cn.bunny.security.service.CustomUserDetailsService { - @Autowired - private SysUserMapper sysUserMapper; - @Autowired - private SysRoleMapper sysRoleMapper; - - @Override - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - SysUser sysUser = sysUserMapper.selectOne(Wrappers.lambdaQuery().eq(SysUser::getUsername, username)); - List sysRoleList = sysRoleMapper.selectList(null); - if (sysUser == null) { - throw new UsernameNotFoundException(CommonMessageConstant.USER_DOES_NOT_EXIST); - } - - if (sysUser.getStatus() == 0) { - throw new BunnyException(CommonMessageConstant.ACCOUNT_LOCKED); - } - - List roleAuthoritieList = sysRoleList.stream().map(SysRole::getRoleCode).toList(); - return new CustomUser(sysUser, AuthorityUtils.createAuthorityList(roleAuthoritieList)); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/EmailService.java b/service/service-main/src/main/java/cn/bunny/service/service/EmailService.java deleted file mode 100644 index afdcd89..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/EmailService.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.bunny.service.service; - - -import cn.bunny.entity.email.EmailSend; - -public interface EmailService { - /** - * 发送邮件-简单 - * - * @param emailSend 邮件消息 - */ - void sendSimpleEmail(EmailSend emailSend); - - /** - * 发送带附件邮件 - * - * @param emailSend 邮件消息 - * @return 是否成功 - */ - boolean sendAttachmentEmail(EmailSend emailSend); - - /** - * 发送富文本邮件 - * - * @param emailSend 邮件消息 - * @return 是否成功 - */ - boolean sendRich(EmailSend emailSend); - - /** - * 发送带抄送的邮件 - * - * @param emailSend 邮件消息 - * @return 是否成功 - */ - boolean sendCC(EmailSend emailSend); -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/SysMenuService.java b/service/service-main/src/main/java/cn/bunny/service/service/SysMenuService.java deleted file mode 100644 index 8e484f8..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/SysMenuService.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bunny.service.service; - -import cn.bunny.entity.system.SysMenu; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 菜单表 服务类 - *

- * - * @author Bunny - * @since 2024-05-06 - */ -public interface SysMenuService extends IService { - -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/SysRoleService.java b/service/service-main/src/main/java/cn/bunny/service/service/SysRoleService.java deleted file mode 100644 index 8e5a33c..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/SysRoleService.java +++ /dev/null @@ -1,8 +0,0 @@ -package cn.bunny.service.service; - -import cn.bunny.entity.system.SysRole; -import com.baomidou.mybatisplus.extension.service.IService; - -public interface SysRoleService extends IService { - -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/SysUserService.java b/service/service-main/src/main/java/cn/bunny/service/service/SysUserService.java deleted file mode 100644 index c486a78..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/SysUserService.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bunny.service.service; - - -import cn.bunny.entity.system.Login; -import cn.bunny.entity.system.SysUser; -import cn.bunny.entity.system.SysUserinfo; -import cn.bunny.vo.system.LoginVo; -import com.baomidou.mybatisplus.extension.service.IService; -import jakarta.servlet.http.HttpServletRequest; - -/** - *

- * 用户表 服务类 - *

- * - * @author bunny - * @since 2024-04-22 - */ -public interface SysUserService extends IService { - /** - * 登录 - * - * @param vo 登录条件 - * @return 返回token - */ - Login login(LoginVo vo); - - /** - * 获取用户信息 - * - * @param request 请求头 - * @return 用户信息 - */ - SysUserinfo getUserinfo(HttpServletRequest request); - - /** - * 根据用户名查询用户信息 - * - * @param username 用户名 - * @return 用户信息 - */ - SysUser getByUsername(String username); -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/impl/EmailServiceImpl.java b/service/service-main/src/main/java/cn/bunny/service/service/impl/EmailServiceImpl.java deleted file mode 100644 index 1c90bec..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/impl/EmailServiceImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package cn.bunny.service.service.impl; - -import cn.bunny.entity.email.EmailSend; -import cn.bunny.entity.email.EmailSendInit; -import cn.bunny.module.mail.utils.MailSenderUtil; -import cn.bunny.service.service.EmailService; -import jakarta.mail.MessagingException; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Service -@Slf4j -public class EmailServiceImpl implements EmailService { - - /** - * 发送邮件-简单 - * - * @param emailSend 邮件消息 - */ - @Override - public void sendSimpleEmail(EmailSend emailSend) { - EmailSendInit emailSendInit = new EmailSendInit(); - emailSendInit.setHost("smtp.qq.com"); - emailSendInit.setPort(465); - emailSendInit.setUsername("3324855376@qq.com"); - emailSendInit.setPassword("axyqbvfuxkdqdaai"); - MailSenderUtil mailSenderUtil = new MailSenderUtil(emailSendInit); - mailSenderUtil.sendSimpleEmail(emailSend); - } - - /** - * 发送带附件邮件 - * - * @param emailSend 邮件消息 - * @return 是否成功 - */ - @Override - public boolean sendAttachmentEmail(EmailSend emailSend) { - try { - EmailSendInit emailSendInit = new EmailSendInit(); - emailSendInit.setHost("smtp.qq.com"); - emailSendInit.setPort(465); - emailSendInit.setUsername("3324855376@qq.com"); - emailSendInit.setPassword("axyqbvfuxkdqdaai"); - - MailSenderUtil mailSenderUtil = new MailSenderUtil(emailSendInit); - mailSenderUtil.sendEmail(emailSend); - return true; - } catch (MessagingException e) { - return false; - } - } - - /** - * 发送富文本邮件 - * - * @param emailSend 邮件消息 - * @return 是否成功 - */ - @Override - public boolean sendRich(EmailSend emailSend) { - try { - EmailSendInit emailSendInit = new EmailSendInit(); - emailSendInit.setHost("smtp.qq.com"); - emailSendInit.setPort(465); - emailSendInit.setUsername("3324855376@qq.com"); - emailSendInit.setPassword("axyqbvfuxkdqdaai"); - - MailSenderUtil mailSenderUtil = new MailSenderUtil(emailSendInit); - mailSenderUtil.sendRichText(emailSend, true); - return true; - } catch (MessagingException e) { - return false; - } - } - - /** - * 发送带抄送的邮件 - * - * @param emailSend 邮件消息 - */ - @Override - public boolean sendCC(EmailSend emailSend) { - try { - EmailSendInit emailSendInit = new EmailSendInit(); - emailSendInit.setHost("smtp.qq.com"); - emailSendInit.setPort(465); - emailSendInit.setUsername("3324855376@qq.com"); - emailSendInit.setPassword("axyqbvfuxkdqdaai"); - - MailSenderUtil mailSenderUtil = new MailSenderUtil(emailSendInit); - mailSenderUtil.sendCC(emailSend, true); - return true; - } catch (MessagingException e) { - return false; - } - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/impl/SysMenuServiceImpl.java b/service/service-main/src/main/java/cn/bunny/service/service/impl/SysMenuServiceImpl.java deleted file mode 100644 index f58f687..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/impl/SysMenuServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.bunny.service.service.impl; - -import cn.bunny.entity.system.SysMenu; -import cn.bunny.service.mapper.SysMenuMapper; -import cn.bunny.service.service.SysMenuService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 菜单表 服务实现类 - *

- * - * @author Bunny - * @since 2024-05-06 - */ -@Service -public class SysMenuServiceImpl extends ServiceImpl implements SysMenuService { - -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/impl/SysRoleServiceImpl.java b/service/service-main/src/main/java/cn/bunny/service/service/impl/SysRoleServiceImpl.java deleted file mode 100644 index 5dbbb4a..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/impl/SysRoleServiceImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.bunny.service.service.impl; - -import cn.bunny.entity.system.SysRole; -import cn.bunny.service.mapper.SysRoleMapper; -import cn.bunny.service.service.SysRoleService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -@Service -public class SysRoleServiceImpl extends ServiceImpl implements SysRoleService { -} diff --git a/service/service-main/src/main/java/cn/bunny/service/service/impl/SysUserServiceImpl.java b/service/service-main/src/main/java/cn/bunny/service/service/impl/SysUserServiceImpl.java deleted file mode 100644 index 73897ae..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/service/impl/SysUserServiceImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -package cn.bunny.service.service.impl; - -import cn.bunny.common.constant.CommonMessageConstant; -import cn.bunny.common.service.exception.BunnyException; -import cn.bunny.common.service.utils.JwtHelper; -import cn.bunny.entity.system.Login; -import cn.bunny.entity.system.SysUser; -import cn.bunny.entity.system.SysUserinfo; -import cn.bunny.service.mapper.SysUserMapper; -import cn.bunny.service.service.SysUserService; -import cn.bunny.vo.system.LoginVo; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import jakarta.servlet.http.HttpServletRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.util.DigestUtils; - -/** - *

- * 用户表 服务实现类 - *

- * - * @author bunny - * @since 2024-04-22 - */ -@Service -public class SysUserServiceImpl extends ServiceImpl implements SysUserService { - @Autowired - private RedisTemplate redisTemplate; - - /** - * 登录 - * - * @param vo 登录条件 - * @return 返回token - */ - @Override - public Login login(LoginVo vo) { - String username = vo.getUsername(); - String password = vo.getPassword(); - // 查询用户信息 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SysUser::getUsername, username); - SysUser sysUser = getOne(wrapper); - - // 用户是否存在 - if (sysUser == null) { - throw new BunnyException(CommonMessageConstant.ACCOUNT_NOT_FOUND); - } - - // 判断是否被禁用 - if (sysUser.getStatus() == 0) { - throw new BunnyException(CommonMessageConstant.ACCOUNT_LOCKED); - } - - // 判断密码 - String md5DigestAsHexPassword = DigestUtils.md5DigestAsHex(password.getBytes()); - if (!md5DigestAsHexPassword.equals(sysUser.getPassword())) { - throw new BunnyException(CommonMessageConstant.PASSWORD_ERROR); - } - // 添加token - String token = JwtHelper.createToken(sysUser.getId(), sysUser.getUsername()); - return Login.builder().token(token).build(); - } - - /** - * 获取用户信息 - * - * @param request 请求头 - * @return 用户信息 - */ - @Override - public SysUserinfo getUserinfo(HttpServletRequest request) { - redisTemplate.opsForValue().set("test", "测试"); - return null; - } - - /** - * 根据用户名查询用户信息 - * - * @param username 用户名 - * @return 用户信息 - */ - @Override - public SysUser getByUsername(String username) { - return getOne(Wrappers.lambdaQuery().eq(SysUser::getUsername, username)); - } -} diff --git a/service/service-main/src/main/java/cn/bunny/service/task/TemplateTask.java b/service/service-main/src/main/java/cn/bunny/service/task/TemplateTask.java deleted file mode 100644 index d28941b..0000000 --- a/service/service-main/src/main/java/cn/bunny/service/task/TemplateTask.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bunny.service.task; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -@Component -@Slf4j -public class TemplateTask { - @Scheduled(cron = "0/1 5 * * * ?") - public void templateTask() { - log.info("定时任务执行..."); - } -} diff --git a/service/service-main/src/main/resources/application-dev.yml b/service/service-main/src/main/resources/application-dev.yml deleted file mode 100644 index 511b357..0000000 --- a/service/service-main/src/main/resources/application-dev.yml +++ /dev/null @@ -1,19 +0,0 @@ -bunny: - datasource: - host: 106.15.251.123 - port: 3305 - sqlData: guigu-oa - username: root - password: "02120212" - - redis: - host: 47.120.65.66 - port: 6379 - database: 3 - password: "02120212" - - minio: - endpointUrl: "http://129.211.31.58:9000" - bucket-name: ssyx - accessKey: bunny - secretKey: "02120212" \ No newline at end of file diff --git a/service/service-main/src/main/resources/application.yml b/service/service-main/src/main/resources/application.yml deleted file mode 100644 index 41452c0..0000000 --- a/service/service-main/src/main/resources/application.yml +++ /dev/null @@ -1,63 +0,0 @@ -server: - port: 8801 - -spring: - profiles: - active: dev - application: - name: bunny-mirror-server - - datasource: - type: com.zaxxer.hikari.HikariDataSource - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true - username: ${bunny.datasource.username} - password: ${bunny.datasource.password} - - data: - redis: - host: ${bunny.redis.host} - port: ${bunny.redis.port} - database: ${bunny.redis.database} - password: ${bunny.redis.password} - lettuce: - pool: - max-active: 20 #最大连接数 - max-wait: -1 #最大阻塞等待时间(负数表示没限制) - max-idle: 5 #最大空闲 - min-idle: 0 #最小空闲 - - jackson: - date-format: yyyy-MM-dd HH:mm:ss - time-zone: GMT+8 - -mybatis-plus: - mapper-locations: classpath:mapper/*.xml - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志 - -logging: - level: - cn.bunny.service.mapper: debug - cn.bunny.service.controller: info - cn.bunny.service.service: info - pattern: - dateformat: HH:mm:ss:SSS - file: - path: "logs/${spring.application.name}" - -bunny: - minio: - endpointUrl: ${bunny.minio.endpointUrl} - accessKey: ${bunny.minio.accessKey} - secretKey: ${bunny.minio.secretKey} - bucket-name: ${bunny.minio.bucket-name} - - snowflake: - datacenterBits: 5 # 数据中心id位数 - workerBits: 5 # 机器id位数 - sequenceBits: 12 # 序列id所占位数 - datacenterId: 1 # 数据中心id,范围0-2^5-1 - workerId: 1 # 机器id,范围0-2^5-1 - twepoch: 1704038400000 # 时间戳起始点(2024-01-01 00::00:00 的毫秒数) - maxBatchCount: 100000 #单次批量生成id的最大数量 默认10万 \ No newline at end of file diff --git a/service/service-main/src/main/resources/banner.txt b/service/service-main/src/main/resources/banner.txt deleted file mode 100644 index cc77fc2..0000000 --- a/service/service-main/src/main/resources/banner.txt +++ /dev/null @@ -1,16 +0,0 @@ ------------------▄██-█▄--------- ------------------███▄██▄-------- ------------------███████-------- ------------------▀███████------- --------------------██████▄▄----- --------------------█████████▄--- --------------------██████▄████-- --------▄███████████████████████- ------▄███████████████████████▀-- ----▄██████████████████████------ ----███████████████████████------ ----███████████████████████------ --▄▄██████████████████████▀------ --█████████████████▀█████-------- --▀██████████████▀▀-▀█████▄------ --------▀▀▀▀▀▀▀▀▀------▀▀▀▀------ \ No newline at end of file diff --git a/service/service-main/src/main/resources/favicon.ico b/service/service-main/src/main/resources/favicon.ico deleted file mode 100644 index 385f8a67127e1978b08387383f5935feaf561d04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17014 zcmeI2`HvJu6vt<;x!8+k7i3+=ML=*-6c11|xGE9x29+2OJP1)y@m4}qz&l1o#rwb$ zQBVvhh$y&gjK-gh(ck^WL=zMJ1N8Hq?V8l|HQlqlGI4q2JKbIN>RYc~SG{`GODa{z zzyAIdzrCqz&Pb)kr&6gIfTGkopz@;h4_%V@?O(8<38XDF4TrbZ`TWLK>o!NRPda{M zi&_??kEmSI`>*-vPjh(G`oJ0gsP%z0{!!@z&Hd5rg98zB;>5#|w$IoyTIYco|494U zSz|S~&)DN1jXrRXKY|Z>(76Dt1b2Yt;2bas_)4v>EkC2(Ha9jlUWVRo@D^AB&Ib#? z#o$)(D%cO+16P1Cpd@ZSJ(nu0xJjDNZ9-jL-E_vhw4tHl_WJtzPk8>LzM)|qddomR z=mLH+fx=tB7vLpuJSd86o_)dzS+3^XRBJwv?N5L&!82eLKDacUPS0;@YC5~IscA_= zW8+nnKLECZeP9c?9&`gEhjXK{LGU-wy!Z_4#h2T_S6~;|TUTGdhw`0Z1CVd~Ks|^g z3C@G_=x{GM+1+u4K6KocPc-j$fv>=3a0xgJc*M=u-P6;;{L;9^^DK~G-vC-;Sr962 zK0Svv@K*LyB%2$&RYN5a`{+b_HPHKBG}O}nHv*sLkm9S>(MB*C1WE+Hz_wJVkFjA2 zs*BM_JL-CWcdK2H#Nay-4y`l2qnQct*%W$bn!AxChRx!uICl@9IyFy>y^~n58|(p! z6N(2~2kx~vg|cnnagYHXiD{qO=fKw&6trR9vnrZ z=fEc5UeAgxiZk+uN2;(-{(JychVc2R*HL&8xCg8Nr-P|r7SI|V1j_r$BxWCFZJmcxxvnu4;+xpr-9C5T zybSmD_Xx!&Kau}F2jcNa6#Jy(Y3MCbZa3Fk9Qxk;)ZJxgP;i%B$ohXMlgZ3;#&3L} z93eO> zFi{Lw?xOuN?N$u4&l$h*v%9IDZwAWoLnW+_kcN%aY5v;s8V@VU3kMnZcCe?dy}euf zwvx}i*09bfKLW+Zcfcdy2C%TXxw&ACwKQJ8GW2cHepGgru`BKSDt(}ReUi;%?v)ot zu+ONQYk?c>XIihvfW<&->|OSh@9^iR+Hb~obc}cG4g3D5d{Ae;$Wnz5`XPTfsDmo_ zM5Q%50J=e$w6?WP`%p*gH+@4g1`xz!>+SIM`A4wNsBb9cn}S2KR?`6Y4pLH$`& zDyCK?ZazI%MdUP!$fvwmxuf2D9{dWFC*22>(?|{l10CbWdHiDc!9F~fb@FJjMU_7` zANQrWTP0oCS~ZmGx!DA?XQ#nq;7p*i^y^?3cpu0|zG7@vPR{su=-F2>Vxi%4#y?U% zP@b+a>0RsHZwAT_X9MN(u|zhrM($wG_-*`z2_3cWgIq2*odNy;UU3GhoKT`1BPf3^ zDg^v2;@!W__pjxA^SZ%#ceOANF2&wI!LQj|ZiY3dlq+h#SFWsl@h4#7yYU4@k!3Gq zZ<$mmG~qc(>1-H7j?3=Yh_nn%{zATrn>-KIkbFTJ@e-w>OeMo19YLQWf*!$RQ}dX*YoL zT70l+dS74u0Q(ydTHblCJTAzS9%8|KaZyYpK*($g|Iv8U^2Ik1V*WvH3WBunYU|?dD|<7W;0lFnpK^lC*a(f5Q8 zfaXw{s1IVz<@E78wr{}~H>K+8PDW`W(4N}{dcb^e8_-!)`?7Kooy*EN#mC=RPJ?SV zTx%6`(Wy!_=i%9@zu8!SYl`}g+<(r`*AAmG#Y$aR+dJb(6T&X;Fnc)+sgKGJ%g-`p(QlK2;RG{&#POuN?_y{nx z*KT7nEU41v+o5^3NXAbT`=n#^L#~?B*8zR2x*yC0MG5I6gF=g=R_UViy8QeD>*^wB z?8W!S`kiC#WkEcXsn`P60ngg9`P}1m>Z14nYJU-@c=SDi^}7ap_o2B1Yz5j!3^b1f z#XmvcRs_Y`D?!m;;v3i5*~L283SMq$Z9P=E81=>do~vX$(417;kHB%jSB!nK(Lrgv zer3KS6$*8h#8%~u%bd7V>Z3waPc?D1fDZ>16J=k1%$R9>SqMc?mG&#m z_ee1(h=g+OjoK%*kER%R7k>CAm(TZEb|>ls^^<@PGzVW3m!wL*l{D3vqg@<`zTJGu z_-9wiS0wTKvH48BUB-RfwV;@*_f~p0G5C6E_c73SHWRzk+;0bGfuh9VGfhIThR;?q zWn4XR($)*OUrf2q-KAWq0$&HZ>w(6p?>0uV+^DSV+oUQh@JS_>h|k?%n0+jVPjR5n z@Y;Mj=MdACKRpAqCoVL4&Q*Jw_Qyr8^3tQt$9>#+TH*=28D<~K5#Ive1LeSv6UR0H z{eP$ZoO7PcX0!JDMx`jH@%uG6dgw9ucbN7C6I(S2^r5*m4ZIBAZXY{Ve{VAD%6@O% z)a%@!wbKeBNdop&>?ff<6w~eo`^XJf>2KTMB=RJEOV~`gV&5qswj^Xe(M3lq z81qK(9OGX;rnz~F_(Kh-P??~8fjuSNN3HYuIil8WPTIbMKJfFv$mAfrJHLIw-+&6G z2j@ZZ@5s;PN&C6h`Tnmykl+2r7PYL_-&-a7sJC;`sKYMPtJFuCa)gIk=Zi3egDU@X G5Bv)+nYH-< diff --git a/service/service-main/src/main/resources/logback.xml b/service/service-main/src/main/resources/logback.xml deleted file mode 100644 index 04ecbe3..0000000 --- a/service/service-main/src/main/resources/logback.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - %cyan([%thread]) %yellow(%-5level) %green(%logger{100}).%boldRed(%method)-%boldMagenta(%line) - %blue(%msg%n) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/service/service-main/src/main/resources/mapper/SysMenuMapper.xml b/service/service-main/src/main/resources/mapper/SysMenuMapper.xml deleted file mode 100644 index 9464822..0000000 --- a/service/service-main/src/main/resources/mapper/SysMenuMapper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - id, parent_id, name, type, path, component, perms, icon, sort_value, status, create_time, update_time, is_deleted - - - diff --git a/service/service-main/src/main/resources/mapper/SysRoleMapper.xml b/service/service-main/src/main/resources/mapper/SysRoleMapper.xml deleted file mode 100644 index 3d5b7e5..0000000 --- a/service/service-main/src/main/resources/mapper/SysRoleMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/service/service-main/src/main/resources/mapper/SysUserMapper.xml b/service/service-main/src/main/resources/mapper/SysUserMapper.xml deleted file mode 100644 index 7134a56..0000000 --- a/service/service-main/src/main/resources/mapper/SysUserMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/service/service-main/src/test/java/cn/bunny/CustomPasswordEncoderTest.java b/service/service-main/src/test/java/cn/bunny/CustomPasswordEncoderTest.java deleted file mode 100644 index f952f74..0000000 --- a/service/service-main/src/test/java/cn/bunny/CustomPasswordEncoderTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bunny; - -import cn.bunny.security.custom.CustomPasswordEncoder; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.security.crypto.password.PasswordEncoder; - -@SpringBootTest(classes = CustomPasswordEncoder.class) -class CustomPasswordEncoderTest { - @Autowired - private CustomPasswordEncoder customPasswordEncoder; - @Autowired - private PasswordEncoder passwordEncoder; - - @Test - void testCustomPasswordEncoder() { - String encode = customPasswordEncoder.encode("111111"); - System.out.println(encode); - } - - @Test - void testPasswordEncoder() { - String encode = passwordEncoder.encode("111111"); - System.out.println(encode); - } -} \ No newline at end of file