reports-service поправил обработку ошибок: если 1 вид отчёта не сможет сделать, то дбудет пробовать доделать остальные; поправил ReportBR_0420314_P2 при отсутствии company пишет warn и пропускает

This commit is contained in:
AKurakin 2023-01-31 13:58:05 +03:00
parent df04573792
commit 10cf6bc3cb
2 changed files with 15 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import ru.spcex.clearing.reports.reports.ReportId;
import ru.spcex.clearing.reports.services.builders.XMLReportBuilder;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.utils.enumeration.IEnumKey;
import ru.spcex.platform.utils.log.ExceptionUtils;
import java.io.File;
import java.io.IOException;
@ -74,12 +75,20 @@ public class ReportsServiceCommand implements InitializingBean {
public void generateReportAll(@Nullable String reportGroup, LocalDate startDate, LocalDate endDate) throws IOException {
for (ReportWithPeriodCollector<?> reportDataCollector : allPeriodReports) {
if (reportGroup == null || QUEUE_RUN_REPORT_COMMAND.equals(reportGroup)) {
makeSingleReport(reportDataCollector, startDate, endDate);
try {
makeSingleReport(reportDataCollector, startDate, endDate);
} catch (Exception e) {
log.error("Error generate report of type {}: {}", reportDataCollector, ExceptionUtils.getStackTrace(e));
}
}
}
for (SimpleReportCollector<?> reportDataCollector : allSimpleReports) {
if (reportGroup == null || QUEUE_RUN_DAILY_REPORT_COMMAND.equals(reportGroup)) {
makeSingleReport(reportDataCollector);
try {
makeSingleReport(reportDataCollector);
} catch (Exception e) {
log.error("Error generate report of type {}: {}", reportDataCollector, ExceptionUtils.getStackTrace(e));
}
}
}
}

View file

@ -68,6 +68,10 @@ public class ReportBR_0420314_P2_Collector extends ReportWithPeriodCollector<Rep
final Long companyId = entry.getKey();
List<PaymentInstruction> paymentInstructionsByCompany = entry.getValue();
Company company = companyImdg.getSingleObjectByID(companyId);
if (company == null) {
log.warn("Company not found, id={}", companyId);
continue;
}
ProfileDocument profileDocumentCntr = profileDocumentImdg.getSingleObjectByFieldValues(Map.of(
"companyId", companyId,
"documentType", DocumentTypes.cntr.getKey()