mirror of https://gitee.com/stylefeng/roses
【7.1.6】【statistics】整理
parent
95793512fb
commit
236b6ddda3
|
@ -66,5 +66,5 @@ public interface HomePageService extends IService<InterfaceStatistics> {
|
||||||
* @author xixiaowei
|
* @author xixiaowei
|
||||||
* @date 2022/2/10 12:07
|
* @date 2022/2/10 12:07
|
||||||
*/
|
*/
|
||||||
void interfaceStatistics();
|
void saveStatisticsCacheToDb();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class HomePageServiceImpl extends ServiceImpl<InterfaceStatisticsMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void interfaceStatistics() {
|
public void saveStatisticsCacheToDb() {
|
||||||
// key是用户id,value的key是statUrlId,最后的value是次数
|
// key是用户id,value的key是statUrlId,最后的value是次数
|
||||||
Map<String, Map<Long, Integer>> userRequestStats = requestCountCacheApi.getAllKeyValues();
|
Map<String, Map<Long, Integer>> userRequestStats = requestCountCacheApi.getAllKeyValues();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class StatisticsUrlContext implements CommandLineRunner {
|
||||||
/**
|
/**
|
||||||
* 需要被统计的url集合,key是url,value是stat_url_id
|
* 需要被统计的url集合,key是url,value是stat_url_id
|
||||||
*/
|
*/
|
||||||
private static Map<String, Long> STATISTICS_KEY_VALUES = new HashMap<>(10);
|
private static final Map<String, Long> STATISTICS_KEY_VALUES = new HashMap<>(10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取需要统计的url集合
|
* 获取需要统计的url集合
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class InterfaceStatisticsTimer implements TimerAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void action(String params) {
|
public void action(String params) {
|
||||||
homePageService.interfaceStatistics();
|
homePageService.saveStatisticsCacheToDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue