fix: 修复登录后操作日志没有记录操作人的问题

--bug=1031897 --user=刘瑞斌 【系统设置】github#27080,登录日志无操作人 https://www.tapd.cn/55049933/s/1427027
This commit is contained in:
CaptainB 2023-10-17 11:58:39 +08:00 committed by 刘瑞斌
parent f08185f191
commit ec9b01c773
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,7 @@ public class LoginController {
@PostMapping(value = "/signin")
@MsAuditLog(module = OperLogModule.AUTH_TITLE, type = OperLogConstants.LOGIN, title = "登录")
public Mono<ResultHolder> login(@RequestBody LoginRequest request, WebSession session, Locale locale) {
return Mono.defer(() -> userLoginService.login(request, session, locale).map(Mono::just).orElseGet(Mono::empty))
return Mono.just(userLoginService.login(request, session, locale))
.subscribeOn(Schedulers.boundedElastic())
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.BAD_REQUEST, "Not found user info or invalid password")))
.map(ResultHolder::success)

View File

@ -113,8 +113,9 @@ public class MsLogAspect {
if (arg instanceof WebSession session) {
Object user = session.getAttribute("user");
if (user != null) {
String username = (String) MethodUtils.invokeExactMethod(user, "getName");
msOperLog.setOperUser(username);
String userId = (String) MethodUtils.invokeExactMethod(user, "getId");
msOperLog.setOperUser(userId);
msOperLog.setCreateUser(userId);
}
break;
}