This commit is contained in:
arys
2026-03-01 15:19:13 +05:00
parent 97d368f46b
commit c71d7aabbb
@@ -13,6 +13,8 @@ import kz.konturai.parser.repository.MarketingAnalysisV3Repository;
import kz.konturai.parser.repository.MarketingStrategyRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
@@ -36,6 +38,11 @@ public class MarketingStrategyV3Service {
private final PostingTaskService postingTaskService;
private final MinIOService minIOService;
// Решение проблемы с @Async (Self-Injection)
@Autowired
@Lazy
private MarketingStrategyV3Service self;
private final ObjectMapper objectMapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -76,7 +83,9 @@ public class MarketingStrategyV3Service {
addStatusHistoryEntry(strategy, "queued", "Запуск генерации. ИИ проектирует массированный контент-план...");
strategy = repository.save(strategy);
processStrategyGenerationAsync(strategy.getId(), analysisDoc, strategy);
// Вызов через прокси для корректной работы @Async
self.processStrategyGenerationAsync(strategy.getId(), analysisDoc, strategy);
return strategy;
}