|
@@ -2,33 +2,8 @@ package com.yaoyicloud.service.impl;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
-import java.time.LocalDate;
|
|
|
|
-
|
|
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
-
|
|
|
|
-import com.yaoyicloud.config.FilerepoProperties;
|
|
|
|
-import com.yaoyicloud.constant.enums.ModuleType;
|
|
|
|
import com.yaoyicloud.constant.enums.ReportType;
|
|
import com.yaoyicloud.constant.enums.ReportType;
|
|
-import com.yaoyicloud.render.InterestConflictsRender;
|
|
|
|
-import com.yaoyicloud.render.ProjectInfoRender;
|
|
|
|
-import com.yaoyicloud.render.PublicRecordRender;
|
|
|
|
-
|
|
|
|
-import com.yaoyicloud.render.association.AssociationAttachmentSectionRender;
|
|
|
|
-import com.yaoyicloud.render.foundation.FoundationAttachmentSectionRender;
|
|
|
|
-import com.yaoyicloud.render.foundation.FoundationfinancialInfoRender;
|
|
|
|
-import com.yaoyicloud.render.platform.AntiBriberyRender;
|
|
|
|
-import com.yaoyicloud.render.platform.AttachmentSectionRender;
|
|
|
|
-import com.yaoyicloud.render.platform.BasicInfoRender;
|
|
|
|
-import com.yaoyicloud.render.platform.FinancialInfoRender;
|
|
|
|
-import com.yaoyicloud.render.platform.ServiceProviderInfoRender;
|
|
|
|
-import com.yaoyicloud.render.association.AssociationBasicInfoRender;
|
|
|
|
-import com.yaoyicloud.render.foundation.FoundationBasicInfoRender;
|
|
|
|
-import com.yaoyicloud.render.platform.update.AntiBriberyNewRender;
|
|
|
|
-import com.yaoyicloud.render.platform.update.BasicInfoNewRender;
|
|
|
|
-import com.yaoyicloud.render.platform.update.FinancialInfoNewRender;
|
|
|
|
-import com.yaoyicloud.render.platform.update.PublicRecordNewRender;
|
|
|
|
-import com.yaoyicloud.render.platform.update.TaxNewRender;
|
|
|
|
import com.yaoyicloud.service.ReportService;
|
|
import com.yaoyicloud.service.ReportService;
|
|
import com.yaoyicloud.template.AcademicAssociationReport;
|
|
import com.yaoyicloud.template.AcademicAssociationReport;
|
|
import com.yaoyicloud.template.FoundationReport;
|
|
import com.yaoyicloud.template.FoundationReport;
|
|
@@ -38,10 +13,6 @@ import org.springframework.stereotype.Service;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-
|
|
|
|
-import static com.yaoyicloud.config.SessionInterceptor.SESSION_MAP;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 报告服务
|
|
* 报告服务
|
|
*
|
|
*
|
|
@@ -55,13 +26,12 @@ public class ReportServiceImpl implements ReportService {
|
|
private final PlatformCompanyReport platformCompanyReport;
|
|
private final PlatformCompanyReport platformCompanyReport;
|
|
private final AcademicAssociationReport academicAssociationReport;
|
|
private final AcademicAssociationReport academicAssociationReport;
|
|
private final FoundationReport foundationReport;
|
|
private final FoundationReport foundationReport;
|
|
- private final FilerepoProperties filerepoProperties;
|
|
|
|
|
|
+
|
|
|
|
|
|
@SuppressWarnings("checkstyle:ReturnCount")
|
|
@SuppressWarnings("checkstyle:ReturnCount")
|
|
@Override
|
|
@Override
|
|
public String createPlusVersionCheckReport(
|
|
public String createPlusVersionCheckReport(
|
|
- ReportType reportType, String data, byte[] templateBytes, String outputBasePath, Long relationId,
|
|
|
|
- HttpServletRequest request, ModuleType moduleType, String name, Integer level, String tenantName)
|
|
|
|
|
|
+ ReportType reportType, Map<String, Object> data, byte[] templateBytes, String outputBasePath, Long relationId)
|
|
throws Exception {
|
|
throws Exception {
|
|
|
|
|
|
// 1. 将字节流模版写入临时文件
|
|
// 1. 将字节流模版写入临时文件
|
|
@@ -69,114 +39,43 @@ public class ReportServiceImpl implements ReportService {
|
|
try (FileOutputStream fos = new FileOutputStream(tempTemplateFile)) {
|
|
try (FileOutputStream fos = new FileOutputStream(tempTemplateFile)) {
|
|
fos.write(templateBytes);
|
|
fos.write(templateBytes);
|
|
}
|
|
}
|
|
- Map<String, Object> processedData = new HashMap<>();
|
|
|
|
- processedData.put("reportDate", LocalDate.now().toString());
|
|
|
|
- processedData.put("type", reportType.getDesc());
|
|
|
|
- processedData.put("name", name);
|
|
|
|
- processedData.put("tenantName", tenantName);
|
|
|
|
- processedData.put("levelInteger", level);
|
|
|
|
-
|
|
|
|
- String sessionId = SESSION_MAP.get(relationId.toString());
|
|
|
|
-
|
|
|
|
- String reportPath;
|
|
|
|
- switch (moduleType) {
|
|
|
|
- case ANTIBRIBERY:
|
|
|
|
- reportPath =
|
|
|
|
- new AntiBriberyRender(sessionId, filerepoProperties).renderDocx(data, processedData, templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case ANTIBRIBERY_NEW:
|
|
|
|
- reportPath =
|
|
|
|
- new AntiBriberyNewRender(sessionId, filerepoProperties).renderDocx(data, processedData, templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PLATFORM_COMPANY_BASICINFO:
|
|
|
|
- reportPath =
|
|
|
|
- new BasicInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData, templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PLATFORM_COMPANY_ATTACHMENTSECTION:
|
|
|
|
- reportPath =
|
|
|
|
- new AttachmentSectionRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case ASSOCIATION_ATTACHMENTSECTION:
|
|
|
|
- reportPath =
|
|
|
|
- new AssociationAttachmentSectionRender(sessionId, filerepoProperties).renderDocx(data,
|
|
|
|
|
|
+ Map<String, Object> processedData = null;
|
|
|
|
+ switch (reportType) {
|
|
|
|
+ case PLATFORM_COMPANY:
|
|
|
|
+ processedData = platformCompanyReport.processData(data);
|
|
|
|
+ return platformCompanyReport.exportReport(
|
|
processedData,
|
|
processedData,
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case FOUNDATION_ATTACHMENTSECTION:
|
|
|
|
- reportPath =
|
|
|
|
- new FoundationAttachmentSectionRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case COMMON:
|
|
|
|
- reportPath =
|
|
|
|
- new ServiceProviderInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PLATFORM_COMPANY_FINANCIALINFO:
|
|
|
|
- reportPath = new FinancialInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PLATFORM_COMPANY_FINANCIALINFO_NEW:
|
|
|
|
- reportPath = new FinancialInfoNewRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case FOUNDATION_FINANCIALINFO:
|
|
|
|
- reportPath =
|
|
|
|
- new FoundationfinancialInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PUBLIC_RECORD:
|
|
|
|
- reportPath = new PublicRecordRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PUBLIC_RECORD_NEW:
|
|
|
|
- reportPath = new PublicRecordNewRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
-
|
|
|
|
- case PLATFORM_COMPANY_BASICINFO_NEW:
|
|
|
|
- reportPath =
|
|
|
|
- new BasicInfoNewRender(sessionId, filerepoProperties).renderDocx(data, processedData, templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
-
|
|
|
|
- case FOUNDATION_BASICINFO:
|
|
|
|
- reportPath =
|
|
|
|
- new FoundationBasicInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case ASSOCIATION_BASICINFO:
|
|
|
|
- reportPath =
|
|
|
|
- new AssociationBasicInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case PROJECT:
|
|
|
|
- reportPath =
|
|
|
|
- new ProjectInfoRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case INTERESTCONFLICTS:
|
|
|
|
- reportPath =
|
|
|
|
- new InterestConflictsRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes,
|
|
|
|
- String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
- case TAX_NEW:
|
|
|
|
- reportPath = new TaxNewRender(sessionId, filerepoProperties).renderDocx(data, processedData,
|
|
|
|
- templateBytes, String.valueOf(relationId));
|
|
|
|
- return reportPath;
|
|
|
|
-
|
|
|
|
|
|
+ tempTemplateFile.getAbsolutePath(),
|
|
|
|
+ outputBasePath,
|
|
|
|
+ relationId);
|
|
|
|
+ case ACADEMIC_ASSOCIATIONS:
|
|
|
|
+ processedData = academicAssociationReport.processData(data);
|
|
|
|
+ return academicAssociationReport.exportReport(
|
|
|
|
+ processedData,
|
|
|
|
+ tempTemplateFile.getAbsolutePath(),
|
|
|
|
+ outputBasePath,
|
|
|
|
+ relationId);
|
|
|
|
+ case FOUNDATION:
|
|
|
|
+ processedData = foundationReport.processData(data);
|
|
|
|
+ return foundationReport.exportReport(
|
|
|
|
+ processedData,
|
|
|
|
+ tempTemplateFile.getAbsolutePath(),
|
|
|
|
+ outputBasePath,
|
|
|
|
+ relationId);
|
|
|
|
+ case PROMOTION:
|
|
|
|
+ processedData = platformCompanyReport.processData(data);
|
|
|
|
+ return platformCompanyReport.exportReport(
|
|
|
|
+ processedData,
|
|
|
|
+ tempTemplateFile.getAbsolutePath(),
|
|
|
|
+ outputBasePath,
|
|
|
|
+ relationId);
|
|
default:
|
|
default:
|
|
- throw new UnsupportedOperationException("Unsupported module type: " + moduleType);
|
|
|
|
-
|
|
|
|
|
|
+ throw new UnsupportedOperationException("Unsupported report type: " + reportType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|