增加系统业务配置操作日志功能,与系统日志菜单分离,增加相关国际化字典,并更新国际化部分翻译
This commit is contained in:
@@ -67,7 +67,26 @@ public class LogUtils {
|
||||
}else{
|
||||
log.setFunctionId(Integer.parseInt(request.getParameter("functionId")));
|
||||
}
|
||||
if(!StringUtil.isEmpty(request.getParameter("compileId"))){
|
||||
log.setCompileIds(request.getParameter("compileId"));
|
||||
}else{
|
||||
log.setCompileIds(request.getParameter("compileIds"));
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(request.getParameter("cfgId"))){
|
||||
log.setCfgIds(request.getParameter("cfgId"));
|
||||
}else{
|
||||
log.setCfgIds(request.getParameter("ids"));
|
||||
}
|
||||
if(!StringUtil.isEmpty(request.getParameter("isAudit"))){
|
||||
log.setAuditState(Integer.parseInt(request.getParameter("isAudit")));
|
||||
}
|
||||
if(!StringUtil.isEmpty(request.getParameter("action"))){
|
||||
log.setAction(Integer.parseInt(request.getParameter("action")));
|
||||
}
|
||||
if(!(StringUtil.isEmpty(request.getParameter("isValid")))){
|
||||
log.setIsValid(Integer.parseInt(request.getParameter("isValid")));
|
||||
}
|
||||
// 异步保存日志
|
||||
new SaveLogThread(log, handler, ex).start();
|
||||
}
|
||||
@@ -96,6 +115,7 @@ public class LogUtils {
|
||||
String permission = "";
|
||||
if (handler instanceof HandlerMethod){
|
||||
Method m = ((HandlerMethod)handler).getMethod();
|
||||
log.setMethodName(m.getName());
|
||||
RequiresPermissions rp = m.getAnnotation(RequiresPermissions.class);
|
||||
permission = (rp != null ? StringUtils.join(rp.value(), ",") : "");
|
||||
}
|
||||
@@ -104,11 +124,44 @@ public class LogUtils {
|
||||
}
|
||||
// 如果有异常,设置异常信息
|
||||
log.setException(Exceptions.getStackTraceAsString(ex));
|
||||
// 如果无标题并无异常日志,则不保存信息
|
||||
if (StringUtils.isBlank(log.getTitle()) && StringUtils.isBlank(log.getException())){
|
||||
// 如果无标题并无异常日志并且无具体的功能id(非业务配置的操作),则不保存信息
|
||||
if ((StringUtils.isBlank(log.getTitle()) && StringUtils.isBlank(log.getException()) && (log.getFunctionId()==null || log.getFunctionId()==0))){
|
||||
return;
|
||||
}
|
||||
// 保存日志信息
|
||||
if(log.getFunctionId()!=null
|
||||
&& log.getFunctionId()!=0 ){
|
||||
String functionName = DictUtils.getDictLabel("SYS_SERVICE_FUNCTION", log.getFunctionId().toString());
|
||||
if(!StringUtil.isEmpty(log.getMethodName())){
|
||||
String operation = DictUtils.getDictLabel("SYS_SERVICE_OPERATION", log.getMethodName());
|
||||
if("saveOrUpdate".equals(operation)){
|
||||
if (log.getCfgId()!=null || log.getCfgIds()!=null || log.getCompileId()!=null || log.getCompileIds()!=null){
|
||||
log.setOperation("edit");
|
||||
}else{
|
||||
log.setOperation("add");
|
||||
}
|
||||
}else{
|
||||
log.setOperation(operation);
|
||||
}
|
||||
}
|
||||
if(log.getOperation()!=null && !"默认".equals(log.getOperation()) && !"默认".equals(functionName)){
|
||||
log.setFunctionName(functionName);
|
||||
if(!StringUtil.isEmpty(log.getCompileIds())){
|
||||
for(String compileId:StringUtils.split(log.getCompileIds(),",")){
|
||||
log.setCompileId(Integer.parseInt(compileId));
|
||||
logDao.insertCfgOperationLog(log);
|
||||
}
|
||||
}else if(!StringUtil.isEmpty(log.getCfgIds())){
|
||||
for(String cfgId:StringUtils.split(log.getCfgIds(),",")){
|
||||
log.setCfgId(Integer.parseInt(cfgId));
|
||||
logDao.insertCfgOperationLog(log);
|
||||
}
|
||||
}else{
|
||||
logDao.insertCfgOperationLog(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logDao.insert(log);
|
||||
}
|
||||
}
|
||||
@@ -202,7 +255,6 @@ public class LogUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CacheUtils.put(CACHE_MENU_NAME_PATH_MAP, menuMap);
|
||||
CacheUtils.put(CACHE_MENU_NAME_PATH_MAP2, menuMap2);
|
||||
}
|
||||
@@ -240,7 +292,6 @@ public class LogUtils {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
System.out.println(menuNamePath);
|
||||
return menuNamePath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user