update 优化api,gateway,auth代码结构

This commit is contained in:
AprilWind
2024-01-19 16:57:17 +08:00
parent bf95012138
commit ef83f06f2b
35 changed files with 320 additions and 29 deletions

View File

@@ -45,6 +45,9 @@ public class LogEventListener {
remoteLogService.saveLog(sysOperLog);
}
/**
* 保存系统访问记录
*/
@Async
@EventListener
public void saveLogininfor(LogininforEvent logininforEvent) {
@@ -52,10 +55,10 @@ public class LogEventListener {
final UserAgent userAgent = UserAgentUtil.parse(request.getHeader("User-Agent"));
final String ip = ServletUtils.getClientIP(request);
// 客户端信息
String clientid = request.getHeader(LoginHelper.CLIENT_KEY);
String clientId = request.getHeader(LoginHelper.CLIENT_KEY);
RemoteClientVo clientVo = null;
if (StringUtils.isNotBlank(clientid)) {
clientVo = remoteClientService.queryByClientId(clientid);
if (StringUtils.isNotBlank(clientId)) {
clientVo = remoteClientService.queryByClientId(clientId);
}
String address = AddressUtils.getRealAddressByIP(ip);
@@ -93,7 +96,15 @@ public class LogEventListener {
remoteLogService.saveLogininfor(logininfor);
}
/**
* 将传入的对象转换为带方括号的字符串表示形式
* 如果传入对象为 null则返回空字符串表示的方括号
*
* @param msg 要转换的对象,可以是任何类型
* @return 包含方括号的字符串表示形式
*/
private String getBlock(Object msg) {
// 如果传入对象为 null则将其替换为空字符串
if (msg == null) {
msg = "";
}