cloudroam
4 天以前 46715d892da947c31f07796fdc79dbbef06677b3
src/main/java/com/mzl/flower/schedule/DynamicTaskManager.java
@@ -1,6 +1,7 @@
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;
@@ -8,6 +9,7 @@
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;
@@ -19,8 +21,8 @@
    @Autowired
    private ThreadPoolTaskScheduler taskScheduler;
    @Autowired
    private AiContentTaskConfigService configService;
    @Resource
    private AiContentTaskConfigMapper aiContentTaskConfigMapper;
    @Autowired
    private TaskExecutor taskExecutor;
@@ -30,7 +32,7 @@
    }
    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());