Fixed missing filename in reports
This commit is contained in:
parent
f492fb6e47
commit
05bce43c5d
@ -49,6 +49,13 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.iqser.red.service</groupId>
|
||||
<artifactId>file-management-service-api-v1</artifactId>
|
||||
<version>2.8.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.iqser.red.service.redaction.report.v1.server.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
import com.iqser.red.service.file.management.v1.api.resources.StatusResource;
|
||||
|
||||
@FeignClient(name = "StatusResource", url = "${file-management-service.url}")
|
||||
public interface FileStatusClient extends StatusResource {
|
||||
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.iqser.red.service.redaction.report.v1.server.service;
|
||||
|
||||
import com.iqser.red.service.configuration.v1.api.model.LegalBasisMapping;
|
||||
import com.iqser.red.service.file.management.v1.api.model.FileStatus;
|
||||
import com.iqser.red.service.redaction.report.v1.api.model.ReportRequestMessage;
|
||||
import com.iqser.red.service.redaction.report.v1.api.model.ReportType;
|
||||
import com.iqser.red.service.redaction.report.v1.api.model.StoredFileInformation;
|
||||
import com.iqser.red.service.redaction.report.v1.server.client.FileStatusClient;
|
||||
import com.iqser.red.service.redaction.report.v1.server.client.LegalBasisMappingClient;
|
||||
import com.iqser.red.service.redaction.report.v1.server.model.ReportRedactionEntry;
|
||||
import com.iqser.red.service.redaction.report.v1.server.storage.ReportStorageService;
|
||||
@ -28,6 +30,7 @@ public class ReportGenerationService {
|
||||
private final WordReportGenerationService wordReportGenerationService;
|
||||
private final LegalBasisMappingClient legalBasisMappingClient;
|
||||
private final RedactionLogConverterService redactionLogConverterService;
|
||||
private final FileStatusClient fileStatusClient;
|
||||
|
||||
|
||||
public List<StoredFileInformation> generateReport(ReportRequestMessage reportMessage) {
|
||||
@ -47,6 +50,8 @@ public class ReportGenerationService {
|
||||
int i = 1;
|
||||
for (String fileId : reportMessage.getFileIds()) {
|
||||
|
||||
FileStatus fileStatus = fileStatusClient.getFileStatus(reportMessage.getProjectId(), fileId);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
RedactionLog redactionLog = reportStorageService.getRedactionLog(reportMessage.getProjectId(), fileId);
|
||||
if (legalBasisMappings == null) {
|
||||
@ -56,24 +61,24 @@ public class ReportGenerationService {
|
||||
List<ReportRedactionEntry> reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMappings);
|
||||
|
||||
if (reportMessage.getReportTypes().contains(ReportType.EXCEL_MULTI_FILE)) {
|
||||
excelReportService.addEntries(excelMultiFileSheet, reportEntries, redactionLog.getFilename(), excelRowIndex);
|
||||
excelReportService.addEntries(excelMultiFileSheet, reportEntries, fileStatus.getFilename(), excelRowIndex);
|
||||
}
|
||||
|
||||
if (reportMessage.getReportTypes().contains(ReportType.EXCEL_SINGLE_FILE)) {
|
||||
byte[] excelSingleReport = excelReportService.generateSingleFileReport(reportEntries, redactionLog.getFilename());
|
||||
byte[] excelSingleReport = excelReportService.generateSingleFileReport(reportEntries, fileStatus.getFilename());
|
||||
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), excelSingleReport);
|
||||
storedFileInformation.add(new StoredFileInformation(fileId, storageId, ReportType.EXCEL_SINGLE_FILE));
|
||||
}
|
||||
|
||||
if (reportMessage.getReportTypes().contains(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE)) {
|
||||
byte[] wordEFSATemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE, reportEntries, redactionLog
|
||||
byte[] wordEFSATemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE, reportEntries, fileStatus
|
||||
.getFilename());
|
||||
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), wordEFSATemplate);
|
||||
storedFileInformation.add(new StoredFileInformation(fileId, storageId, ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE));
|
||||
}
|
||||
|
||||
if (reportMessage.getReportTypes().contains(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE)) {
|
||||
byte[] wordSyngentaTemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE, reportEntries, redactionLog
|
||||
byte[] wordSyngentaTemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE, reportEntries, fileStatus
|
||||
.getFilename());
|
||||
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), wordSyngentaTemplate);
|
||||
storedFileInformation.add(new StoredFileInformation(fileId, storageId, ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE));
|
||||
|
||||
@ -2,6 +2,7 @@ info:
|
||||
description: Redaction Report Server v1
|
||||
|
||||
configuration-service.url: "http://configuration-service-v1:8080"
|
||||
file-management-service.url: "http://file-management-service-v1:8080"
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
@ -19,6 +19,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.iqser.red.service.configuration.v1.api.model.LegalBasisMapping;
|
||||
import com.iqser.red.service.redaction.report.v1.api.model.ReportType;
|
||||
import com.iqser.red.service.redaction.report.v1.server.client.FileStatusClient;
|
||||
import com.iqser.red.service.redaction.report.v1.server.client.LegalBasisMappingClient;
|
||||
import com.iqser.red.service.redaction.report.v1.server.configuration.MessagingConfiguration;
|
||||
import com.iqser.red.service.redaction.report.v1.server.model.ReportRedactionEntry;
|
||||
@ -53,6 +54,9 @@ public class RedactionReportIntegrationTest {
|
||||
@MockBean
|
||||
private MessagingConfiguration messagingConfiguration;
|
||||
|
||||
@MockBean
|
||||
private FileStatusClient fileStatusClient;
|
||||
|
||||
@Autowired
|
||||
private RedactionLogConverterService redactionLogConverterService;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user