Commit 57b9e902 by xmh

<feat> 数据清除添加日志

<fix> 数据概览去掉缓存,数据概览详情添加24小时
1 parent ed98d597
...@@ -18,6 +18,8 @@ public enum LogType { ...@@ -18,6 +18,8 @@ public enum LogType {
QUERY(3), QUERY(3),
/** 视频资源管理 */ /** 视频资源管理 */
VIDEO_RESOURCE(4), VIDEO_RESOURCE(4),
/** 系统日志 */
SYSTEM(5),
; ;
public int value; public int value;
......
...@@ -2,8 +2,10 @@ package com.viontech.fanxing.forward.runner; ...@@ -2,8 +2,10 @@ package com.viontech.fanxing.forward.runner;
import cn.hutool.core.util.RuntimeUtil; import cn.hutool.core.util.RuntimeUtil;
import com.viontech.fanxing.commons.config.VionConfig; import com.viontech.fanxing.commons.config.VionConfig;
import com.viontech.fanxing.commons.constant.LogType;
import com.viontech.fanxing.commons.feign.OpsClient; import com.viontech.fanxing.commons.feign.OpsClient;
import com.viontech.fanxing.commons.model.main.ImageKeepConfig; import com.viontech.fanxing.commons.model.main.ImageKeepConfig;
import com.viontech.fanxing.commons.vo.LogVo;
import com.viontech.keliu.util.DateUtil; import com.viontech.keliu.util.DateUtil;
import com.viontech.keliu.util.JsonMessageUtil; import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -129,7 +131,9 @@ public class PicKeepRunner { ...@@ -129,7 +131,9 @@ public class PicKeepRunner {
// 删除文件 // 删除文件
for (String dirName : yyyyMMddSet) { for (String dirName : yyyyMMddSet) {
dropDir(dirName); dropDir(dirName);
addLog(yyyyMMdd);
} }
} }
private void dropDir(String dirName) { private void dropDir(String dirName) {
...@@ -151,6 +155,17 @@ public class PicKeepRunner { ...@@ -151,6 +155,17 @@ public class PicKeepRunner {
} }
} }
private void addLog(String yyyyMMdd) {
String year = yyyyMMdd.substring(0, 4);
String month = yyyyMMdd.substring(4, 6);
String day = yyyyMMdd.substring(6, 8);
LogVo logVo = new LogVo();
logVo.setUsername("系统");
logVo.setLogType(LogType.SYSTEM.value);
logVo.setContent("清除数据 执行时间: " + DateUtil.format(DateUtil.FORMAT_LONG, new Date()) + " 数据日期: " + year + "-" + month + "-" + day);
opsClient.addLog(logVo);
}
} }
...@@ -69,7 +69,6 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf ...@@ -69,7 +69,6 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
} }
@Override @Override
@LocalCache(value = "dataOverview", duration = 1)
public JSONObject dataOverview(Date date, Long taskId, Integer page, Integer pageSize) { public JSONObject dataOverview(Date date, Long taskId, Integer page, Integer pageSize) {
// todo 还需要加有效分析时长(effectiveAnalysisTime) 和 异常次数(exceptionNum) // todo 还需要加有效分析时长(effectiveAnalysisTime) 和 异常次数(exceptionNum)
...@@ -151,6 +150,13 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf ...@@ -151,6 +150,13 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
Date min = DateUtil.setDayMinTime(date); Date min = DateUtil.setDayMinTime(date);
Date max = DateUtil.setDayMaxTime(date); Date max = DateUtil.setDayMaxTime(date);
TreeMap<Integer, DataOverViewModel> resultMap = new TreeMap<>(); TreeMap<Integer, DataOverViewModel> resultMap = new TreeMap<>();
for (int i = 0; i < 24; i++) {
resultMap.computeIfAbsent(i, x -> {
DataOverViewModel temp = new DataOverViewModel();
temp.setHour(x);
return temp;
});
}
TrafficExample trafficExample = new TrafficExample(); TrafficExample trafficExample = new TrafficExample();
trafficExample.createCriteria().andEventTimeGreaterThanOrEqualTo(min).andEventTimeLessThanOrEqualTo(max).andTaskIdEqualTo(taskId); trafficExample.createCriteria().andEventTimeGreaterThanOrEqualTo(min).andEventTimeLessThanOrEqualTo(max).andTaskIdEqualTo(taskId);
TrafficExample.ColumnContainer columns = trafficExample.createColumns().hasTaskIdColumn(); TrafficExample.ColumnContainer columns = trafficExample.createColumns().hasTaskIdColumn();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!