This commit is contained in:
root
2025-12-15 19:30:06 +05:00
parent 27f22e1099
commit 922f349b23
@@ -2154,13 +2154,34 @@ public class MarketingAnalysisService {
chartsData != null ? chartsData.keySet() : "null");
report.put("chartsData", chartsData);
// Заменяем плейсхолдеры графиков на JSON-блоки
String processedTextReport = textReport;
if (textReport != null && chartsData != null && !chartsData.isEmpty()) {
logger.info("generateMarketingReport: Replacing chart placeholders in text report");
processedTextReport = replaceChartPlaceholders(textReport, chartsData);
logger.info("generateMarketingReport: Chart placeholders replaced. Length: {} chars",
processedTextReport != null ? processedTextReport.length() : 0);
} else if (textReport != null) {
// Если данных графиков нет, просто удаляем плейсхолдеры
logger.warn("generateMarketingReport: No chart data available, removing placeholders");
processedTextReport = textReport
.replace("[[CHART_SEASONALITY]]", "")
.replace("[[CHART_AUDIENCE]]", "")
.replace("[[CHART_COMPETITORS]]", "")
.replace("[[CHART_CHANNELS]]", "")
.replace("[[CHART_FUNNEL]]", "")
.replace("[[CHART_SWOT]]", "");
}
// Сохраняем данные анализа
report.put("analysisTypes", analysisTypeNames);
report.put("detailLevel", detailLevelName);
report.put("fullAnalysis", textReport != null ? textReport : "Анализ не удалось сгенерировать.");
report.put("summary", textReport != null ? textReport : "Анализ не удалось сгенерировать."); // Keep for
// backward
// compatibility
report.put("fullAnalysis",
processedTextReport != null ? processedTextReport : "Анализ не удалось сгенерировать.");
report.put("summary",
processedTextReport != null ? processedTextReport : "Анализ не удалось сгенерировать."); // Keep for
// backward
// compatibility
}
// Generate target audience description (adjusted by detail level)