This commit is contained in:
akulikov 2023-07-28 18:51:04 +03:00
parent 2d559f9bf1
commit cb0d720ae0
2 changed files with 21 additions and 5 deletions

View file

@ -95,11 +95,21 @@ public class KSRepTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSRe
ksRepTradesReport.setTrId(execution.getId());
ksRepTradesReport.setTkr(execution.getTradingClearingRegistryId());
Company company = companyImdg.getSingleObjectByID(execution.getCompanyId());
ksRepTradesReport.setFirmId(company != null ? company.getTradingCode() : null);
if (execution.getCompanyId() != null) {
Company company = companyImdg.getSingleObjectByID(execution.getCompanyId());
ksRepTradesReport.setFirmId(company != null ? company.getTradingCode() : null);
} else {
log.info("Execution id = {} was skipped: company_id is null", execution.getId());
continue;
}
Session session = sessionImdg.getSingleObjectByID(execution.getSessionId());
ksRepTradesReport.setSessionDate(session != null ? session.getCreated() : null);
if (execution.getSessionId() != null) {
Session session = sessionImdg.getSingleObjectByID(execution.getSessionId());
ksRepTradesReport.setSessionDate(session != null ? session.getCreated() : null);
} else {
log.info("Execution id = {} was skipped: session_id is null", execution.getId());
continue;
}
if (execution instanceof ExecutionDeposit executionDeposit) {
ksRepTradesReport.setCashLiability(executionDeposit.getFirstLegAmount());

View file

@ -108,11 +108,17 @@ public class ReportService extends QueueConsumer implements InitializingBean {
this.reportRequestGREPValidator = reportRequestGREPValidator;
this.reportRequestGRETValidator = reportRequestGRETValidator;
this.reportRequestGREFValidator = reportRequestGREFValidator;
this.outFolder = new File(reportsServiceSettings.getReportModuleOut());
this.reportBuildersForGREP = reportBuildersForGREP;
this.reportBuildersForGREF = reportBuildersForGREF;
this.reportBuildersForGRET = reportBuildersForGRET;
this.sessionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Session, Session.class);
this.outFolder = new File(reportsServiceSettings.getReportModuleOut());
if (!outFolder.exists()) {
boolean mkDirOk = outFolder.mkdirs();
if (!mkDirOk) throw new IllegalStateException("Can't create output directory for reports, reports-service was terminated");
} else if (!outFolder.isDirectory()) {
throw new IllegalStateException("Output reports path from settings is not directory!");
}
assert outFolder.isDirectory();
}