Skip to content

Commit

Permalink
【代码修复】SYSTEM:角色标识的提示不正确问题
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Aug 31, 2024
1 parent df5077f commit 047252d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
*
* @author 芋道源码
*/
@AutoConfiguration(before = MybatisPlusAutoConfiguration.class)
// 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志
@AutoConfiguration(before = MybatisPlusAutoConfiguration.class) // 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志
@MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class,
lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试
public class YudaoMybatisAutoConfiguration {

static {
// 动态 SQL 智能优化支持本地缓存加速解析,更完善的租户复杂 XML 动态 SQL 支持,静态注入缓存
JsqlParserGlobal.setJsqlParseCache(new JdkSerialCaffeineJsqlParseCache(
(cache) -> cache.maximumSize(1024)
.expireAfterWrite(5, TimeUnit.SECONDS))
Expand Down Expand Up @@ -73,5 +73,4 @@ public IKeyGenerator keyGenerator(ConfigurableEnvironment environment) {
throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType));
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,4 @@ private static SortedMap<String, String> getRequestParameterMap(HttpServletReque
return sortedMap;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,49 @@
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.api.logger.OperateLogApi;
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
import com.mzt.logapi.beans.LogRecord;
import com.mzt.logapi.service.ILogRecordService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;

import java.util.List;

/**
* 操作日志 ILogRecordService 实现类
*
* 基于 {@link OperateLogFrameworkService}实现, 记录操作日志
* 基于 {@link OperateLogApi} 实现,记录操作日志
*
* @author HUIHUI
*/
@Slf4j
public class LogRecordServiceImpl implements ILogRecordService {

@Resource
OperateLogFrameworkService operateLogFrameworkService;
private OperateLogApi operateLogApi;

@Override
@Async
public void record(LogRecord logRecord) {
// 1. 补全通用字段
OperateLogCreateReqDTO reqDTO = new OperateLogCreateReqDTO();
reqDTO.setTraceId(TracerUtils.getTraceId());
// 补充用户信息
fillUserFields(reqDTO);
// 补全模块信息
fillModuleFields(reqDTO, logRecord);
// 补全请求信息
fillRequestFields(reqDTO);
try {
reqDTO.setTraceId(TracerUtils.getTraceId());
// 补充用户信息
fillUserFields(reqDTO);
// 补全模块信息
fillModuleFields(reqDTO, logRecord);
// 补全请求信息
fillRequestFields(reqDTO);

// 2. 异步记录日志
operateLogFrameworkService.createOperateLog(reqDTO);
// 2. 异步记录日志
operateLogApi.createOperateLog(reqDTO).getCheckedData();
} catch (Throwable ex) {
// 由于 @Async 异步调用,这里打印下日志,更容易跟进
log.error("[record][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex);
}
}

private static void fillUserFields(OperateLogCreateReqDTO reqDTO) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* Spring Security 自动配置类,主要用于相关组件的配置
* <p>
*
* 注意,不能和 {@link YudaoWebSecurityConfigurerAdapter} 用一个,原因是会导致初始化报错。
* 参见 https://stackoverflow.com/questions/53847050/spring-boot-delegatebuilder-cannot-be-null-on-autowiring-authenticationmanager 文档。
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public PageResult<Task> getTaskTodoPage(Long userId, BpmTaskPageReqVO pageVO) {
}
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[1]));
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
}
long count = taskQuery.count();
if (count == 0) {
Expand All @@ -119,7 +119,7 @@ public PageResult<HistoricTaskInstance> getTaskDonePage(Long userId, BpmTaskPage
}
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[1]));
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
}
// 执行查询
long count = taskQuery.count();
Expand All @@ -141,7 +141,7 @@ public PageResult<HistoricTaskInstance> getTaskPage(Long userId, BpmTaskPageReqV
}
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[1]));
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
}
// 执行查询
long count = taskQuery.count();
Expand Down

0 comments on commit 047252d

Please sign in to comment.