refactor(日志中心): 有关admin账号的操作不记录

This commit is contained in:
yjz
2023-12-22 09:27:31 +08:00
parent ade23a7dba
commit 69b274237a
2 changed files with 14 additions and 11 deletions
@@ -105,6 +105,9 @@ public class AutoLogAspect {
//获取登录用户信息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(sysUser!=null){
if ("admin".equals(sysUser.getUsername())){
return;
}
dto.setUserid(sysUser.getUsername());
dto.setUsername(sysUser.getRealname());
@@ -1,26 +1,20 @@
package com.jero.modules.base.service.impl;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import com.jero.common.api.dto.LogDTO;
import com.jero.common.constant.CacheConstant;
import com.jero.modules.base.mapper.BaseCommonMapper;
import com.jero.modules.base.service.BaseCommonService;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.system.vo.SysPermissionDataRuleModel;
import com.jero.common.system.vo.SysUserCacheInfo;
import com.jero.common.util.IPUtils;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils;
import org.springframework.cache.annotation.Cacheable;
import com.jero.modules.base.mapper.BaseCommonMapper;
import com.jero.modules.base.service.BaseCommonService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.Date;
@Service
@Slf4j
@@ -34,6 +28,9 @@ public class BaseCommonServiceImpl implements BaseCommonService {
if(oConvertUtils.isEmpty(logDTO.getId())){
logDTO.setId(String.valueOf(IdWorker.getId()));
}
if ("admin".equals(logDTO.getUsername())){
return;
}
//保存日志(异常捕获处理,防止数据太大存储失败,导致业务失败)JT-238
try {
baseCommonMapper.saveLog(logDTO);
@@ -68,6 +65,9 @@ public class BaseCommonServiceImpl implements BaseCommonService {
}
}
if(user!=null){
if ("admin".equals(user.getUsername())){
return;
}
sysLog.setUserid(user.getUsername());
sysLog.setUsername(user.getRealname());
}