|
@@ -1,60 +1,63 @@
|
|
|
package com.x.attendance.assemble.control;
|
|
package com.x.attendance.assemble.control;
|
|
|
|
|
|
|
|
|
|
+import org.apache.commons.lang3.BooleanUtils;
|
|
|
|
|
+
|
|
|
import com.x.attendance.assemble.control.processor.monitor.MonitorFileDataOpt;
|
|
import com.x.attendance.assemble.control.processor.monitor.MonitorFileDataOpt;
|
|
|
import com.x.attendance.assemble.control.processor.thread.DataProcessThreadFactory;
|
|
import com.x.attendance.assemble.control.processor.thread.DataProcessThreadFactory;
|
|
|
-import com.x.attendance.assemble.control.schedule.*;
|
|
|
|
|
|
|
+import com.x.attendance.assemble.control.schedule.AttendanceStatisticTask;
|
|
|
|
|
+import com.x.attendance.assemble.control.schedule.DetailLastDayRecordAnalyseTask;
|
|
|
|
|
+import com.x.attendance.assemble.control.schedule.DingdingAttendanceSyncScheduleTask;
|
|
|
|
|
+import com.x.attendance.assemble.control.schedule.MobileRecordAnalyseTask;
|
|
|
|
|
+import com.x.attendance.assemble.control.schedule.QywxAttendanceSyncScheduleTask;
|
|
|
import com.x.attendance.assemble.control.service.AttendanceSettingService;
|
|
import com.x.attendance.assemble.control.service.AttendanceSettingService;
|
|
|
import com.x.base.core.project.Context;
|
|
import com.x.base.core.project.Context;
|
|
|
import com.x.base.core.project.cache.CacheManager;
|
|
import com.x.base.core.project.cache.CacheManager;
|
|
|
import com.x.base.core.project.config.Config;
|
|
import com.x.base.core.project.config.Config;
|
|
|
import com.x.base.core.project.logger.LoggerFactory;
|
|
import com.x.base.core.project.logger.LoggerFactory;
|
|
|
|
|
|
|
|
-import org.apache.commons.lang3.BooleanUtils;
|
|
|
|
|
-
|
|
|
|
|
public class ThisApplication {
|
|
public class ThisApplication {
|
|
|
|
|
|
|
|
|
|
+ private ThisApplication() {
|
|
|
|
|
+ //nothing
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected static Context context;
|
|
protected static Context context;
|
|
|
|
|
|
|
|
public static Context context() {
|
|
public static Context context() {
|
|
|
return context;
|
|
return context;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static QueueDingdingAttendance dingdingQueue = new QueueDingdingAttendance();
|
|
|
|
|
- public static QueueQywxAttendanceSync qywxQueue = new QueueQywxAttendanceSync();
|
|
|
|
|
- public static QueueQywxUnitStatistic unitQywxStatisticQueue = new QueueQywxUnitStatistic();
|
|
|
|
|
- public static QueueQywxPersonStatistic personQywxStatisticQueue = new QueueQywxPersonStatistic();
|
|
|
|
|
- public static QueueDingdingPersonStatistic personStatisticQueue = new QueueDingdingPersonStatistic();
|
|
|
|
|
- public static QueueDingdingUnitStatistic unitStatisticQueue = new QueueDingdingUnitStatistic();
|
|
|
|
|
|
|
+ public static final QueueDingdingAttendance dingdingQueue = new QueueDingdingAttendance();
|
|
|
|
|
+ public static final QueueQywxAttendanceSync qywxQueue = new QueueQywxAttendanceSync();
|
|
|
|
|
+ public static final QueueQywxUnitStatistic unitQywxStatisticQueue = new QueueQywxUnitStatistic();
|
|
|
|
|
+ public static final QueueQywxPersonStatistic personQywxStatisticQueue = new QueueQywxPersonStatistic();
|
|
|
|
|
+ public static final QueueDingdingPersonStatistic personStatisticQueue = new QueueDingdingPersonStatistic();
|
|
|
|
|
+ public static final QueueDingdingUnitStatistic unitStatisticQueue = new QueueDingdingUnitStatistic();
|
|
|
|
|
|
|
|
- public static QueuePersonAttendanceDetailAnalyse detailAnalyseQueue = new QueuePersonAttendanceDetailAnalyse();
|
|
|
|
|
- public static QueueAttendanceDetailStatistic detailStatisticQueue = new QueueAttendanceDetailStatistic();
|
|
|
|
|
|
|
+ public static final QueuePersonAttendanceDetailAnalyse detailAnalyseQueue = new QueuePersonAttendanceDetailAnalyse();
|
|
|
|
|
+ public static final QueueAttendanceDetailStatistic detailStatisticQueue = new QueueAttendanceDetailStatistic();
|
|
|
|
|
|
|
|
public static void init() throws Exception {
|
|
public static void init() throws Exception {
|
|
|
try {
|
|
try {
|
|
|
CacheManager.init(context.clazz().getSimpleName());
|
|
CacheManager.init(context.clazz().getSimpleName());
|
|
|
LoggerFactory.setLevel(Config.logLevel().x_attendance_assemble_control());
|
|
LoggerFactory.setLevel(Config.logLevel().x_attendance_assemble_control());
|
|
|
new AttendanceSettingService().initAllSystemConfig();
|
|
new AttendanceSettingService().initAllSystemConfig();
|
|
|
-
|
|
|
|
|
- detailAnalyseQueue.start();
|
|
|
|
|
- detailStatisticQueue.start();
|
|
|
|
|
|
|
+ context.startQueue(detailAnalyseQueue);
|
|
|
|
|
+ context.startQueue(detailStatisticQueue);
|
|
|
if (BooleanUtils.isTrue(Config.dingding().getAttendanceSyncEnable())) {
|
|
if (BooleanUtils.isTrue(Config.dingding().getAttendanceSyncEnable())) {
|
|
|
- dingdingQueue.start();
|
|
|
|
|
- personStatisticQueue.start();
|
|
|
|
|
- unitStatisticQueue.start();
|
|
|
|
|
|
|
+ context.startQueue(dingdingQueue);
|
|
|
|
|
+ context.startQueue(personStatisticQueue);
|
|
|
|
|
+ context.startQueue(unitStatisticQueue);
|
|
|
context.schedule(DingdingAttendanceSyncScheduleTask.class, "0 0 1 * * ?");
|
|
context.schedule(DingdingAttendanceSyncScheduleTask.class, "0 0 1 * * ?");
|
|
|
// 已经将任务 放到了同步结束后执行 暂时不需要开定时任务了
|
|
// 已经将任务 放到了同步结束后执行 暂时不需要开定时任务了
|
|
|
-// context.schedule(DingdingAttendanceStatisticScheduleTask.class, "0 0 3 * * ?");
|
|
|
|
|
-// context.schedule(DingdingAttendanceStatisticPersonScheduleTask.class, "0 0 3 * * ?");
|
|
|
|
|
}
|
|
}
|
|
|
if (BooleanUtils.isTrue(Config.qiyeweixin().getAttendanceSyncEnable())) {
|
|
if (BooleanUtils.isTrue(Config.qiyeweixin().getAttendanceSyncEnable())) {
|
|
|
- qywxQueue.start();
|
|
|
|
|
- unitQywxStatisticQueue.start();
|
|
|
|
|
- personQywxStatisticQueue.start();
|
|
|
|
|
|
|
+ context.startQueue(qywxQueue);
|
|
|
|
|
+ context.startQueue(unitQywxStatisticQueue);
|
|
|
|
|
+ context.startQueue(personQywxStatisticQueue);
|
|
|
context.schedule(QywxAttendanceSyncScheduleTask.class, "0 0 1 * * ?");
|
|
context.schedule(QywxAttendanceSyncScheduleTask.class, "0 0 1 * * ?");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
context.schedule(AttendanceStatisticTask.class, "0 0 0/4 * * ?");
|
|
context.schedule(AttendanceStatisticTask.class, "0 0 0/4 * * ?");
|
|
|
-
|
|
|
|
|
context.schedule(MobileRecordAnalyseTask.class, "0 0 * * * ?");
|
|
context.schedule(MobileRecordAnalyseTask.class, "0 0 * * * ?");
|
|
|
// 每天凌晨1点,计算前一天所有的未签退和未分析的打卡数据
|
|
// 每天凌晨1点,计算前一天所有的未签退和未分析的打卡数据
|
|
|
context.schedule(DetailLastDayRecordAnalyseTask.class, "0 0 1 * * ?");
|
|
context.schedule(DetailLastDayRecordAnalyseTask.class, "0 0 1 * * ?");
|
|
@@ -68,43 +71,9 @@ public class ThisApplication {
|
|
|
try {
|
|
try {
|
|
|
CacheManager.shutdown();
|
|
CacheManager.shutdown();
|
|
|
DataProcessThreadFactory.getInstance().showdown();
|
|
DataProcessThreadFactory.getInstance().showdown();
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
MonitorFileDataOpt.stop();
|
|
MonitorFileDataOpt.stop();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
- try {
|
|
|
|
|
- dingdingQueue.stop();
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- personStatisticQueue.stop();
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- unitStatisticQueue.stop();
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- qywxQueue.stop();
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- unitQywxStatisticQueue.stop();
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- personQywxStatisticQueue.stop();
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|