fix after review
This commit is contained in:
parent
15abb8cbfa
commit
90b8d80ce8
7 changed files with 30 additions and 56 deletions
|
|
@ -27,7 +27,6 @@ import ru.spcex.platform.utils.validation.ValidatorImpl;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Configuration
|
||||
|
|
@ -55,10 +54,6 @@ public class ValidationConfig {
|
|||
return reportRequest -> {
|
||||
ImdgValidationContext<ReportRequest> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequest);
|
||||
|
||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||
// todo add dictionary for check reportId
|
||||
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequest::getReportId,
|
||||
|
|
@ -79,10 +74,6 @@ public class ValidationConfig {
|
|||
return reportRequestWithSessionId -> {
|
||||
ImdgValidationContext<ReportRequestWithSessionId> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequestWithSessionId);
|
||||
|
||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||
// todo add dictionary for check reportId
|
||||
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequestWithSessionId::getReportId,
|
||||
|
|
@ -109,10 +100,6 @@ public class ValidationConfig {
|
|||
return reportRequestWithSessionIdList -> {
|
||||
ImdgValidationContext<ReportRequestWithSessionIdList> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequestWithSessionIdList);
|
||||
|
||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||
// todo add dictionary for check reportId
|
||||
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequestWithSessionIdList::getReportId,
|
||||
|
|
@ -140,10 +127,6 @@ public class ValidationConfig {
|
|||
return reportRequestWithPeriod -> {
|
||||
ImdgValidationContext<ReportRequestWithPeriod> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(reportRequestWithPeriod);
|
||||
|
||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||
// todo add dictionary for check reportId
|
||||
|
||||
return new ValidatorImpl<>(context,
|
||||
EnumPresentRule.instance("reportId",
|
||||
ReportRequestWithPeriod::getReportId,
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@ package ru.spcex.clearing.reports.errors;
|
|||
|
||||
import ru.spcex.platform.utils.enumeration.IErrorEnumId;
|
||||
|
||||
// todo codes
|
||||
public enum ReportError implements IErrorEnumId {
|
||||
InternalError(99000L),
|
||||
UserVerifyDenial(99001L),
|
||||
RequiredFieldEmpty(99002L),
|
||||
WrongFieldValue(99004L),
|
||||
InternalError(4000L),
|
||||
UserVerifyDenial(4001L),
|
||||
RequiredFieldEmpty(4002L),
|
||||
WrongFieldValue(4004L),
|
||||
;
|
||||
|
||||
private final Long id;
|
||||
|
|
|
|||
|
|
@ -29,24 +29,16 @@ public class PeriodLiabilitiesClaimsReportBuilder extends LiabilitiesClaimsRepor
|
|||
@Override
|
||||
protected Collection<ExecutionFond> getExecutionFondsForReport(SessionIdListParams params) {
|
||||
if (params.getSessionIdList() == null || params.getSessionIdList().isEmpty()) return Collections.emptyList();
|
||||
StringBuilder sql = new StringBuilder("sessionId in (");
|
||||
for (Long sessionId : params.getSessionIdList()) {
|
||||
sql.append(sessionId).append(",");
|
||||
}
|
||||
sql.setLength(sql.length() - 1);
|
||||
sql.append(")");
|
||||
return executionFondImdg.getCollectionObjectsBySQL(sql.toString());
|
||||
return executionFondImdg.getCollectionObjectsByPredicate(
|
||||
executionFondImdg.predicateBuilder().in("sessionId", params.getSessionIdList().toArray(new Long[0]))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ExecutionDeposit> getExecutionDepositsForReport(SessionIdListParams params) {
|
||||
if (params.getSessionIdList() == null || params.getSessionIdList().isEmpty()) return Collections.emptyList();
|
||||
StringBuilder sql = new StringBuilder("sessionId in (");
|
||||
for (Long sessionId : params.getSessionIdList()) {
|
||||
sql.append(sessionId).append(",");
|
||||
}
|
||||
sql.setLength(sql.length() - 1);
|
||||
sql.append(")");
|
||||
return executionDepositImdg.getCollectionObjectsBySQL(sql.toString());
|
||||
return executionDepositImdg.getCollectionObjectsByPredicate(
|
||||
executionDepositImdg.predicateBuilder().in("sessionId", params.getSessionIdList().toArray(new Long[0]))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public class UnfulfilledDealReportBuilder extends CSVReportBuilder<SessionIdPara
|
|||
);
|
||||
Collection<ExecutionFond> executionFonds = executionFondImdg.getCollectionObjectsByPredicate(predicate);
|
||||
|
||||
lines = new ArrayList<>(executionFonds.size());
|
||||
for (ExecutionFond executionFond : executionFonds) {
|
||||
Company company = companyImdg.getSingleObjectByID(executionFond.getCompanyId());
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
|
@ -81,7 +82,6 @@ public class UnfulfilledDealReportBuilder extends CSVReportBuilder<SessionIdPara
|
|||
String settleCode = sTrade != null ? sTrade.getClassCode() : null;
|
||||
|
||||
int valueIdx = 0;
|
||||
lines = new ArrayList<>(executionFonds.size());
|
||||
String[] line = new String[getHeaders().length];
|
||||
line[valueIdx++] = id;
|
||||
line[valueIdx++] = securityId;
|
||||
|
|
|
|||
|
|
@ -89,16 +89,16 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
|||
public void afterPropertiesSet() throws Exception {
|
||||
callback(ReportRequest.class)
|
||||
.setFunction(this::createReport)
|
||||
.forDestination(Consts.DESTINATION_CREATE_REPORT, callbacks::put);
|
||||
.forDestination(Consts.CREATE_REPORT, callbacks::put);
|
||||
callback(ReportRequestWithSessionId.class)
|
||||
.setFunction(this::createReportForSessionId)
|
||||
.forDestination(Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID, callbacks::put);
|
||||
.forDestination(Consts.CREATE_REPORT_FOR_SESSION_ID, callbacks::put);
|
||||
callback(ReportRequestWithSessionIdList.class)
|
||||
.setFunction(this::createReportForSessionIdList)
|
||||
.forDestination(Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID_LIST, callbacks::put);
|
||||
.forDestination(Consts.CREATE_REPORT_FOR_SESSION_ID_LIST, callbacks::put);
|
||||
callback(ReportRequestWithPeriod.class)
|
||||
.setFunction(this::createReportForPeriod)
|
||||
.forDestination(Consts.DESTINATION_CREATE_REPORT_FOR_PERIOD, callbacks::put);
|
||||
.forDestination(Consts.CREATE_REPORT_FOR_PERIOD, callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequestWithSessionId, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -229,7 +229,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequestWithPeriod, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID_LIST,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID_LIST,
|
||||
reportRequestWithSessionIdListCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -252,7 +252,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT,
|
||||
Consts.CREATE_REPORT,
|
||||
reportRequestCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -284,7 +284,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -314,7 +314,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_PERIOD,
|
||||
Consts.CREATE_REPORT_FOR_PERIOD,
|
||||
reportRequestWithPeriodCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -341,7 +341,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT,
|
||||
Consts.CREATE_REPORT,
|
||||
reportRequestCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -394,7 +394,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -446,7 +446,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -495,7 +495,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -545,7 +545,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
@ -595,7 +595,7 @@ public class ReportServiceTest {
|
|||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
Consts.DESTINATION_CREATE_REPORT_FOR_SESSION_ID,
|
||||
Consts.CREATE_REPORT_FOR_SESSION_ID,
|
||||
reportRequestWithSessionIdCnt++,
|
||||
0,
|
||||
jsonString);
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ public interface Consts {
|
|||
String DESTINATION_BANK_ACCOUNT_UPDATE = "bank-account-update";
|
||||
String DESTINATION_BANK_ACCOUNT_NEW = "bank-account-new";
|
||||
|
||||
String DESTINATION_CREATE_REPORT = "destination-create-report";
|
||||
String DESTINATION_CREATE_REPORT_FOR_SESSION_ID = "destination-create-report-for-session-id";
|
||||
String DESTINATION_CREATE_REPORT_FOR_SESSION_ID_LIST = "destination-create-report-for-session-id-list";
|
||||
String DESTINATION_CREATE_REPORT_FOR_PERIOD = "destination-create-report-for-period";
|
||||
String CREATE_REPORT = "create-report";
|
||||
String CREATE_REPORT_FOR_SESSION_ID = "create-report-for-session-id";
|
||||
String CREATE_REPORT_FOR_SESSION_ID_LIST = "create-report-for-session-id-list";
|
||||
String CREATE_REPORT_FOR_PERIOD = "create-report-for-period";
|
||||
|
||||
@Deprecated
|
||||
String ACCOUNT_NEW_SDF01 = "account-new-sdf01";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue