|
@@ -7,10 +7,9 @@ import io.swagger.annotations.ApiParam;
|
|
|
import org.example.mybatisplus.model.auto.CmsEnterpriseRiskInfoCheckBO;
|
|
|
import org.example.mybatisplus.model.auto.CmsEnterpriseRiskInfoDeclaration;
|
|
|
import org.example.mybatisplus.model.auto.CmsEnterpriseRiskQxbInfoBO;
|
|
|
-import org.example.mybatisplus.module.AuditResult;
|
|
|
-import org.example.mybatisplus.module.BasicInfo;
|
|
|
-import org.example.mybatisplus.module.ServiceProviderAuditReport;
|
|
|
-import org.example.mybatisplus.module.vo.ServiceProviderInfo;
|
|
|
+import org.example.mybatisplus.module.*;
|
|
|
+import org.example.mybatisplus.module.vo.*;
|
|
|
+import org.example.mybatisplus.tools.DocxGenerator;
|
|
|
import org.example.mybatisplus.tools.WordPoiExporter;
|
|
|
import org.example.mybatisplus.tools.WordToPdfUtil;
|
|
|
import org.springframework.core.io.FileSystemResource;
|
|
@@ -26,13 +25,11 @@ import java.io.*;
|
|
|
@ApiOperation("控制类")
|
|
|
@RestController
|
|
|
public class IndexController {
|
|
|
- public static void main(String[] args) {
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
|
|
|
- String wordFilePath = System.getProperty("user.dir")+File.separator+ "jijinhui.docx";
|
|
|
String wordExportpath = System.getProperty("user.dir")+File.separator+ "jijinhui1.docx";
|
|
|
String pdfFilePath =System.getProperty("user.dir")+File.separator+ "download.pdf";
|
|
|
|
|
|
- // todo:
|
|
|
ServiceProviderInfo serviceProviderInfo=new ServiceProviderInfo();
|
|
|
serviceProviderInfo.setName("海潮基金会");
|
|
|
serviceProviderInfo.setType("基金会");
|
|
@@ -41,24 +38,43 @@ public class IndexController {
|
|
|
auditResult.setAuditDate("2025-03-11");
|
|
|
auditResult.setScore("222");
|
|
|
auditResult.setOpinion("test");
|
|
|
- // auditResult.setMocaRating("test");
|
|
|
- // auditResult.setDonationIncomeScale("test");
|
|
|
- // auditResult.setManagementExpense("test");
|
|
|
- // auditResult.setOperationYears("2025");
|
|
|
- // auditResult.setPublicExpenseGrowth("test");
|
|
|
- BasicInfo basicInfo = new BasicInfo();
|
|
|
- // ...
|
|
|
+ auditResult.setServiceProviderName("服务商2");
|
|
|
|
|
|
- // 最后把所有片段合成一个完整报告
|
|
|
+ BasicInfo basicInfo = new BasicInfo();
|
|
|
+ basicInfo.setBasicInfoScore(new BasicInfoScore(
|
|
|
+ 66l,
|
|
|
+ "哈哈哈",
|
|
|
+ "测试"
|
|
|
+ ));
|
|
|
+ // 将图片转换为 Base64 编码
|
|
|
+ String imageBase64 = DocxGenerator.convertImageToBase64("G:\\Code\\new\\fxy-tool\\src\\main\\resources\\pic1.png");
|
|
|
+ Attachment attach = new Attachment();
|
|
|
+ attach.setFileName("关联实体情况.png");
|
|
|
+
|
|
|
+ attach.setBase64(imageBase64);
|
|
|
+ basicInfo.setRelatedEntitiesImage(attach);
|
|
|
+ PublicRecord publicRecord=new PublicRecord();
|
|
|
+ publicRecord.setPublicRecordScore(new PublicRecordScore());
|
|
|
+ FinancialInfo financialInfo=new FinancialInfo();
|
|
|
+ financialInfo.setFinancialData1(new FinancialData());//new 空对象防止模板空指针
|
|
|
+ financialInfo.setFinancialData2(new FinancialData());
|
|
|
+ financialInfo.setFinancialData3(new FinancialData());
|
|
|
+ financialInfo.setFinancialData4(new FinancialData());
|
|
|
+ financialInfo.setFinancialScore(new FinancialScore());
|
|
|
+ ProjectInfo projectInfo=new ProjectInfo();
|
|
|
+ DocumentVo documentVo=new DocumentVo();
|
|
|
|
|
|
ServiceProviderAuditReport report=new ServiceProviderAuditReport();
|
|
|
report.setServiceProviderInfo(serviceProviderInfo);
|
|
|
report.setAuditResult(auditResult);
|
|
|
report.setBasicInfo(basicInfo);
|
|
|
+ report.setPublicRecord(publicRecord);
|
|
|
+ report.setFinancialInfo(financialInfo);
|
|
|
+ report.setProjectInfo(projectInfo);
|
|
|
+ report.setDocumentVo(documentVo);
|
|
|
try {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(report));
|
|
|
// 生成Word文档
|
|
|
- WordPoiExporter.init(wordFilePath,wordExportpath,jsonObject);
|
|
|
+ DocxGenerator.init(report,"n_jjh.xml",wordExportpath);
|
|
|
// 将Word文档转换为PDF
|
|
|
WordToPdfUtil.wordToPdf(wordExportpath,pdfFilePath);
|
|
|
} catch (Exception e) {
|
|
@@ -109,9 +125,11 @@ public class IndexController {
|
|
|
report.setBasicInfo(basicInfo);
|
|
|
report.setAuditResult(auditResult);
|
|
|
try {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(report));
|
|
|
+ //JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(report));
|
|
|
+ // 生成Word文档
|
|
|
+ //WordPoiExporter.init(wordFilePath,wordExportpath,jsonObject);
|
|
|
// 生成Word文档
|
|
|
- WordPoiExporter.init(wordFilePath,wordExportpath,jsonObject);
|
|
|
+ DocxGenerator.init(report,"n_jjh.xml",wordExportpath);
|
|
|
// 将Word文档转换为PDF
|
|
|
WordToPdfUtil.wordToPdf(wordExportpath,pdfFilePath);
|
|
|
} catch (Exception e) {
|