|
@@ -6,6 +6,7 @@ import org.dromara.business.domain.dto.ItemsPrizeDto;
|
|
|
import org.dromara.business.domain.dto.TournamentsDto;
|
|
import org.dromara.business.domain.dto.TournamentsDto;
|
|
|
import org.dromara.business.domain.vo.*;
|
|
import org.dromara.business.domain.vo.*;
|
|
|
import org.dromara.business.mapper.*;
|
|
import org.dromara.business.mapper.*;
|
|
|
|
|
+import org.dromara.business.service.IScheduleConfigService;
|
|
|
import org.dromara.business.service.ITournamentsService;
|
|
import org.dromara.business.service.ITournamentsService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
@@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.LocalTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
@@ -60,10 +62,39 @@ public class ScheduleTask {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
ScheduleTournamentsReletionMapper scheduleTournamentsReletionMapper;
|
|
ScheduleTournamentsReletionMapper scheduleTournamentsReletionMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ IScheduleConfigService scheduleConfigService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生成 schedule_execution 未来七天任务
|
|
|
|
|
+ */
|
|
|
|
|
+ @Scheduled(cron = "0 01 00 * * ?")
|
|
|
|
|
+ public void generateNextSevenDayTask() {
|
|
|
|
|
+ List<ScheduleConfigVo> scheduleConfigVoList = baseMapper.selectAllScheduleUseConfigs();
|
|
|
|
|
+ for (ScheduleConfigVo scheduleConfigVo : scheduleConfigVoList) {
|
|
|
|
|
+ List<String> repeatTypes=new ArrayList<>();
|
|
|
|
|
+ List<ScheduleRepeatVo> scheduleRepeatVos = scheduleRepeatMapper.selectScheduleRepeatByConfigId(scheduleConfigVo.getId());
|
|
|
|
|
+ for (ScheduleRepeatVo scheduleRepeatVo : scheduleRepeatVos) {
|
|
|
|
|
+ repeatTypes.add(scheduleRepeatVo.getRepeatType());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<LocalTime> execTimes=new ArrayList<>();
|
|
|
|
|
+ List<ScheduleTimeVo> scheduleTimeVos = scheduleTimeMapper.selectScheduleTimeInfoById(scheduleConfigVo.getId());
|
|
|
|
|
+ for (ScheduleTimeVo scheduleTimeVo : scheduleTimeVos) {
|
|
|
|
|
+ execTimes.add(scheduleTimeVo.getExecTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ scheduleConfigService.generateExecutionPlanTask(scheduleConfigVo.getId(),"WEEKLY",LocalDate.now(),LocalDate.now().plusDays(7),repeatTypes,execTimes);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 每天 00:10 执行
|
|
* 每天 00:10 执行
|
|
|
*/
|
|
*/
|
|
|
- @Scheduled(cron = "0 05 00 * * ?")
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 15 00 * * ?")
|
|
|
public void generateMatchesForToday() {
|
|
public void generateMatchesForToday() {
|
|
|
LocalDate today = LocalDate.now();
|
|
LocalDate today = LocalDate.now();
|
|
|
log.info("开始生成今日比赛: {}", today);
|
|
log.info("开始生成今日比赛: {}", today);
|
|
@@ -109,7 +140,7 @@ public class ScheduleTask {
|
|
|
/**
|
|
/**
|
|
|
* 每周一 00:10 执行,生成未来一周的数据
|
|
* 每周一 00:10 执行,生成未来一周的数据
|
|
|
*/
|
|
*/
|
|
|
- @Scheduled(cron = "0 10 00 ? * MON")
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 20 00 ? * MON")
|
|
|
public void generateMatchesForNextWeek() {
|
|
public void generateMatchesForNextWeek() {
|
|
|
LocalDate today = LocalDate.now();
|
|
LocalDate today = LocalDate.now();
|
|
|
log.info("开始生成未来一周比赛: {}", today);
|
|
log.info("开始生成未来一周比赛: {}", today);
|
|
@@ -157,7 +188,7 @@ public class ScheduleTask {
|
|
|
/**
|
|
/**
|
|
|
* 每天 00:10 执行,生成未来三天的数据
|
|
* 每天 00:10 执行,生成未来三天的数据
|
|
|
*/
|
|
*/
|
|
|
- @Scheduled(cron = "0 10 00 * * ?")
|
|
|
|
|
|
|
+ //@Scheduled(cron = "0 10 00 * * ?")
|
|
|
public void generateMatchesForNextThreeDays() {
|
|
public void generateMatchesForNextThreeDays() {
|
|
|
LocalDate today = LocalDate.now();
|
|
LocalDate today = LocalDate.now();
|
|
|
log.info("开始生成未来三天比赛: {}", today);
|
|
log.info("开始生成未来三天比赛: {}", today);
|
|
@@ -251,9 +282,10 @@ public class ScheduleTask {
|
|
|
//查询模版 赛事对应盲注
|
|
//查询模版 赛事对应盲注
|
|
|
TournamentBlindStructuresVo tournamentBlindStructuresVo = tournamentBlindStructuresMapper.selectTournamentBlindStructureByTournamentIdTemplate(tournamentsVo.getId());
|
|
TournamentBlindStructuresVo tournamentBlindStructuresVo = tournamentBlindStructuresMapper.selectTournamentBlindStructureByTournamentIdTemplate(tournamentsVo.getId());
|
|
|
|
|
|
|
|
- // 设置盲注结构 ID
|
|
|
|
|
- bo.setBlindStructureId(tournamentBlindStructuresVo.getBlindStructureId());
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(tournamentBlindStructuresVo!=null){
|
|
|
|
|
+ // 设置盲注结构 ID
|
|
|
|
|
+ bo.setBlindStructureId(tournamentBlindStructuresVo.getBlindStructureId());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//查询模版 设置报名条件
|
|
//查询模版 设置报名条件
|
|
|
TournamentEntryConditionsVo tournamentEntryConditionsVo = tournamentEntryConditionsMapper.selectByTournamentInfoTemplate(tournamentsVo.getId());
|
|
TournamentEntryConditionsVo tournamentEntryConditionsVo = tournamentEntryConditionsMapper.selectByTournamentInfoTemplate(tournamentsVo.getId());
|