审计日志 弹框修改
This commit is contained in:
parent
fdb4bc45b7
commit
03169f4bff
|
|
@ -242,7 +242,7 @@ public class TokenController {
|
|||
redisUtil.delete("userId:" + userId);
|
||||
redisUtil.delete("ISCUserId:" + iscUser);
|
||||
redisUtil.delete("userName:" + userName);
|
||||
sysRecordLogService.exitLos("userName",startTime);
|
||||
sysRecordLogService.exitLos(userName,startTime);
|
||||
}catch (Exception e){
|
||||
sysRecordLogService.exitLos("-",startTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class SysRecordLogService {
|
|||
sysLogsInfo.setOperIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||
sysLogsInfo.setOperResult("1");
|
||||
sysLogsInfo.setEventType("正常事件");
|
||||
|
||||
sysLogsInfo.setUserName(username);
|
||||
sysLogsInfo.setOperParam("{username:"+username+"}");
|
||||
sysLogsInfo.setOperMeth("/auth/logout");
|
||||
sysLogsInfo.setLogType(0);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
|
|||
/**
|
||||
* 越权白名单路径->指定的路径
|
||||
*/
|
||||
public static String[] WHITE_URLS= new String[]{"/sys/logs/addLogs"};
|
||||
public static String[] WHITE_URLS= new String[]{"/sys/logs/addLogs","/sys/logs/logWarn"};
|
||||
|
||||
@Resource
|
||||
private RemoteLogService remoteLogService;
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@ public class SysLogsController extends BaseController {
|
|||
return logService.saveLogs(sysLog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询(系统日志、业务日志)
|
||||
*
|
||||
|
|
@ -180,38 +178,6 @@ public class SysLogsController extends BaseController {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询运行日志
|
||||
*
|
||||
* @param sysLogQo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询运行日志")
|
||||
@PostMapping("getRunningLog")
|
||||
@SysLog(title = "日志管理", model = "日志管理->运行日志", operaType = OperaType.QUERY, details = "查询系统运行日志",logType = 0)
|
||||
public Map<String, Object> getRunningLog(SysLogQo sysLogQo) {
|
||||
PageHelper.startPage(Integer.parseInt(sysLogQo.getPage()), Integer.parseInt(sysLogQo.getLimit()));
|
||||
Map<String, Object> map = new HashMap<String, Object>(16);
|
||||
try {
|
||||
List<SysRunningLogVo> list = logService.getRunningLog(sysLogQo);
|
||||
PageInfo<SysRunningLogVo> pageInfo = new PageInfo<>(list);
|
||||
map.put("code", 200);
|
||||
map.put("msg", "获取数据成功");
|
||||
map.put("count", pageInfo.getTotal());
|
||||
map.put("curr", Integer.parseInt(sysLogQo.getPage()));
|
||||
map.put("limit", Integer.parseInt(sysLogQo.getLimit()));
|
||||
map.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
map.put("code", 1);
|
||||
map.put("msg", "获取数据失败");
|
||||
map.put("count", 0);
|
||||
map.put("curr", Integer.parseInt(sysLogQo.getPage()));
|
||||
map.put("limit", Integer.parseInt(sysLogQo.getLimit()));
|
||||
map.put("data", null);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -312,13 +278,10 @@ public class SysLogsController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询今日越权
|
||||
*/
|
||||
@GetMapping("/getYueQuan")
|
||||
public AjaxResult getYueQuan(String logType) {
|
||||
return AjaxResult.success(logService.getYueQuan());
|
||||
@ApiOperation(value = "查询日志告警")
|
||||
@PostMapping("logWarn")
|
||||
public AjaxResult logWarn() {
|
||||
return logService.logWarn();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public interface SysLogsDao {
|
|||
|
||||
void saveRestoreLog(SysOperLog sysLog);
|
||||
|
||||
Map<String, String> getYueQuan();
|
||||
|
||||
|
||||
void addSaveSysLog(SysLogsInfo sysLog);
|
||||
|
||||
|
|
@ -100,4 +100,10 @@ public interface SysLogsDao {
|
|||
* @return
|
||||
*/
|
||||
List<SysLogsInfo> getLogsLists(@Param("logType") String logType);
|
||||
|
||||
int getErrorLogs();
|
||||
|
||||
String getLogsRl();
|
||||
|
||||
String getLogsSet();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ public interface SysLogsService {
|
|||
*/
|
||||
void restoreLog(String logType);
|
||||
|
||||
Map<String, String> getYueQuan();
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
|
@ -72,4 +71,10 @@ public interface SysLogsService {
|
|||
* @return
|
||||
*/
|
||||
void addLogs(SysLogsInfo sysLog);
|
||||
|
||||
/**
|
||||
* 日志告警查询
|
||||
* @return
|
||||
*/
|
||||
AjaxResult logWarn();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.securityControl.system.service.impl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.securityControl.common.core.utils.DateUtils;
|
||||
import com.securityControl.common.core.utils.ServletUtils;
|
||||
import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
||||
|
|
@ -95,6 +96,41 @@ public class SysLogsServiceImpl implements SysLogsService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审计日志告警弹框
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult logWarn() {
|
||||
Map<String, Object> map= Maps.newHashMap();
|
||||
try {
|
||||
double bfb=0.9;
|
||||
//查询当日的告警
|
||||
int num =dao.getErrorLogs();
|
||||
if(num>0){
|
||||
map.put("logWarn","1");
|
||||
map.put("err","您有新的异常告警:"+num +",请及时处理!");
|
||||
}else{
|
||||
map.put("logWarn","0");
|
||||
}
|
||||
String rl=dao.getLogsRl();
|
||||
String city=dao.getLogsSet();
|
||||
double d=Double.parseDouble(rl);
|
||||
double max=Double.parseDouble(city)*bfb;
|
||||
if(d>=max){
|
||||
map.put("warnType","1");
|
||||
map.put("warnError","日志容量告警,当日日志内存为"+d+"MB,日志内存超过总内存的90%,请及时处理!");
|
||||
}else {
|
||||
map.put("warnType","0");
|
||||
}
|
||||
}catch (Exception e){
|
||||
map.put("logWarn","0");
|
||||
map.put("warnType","0");
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
|
||||
public void setModelTitle(SysLogsInfo sysLog){
|
||||
try{
|
||||
|
|
@ -190,7 +226,6 @@ public class SysLogsServiceImpl implements SysLogsService {
|
|||
|
||||
double rate = b2.divide(b1, RoundingMode.HALF_UP).doubleValue();
|
||||
if (rate >= 0.90) {
|
||||
log.warn("内存报警发送邮件!!!");
|
||||
addWaringLog("基建视频安全管控系统日志容量已超过" + rate * 100 + "%");
|
||||
}
|
||||
resultMap.put("maxLogSize", maxLogSize);
|
||||
|
|
@ -240,10 +275,6 @@ public class SysLogsServiceImpl implements SysLogsService {
|
|||
dao.updateLastCopyTime(logType, DateUtils.getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getYueQuan() {
|
||||
return dao.getYueQuan();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -270,13 +270,7 @@
|
|||
AND create_time < #{updateDate}
|
||||
</delete>
|
||||
|
||||
<select id="getYueQuan" resultType="java.util.Map">
|
||||
SELECT user_name as userName ,details,ip,DATE_FORMAT(create_time,'%Y-%m-%d %T') as createTime
|
||||
FROM sys_logs
|
||||
WHERE grade = '越权访问' and date(create_time) = current_date
|
||||
order by id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!--查询菜单名称及模块-->
|
||||
<select id="getModelTitle" resultType="com.securityControl.system.api.domain.SysLogsInfo">
|
||||
select sm.menu_name operModel ,sm2.menu_name title ,sm.paths
|
||||
|
|
@ -296,6 +290,23 @@
|
|||
where log_type=#{logType}
|
||||
|
||||
</select>
|
||||
<select id="getErrorLogs" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from sys_log_info
|
||||
where log_type=2
|
||||
and DATE_FORMAT(oper_time,'%Y-%m-%d')=CURRENT_DATE
|
||||
|
||||
</select>
|
||||
<select id="getLogsRl" resultType="java.lang.String">
|
||||
SELECT
|
||||
round(((data_length + index_length) / 1024 / 1024), 2) AS 'Size in MB'
|
||||
FROM information_schema.TABLES
|
||||
WHERE table_schema = 'gwjjspaq' AND table_name = 'sys_log_info'
|
||||
</select>
|
||||
<select id="getLogsSet" resultType="java.lang.String">
|
||||
select content_size
|
||||
from sys_log_config
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue