This commit is contained in:
parent
b15334d8ac
commit
934b9babd3
5 changed files with 58 additions and 4 deletions
|
|
@ -88,11 +88,28 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
|
|||
}
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
Registry pairRegistry = null;
|
||||
ImdgPredicate pairRegistryPredicate = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AM_T).buildPredicate(pb);
|
||||
Collection<Registry> pairRegistries = registryImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.equals("tradingCode", registry.getTradingCode()),
|
||||
pb.equals("account", registry.getAccount()),
|
||||
pairRegistryPredicate
|
||||
)
|
||||
);
|
||||
if (pairRegistries.isEmpty()) log.warn("Pair AM_T registry for registry (id = {}) not found", registry.getId());
|
||||
pairRegistry = pairRegistries.iterator().next();
|
||||
if (pairRegistries.size() > 1) {
|
||||
log.warn("For registry (id = {}) found > 1 AM_T registry, use first (id = {})",
|
||||
registry.getId(),
|
||||
pairRegistry.getId());
|
||||
}
|
||||
|
||||
String firmId = registry.getTradingCode();
|
||||
String account = registry.getAccount();
|
||||
String tkr = registry.getTradingClearingRegistry();
|
||||
String tradeNum = "";
|
||||
String registerCode = registry.getRegistryCode();
|
||||
String registerCode = pairRegistry != null ? pairRegistry.getRegistryCode() : "";
|
||||
BigDecimal addSum = registry.getBalance() != null ? registry.getBalance() :BigDecimal.ZERO;
|
||||
Instant addTime = registry.getUpdated();
|
||||
LocalDate addDate = LocalDate.now();
|
||||
|
|
|
|||
|
|
@ -88,12 +88,29 @@ public class KSRepDepoRegisterQuantitiesReportBuilder extends CSVReportBuilder<E
|
|||
}
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
Registry pairRegistry = null;
|
||||
ImdgPredicate pairRegistryPredicate = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AS_T).buildPredicate(pb);
|
||||
Collection<Registry> pairRegistries = registryImdg.getCollectionObjectsByPredicate(
|
||||
pb.and(
|
||||
pb.equals("tradingCode", registry.getTradingCode()),
|
||||
pb.equals("account", registry.getAccount()),
|
||||
pairRegistryPredicate
|
||||
)
|
||||
);
|
||||
if (pairRegistries.isEmpty()) log.warn("Pair AS_T registry for registry (id = {}) not found", registry.getId());
|
||||
pairRegistry = pairRegistries.iterator().next();
|
||||
if (pairRegistries.size() > 1) {
|
||||
log.warn("For registry (id = {}) found > 1 AS_T registry, use first (id = {})",
|
||||
registry.getId(),
|
||||
pairRegistry.getId());
|
||||
}
|
||||
|
||||
String firmId = registry.getTradingCode();
|
||||
String account = registry.getAccount();
|
||||
String tkr = registry.getTradingClearingRegistry();
|
||||
String tradeNum = "";
|
||||
String securityId = registry.getSecuritySymbol();
|
||||
String registerCode = registry.getRegistryCode();
|
||||
String registerCode = pairRegistry != null ? pairRegistry.getRegistryCode() : "";
|
||||
BigDecimal addQuantity = registry.getBalance() != null ? registry.getBalance() :BigDecimal.ZERO;
|
||||
Instant addTime = registry.getUpdated();
|
||||
LocalDate addDate = LocalDate.now();
|
||||
|
|
|
|||
|
|
@ -232,6 +232,15 @@ public class ReportServiceTest_KS {
|
|||
registry_1.setRegistryUnit("I");
|
||||
registryImdg.insert(registry_1);
|
||||
|
||||
Registry pairRegistry = new Registry();
|
||||
pairRegistry.setTradingCode("TRADING_CODE");
|
||||
pairRegistry.setAccount("ACCOUNT");
|
||||
pairRegistry.setRegistryCode("AM_T");
|
||||
pairRegistry.setRegistryDesignation("A");
|
||||
pairRegistry.setRegistryInstrumentType("M");
|
||||
pairRegistry.setRegistryUnit("T");
|
||||
registryImdg.insert(pairRegistry);
|
||||
|
||||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
|
|
@ -247,6 +256,7 @@ public class ReportServiceTest_KS {
|
|||
compareCSVFiles(expectedFile, outFile, Arrays.asList("FIRMID", "ADD_DATE", "ADD_TIME"));
|
||||
|
||||
registryImdg.delete(registry_1);
|
||||
registryImdg.delete(pairRegistry);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -370,6 +380,15 @@ public class ReportServiceTest_KS {
|
|||
registry_1.setBalance(BigDecimal.TEN);
|
||||
registryImdg.insert(registry_1);
|
||||
|
||||
Registry pairRegistry = new Registry();
|
||||
pairRegistry.setTradingCode("TRADING_CODE");
|
||||
pairRegistry.setAccount("ACCOUNT");
|
||||
pairRegistry.setRegistryCode("AS_T");
|
||||
pairRegistry.setRegistryDesignation("A");
|
||||
pairRegistry.setRegistryInstrumentType("S");
|
||||
pairRegistry.setRegistryUnit("T");
|
||||
registryImdg.insert(pairRegistry);
|
||||
|
||||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
|
|
@ -385,6 +404,7 @@ public class ReportServiceTest_KS {
|
|||
compareCSVFiles(expectedFile, outFile, Arrays.asList("FIRMID", "ADD_DATE", "ADD_TIME"));
|
||||
|
||||
registryImdg.delete(registry_1);
|
||||
registryImdg.delete(pairRegistry);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
"FIRMID","ACCOUNT","TKR","REGISTER_CODE","ADD_SUM","ADD_TIME","ADD_DATE","TRADE_NUM"
|
||||
"TRADING_CODE","ACCOUNT","0008CAT00001","DM_I","0.00","13:02:50","02.10.2023",""
|
||||
"TRADING_CODE","ACCOUNT","0008CAT00001","AM_T","0.00","13:02:50","02.10.2023",""
|
||||
|
|
|
|||
|
|
|
@ -1,2 +1,2 @@
|
|||
"FIRMID","ACCOUNT","TKR","SECURITYID","REGISTER_CODE","ADD_QUANTITY","ADD_TIME","ADD_DATE","TRADE_NUM"
|
||||
"TRADING_CODE","ACCOUNT","0008CAT00001","SECURITY_SYMBOL","DS_I","10","13:55:53","02.10.2023",""
|
||||
"TRADING_CODE","ACCOUNT","0008CAT00001","SECURITY_SYMBOL","AS_T","10","13:55:53","02.10.2023",""
|
||||
|
|
|
|||
|
Loading…
Add table
Reference in a new issue