| | |
| | | package com.mzl.flower.schedule; |
| | | |
| | | import com.mzl.flower.entity.film.AiContentTaskConfig; |
| | | import com.mzl.flower.mapper.film.AiContentTaskConfigMapper; |
| | | import com.mzl.flower.service.film.AiContentTaskConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ScheduledFuture; |
| | |
| | | |
| | | @Autowired |
| | | private ThreadPoolTaskScheduler taskScheduler; |
| | | @Autowired |
| | | private AiContentTaskConfigService configService; |
| | | @Resource |
| | | private AiContentTaskConfigMapper aiContentTaskConfigMapper; |
| | | @Autowired |
| | | private TaskExecutor taskExecutor; |
| | | |
| | |
| | | } |
| | | |
| | | public synchronized void refreshTasks() { |
| | | List<AiContentTaskConfig> latestConfigs = configService.getEnabledConfigs(); |
| | | List<AiContentTaskConfig> latestConfigs = aiContentTaskConfigMapper.getAiContentTaskConfigAll(); |
| | | Set<Long> latestIds = latestConfigs.stream() |
| | | .map(AiContentTaskConfig::getId) |
| | | .collect(Collectors.toSet()); |