http://jira.mfd.msk:8088/browse/CLS-497 KSRepTrades
This commit is contained in:
parent
10d8803651
commit
4e431ee798
4 changed files with 35 additions and 35 deletions
|
|
@ -224,55 +224,50 @@ public class KSRepTradesReportBuilder extends CSVReportBuilder<EmptyParams, KSRe
|
||||||
status = "1";
|
status = "1";
|
||||||
} else if (coverage == CoverageStatus.DEND) {
|
} else if (coverage == CoverageStatus.DEND) {
|
||||||
if (execution instanceof ExecutionDeposit) {
|
if (execution instanceof ExecutionDeposit) {
|
||||||
ksRepTradesReport.setStatus("2");
|
status = "2";
|
||||||
} else {
|
} else {
|
||||||
ImdgPredicateBuilder pbRegistry = registryImdg.predicateBuilder();
|
ImdgPredicateBuilder pbRegistry = registryImdg.predicateBuilder();
|
||||||
String registryPredicateStr = RegistryCodeSqlBuilder.getInstance(
|
String registryPredicateStr = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams._S_T).build();
|
||||||
RegistryTradingParams.OS_T,
|
|
||||||
RegistryTradingParams.TS_T,
|
|
||||||
RegistryTradingParams.OM_T,
|
|
||||||
RegistryTradingParams.TM_T
|
|
||||||
).build();
|
|
||||||
Long groupId = execution.getExchangeExecutionId();
|
Long groupId = execution.getExchangeExecutionId();
|
||||||
Collection<Registry> registryCollection = registryImdg.getCollectionObjectsByPredicate(
|
Collection<Registry> registryCollection = registryImdg.getCollectionObjectsByPredicate(
|
||||||
pbRegistry.and(
|
pbRegistry.and(
|
||||||
pbRegistry.sql(registryPredicateStr), pbRegistry.equals("groupId", groupId)
|
pbRegistry.equals("groupId", groupId),
|
||||||
|
pbRegistry.equals("companyId", execution.getCompanyId()),
|
||||||
|
pbRegistry.in("registryStatus",
|
||||||
|
RegistryStatus.NACC.getKey(),
|
||||||
|
RegistryStatus.NACC.getKey(),
|
||||||
|
RegistryStatus.FAIL.getKey(),
|
||||||
|
RegistryStatus.UNCV.getKey()),
|
||||||
|
pbRegistry.sql(registryPredicateStr)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (registryCollection.isEmpty()) {
|
if (registryCollection.isEmpty()) {
|
||||||
log.warn(
|
log.warn(
|
||||||
"Broken execution (empty registries). Registry for groupId = {} not found. Execution (id = {}) skipped",
|
"Broken execution (empty registries). Registry for groupId = {}, companyId = {} not found. Execution (id = {}) skipped",
|
||||||
groupId,
|
groupId,
|
||||||
|
execution.getCompanyId(),
|
||||||
execution.getId()
|
execution.getId()
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean allOk = checkRegistryStatus(
|
Registry registry = registryCollection.iterator().next();
|
||||||
registryCollection,
|
RegistryStatus registryStatus = IEnumKey.getEnumByKey(RegistryStatus.class, registry.getRegistryStatus());
|
||||||
List.of(RegistryStatus.NACK, RegistryStatus.NACC, RegistryStatus.FAIL, RegistryStatus.UNCV)
|
if (registryStatus == RegistryStatus.NACK || registryStatus == RegistryStatus.UNCV) {
|
||||||
);
|
status = "3";
|
||||||
if (allOk) {
|
} else if (registryStatus == RegistryStatus.NACC || registryStatus == RegistryStatus.FAIL) {
|
||||||
for (Registry registry : registryCollection) {
|
status = "2";
|
||||||
RegistryInstrumentType registryInstrumentType = IEnumKey.getEnumByKey(RegistryInstrumentType.class, registry.getRegistryInstrumentType());
|
|
||||||
if (registryInstrumentType == RegistryInstrumentType.M) {
|
|
||||||
ksRepTradesReport.setStatus("2");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (registryInstrumentType == RegistryInstrumentType.S) {
|
|
||||||
ksRepTradesReport.setStatus("3");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksRepTradesReport.setStatus(status);
|
ksRepTradesReport.setStatus(status);
|
||||||
|
|
||||||
rows.add(ksRepTradesReport);
|
rows.add(ksRepTradesReport);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("Can't create report row for execution_%s (id = %d), skipped".formatted(execution instanceof ExecutionFond ? "fond" : "deposit", execution.getId()), e);
|
log.error("Can't create report row for execution_%s (id = %d), skipped".formatted(
|
||||||
|
execution instanceof ExecutionFond ? "fond" : "deposit",
|
||||||
|
execution.getId()), e
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -651,9 +651,9 @@ public class ReportServiceTest_KS {
|
||||||
|
|
||||||
Registry registry = new Registry();
|
Registry registry = new Registry();
|
||||||
registry.setSessionId(sessionId_2);
|
registry.setSessionId(sessionId_2);
|
||||||
registry.setRegistryCode("OM_T");
|
registry.setCompanyId(COMPANY_ID);
|
||||||
registry.setRegistryDesignation(RegistryDesignation.O.getKey());
|
registry.setRegistryCode("_S_T");
|
||||||
registry.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
registry.setRegistryInstrumentType(RegistryInstrumentType.S.getKey());
|
||||||
registry.setRegistryUnit(RegistryUnit.T.getKey());
|
registry.setRegistryUnit(RegistryUnit.T.getKey());
|
||||||
registry.setGroupId(Long.parseLong("%s%d%d".formatted(dateFormatter_yyyyMMdd.format(LocalDate.now()), 222, marketId)));
|
registry.setGroupId(Long.parseLong("%s%d%d".formatted(dateFormatter_yyyyMMdd.format(LocalDate.now()), 222, marketId)));
|
||||||
registry.setRegistryStatus(RegistryStatus.FAIL.getKey());
|
registry.setRegistryStatus(RegistryStatus.FAIL.getKey());
|
||||||
|
|
@ -662,9 +662,9 @@ public class ReportServiceTest_KS {
|
||||||
|
|
||||||
Registry registry_2 = new Registry();
|
Registry registry_2 = new Registry();
|
||||||
registry_2.setSessionId(sessionId_2);
|
registry_2.setSessionId(sessionId_2);
|
||||||
registry_2.setRegistryCode("OM_T");
|
registry_2.setCompanyId(COMPANY_ID);
|
||||||
registry_2.setRegistryDesignation(RegistryDesignation.O.getKey());
|
registry_2.setRegistryCode("_S_T");
|
||||||
registry_2.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
registry_2.setRegistryInstrumentType(RegistryInstrumentType.S.getKey());
|
||||||
registry_2.setRegistryUnit(RegistryUnit.T.getKey());
|
registry_2.setRegistryUnit(RegistryUnit.T.getKey());
|
||||||
registry_2.setGroupId(executionFond_3.getExchangeExecutionId());
|
registry_2.setGroupId(executionFond_3.getExchangeExecutionId());
|
||||||
registry_2.setRegistryStatus(RegistryStatus.FAIL.getKey());
|
registry_2.setRegistryStatus(RegistryStatus.FAIL.getKey());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
"SESSION_ID","SESSION_DATE","TR_ID","AGREEMENT_NUMBER","FIRM_ID","TKR","ACCOUNT","DEPO_ACCOUNT","CASH_LIABILITY","DEPO_LIABILITY","TRADE_NUM","CLASS_CODE","TRADE_DATE","STATUS"
|
"SESSION_ID","SESSION_DATE","TR_ID","AGREEMENT_NUMBER","FIRM_ID","TKR","ACCOUNT","DEPO_ACCOUNT","CASH_LIABILITY","DEPO_LIABILITY","TRADE_NUM","CLASS_CODE","TRADE_DATE","STATUS"
|
||||||
"4","20.01.1970T07:09:07","222","CONTRACT","TRADING_CODE","TKR","","","8888.89","0","222","3333","20.01.1970T02:49:58","0"
|
"4","20.01.1970T07:09:07","222","CONTRACT","TRADING_CODE","TKR","","","8888.89","0","222","3333","20.01.1970T02:49:58","2"
|
||||||
"3","20.01.1970T15:54:43","222","","TRADING_CODE","TKR","","","-8888.89","123","222","3333","20.01.1970T02:49:58","1"
|
"3","20.01.1970T15:54:43","222","","TRADING_CODE","TKR","","","-8888.89","123","222","3333","20.01.1970T02:49:58","1"
|
||||||
"3","20.01.1970T15:54:43","222","","TRADING_CODE","TKR","","","-8888.89","123","222","3333","20.01.1970T02:49:58","0"
|
"3","20.01.1970T15:54:43","222","","TRADING_CODE","TKR","","","-8888.89","123","222","3333","20.01.1970T02:49:58","2"
|
||||||
"3","20.01.1970T15:54:43","222","","TRADING_CODE","TKR","","","8888.89","-123","222","3333","20.01.1970T02:49:58","1"
|
"3","20.01.1970T15:54:43","222","","TRADING_CODE","TKR","","","8888.89","-123","222","3333","20.01.1970T02:49:58","1"
|
||||||
|
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ public record RegistryTradingParams(RegistryDesignation registryDesignation,
|
||||||
public final static RegistryTradingParams DMAI;
|
public final static RegistryTradingParams DMAI;
|
||||||
public final static RegistryTradingParams D__I;
|
public final static RegistryTradingParams D__I;
|
||||||
public final static RegistryTradingParams D__V;
|
public final static RegistryTradingParams D__V;
|
||||||
|
public final static RegistryTradingParams _S_T;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
OS_T = new RegistryTradingParams(RegistryDesignation.O,
|
OS_T = new RegistryTradingParams(RegistryDesignation.O,
|
||||||
|
|
@ -255,6 +256,10 @@ public record RegistryTradingParams(RegistryDesignation registryDesignation,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
RegistryUnit.T);
|
RegistryUnit.T);
|
||||||
|
_S_T = new RegistryTradingParams(null,
|
||||||
|
RegistryInstrumentType.S,
|
||||||
|
null,
|
||||||
|
RegistryUnit.T);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue