Commit ae9186f4b413174489758af024bb3c075e057a7b
1 parent
64418838
多模块重构 14:MEMBER 用户,过滤掉操作日志的记录~
Showing
10 changed files
with
32 additions
and
16 deletions
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java
| ... | ... | @@ -4,6 +4,7 @@ import cn.hutool.core.exceptions.ExceptionUtil; |
| 4 | 4 | import cn.hutool.core.util.ArrayUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | 6 | import cn.hutool.extra.servlet.ServletUtil; |
| 7 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 7 | 8 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | 10 | import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO; |
| ... | ... | @@ -81,6 +82,12 @@ public class OperateLogAspect { |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | private Object around0(ProceedingJoinPoint joinPoint, OperateLog operateLog, ApiOperation apiOperation) throws Throwable { |
| 85 | + // 目前,只有管理员,才记录操作日志!所以非管理员,直接调用,不进行记录 | |
| 86 | + Integer userType = WebFrameworkUtils.getLoginUserType(); | |
| 87 | + if (!Objects.equals(userType, UserTypeEnum.ADMIN.getValue())) { | |
| 88 | + return joinPoint.proceed(); | |
| 89 | + } | |
| 90 | + | |
| 84 | 91 | // 记录开始时间 |
| 85 | 92 | Date startTime = new Date(); |
| 86 | 93 | try { | ... | ... |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/InfraSecurityConfiguration.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java
| ... | ... | @@ -10,8 +10,8 @@ import org.springframework.security.config.annotation.web.configurers.Expression |
| 10 | 10 | /** |
| 11 | 11 | * Infra 模块的 Security 配置 |
| 12 | 12 | */ |
| 13 | -@Configuration | |
| 14 | -public class InfraSecurityConfiguration { | |
| 13 | +@Configuration("infraSecurityConfiguration") | |
| 14 | +public class SecurityConfiguration { | |
| 15 | 15 | |
| 16 | 16 | @Value("${spring.boot.admin.context-path:''}") |
| 17 | 17 | private String adminSeverContextPath; | ... | ... |
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.http
| 1 | 1 | ### 请求 /member/user/profile/get 接口 => 没有权限 |
| 2 | -GET {{userServerUrl}}/member/user/profile/get | |
| 2 | +GET {{appApi}}/member/user/get | |
| 3 | 3 | Authorization: Bearer test245 |
| 4 | +tenant-id: {{appTenentId}} | |
| 4 | 5 | |
| 5 | 6 | ### 请求 /member/user/profile/revise-nickname 接口 成功 |
| 6 | -PUT {{userServerUrl}}/member/user/profile/update-nickname?nickName=yunai222 | |
| 7 | +PUT {{appApi}}/member/user/update-nickname?nickname=yunai222 | |
| 7 | 8 | Authorization: Bearer test245 |
| 9 | +tenant-id: {{appTenentId}} | |
| 8 | 10 | |
| 9 | -### 请求 /member/user/profile/get-user-info 接口 成功 | |
| 10 | -GET {{userServerUrl}}/member/user/profile/get-user-info?id=245 | |
| 11 | +### 请求 /member/user/get-user-info 接口 成功 | |
| 12 | +GET {{appApi}}/member/user/get-user-info?id=245 | |
| 11 | 13 | Authorization: Bearer test245 |
| 14 | +tenant-id: {{appTenentId}} | ... | ... |
yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/PayRedisKeyCoreConstants.java renamed to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/RedisKeyConstants.java
| ... | ... | @@ -3,14 +3,12 @@ package cn.iocoder.yudao.module.pay.dal.redis; |
| 3 | 3 | import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; |
| 4 | 4 | import org.redisson.api.RLock; |
| 5 | 5 | |
| 6 | -import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.HASH; | |
| 7 | - | |
| 8 | 6 | /** |
| 9 | 7 | * 支付 Redis Key 枚举类 |
| 10 | 8 | * |
| 11 | 9 | * @author 芋道源码 |
| 12 | 10 | */ |
| 13 | -public interface PayRedisKeyCoreConstants { | |
| 11 | +public interface RedisKeyConstants { | |
| 14 | 12 | |
| 15 | 13 | RedisKeyDefine PAY_NOTIFY_LOCK = new RedisKeyDefine("通知任务的分布式锁", |
| 16 | 14 | "pay_notify:lock:", // 参数来自 DefaultLockKeyBuilder 类 | ... | ... |
yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java
| ... | ... | @@ -7,7 +7,7 @@ import org.springframework.stereotype.Repository; |
| 7 | 7 | import javax.annotation.Resource; |
| 8 | 8 | import java.util.concurrent.TimeUnit; |
| 9 | 9 | |
| 10 | -import static cn.iocoder.yudao.module.pay.dal.redis.PayRedisKeyCoreConstants.PAY_NOTIFY_LOCK; | |
| 10 | +import static cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants.PAY_NOTIFY_LOCK; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * 支付通知的锁 Redis DAO | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/OperateLogDO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.dal.dataobject.logger; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| ... | ... | @@ -48,10 +48,16 @@ public class OperateLogDO extends TenantBaseDO { |
| 48 | 48 | /** |
| 49 | 49 | * 用户编号 |
| 50 | 50 | * |
| 51 | - * {@link AdminUserDO#getId()} | |
| 51 | + * 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性 | |
| 52 | 52 | */ |
| 53 | 53 | private Long userId; |
| 54 | 54 | /** |
| 55 | + * 用户类型 | |
| 56 | + * | |
| 57 | + * 关联 {@link UserTypeEnum} | |
| 58 | + */ | |
| 59 | + private Integer userType; | |
| 60 | + /** | |
| 55 | 61 | * 操作模块 |
| 56 | 62 | */ |
| 57 | 63 | private String module; | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/RedisKeyConstants.java
| ... | ... | @@ -27,7 +27,7 @@ public interface RedisKeyConstants { |
| 27 | 27 | "social_auth_user:%d:%s", // 参数为 type,code |
| 28 | 28 | STRING, AuthUser.class, Duration.ofDays(1)); |
| 29 | 29 | |
| 30 | - RedisKeyDefine SOCIAL_AUTH_STATE = new RedisKeyDefine("社交登陆的 state", | |
| 30 | + RedisKeyDefine SOCIAL_AUTH_STATE = new RedisKeyDefine("社交登陆的 state", // 注意,它是被 JustAuth 的 justauth.type.prefix 使用到 | |
| 31 | 31 | "social_auth_state:%s", // 参数为 state |
| 32 | 32 | STRING, String.class, Duration.ofHours(24)); // 值为 state |
| 33 | 33 | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SystemSecurityConfiguration.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/security/config/SecurityConfiguration.java
| ... | ... | @@ -9,8 +9,8 @@ import org.springframework.security.config.annotation.web.configurers.Expression |
| 9 | 9 | /** |
| 10 | 10 | * System 模块的 Security 配置 |
| 11 | 11 | */ |
| 12 | -@Configuration | |
| 13 | -public class SystemSecurityConfiguration { | |
| 12 | +@Configuration("systemSecurityConfiguration") | |
| 13 | +public class SecurityConfiguration { | |
| 14 | 14 | |
| 15 | 15 | @Bean("systemAuthorizeRequestsCustomizer") |
| 16 | 16 | public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java
| ... | ... | @@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; |
| 16 | 16 | import org.springframework.scheduling.annotation.Async; |
| 17 | 17 | import org.springframework.scheduling.annotation.AsyncResult; |
| 18 | 18 | import org.springframework.stereotype.Service; |
| 19 | +import org.springframework.validation.annotation.Validated; | |
| 19 | 20 | |
| 20 | 21 | import javax.annotation.Resource; |
| 21 | 22 | import java.util.Collection; |
| ... | ... | @@ -28,6 +29,7 @@ import static cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO. |
| 28 | 29 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 29 | 30 | |
| 30 | 31 | @Service |
| 32 | +@Validated | |
| 31 | 33 | @Slf4j |
| 32 | 34 | public class OperateLogServiceImpl implements OperateLogService { |
| 33 | 35 | ... | ... |