|
|
@@ -12,11 +12,13 @@ import com.xunmei.common.core.domain.reminder.domain.CoreReminderConfigurationOr
|
|
|
import com.xunmei.common.core.domain.reminder.domain.CoreReminderConfigurationRole;
|
|
|
import com.xunmei.common.core.domain.reminder.dto.ReminderConfigEditDto;
|
|
|
import com.xunmei.common.core.domain.reminder.dto.ReminderConfigPageDto;
|
|
|
+import com.xunmei.common.core.domain.reminder.vo.CoreReminderConfigurationFullVo;
|
|
|
import com.xunmei.common.core.domain.reminder.vo.ReminderConfigDetailVo;
|
|
|
import com.xunmei.common.core.domain.reminder.vo.ReminderConfigPageVo;
|
|
|
import com.xunmei.common.core.enums.BusinessPlanType;
|
|
|
import com.xunmei.common.core.enums.CycleCommonEnum;
|
|
|
import com.xunmei.common.core.enums.TimeUnitEnum;
|
|
|
+import com.xunmei.common.core.thread.ThreadPoolConfig;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.core.vo.IdNameVo;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
@@ -39,6 +41,8 @@ import com.xunmei.system.api.RemoteRoleService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -48,6 +52,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -80,7 +85,9 @@ public class CoreReminderConfigurationServiceImpl extends ServiceImpl<CoreRemind
|
|
|
private CoreReminderConfigurationOrgMapper coreReminderConfigurationOrgMapper;
|
|
|
@Autowired
|
|
|
private ICoreReminderScheduleService reminderScheduleService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ @Qualifier(ThreadPoolConfig.SOC_EXECUTOR)
|
|
|
+ private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -133,7 +140,7 @@ public class CoreReminderConfigurationServiceImpl extends ServiceImpl<CoreRemind
|
|
|
if (sysOrg == null) {
|
|
|
throw new RuntimeException("未找到机构");
|
|
|
}
|
|
|
- if (req.getCheckSub()){
|
|
|
+ if (req.getCheckSub()) {
|
|
|
req.setOrgPath(sysOrg.getPath());
|
|
|
}
|
|
|
|
|
|
@@ -218,6 +225,42 @@ public class CoreReminderConfigurationServiceImpl extends ServiceImpl<CoreRemind
|
|
|
execNums);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void findTask() {
|
|
|
+
|
|
|
+ List<CoreReminderConfigurationFullVo> configList = baseMapper.findAllFullData();
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, List<CoreReminderConfigurationFullVo>> listMap = configList.stream().collect(Collectors.groupingBy(CoreReminderConfigurationFullVo::getSendModule));
|
|
|
+ for (Map.Entry<String, List<CoreReminderConfigurationFullVo>> entry : listMap.entrySet()) {
|
|
|
+ BusinessPlanType type = BusinessPlanType.getBusinessPlanType(entry.getKey());
|
|
|
+ List<CoreReminderConfigurationFullVo> configurationList = entry.getValue();
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ switch (type) {
|
|
|
+ case RESUMPTION:
|
|
|
+ resumptionPlanService.findTaskAndBuildReminderSchedule(configurationList);
|
|
|
+ break;
|
|
|
+ case SAFETY_CHECK:
|
|
|
+ break;
|
|
|
+ case EDU_TRAINING:
|
|
|
+ break;
|
|
|
+
|
|
|
+ case DRILL:
|
|
|
+ break;
|
|
|
+
|
|
|
+ case MONITORING_RETRIEVAL:
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ throw new RuntimeException("不支持的业务类型!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }, threadPoolTaskExecutor);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private DateRange getPlanDateRange(String sendModule, Long planId) {
|
|
|
BusinessPlanType type = BusinessPlanType.getBusinessPlanType(sendModule);
|
|
|
switch (type) {
|