提交 585e1ea4 编写于 作者: Z zhourui

fix queue start

上级 ed56ea12
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 final QueueDingdingAttendance dingdingQueue = new QueueDingdingAttendance();
public static QueueQywxAttendanceSync qywxQueue = new QueueQywxAttendanceSync(); public static final QueueQywxAttendanceSync qywxQueue = new QueueQywxAttendanceSync();
public static QueueQywxUnitStatistic unitQywxStatisticQueue = new QueueQywxUnitStatistic(); public static final QueueQywxUnitStatistic unitQywxStatisticQueue = new QueueQywxUnitStatistic();
public static QueueQywxPersonStatistic personQywxStatisticQueue = new QueueQywxPersonStatistic(); public static final QueueQywxPersonStatistic personQywxStatisticQueue = new QueueQywxPersonStatistic();
public static QueueDingdingPersonStatistic personStatisticQueue = new QueueDingdingPersonStatistic(); public static final QueueDingdingPersonStatistic personStatisticQueue = new QueueDingdingPersonStatistic();
public static QueueDingdingUnitStatistic unitStatisticQueue = new QueueDingdingUnitStatistic(); public static final QueueDingdingUnitStatistic unitStatisticQueue = new QueueDingdingUnitStatistic();
public static QueuePersonAttendanceDetailAnalyse detailAnalyseQueue = new QueuePersonAttendanceDetailAnalyse(); public static final QueuePersonAttendanceDetailAnalyse detailAnalyseQueue = new QueuePersonAttendanceDetailAnalyse();
public static QueueAttendanceDetailStatistic detailStatisticQueue = new QueueAttendanceDetailStatistic(); 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();
context.startQueue(detailAnalyseQueue);
detailAnalyseQueue.start(); context.startQueue(detailStatisticQueue);
detailStatisticQueue.start();
if (BooleanUtils.isTrue(Config.dingding().getAttendanceSyncEnable())) { if (BooleanUtils.isTrue(Config.dingding().getAttendanceSyncEnable())) {
dingdingQueue.start(); context.startQueue(dingdingQueue);
personStatisticQueue.start(); context.startQueue(personStatisticQueue);
unitStatisticQueue.start(); 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(); context.startQueue(qywxQueue);
unitQywxStatisticQueue.start(); context.startQueue(unitQywxStatisticQueue);
personQywxStatisticQueue.start(); 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 { ...@@ -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();
}
} }
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.x.bbs.assemble.control; ...@@ -2,6 +2,8 @@ package com.x.bbs.assemble.control;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.BooleanUtils;
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;
...@@ -26,10 +28,14 @@ import com.x.bbs.entity.BBSSectionInfo; ...@@ -26,10 +28,14 @@ import com.x.bbs.entity.BBSSectionInfo;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static final String BBSMANAGER = "BBSManager@CMSManagerSystemRole@R"; public static final String BBSMANAGER = "BBSManager@CMSManagerSystemRole@R";
public static QueueNewReplyNotify queueNewReplyNotify; public static final QueueNewReplyNotify queueNewReplyNotify = new QueueNewReplyNotify();
public static QueueNewSubjectNotify queueNewSubjectNotify; public static final QueueNewSubjectNotify queueNewSubjectNotify = new QueueNewSubjectNotify();
public static String CONFIG_BBS_ANONYMOUS_PERMISSION = "YES"; public static String CONFIG_BBS_ANONYMOUS_PERMISSION = "YES";
public static Context context() { public static Context context() {
...@@ -43,11 +49,7 @@ public class ThisApplication { ...@@ -43,11 +49,7 @@ public class ThisApplication {
CONFIG_BBS_ANONYMOUS_PERMISSION = (new BBSConfigSettingService()) CONFIG_BBS_ANONYMOUS_PERMISSION = (new BBSConfigSettingService())
.getValueWithConfigCode("BBS_ANONYMOUS_PERMISSION"); .getValueWithConfigCode("BBS_ANONYMOUS_PERMISSION");
initAllSystemConfig(); initAllSystemConfig();
queueNewReplyNotify = new QueueNewReplyNotify();
queueNewSubjectNotify = new QueueNewSubjectNotify();
MessageConnector.start(context()); MessageConnector.start(context());
context().startQueue(queueNewReplyNotify); context().startQueue(queueNewReplyNotify);
context().startQueue(queueNewSubjectNotify); context().startQueue(queueNewSubjectNotify);
context.schedule(SubjectTotalStatisticTask.class, "0 0 1 * * ?"); // 每天凌晨一点执行 context.schedule(SubjectTotalStatisticTask.class, "0 0 1 * * ?"); // 每天凌晨一点执行
...@@ -144,7 +146,7 @@ public class ThisApplication { ...@@ -144,7 +146,7 @@ public class ThisApplication {
* @return * @return
*/ */
public static Boolean isForumManager(EffectivePerson effectivePerson, BBSForumInfo forumInfo) { public static Boolean isForumManager(EffectivePerson effectivePerson, BBSForumInfo forumInfo) {
if (isBBSManager(effectivePerson)) { if (BooleanUtils.isTrue(isBBSManager(effectivePerson))) {
return true; return true;
} }
if (forumInfo != null && ListTools.isNotEmpty(forumInfo.getForumManagerList())) { if (forumInfo != null && ListTools.isNotEmpty(forumInfo.getForumManagerList())) {
......
...@@ -2,6 +2,8 @@ package com.x.calendar.assemble.control; ...@@ -2,6 +2,8 @@ package com.x.calendar.assemble.control;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.BooleanUtils;
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;
...@@ -17,6 +19,10 @@ import com.x.calendar.core.entity.Calendar_Event; ...@@ -17,6 +19,10 @@ import com.x.calendar.core.entity.Calendar_Event;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static final String CalendarMANAGER = "CalendarManager"; public static final String CalendarMANAGER = "CalendarManager";
...@@ -73,7 +79,7 @@ public class ThisApplication { ...@@ -73,7 +79,7 @@ public class ThisApplication {
* @return * @return
*/ */
public static Boolean isCalendarManager(EffectivePerson effectivePerson, Calendar calendar) { public static Boolean isCalendarManager(EffectivePerson effectivePerson, Calendar calendar) {
if (isCalendarSystemManager(effectivePerson)) { if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) {
return true; return true;
} }
if (calendar != null) { if (calendar != null) {
...@@ -98,11 +104,11 @@ public class ThisApplication { ...@@ -98,11 +104,11 @@ public class ThisApplication {
*/ */
public static Boolean isCalendarPublisher(EffectivePerson effectivePerson, List<String> unitNames, public static Boolean isCalendarPublisher(EffectivePerson effectivePerson, List<String> unitNames,
List<String> groupNames, Calendar calendar) { List<String> groupNames, Calendar calendar) {
if (isCalendarSystemManager(effectivePerson)) { if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) {
return true; return true;
} }
if (calendar != null) { if (calendar != null) {
if (isCalendarManager(effectivePerson, calendar)) { if (BooleanUtils.isTrue(isCalendarManager(effectivePerson, calendar))) {
return true; return true;
} }
// 判断发布权限 // 判断发布权限
...@@ -142,13 +148,13 @@ public class ThisApplication { ...@@ -142,13 +148,13 @@ public class ThisApplication {
* @throws Exception * @throws Exception
*/ */
public static Boolean isCalendarPublisher(EffectivePerson effectivePerson, Calendar calendar) throws Exception { public static Boolean isCalendarPublisher(EffectivePerson effectivePerson, Calendar calendar) throws Exception {
if (isCalendarSystemManager(effectivePerson)) { if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) {
return true; return true;
} }
List<String> unitNames = null; List<String> unitNames = null;
List<String> groupNames = null; List<String> groupNames = null;
if (calendar != null) { if (calendar != null) {
if (isCalendarManager(effectivePerson, calendar)) { if (BooleanUtils.isTrue(isCalendarManager(effectivePerson, calendar))) {
return true; return true;
} }
UserManagerService userManagerService = new UserManagerService(); UserManagerService userManagerService = new UserManagerService();
...@@ -192,7 +198,7 @@ public class ThisApplication { ...@@ -192,7 +198,7 @@ public class ThisApplication {
*/ */
public static Boolean isEventManager(EffectivePerson effectivePerson, Calendar calendar, Calendar_Event event) public static Boolean isEventManager(EffectivePerson effectivePerson, Calendar calendar, Calendar_Event event)
throws Exception { throws Exception {
if (isCalendarSystemManager(effectivePerson)) { if (BooleanUtils.isTrue(isCalendarSystemManager(effectivePerson))) {
return true; return true;
} }
List<String> unitNames = null; List<String> unitNames = null;
...@@ -203,7 +209,7 @@ public class ThisApplication { ...@@ -203,7 +209,7 @@ public class ThisApplication {
unitNames = userManagerService.listUnitNamesWithPerson(personName); unitNames = userManagerService.listUnitNamesWithPerson(personName);
groupNames = userManagerService.listGroupNamesByPerson(personName); groupNames = userManagerService.listGroupNamesByPerson(personName);
// 判断日历的发布权限 // 判断日历的发布权限
if (isCalendarPublisher(effectivePerson, unitNames, groupNames, calendar)) { if (BooleanUtils.isTrue(isCalendarPublisher(effectivePerson, unitNames, groupNames, calendar))) {
return true; return true;
} }
// 判断事件的管理权限 // 判断事件的管理权限
......
package com.x.cms.assemble.control; package com.x.cms.assemble.control;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
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;
...@@ -22,17 +23,27 @@ import com.x.cms.assemble.control.timertask.Timertask_RefreshAllDocumentReviews; ...@@ -22,17 +23,27 @@ import com.x.cms.assemble.control.timertask.Timertask_RefreshAllDocumentReviews;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static final String ROLE_CMSManager = "CMSManager@CMSManagerSystemRole@R"; public static final String ROLE_CMSManager = "CMSManager@CMSManagerSystemRole@R";
public static final String ROLE_Manager = "Manager@ManagerSystemRole@R"; public static final String ROLE_Manager = "Manager@ManagerSystemRole@R";
public static QueueDataRowImport queueDataRowImport; // 文档批量导入时数据存储过程
public static QueueDocumentDelete queueDocumentDelete; public static final QueueDataRowImport queueDataRowImport = new QueueDataRowImport();
public static QueueDocumentUpdate queueDocumentUpdate; // Document删除时也需要检查一下热点图片里的数据是否已经删除掉了
public static QueueDocumentViewCountUpdate queueDocumentViewCountUpdate; public static final QueueDocumentDelete queueDocumentDelete = new QueueDocumentDelete();
public static QueueBatchOperation queueBatchOperation; // Document变更标题时也需要更新一下热点图片里的数据
public static QueueSendDocumentNotify queueSendDocumentNotify; public static final QueueDocumentUpdate queueDocumentUpdate = new QueueDocumentUpdate();
private static ConcurrentHashMap<String, DataImportStatus> importStatus = new ConcurrentHashMap<>(); // Document被访问时,需要将总的访问量更新到item的document中,便于视图使用,在队列里异步修改
public static final QueueDocumentViewCountUpdate queueDocumentViewCountUpdate = new QueueDocumentViewCountUpdate();
// 执行数据库中的批处理操作
public static final QueueBatchOperation queueBatchOperation = new QueueBatchOperation();
// Document发布时,向所有阅读者推送通知
public static final QueueSendDocumentNotify queueSendDocumentNotify = new QueueSendDocumentNotify();
private static final ConcurrentHashMap<String, DataImportStatus> importStatus = new ConcurrentHashMap<>();
public static Context context() { public static Context context() {
return context; return context;
...@@ -41,21 +52,7 @@ public class ThisApplication { ...@@ -41,21 +52,7 @@ public class ThisApplication {
public static void init() throws Exception { public static void init() throws Exception {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_cms_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_cms_assemble_control());
// 执行数据库中的批处理操作
queueBatchOperation = new QueueBatchOperation();
// Document删除时也需要检查一下热点图片里的数据是否已经删除掉了
queueDocumentDelete = new QueueDocumentDelete();
// 文档批量导入时数据存储过程
queueDataRowImport = new QueueDataRowImport();
// Document变更标题时也需要更新一下热点图片里的数据
queueDocumentUpdate = new QueueDocumentUpdate();
// Document被访问时,需要将总的访问量更新到item的document中,便于视图使用,在队列里异步修改
queueDocumentViewCountUpdate = new QueueDocumentViewCountUpdate();
// Document发布时,向所有阅读者推送通知
queueSendDocumentNotify = new QueueSendDocumentNotify();
MessageConnector.start(context()); MessageConnector.start(context());
context().startQueue(queueBatchOperation); context().startQueue(queueBatchOperation);
context().startQueue(queueDocumentDelete); context().startQueue(queueDocumentDelete);
context().startQueue(queueDataRowImport); context().startQueue(queueDataRowImport);
...@@ -77,18 +74,12 @@ public class ThisApplication { ...@@ -77,18 +74,12 @@ public class ThisApplication {
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown(); CacheManager.shutdown();
queueBatchOperation.stop();
queueDocumentDelete.stop();
queueDataRowImport.stop();
queueDocumentUpdate.stop();
queueDocumentViewCountUpdate.stop();
queueSendDocumentNotify.stop();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static ConcurrentHashMap<String, DataImportStatus> listImportStatus() { public static ConcurrentMap<String, DataImportStatus> listImportStatus() {
return importStatus; return importStatus;
} }
......
...@@ -9,7 +9,11 @@ import com.x.file.assemble.control.jaxrs.file.FileRemoveQueue; ...@@ -9,7 +9,11 @@ import com.x.file.assemble.control.jaxrs.file.FileRemoveQueue;
public class ThisApplication { public class ThisApplication {
public static FileRemoveQueue fileRemoveQueue; private ThisApplication() {
// nothing
}
public static final FileRemoveQueue fileRemoveQueue = new FileRemoveQueue();
protected static Context context; protected static Context context;
...@@ -21,7 +25,6 @@ public class ThisApplication { ...@@ -21,7 +25,6 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_file_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_file_assemble_control());
fileRemoveQueue = new FileRemoveQueue();
MessageConnector.start(context()); MessageConnector.start(context());
context().startQueue(fileRemoveQueue); context().startQueue(fileRemoveQueue);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -9,7 +9,11 @@ import com.x.hotpic.assemble.control.schedule.InfoExistsCheckTask; ...@@ -9,7 +9,11 @@ import com.x.hotpic.assemble.control.schedule.InfoExistsCheckTask;
public class ThisApplication { public class ThisApplication {
public static DocumentExistsCheckTask queueLoginRecord; private ThisApplication() {
// nothing
}
public static final DocumentExistsCheckTask queueLoginRecord = new DocumentExistsCheckTask();
protected static Context context; protected static Context context;
public static Context context() { public static Context context() {
...@@ -20,7 +24,6 @@ public class ThisApplication { ...@@ -20,7 +24,6 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_hotpic_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_hotpic_assemble_control());
queueLoginRecord = new DocumentExistsCheckTask();
context.startQueue(queueLoginRecord); context.startQueue(queueLoginRecord);
context.schedule(InfoExistsCheckTask.class, "0 0/10 * * * ?"); context.schedule(InfoExistsCheckTask.class, "0 0/10 * * * ?");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -8,6 +8,10 @@ import com.x.base.core.project.message.MessageConnector; ...@@ -8,6 +8,10 @@ import com.x.base.core.project.message.MessageConnector;
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() {
......
package com.x.message.assemble.communicate; package com.x.message.assemble.communicate;
import com.x.base.core.project.message.MessageConnector;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
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 com.x.base.core.project.message.MessageConnector;
import com.x.message.assemble.communicate.schedule.Clean; import com.x.message.assemble.communicate.schedule.Clean;
import com.x.message.assemble.communicate.schedule.TriggerMq; import com.x.message.assemble.communicate.schedule.TriggerMq;
import com.x.message.core.entity.Message;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static WsConsumeQueue wsConsumeQueue = new WsConsumeQueue(); public static final WsConsumeQueue wsConsumeQueue = new WsConsumeQueue();
public static PmsConsumeQueue pmsConsumeQueue = new PmsConsumeQueue(); public static final PmsConsumeQueue pmsConsumeQueue = new PmsConsumeQueue();
public static CalendarConsumeQueue calendarConsumeQueue = new CalendarConsumeQueue(); public static final CalendarConsumeQueue calendarConsumeQueue = new CalendarConsumeQueue();
public static QiyeweixinConsumeQueue qiyeweixinConsumeQueue = new QiyeweixinConsumeQueue(); public static final QiyeweixinConsumeQueue qiyeweixinConsumeQueue = new QiyeweixinConsumeQueue();
public static ZhengwuDingdingConsumeQueue zhengwuDingdingConsumeQueue = new ZhengwuDingdingConsumeQueue(); public static final ZhengwuDingdingConsumeQueue zhengwuDingdingConsumeQueue = new ZhengwuDingdingConsumeQueue();
public static DingdingConsumeQueue dingdingConsumeQueue = new DingdingConsumeQueue(); public static final DingdingConsumeQueue dingdingConsumeQueue = new DingdingConsumeQueue();
public static WeLinkConsumeQueue weLinkConsumeQueue = new WeLinkConsumeQueue(); public static final WeLinkConsumeQueue weLinkConsumeQueue = new WeLinkConsumeQueue();
public static PmsInnerConsumeQueue pmsInnerConsumeQueue = new PmsInnerConsumeQueue(); public static final PmsInnerConsumeQueue pmsInnerConsumeQueue = new PmsInnerConsumeQueue();
public static MQConsumeQueue mqConsumeQueue = new MQConsumeQueue(); public static final MQConsumeQueue mqConsumeQueue = new MQConsumeQueue();
public static Context context() { public static Context context() {
return context; return context;
...@@ -41,62 +44,57 @@ public class ThisApplication { ...@@ -41,62 +44,57 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_message_assemble_communicate()); LoggerFactory.setLevel(Config.logLevel().x_message_assemble_communicate());
if (Config.communicate().wsEnable()) {
wsConsumeQueue.start(); MessageConnector.start(context());
startQueue();
if (BooleanUtils.isTrue(Config.communicate().clean().getEnable())) {
context().schedule(Clean.class, Config.communicate().clean().getCron());
} }
if (Config.communicate().pmsEnable()) { if (BooleanUtils.isTrue(Config.communicate().cronMq().getEnable())) {
pmsConsumeQueue.start(); context().schedule(TriggerMq.class, Config.communicate().cronMq().getCron());
} }
if (Config.communicate().calendarEnable()) { } catch (Exception e) {
calendarConsumeQueue.start(); e.printStackTrace();
} }
if (BooleanUtils.isTrue(Config.communicate().clean().getEnable())) {
context().schedule(Clean.class, Config.communicate().clean().getCron());
} }
private static void startQueue() throws Exception {
if (BooleanUtils.isTrue(Config.communicate().wsEnable())) {
context().startQueue(wsConsumeQueue);
}
if (BooleanUtils.isTrue(Config.communicate().pmsEnable())) {
context().startQueue(pmsConsumeQueue);
}
if (BooleanUtils.isTrue(Config.communicate().calendarEnable())) {
context().startQueue(calendarConsumeQueue);
}
if (BooleanUtils.isTrue(Config.qiyeweixin().getEnable()) if (BooleanUtils.isTrue(Config.qiyeweixin().getEnable())
&& BooleanUtils.isTrue(Config.qiyeweixin().getMessageEnable())) { && BooleanUtils.isTrue(Config.qiyeweixin().getMessageEnable())) {
qiyeweixinConsumeQueue.start(); context().startQueue(qiyeweixinConsumeQueue);
} }
if (BooleanUtils.isTrue(Config.zhengwuDingding().getEnable()) if (BooleanUtils.isTrue(Config.zhengwuDingding().getEnable())
&& BooleanUtils.isTrue(Config.zhengwuDingding().getMessageEnable())) { && BooleanUtils.isTrue(Config.zhengwuDingding().getMessageEnable())) {
zhengwuDingdingConsumeQueue.start(); context().startQueue(zhengwuDingdingConsumeQueue);
} }
if (Config.dingding().getEnable() && Config.dingding().getMessageEnable()) { if (Config.dingding().getEnable() && Config.dingding().getMessageEnable()) {
dingdingConsumeQueue.start(); context().startQueue(dingdingConsumeQueue);
} }
if (BooleanUtils.isTrue(Config.pushConfig().getEnable())) { if (BooleanUtils.isTrue(Config.pushConfig().getEnable())) {
pmsInnerConsumeQueue.start(); context().startQueue(pmsInnerConsumeQueue);
} }
if (Config.weLink().getEnable() && Config.weLink().getMessageEnable()) { if (Config.weLink().getEnable() && Config.weLink().getMessageEnable()) {
weLinkConsumeQueue.start(); context().startQueue(weLinkConsumeQueue);
}
if (Config.mq().getEnable()) {
mqConsumeQueue.start();
}
MessageConnector.start(context());
if (BooleanUtils.isTrue(Config.communicate().cronMq().getEnable())) {
context().schedule(TriggerMq.class, Config.communicate().cronMq().getCron());
} }
} catch (Exception e) { if (BooleanUtils.isTrue(Config.mq().getEnable())) {
e.printStackTrace(); context().startQueue(mqConsumeQueue);
} }
} }
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown(); CacheManager.shutdown();
wsConsumeQueue.stop();
pmsConsumeQueue.stop();
calendarConsumeQueue.stop();
qiyeweixinConsumeQueue.stop();
zhengwuDingdingConsumeQueue.stop();
dingdingConsumeQueue.stop();
pmsInnerConsumeQueue.stop();
weLinkConsumeQueue.stop();
MessageConnector.stop(); MessageConnector.stop();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -8,8 +8,13 @@ import com.x.base.core.project.message.MessageConnector; ...@@ -8,8 +8,13 @@ import com.x.base.core.project.message.MessageConnector;
import com.x.mind.assemble.control.queue.QueueShareNotify; import com.x.mind.assemble.control.queue.QueueShareNotify;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static QueueShareNotify queueShareNotify; public static final QueueShareNotify queueShareNotify = new QueueShareNotify();
public static Context context() { public static Context context() {
return context; return context;
...@@ -19,7 +24,6 @@ public class ThisApplication { ...@@ -19,7 +24,6 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_mind_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_mind_assemble_control());
queueShareNotify = new QueueShareNotify();
MessageConnector.start(context()); MessageConnector.start(context());
context().startQueue(queueShareNotify); context().startQueue(queueShareNotify);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -8,8 +8,13 @@ import com.x.base.core.project.message.MessageConnector; ...@@ -8,8 +8,13 @@ import com.x.base.core.project.message.MessageConnector;
import com.x.mind.assemble.control.queue.QueueShareNotify; import com.x.mind.assemble.control.queue.QueueShareNotify;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static QueueShareNotify queueShareNotify; public static final QueueShareNotify queueShareNotify = new QueueShareNotify();
public static Context context() { public static Context context() {
return context; return context;
...@@ -19,7 +24,6 @@ public class ThisApplication { ...@@ -19,7 +24,6 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_mind_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_mind_assemble_control());
queueShareNotify = new QueueShareNotify();
MessageConnector.start(context()); MessageConnector.start(context());
context().startQueue(queueShareNotify); context().startQueue(queueShareNotify);
} catch (Exception e) { } catch (Exception e) {
...@@ -30,6 +34,7 @@ public class ThisApplication { ...@@ -30,6 +34,7 @@ public class ThisApplication {
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown();
queueShareNotify.stop(); queueShareNotify.stop();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -20,13 +20,17 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService; ...@@ -20,13 +20,17 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static Map<String, CacheImportFileStatus> importFileStatusMap = new HashMap<String, CacheImportFileStatus>(); public static Map<String, CacheImportFileStatus> importFileStatusMap = new HashMap<String, CacheImportFileStatus>();
public static final String OKRMANAGER = "OKRManager"; public static final String OKRMANAGER = "OKRManager";
public static QueueWorkDynamicRecord queueWorkDynamicRecord; public static final QueueWorkDynamicRecord queueWorkDynamicRecord = new QueueWorkDynamicRecord();
public static Context context() { public static Context context() {
return context; return context;
...@@ -36,11 +40,8 @@ public class ThisApplication { ...@@ -36,11 +40,8 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_okr_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_okr_assemble_control());
queueWorkDynamicRecord = new QueueWorkDynamicRecord();
context().startQueue(queueWorkDynamicRecord); context().startQueue(queueWorkDynamicRecord);
new OkrConfigSystemService().initAllSystemConfig(); new OkrConfigSystemService().initAllSystemConfig();
// 每天凌晨2点执行一次 // 每天凌晨2点执行一次
context.schedule(St_WorkReportContent.class, "0 0 2 * * ?"); context.schedule(St_WorkReportContent.class, "0 0 2 * * ?");
// 每天凌晨2点30执行一次 // 每天凌晨2点30执行一次
......
...@@ -20,13 +20,17 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService; ...@@ -20,13 +20,17 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static Map<String, CacheImportFileStatus> importFileStatusMap = new HashMap<String, CacheImportFileStatus>(); public static Map<String, CacheImportFileStatus> importFileStatusMap = new HashMap<String, CacheImportFileStatus>();
public static final String OKRMANAGER = "OKRManager"; public static final String OKRMANAGER = "OKRManager";
public static QueueWorkDynamicRecord queueWorkDynamicRecord; public static final QueueWorkDynamicRecord queueWorkDynamicRecord = new QueueWorkDynamicRecord();
public static Context context() { public static Context context() {
return context; return context;
...@@ -36,11 +40,8 @@ public class ThisApplication { ...@@ -36,11 +40,8 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_okr_assemble_control()); LoggerFactory.setLevel(Config.logLevel().x_okr_assemble_control());
queueWorkDynamicRecord = new QueueWorkDynamicRecord();
context().startQueue(queueWorkDynamicRecord); context().startQueue(queueWorkDynamicRecord);
new OkrConfigSystemService().initAllSystemConfig(); new OkrConfigSystemService().initAllSystemConfig();
// 每天凌晨2点执行一次 // 每天凌晨2点执行一次
context.schedule(St_WorkReportContent.class, "0 0 2 * * ?"); context.schedule(St_WorkReportContent.class, "0 0 2 * * ?");
// 每天凌晨2点30执行一次 // 每天凌晨2点30执行一次
...@@ -63,6 +64,7 @@ public class ThisApplication { ...@@ -63,6 +64,7 @@ public class ThisApplication {
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -10,7 +10,11 @@ import com.x.organization.assemble.authentication.schedule.CleanupOauthCode; ...@@ -10,7 +10,11 @@ import com.x.organization.assemble.authentication.schedule.CleanupOauthCode;
public class ThisApplication { public class ThisApplication {
public static QueueLoginRecord queueLoginRecord; private ThisApplication() {
// nothing
}
public static final QueueLoginRecord queueLoginRecord = new QueueLoginRecord();
protected static Context context; protected static Context context;
...@@ -22,7 +26,6 @@ public class ThisApplication { ...@@ -22,7 +26,6 @@ public class ThisApplication {
try { try {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_organization_assemble_authentication()); LoggerFactory.setLevel(Config.logLevel().x_organization_assemble_authentication());
queueLoginRecord = new QueueLoginRecord();
context.startQueue(queueLoginRecord); context.startQueue(queueLoginRecord);
context.schedule(CleanupBind.class, "0 */15 * * * ?"); context.schedule(CleanupBind.class, "0 */15 * * * ?");
context.schedule(CleanupOauthCode.class, "0 */15 * * * ?"); context.schedule(CleanupOauthCode.class, "0 */15 * * * ?");
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -8,6 +8,10 @@ import com.x.organization.assemble.personal.schedule.DisableExpiredEmpower; ...@@ -8,6 +8,10 @@ import com.x.organization.assemble.personal.schedule.DisableExpiredEmpower;
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() {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
...@@ -24,6 +28,7 @@ public class ThisApplication { ...@@ -24,6 +28,7 @@ public class ThisApplication {
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -11,6 +11,10 @@ import com.x.processplatform.assemble.bam.schedule.StateTimer; ...@@ -11,6 +11,10 @@ import com.x.processplatform.assemble.bam.schedule.StateTimer;
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() {
......
...@@ -11,6 +11,10 @@ import com.x.processplatform.assemble.bam.schedule.StateTimer; ...@@ -11,6 +11,10 @@ import com.x.processplatform.assemble.bam.schedule.StateTimer;
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() {
...@@ -31,6 +35,7 @@ public class ThisApplication { ...@@ -31,6 +35,7 @@ public class ThisApplication {
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -8,13 +8,17 @@ import com.x.base.core.project.message.MessageConnector; ...@@ -8,13 +8,17 @@ import com.x.base.core.project.message.MessageConnector;
public class ThisApplication { public class ThisApplication {
private ThisApplication() {
// nothing
}
protected static Context context; protected static Context context;
public static ProjectionExecuteQueue projectionExecuteQueue = new ProjectionExecuteQueue(); public static final ProjectionExecuteQueue projectionExecuteQueue = new ProjectionExecuteQueue();
public static MappingExecuteQueue mappingExecuteQueue = new MappingExecuteQueue(); public static final MappingExecuteQueue mappingExecuteQueue = new MappingExecuteQueue();
public static FormVersionQueue formVersionQueue = new FormVersionQueue(); public static final FormVersionQueue formVersionQueue = new FormVersionQueue();
public static ProcessVersionQueue processVersionQueue = new ProcessVersionQueue(); public static final ProcessVersionQueue processVersionQueue = new ProcessVersionQueue();
public static ScriptVersionQueue scriptVersionQueue = new ScriptVersionQueue(); public static final ScriptVersionQueue scriptVersionQueue = new ScriptVersionQueue();
public static Context context() { public static Context context() {
return context; return context;
...@@ -25,11 +29,11 @@ public class ThisApplication { ...@@ -25,11 +29,11 @@ public class ThisApplication {
CacheManager.init(context.clazz().getSimpleName()); CacheManager.init(context.clazz().getSimpleName());
LoggerFactory.setLevel(Config.logLevel().x_processplatform_assemble_designer()); LoggerFactory.setLevel(Config.logLevel().x_processplatform_assemble_designer());
MessageConnector.start(context()); MessageConnector.start(context());
projectionExecuteQueue.start(); context().startQueue(projectionExecuteQueue);
mappingExecuteQueue.start(); context().startQueue(mappingExecuteQueue);
formVersionQueue.start(); context().startQueue(formVersionQueue);
processVersionQueue.start(); context().startQueue(processVersionQueue);
scriptVersionQueue.start(); context().startQueue(scriptVersionQueue);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -38,11 +42,6 @@ public class ThisApplication { ...@@ -38,11 +42,6 @@ public class ThisApplication {
public static void destroy() { public static void destroy() {
try { try {
CacheManager.shutdown(); CacheManager.shutdown();
projectionExecuteQueue.stop();
mappingExecuteQueue.stop();
formVersionQueue.stop();
processVersionQueue.stop();
scriptVersionQueue.stop();
MessageConnector.stop(); MessageConnector.stop();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -8,6 +8,10 @@ import com.x.processplatform.assemble.surface.schedule.CleanKeyLock; ...@@ -8,6 +8,10 @@ import com.x.processplatform.assemble.surface.schedule.CleanKeyLock;
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() {
......
...@@ -21,13 +21,17 @@ import org.apache.commons.lang3.BooleanUtils; ...@@ -21,13 +21,17 @@ 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 SyncJaxrsInvokeQueue syncJaxrsInvokeQueue = new SyncJaxrsInvokeQueue(); public static final SyncJaxrsInvokeQueue syncJaxrsInvokeQueue = new SyncJaxrsInvokeQueue();
public static SyncJaxwsInvokeQueue syncJaxwsInvokeQueue = new SyncJaxwsInvokeQueue(); public static final SyncJaxwsInvokeQueue syncJaxwsInvokeQueue = new SyncJaxwsInvokeQueue();
public static SyncEmbedQueue syncEmbedQueue = new SyncEmbedQueue(); public static final SyncEmbedQueue syncEmbedQueue = new SyncEmbedQueue();
public static Context context() { public static Context context() {
return context; return context;
......
...@@ -5,6 +5,8 @@ import java.util.List; ...@@ -5,6 +5,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.BooleanUtils;
import com.google.gson.internal.LinkedTreeMap; import com.google.gson.internal.LinkedTreeMap;
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;
...@@ -28,23 +30,27 @@ import com.x.program.center.schedule.ZhengwuDingdingSyncOrganizationTrigger; ...@@ -28,23 +30,27 @@ import com.x.program.center.schedule.ZhengwuDingdingSyncOrganizationTrigger;
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 CenterQueue centerQueue = new CenterQueue(); public static final CenterQueue centerQueue = new CenterQueue();
public static LogQueue logQueue = new LogQueue(); public static final LogQueue logQueue = new LogQueue();
public static List<Object> dingdingSyncOrganizationCallbackRequest = new ArrayList<>(); public static final List<Object> dingdingSyncOrganizationCallbackRequest = new ArrayList<>();
public static List<Object> weLinkSyncOrganizationCallbackRequest = new ArrayList<>(); public static final List<Object> weLinkSyncOrganizationCallbackRequest = new ArrayList<>();
public static List<Object> zhengwuDingdingSyncOrganizationCallbackRequest = new ArrayList<>(); public static final List<Object> zhengwuDingdingSyncOrganizationCallbackRequest = new ArrayList<>();
public static List<Object> qiyeweixinSyncOrganizationCallbackRequest = new ArrayList<>(); public static final List<Object> qiyeweixinSyncOrganizationCallbackRequest = new ArrayList<>();
public static Map<String, Map<String, LinkedTreeMap>> metricsReportMap = new ConcurrentHashMap<>(); public static Map<String, Map<String, LinkedTreeMap>> metricsReportMap = new ConcurrentHashMap<>();
...@@ -56,7 +62,7 @@ public class ThisApplication { ...@@ -56,7 +62,7 @@ public class ThisApplication {
context().startQueue(logQueue); context().startQueue(logQueue);
/* 政务钉钉拉入同步 */ /* 政务钉钉拉入同步 */
if (Config.zhengwuDingding().getEnable()) { if (BooleanUtils.isNotTrue(Config.zhengwuDingding().getEnable())) {
/* 启动同步任务 */ /* 启动同步任务 */
context().scheduleLocal(ZhengwuDingdingSyncOrganization.class, Config.zhengwuDingding().getSyncCron()); context().scheduleLocal(ZhengwuDingdingSyncOrganization.class, Config.zhengwuDingding().getSyncCron());
/* 添加一个强制同步任务 */ /* 添加一个强制同步任务 */
...@@ -64,7 +70,7 @@ public class ThisApplication { ...@@ -64,7 +70,7 @@ public class ThisApplication {
Config.zhengwuDingding().getForceSyncCron()); Config.zhengwuDingding().getForceSyncCron());
} }
/* 企业微信拉入同步 */ /* 企业微信拉入同步 */
if (Config.qiyeweixin().getEnable()) { if (BooleanUtils.isNotTrue(Config.qiyeweixin().getEnable())) {
/* 启动同步任务 */ /* 启动同步任务 */
context().scheduleLocal(QiyeweixinSyncOrganization.class, Config.qiyeweixin().getSyncCron()); context().scheduleLocal(QiyeweixinSyncOrganization.class, Config.qiyeweixin().getSyncCron());
/* 添加一个强制同步任务 */ /* 添加一个强制同步任务 */
...@@ -72,14 +78,14 @@ public class ThisApplication { ...@@ -72,14 +78,14 @@ public class ThisApplication {
Config.qiyeweixin().getForceSyncCron()); Config.qiyeweixin().getForceSyncCron());
} }
/* 钉钉同步 */ /* 钉钉同步 */
if (Config.dingding().getEnable()) { if (BooleanUtils.isNotTrue(Config.dingding().getEnable())) {
/* 启动同步任务 */ /* 启动同步任务 */
context().scheduleLocal(DingdingSyncOrganization.class, Config.dingding().getSyncCron()); context().scheduleLocal(DingdingSyncOrganization.class, Config.dingding().getSyncCron());
/* 添加一个强制同步任务 */ /* 添加一个强制同步任务 */
context().scheduleLocal(DingdingSyncOrganizationTrigger.class, Config.dingding().getForceSyncCron()); context().scheduleLocal(DingdingSyncOrganizationTrigger.class, Config.dingding().getForceSyncCron());
} }
/* WeLink同步 */ /* WeLink同步 */
if (Config.weLink().getEnable()) { if (BooleanUtils.isNotTrue(Config.weLink().getEnable())) {
/* 启动同步任务 */ /* 启动同步任务 */
context().scheduleLocal(WeLinkSyncOrganization.class, Config.weLink().getSyncCron()); context().scheduleLocal(WeLinkSyncOrganization.class, Config.weLink().getSyncCron());
/* 添加一个强制同步任务 */ /* 添加一个强制同步任务 */
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory; ...@@ -7,6 +7,10 @@ import com.x.base.core.project.logger.LoggerFactory;
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() {
......
...@@ -12,6 +12,10 @@ import com.x.query.service.processing.schedule.CrawlWorkCompleted; ...@@ -12,6 +12,10 @@ import com.x.query.service.processing.schedule.CrawlWorkCompleted;
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() {
......
...@@ -12,6 +12,10 @@ import com.x.query.service.processing.schedule.CrawlWorkCompleted; ...@@ -12,6 +12,10 @@ import com.x.query.service.processing.schedule.CrawlWorkCompleted;
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() {
......
package com.x.query.service.processing.jaxrs.test; package com.x.query.service.processing.jaxrs.test;
import java.util.ArrayList;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import javax.script.SimpleScriptContext;
import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.container.factory.EntityManagerContainerFactory;
...@@ -19,7 +24,12 @@ class ActionGroup2 extends BaseAction { ...@@ -19,7 +24,12 @@ class ActionGroup2 extends BaseAction {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>(); ActionResult<Wo> result = new ActionResult<>();
ScriptEngine engine = ScriptFactory.newScriptEngine(); ScriptEngine engine = ScriptFactory.newScriptEngine();
Object o = engine.eval("this.data && this.data.length"); ScriptContext scriptContext = new SimpleScriptContext();
Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
bindings.put("data", new ArrayList<>());
engine.setContext(scriptContext);
engine.eval("var o = this.data && this.data.length;");
Object o = engine.eval("o;");
System.out.println(o.getClass()); System.out.println(o.getClass());
return result; return result;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册