reports-service: http://jira.mfd.msk:8088/browse/CLS-711
This commit is contained in:
parent
3f57080c16
commit
05b19f488a
2 changed files with 126 additions and 103 deletions
|
|
@ -248,7 +248,7 @@ public class DBProvider implements ImdgProvider {
|
||||||
this.fieldsMatcherForTable.put(RegistryCodeDictionary.class, registryCodeDictionaryMatcher);
|
this.fieldsMatcherForTable.put(RegistryCodeDictionary.class, registryCodeDictionaryMatcher);
|
||||||
|
|
||||||
Map<String, String> clearingMemberCategoryMatcher = new HashMap<>();
|
Map<String, String> clearingMemberCategoryMatcher = new HashMap<>();
|
||||||
clearingMemberCategoryMatcher.put("company_id", "company_id");
|
clearingMemberCategoryMatcher.put("companyId", "company_id");
|
||||||
clearingMemberCategoryMatcher.put("clearingMemberCategory", "clearing_member_category");
|
clearingMemberCategoryMatcher.put("clearingMemberCategory", "clearing_member_category");
|
||||||
clearingMemberCategoryMatcher.put("id", "id");
|
clearingMemberCategoryMatcher.put("id", "id");
|
||||||
this.fieldsMatcherForTable.put(ClearingMemberCategory.class, clearingMemberCategoryMatcher);
|
this.fieldsMatcherForTable.put(ClearingMemberCategory.class, clearingMemberCategoryMatcher);
|
||||||
|
|
@ -300,7 +300,7 @@ public class DBProvider implements ImdgProvider {
|
||||||
executionCurrencyMatcher.put("settlementAmount", "settlement_amount");
|
executionCurrencyMatcher.put("settlementAmount", "settlement_amount");
|
||||||
executionCurrencyMatcher.put("quantity", "quantity");
|
executionCurrencyMatcher.put("quantity", "quantity");
|
||||||
executionCurrencyMatcher.put("side", "side");
|
executionCurrencyMatcher.put("side", "side");
|
||||||
executionCurrencyMatcher.put("currencyCode", "_currency_code");
|
executionCurrencyMatcher.put("currencyCode", "currency_code");
|
||||||
executionCurrencyMatcher.put("settlementOrganization", "settlement_organization");
|
executionCurrencyMatcher.put("settlementOrganization", "settlement_organization");
|
||||||
executionCurrencyMatcher.put("coverageStatus", "coverage_status");
|
executionCurrencyMatcher.put("coverageStatus", "coverage_status");
|
||||||
executionCurrencyMatcher.put("sessionId", "session_id");
|
executionCurrencyMatcher.put("sessionId", "session_id");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
package ru.spcex.clearing.reports.services;
|
package ru.spcex.clearing.reports.services;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
import org.apache.kafka.clients.consumer.Consumer;
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -35,11 +43,6 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||||
import ru.spcex.platform.utils.validation.IValidator;
|
import ru.spcex.platform.utils.validation.IValidator;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ReportService extends QueueConsumer implements InitializingBean {
|
public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
@ -146,6 +149,7 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
public RequestInfoUpdate createReport(BaseRequest<ReportRequest> userRequest) {
|
public RequestInfoUpdate createReport(BaseRequest<ReportRequest> userRequest) {
|
||||||
log.debug("ReportRequest received");
|
log.debug("ReportRequest received");
|
||||||
|
|
||||||
|
try {
|
||||||
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestValidator);
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestValidator);
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
|
|
||||||
|
|
@ -177,12 +181,16 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFilesToSftp(outFiles);
|
sendFilesToSftp(outFiles);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Unexpected exception", e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate createReportForSessionId(BaseRequest<ReportRequestWithSessionId> userRequest) {
|
public RequestInfoUpdate createReportForSessionId(BaseRequest<ReportRequestWithSessionId> userRequest) {
|
||||||
log.debug("ReportRequestWithSessionId received");
|
log.debug("ReportRequestWithSessionId received");
|
||||||
|
|
||||||
|
try {
|
||||||
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestWithSessionIdValidator);
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestWithSessionIdValidator);
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
|
|
||||||
|
|
@ -215,12 +223,16 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFilesToSftp(outFiles);
|
sendFilesToSftp(outFiles);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Unexpected exception", e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate createReportForGREP(BaseRequest<LauncherCommandRequest> userRequest) {
|
public RequestInfoUpdate createReportForGREP(BaseRequest<LauncherCommandRequest> userRequest) {
|
||||||
log.debug("GREP task received");
|
log.debug("GREP task received");
|
||||||
|
|
||||||
|
try {
|
||||||
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestGREPValidator);
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestGREPValidator);
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
logUnknownProperties(userRequest);
|
logUnknownProperties(userRequest);
|
||||||
|
|
@ -233,12 +245,16 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
sendReportsToGateway(sessionIds, outFiles, ReportType.REPORT_KS_TMP.getKey());
|
sendReportsToGateway(sessionIds, outFiles, ReportType.REPORT_KS_TMP.getKey());
|
||||||
sendFilesToSftp(outFiles.keySet());
|
sendFilesToSftp(outFiles.keySet());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Unexpected exception", e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate createReportForGRET(BaseRequest<LauncherCommandRequest> userRequest) {
|
public RequestInfoUpdate createReportForGRET(BaseRequest<LauncherCommandRequest> userRequest) {
|
||||||
log.debug("GRET task received");
|
log.debug("GRET task received");
|
||||||
|
|
||||||
|
try {
|
||||||
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestGRETValidator);
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestGRETValidator);
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
logUnknownProperties(userRequest);
|
logUnknownProperties(userRequest);
|
||||||
|
|
@ -269,12 +285,16 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
sendReportsToGateway(sessionIds, outFilesWithReportType_PFX64, ReportType.PFX64.getKey());
|
sendReportsToGateway(sessionIds, outFilesWithReportType_PFX64, ReportType.PFX64.getKey());
|
||||||
sendReportsToGateway(sessionIds, outFilesWithReportType_PFX65, ReportType.PFX65.getKey());
|
sendReportsToGateway(sessionIds, outFilesWithReportType_PFX65, ReportType.PFX65.getKey());
|
||||||
sendFilesToSftp(outFiles.keySet());
|
sendFilesToSftp(outFiles.keySet());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Unexpected exception", e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate createReportForGREF(BaseRequest<LauncherCommandRequest> userRequest) {
|
public RequestInfoUpdate createReportForGREF(BaseRequest<LauncherCommandRequest> userRequest) {
|
||||||
log.debug("GREF task received");
|
log.debug("GREF task received");
|
||||||
|
|
||||||
|
try {
|
||||||
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestGREFValidator);
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, reportRequestGREFValidator);
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
logUnknownProperties(userRequest);
|
logUnknownProperties(userRequest);
|
||||||
|
|
@ -287,6 +307,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
sendReportsToGateway(sessionIds, outFiles, ReportType.REPORT_KS_FINAL.getKey());
|
sendReportsToGateway(sessionIds, outFiles, ReportType.REPORT_KS_FINAL.getKey());
|
||||||
sendFilesToSftp(outFiles.keySet());
|
sendFilesToSftp(outFiles.keySet());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Unexpected exception", e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue