mirror of https://github.com/elunez/eladmin
add VisitsInitialization 启动时初始化站点统计
parent
baa9b7c68c
commit
5c27bce52a
|
@ -0,0 +1,25 @@
|
||||||
|
package me.zhengjie.modules.monitor.config;
|
||||||
|
|
||||||
|
import me.zhengjie.modules.monitor.service.VisitsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化站点统计
|
||||||
|
* @author jie
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class VisitsInitialization implements ApplicationRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VisitsService visitsService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
System.out.println("--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------");
|
||||||
|
visitsService.save();
|
||||||
|
System.out.println("--------------- 初始化站点统计完成 ---------------");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue