|
|
@ -2,11 +2,9 @@ package com.dsideal.base.AI.Model;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import com.dsideal.base.AI.Generator.HtmlGenerator;
|
|
|
|
import com.dsideal.base.AI.Generator.HtmlGenerator;
|
|
|
|
import com.dsideal.base.AI.Generator.PptGenerator;
|
|
|
|
|
|
|
|
import com.dsideal.base.AI.Generator.WordGenerator;
|
|
|
|
import com.dsideal.base.AI.Generator.WordGenerator;
|
|
|
|
import com.dsideal.base.DataEase.Model.DataEaseModel;
|
|
|
|
import com.dsideal.base.DataEase.Model.DataEaseModel;
|
|
|
|
import com.dsideal.base.Util.CallDeepSeek;
|
|
|
|
import com.dsideal.base.Util.CallDeepSeek;
|
|
|
|
import com.dsideal.base.Util.PptAIKit;
|
|
|
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
|
|
|
@ -88,7 +86,7 @@ public class YunNanModel {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 生成Word报告
|
|
|
|
* 生成Word报告
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void generateWordReport(String analysisPrompt, String[] regions) {
|
|
|
|
public void generateWordReport(String analysisPrompt, String[] regions, String path) {
|
|
|
|
// 生成输出文件名(不包含路径)
|
|
|
|
// 生成输出文件名(不包含路径)
|
|
|
|
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
|
|
|
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
|
|
|
|
|
|
|
|
|
|
@ -115,25 +113,23 @@ public class YunNanModel {
|
|
|
|
String analysisResult = fullResponse.toString();
|
|
|
|
String analysisResult = fullResponse.toString();
|
|
|
|
|
|
|
|
|
|
|
|
// 生成Word文档
|
|
|
|
// 生成Word文档
|
|
|
|
String wordOutputPath = "D:\\dsWork\\YunNanDsBase\\WebRoot\\upload\\" + regionName + "_教育分析报告_" + timestamp + ".docx";
|
|
|
|
String wordOutputPath = path + "/" + regionName + "_教育分析报告_" + timestamp + ".docx";
|
|
|
|
String wordFilePath = WordGenerator.generateWordDocument(analysisResult, wordOutputPath, regions);
|
|
|
|
String wordFilePath = WordGenerator.generateWordDocument(analysisResult, wordOutputPath, regions);
|
|
|
|
if (wordFilePath != null) {
|
|
|
|
System.out.println("Word文档生成完成: " + wordFilePath);
|
|
|
|
System.out.println("Word文档生成完成: " + wordFilePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生成HTML报告
|
|
|
|
// 生成HTML报告
|
|
|
|
String htmlOutputPath = "D:\\dsWork\\YunNanDsBase\\WebRoot\\upload\\" + regionName + "_教育分析报告_" + timestamp + ".html";
|
|
|
|
// String htmlOutputPath = path + "/" + regionName + "_教育分析报告_" + timestamp + ".html";
|
|
|
|
String htmlFilePath = HtmlGenerator.generateHtmlReport(analysisResult, htmlOutputPath, regionName);
|
|
|
|
// String htmlFilePath = HtmlGenerator.generateHtmlReport(analysisResult, htmlOutputPath, regionName);
|
|
|
|
if (htmlFilePath != null) {
|
|
|
|
// if (htmlFilePath != null) {
|
|
|
|
System.out.println("HTML报告生成完成: " + htmlFilePath);
|
|
|
|
// System.out.println("HTML报告生成完成: " + htmlFilePath);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// 生成PPT
|
|
|
|
// // 生成PPT
|
|
|
|
String token = PptAIKit.createApiToken("dsideal", 1000);
|
|
|
|
// String token = PptAIKit.createApiToken("dsideal", 1000);
|
|
|
|
String pptFilePath = PptGenerator.generatePptPresentation(analysisResult, regions, token);
|
|
|
|
// String pptFilePath = PptGenerator.generatePptPresentation(analysisResult, regions, token);
|
|
|
|
if (pptFilePath != null) {
|
|
|
|
// if (pptFilePath != null) {
|
|
|
|
System.out.println("PPT演示文稿生成完成: " + pptFilePath);
|
|
|
|
// System.out.println("PPT演示文稿生成完成: " + pptFilePath);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
System.err.println("保存文件时出错: " + e.getMessage());
|
|
|
|
System.err.println("保存文件时出错: " + e.getMessage());
|
|
|
|