|
@@ -0,0 +1,48 @@
|
|
|
+/*
|
|
|
+ * *************************************************
|
|
|
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
|
|
|
+ * Created by Deason on 2018-11-23 15:50:18.
|
|
|
+ * *************************************************
|
|
|
+ */
|
|
|
+
|
|
|
+package cn.com.qmth.examcloud.core.print.config;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.core.print.common.utils.DateUtils;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.CourseStatisticService;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.PrintingProjectStatisticService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class StatisticScheduler implements Serializable {
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(StatisticScheduler.class);
|
|
|
+ private static final long serialVersionUID = 1L;
|
|
|
+ @Autowired
|
|
|
+ private CourseStatisticService courseStatisticService;
|
|
|
+ @Autowired
|
|
|
+ private PrintingProjectService printingProjectService;
|
|
|
+ @Autowired
|
|
|
+ private PrintingProjectStatisticService printingProjectStatisticService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 定时统计数据(每N分钟执行)
|
|
|
+ */
|
|
|
+ //@Scheduled(cron = "0 1/1 * * * ?")
|
|
|
+ public void execute() throws Exception {
|
|
|
+ Date start = new Date();
|
|
|
+ printingProjectService.initAllPrintingProject();
|
|
|
+
|
|
|
+ courseStatisticService.initAllCourseStatistic();
|
|
|
+
|
|
|
+ printingProjectStatisticService.initAllPrintingProjectStatistic();
|
|
|
+ log.info("统计耗时:" + DateUtils.diff(start, new Date()));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|