|
|
|
@ -25,12 +25,10 @@ public class AiGenerate {
|
|
|
|
|
String[] regions = {"文山州", "楚雄州"};
|
|
|
|
|
|
|
|
|
|
// 第一步:数据获取
|
|
|
|
|
System.out.println("=== 开始数据收集 ===");
|
|
|
|
|
String dataContent = DataCollector.collectEducationData(regions);
|
|
|
|
|
String analysisPrompt = DataCollector.createAnalysisPrompt(dataContent, regions);
|
|
|
|
|
|
|
|
|
|
// 第二步:AI分析并生成Word文档
|
|
|
|
|
System.out.println("=== 开始AI分析和Word文档生成 ===");
|
|
|
|
|
generateWordReport(analysisPrompt, regions);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -46,7 +44,6 @@ public class AiGenerate {
|
|
|
|
|
String configFile = "application.yaml";
|
|
|
|
|
BaseApplication.PropKit = new YamlProp(configFile);
|
|
|
|
|
LocalMysqlConnectUtil.Init();
|
|
|
|
|
System.out.println("配置初始化完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -55,9 +52,9 @@ public class AiGenerate {
|
|
|
|
|
private static void generateWordReport(String analysisPrompt, String[] regions) {
|
|
|
|
|
// 生成输出文件名(不包含路径)
|
|
|
|
|
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
|
|
|
|
String fileName = "教育资源对比分析报告_" + timestamp + ".docx";
|
|
|
|
|
|
|
|
|
|
System.out.println("开始调用DeepSeek进行数据分析...");
|
|
|
|
|
// 构建区域名称
|
|
|
|
|
String regionName = String.join("与", regions);
|
|
|
|
|
|
|
|
|
|
// 调用DeepSeek进行分析
|
|
|
|
|
CallDeepSeek.callDeepSeekStream(analysisPrompt, new CallDeepSeek.SSEListener() {
|
|
|
|
@ -75,18 +72,28 @@ public class AiGenerate {
|
|
|
|
|
System.out.println("\n\n=== Word文档分析完成 ===");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 使用完整的分析结果
|
|
|
|
|
String analysisResult = fullResponse.toString();
|
|
|
|
|
|
|
|
|
|
// 生成Word文档
|
|
|
|
|
String wordFilePath = WordGenerator.generateWordDocument(fullResponse.toString(), fileName, regions);
|
|
|
|
|
System.out.println("Word分析报告已保存到: " + wordFilePath);
|
|
|
|
|
String wordOutputPath = "D:\\dsWork\\YunNanDsBase\\WebRoot\\upload\\" + regionName + "_教育分析报告_" + timestamp + ".docx";
|
|
|
|
|
String wordFilePath = WordGenerator.generateWordDocument(analysisResult, wordOutputPath, regions);
|
|
|
|
|
if (wordFilePath != null) {
|
|
|
|
|
System.out.println("Word文档生成完成: " + wordFilePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 第三步:生成PPT
|
|
|
|
|
System.out.println("\n\n=== 开始生成PPT ===");
|
|
|
|
|
String uid = "dsideal";
|
|
|
|
|
String apiToken = PptAIKit.createApiToken(uid, null);
|
|
|
|
|
String pptFilePath = PptGenerator.generatePptPresentation(fullResponse.toString(), regions, apiToken);
|
|
|
|
|
// 生成HTML报告
|
|
|
|
|
String htmlOutputPath = "D:\\dsWork\\YunNanDsBase\\WebRoot\\upload\\" + regionName + "_教育分析报告_" + timestamp + ".html";
|
|
|
|
|
String htmlFilePath = HtmlGenerator.generateHtmlReport(analysisResult, htmlOutputPath, regionName);
|
|
|
|
|
if (htmlFilePath != null) {
|
|
|
|
|
System.out.println("HTML报告生成完成: " + htmlFilePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生成PPT
|
|
|
|
|
String token = PptAIKit.createApiToken("dsideal", 1000);
|
|
|
|
|
String pptFilePath = PptGenerator.generatePptPresentation(analysisResult, regions, token);
|
|
|
|
|
if (pptFilePath != null) {
|
|
|
|
|
System.out.println("PPT演示文稿已保存到: " + pptFilePath);
|
|
|
|
|
System.out.println("PPT演示文稿生成完成: " + pptFilePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|