This commit is contained in:
parent
0e4e3c91a8
commit
5863500e51
7 changed files with 39 additions and 13 deletions
|
|
@ -131,7 +131,7 @@ public class KSCommissionTradesReportBuilder extends CSVReportBuilder<EmptyParam
|
|||
registry.getId());
|
||||
continue;
|
||||
}
|
||||
String agreementNumber = "%s/%s/%s%s".formatted(
|
||||
String agreementNumber = "%s/%s/%s/%s".formatted(
|
||||
registry.getSecuritySymbol(),
|
||||
dateFormatter_ddMMyy.format(registry.getClearingDate()),
|
||||
registry.getClearingCode(),
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import ru.spcex.platform.imdg.api.Imdg;
|
|||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
|
||||
import java.time.Instant;
|
||||
|
|
@ -89,24 +90,33 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
|
|||
}
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
String sql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AM_T).build();
|
||||
ImdgPredicateBuilder pbRegistry = registryImdg.predicateBuilder();
|
||||
Registry registry = registryImdg.getSingleObjectByPredicate(
|
||||
Collection<Registry> registries = registryImdg.getCollectionObjectsByPredicate(
|
||||
pbRegistry.and(
|
||||
pbRegistry.equals("companyId", statement.getAddresseeId()),
|
||||
pbRegistry.equals("account", statement.getAccount()),
|
||||
pbRegistry.in("accountType", AccountType.Clrn.getKey(), AccountType.Info.getKey()),
|
||||
pbRegistry.notNull("registryCode")
|
||||
pbRegistry.sql(sql)
|
||||
)
|
||||
);
|
||||
if (registry == null) {
|
||||
if (registries.isEmpty()) {
|
||||
log.warn(
|
||||
"Can't find registry for companyId = {} and account = {}. Statement id = {} skipped",
|
||||
"Can't find registry for companyId = {} and account: {}. Statement id = {} skipped",
|
||||
statement.getAddresseeId(),
|
||||
statement.getAccount(),
|
||||
statement.getId()
|
||||
);
|
||||
continue;
|
||||
} else if (registries.size() > 1) {
|
||||
log.warn(
|
||||
"More then one AM_T registry found for companyId = {} and account: {}, statement id {}. Use first",
|
||||
statement.getAddresseeId(),
|
||||
statement.getAccount(),
|
||||
statement.getId()
|
||||
);
|
||||
}
|
||||
Registry registry = registries.iterator().next();
|
||||
|
||||
KSRepCashRegisterSumsReport ksRepCashRegisterSumsReport = new KSRepCashRegisterSumsReport();
|
||||
ksRepCashRegisterSumsReport.setFirmId(String.valueOf(statement.getAddresseeId()));
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import ru.spcex.platform.imdg.api.Imdg;
|
|||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
|
||||
import java.time.Instant;
|
||||
|
|
@ -99,16 +100,17 @@ public class KSRepDepoRegisterQuantitiesReportBuilder extends CSVReportBuilder<E
|
|||
}
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
String sql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AS_T).build();
|
||||
ImdgPredicateBuilder pbRegistry = registryImdg.predicateBuilder();
|
||||
Registry registry = registryImdg.getSingleObjectByPredicate(
|
||||
Collection<Registry> registries = registryImdg.getCollectionObjectsByPredicate(
|
||||
pbRegistry.and(
|
||||
pbRegistry.equals("companyId", statement.getAddresseeId()),
|
||||
pbRegistry.equals("account", statement.getAccount()),
|
||||
pbRegistry.equals("accountType", AccountType.Depo.getKey()),
|
||||
pbRegistry.notNull("registryCode")
|
||||
pbRegistry.sql(sql)
|
||||
)
|
||||
);
|
||||
if (registry == null) {
|
||||
if (registries.isEmpty()) {
|
||||
log.warn(
|
||||
"Can't find registry for companyId = {} and account: {}. Statement id = {} skipped",
|
||||
statement.getAddresseeId(),
|
||||
|
|
@ -116,7 +118,15 @@ public class KSRepDepoRegisterQuantitiesReportBuilder extends CSVReportBuilder<E
|
|||
statement.getId()
|
||||
);
|
||||
continue;
|
||||
} else if (registries.size() > 1) {
|
||||
log.warn(
|
||||
"More then one AS_T registry found for companyId = {} and account: {}, statement id {}. Use first",
|
||||
statement.getAddresseeId(),
|
||||
statement.getAccount(),
|
||||
statement.getId()
|
||||
);
|
||||
}
|
||||
Registry registry = registries.iterator().next();
|
||||
|
||||
Security security = getSecurityWithSecuritySymbolForId(statement.getSecurityId());
|
||||
if (security == null) {
|
||||
|
|
|
|||
|
|
@ -172,7 +172,10 @@ public class ReportServiceTest_KS {
|
|||
registry_1.setCompanyId(COMPANY_ID);
|
||||
registry_1.setAccount("ACCOUNT");
|
||||
registry_1.setAccountType(AccountType.Clrn.getKey());
|
||||
registry_1.setRegistryCode(RegistryUnit.T.getKey());
|
||||
registry_1.setRegistryCode("AM_T");
|
||||
registry_1.setRegistryDesignation("A");
|
||||
registry_1.setRegistryInstrumentType("M");
|
||||
registry_1.setRegistryUnit("T");
|
||||
registry_1.setTradingClearingRegistry("TRADING_CLEARING_REGISTRY");
|
||||
registryImdg.insert(registry_1);
|
||||
|
||||
|
|
@ -267,7 +270,10 @@ public class ReportServiceTest_KS {
|
|||
registry_1.setAccount("ACCOUNT");
|
||||
registry_1.setTradingClearingRegistry("TRADING_CLEARING_REGISTRY");
|
||||
registry_1.setAccountType(AccountType.Depo.getKey());
|
||||
registry_1.setRegistryCode(RegistryUnit.T.getKey());
|
||||
registry_1.setRegistryCode("AS_T");
|
||||
registry_1.setRegistryDesignation("A");
|
||||
registry_1.setRegistryInstrumentType("S");
|
||||
registry_1.setRegistryUnit("T");
|
||||
registryImdg.insert(registry_1);
|
||||
|
||||
EquitySecurity equitySecurity = new EquitySecurity();
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
"FIRMID","FIRM_INITIATOR","SECCODE","AGREEMENT_NUMBER","AGREEMENT_NUMBER_POSTFIX","AGREEMENT_DATE","SUM","REPAYM_DATE","EXEC_STATUS"
|
||||
"CLEARING_CODE","COMPANY_SYMBOL_VALUE","SECURITY_SYMBOL","SECURITY_SYMBOL/010191/CLEARING_CODE777","","01.01.1991","77.78","01.08.2023","OK"
|
||||
"CLEARING_CODE","COMPANY_SYMBOL_VALUE","SECURITY_SYMBOL","SECURITY_SYMBOL/010191/CLEARING_CODE/777","","01.01.1991","77.78","01.08.2023","OK"
|
||||
|
|
|
|||
|
|
|
@ -1,2 +1,2 @@
|
|||
"FIRMID","ACCOUNT","TKR","REGISTER_CODE","ADD_SUM","ADD_TIME","ADD_DATE"
|
||||
"1","ACCOUNT","TRADING_CLEARING_REGISTRY","T","7777.78","15:49:30","01.08.2023"
|
||||
"1","ACCOUNT","TRADING_CLEARING_REGISTRY","AM_T","7777.78","15:49:30","01.08.2023"
|
||||
|
|
|
|||
|
|
|
@ -1,2 +1,2 @@
|
|||
"FIRMID","ACCOUNT","TKR","SECURITYID","REGISTER_CODE","ADD_QUANTITY","ADD_TIME","ADD_DATE"
|
||||
"1","ACCOUNT","TRADING_CLEARING_REGISTRY","value","T","7777.78","15:52:33","01.08.2023"
|
||||
"1","ACCOUNT","TRADING_CLEARING_REGISTRY","value","AS_T","7777.78","15:52:33","01.08.2023"
|
||||
|
|
|
|||
|
Loading…
Add table
Reference in a new issue