Merge branch 'dev' into plan_balance_dmx_dmt
This commit is contained in:
commit
bd7f6ad460
14 changed files with 54 additions and 58 deletions
|
|
@ -211,6 +211,9 @@ public class Sdf06Executor {
|
||||||
if (ClearingError.WrongField.equals(err.getSubject())) {
|
if (ClearingError.WrongField.equals(err.getSubject())) {
|
||||||
result = errorResult4;
|
result = errorResult4;
|
||||||
}
|
}
|
||||||
|
if (ClearingError.ActiveSessionIsPresent.equals(err.getSubject())) {
|
||||||
|
result = errorResult1;
|
||||||
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = errorResult4;
|
result = errorResult4;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,10 +131,6 @@ public class MultiCompanyService
|
||||||
);
|
);
|
||||||
companyId = getCompanyIdForCompanySymbols(req.getUuid(), req.getCompany(), req.getCompanySymbols());
|
companyId = getCompanyIdForCompanySymbols(req.getUuid(), req.getCompany(), req.getCompanySymbols());
|
||||||
log.debug("For request {} (uuid {}) company {}.", baseRequest.getId(), req.getUuid(), companyId == null ? "not found" : ("found, id=" + companyId));
|
log.debug("For request {} (uuid {}) company {}.", baseRequest.getId(), req.getUuid(), companyId == null ? "not found" : ("found, id=" + companyId));
|
||||||
if (companyId == null) {
|
|
||||||
log.debug("For request {} (uuid {}) company not found. Try find by other symbols.", baseRequest.getId(), req.getUuid());
|
|
||||||
companyId = getCompanyIdForCompanySymbols(req.getCompanySymbols());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (companyId == null) {
|
if (companyId == null) {
|
||||||
companyId = companyService.create(req.getCompany());
|
companyId = companyService.create(req.getCompany());
|
||||||
|
|
@ -353,9 +349,11 @@ public class MultiCompanyService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (companySymbol == null && StringUtils.isNotEmpty(cnr.getCompanySymbolValue())
|
if (companySymbol == null && StringUtils.isNotEmpty(cnr.getCompanySymbolValue())
|
||||||
&& IEnumKey.contains(cnr.getCompanySymbol(), CompanySymbol.INN, CompanySymbol.CIO)) { // вероятно там будет только UUID
|
&& IEnumKey.contains(cnr.getCompanySymbol(), CompanySymbol.UUID, CompanySymbol.INN, CompanySymbol.CIO)) { // вероятно там будет только UUID
|
||||||
{
|
{
|
||||||
String companySymbolType = cnr.getCompanySymbol();
|
String companySymbolType = cnr.getCompanySymbol();
|
||||||
|
log.debug("Company not found by UUID=\"{}\", try find by {}={}",
|
||||||
|
uuid, companySymbolType, cnr.getCompanySymbolValue());
|
||||||
log.trace("Search company by companySymbol {}={}", companySymbolType, cnr.getCompanySymbolValue());
|
log.trace("Search company by companySymbol {}={}", companySymbolType, cnr.getCompanySymbolValue());
|
||||||
Collection<CompanySymbols> companySymbolsFromImdg = companySymbolsImdg.getCollectionObjectsByFieldValues(
|
Collection<CompanySymbols> companySymbolsFromImdg = companySymbolsImdg.getCollectionObjectsByFieldValues(
|
||||||
Map.of(
|
Map.of(
|
||||||
|
|
@ -375,6 +373,7 @@ public class MultiCompanyService
|
||||||
for (CompanySymbolNewRequest cSymbolReq : companySymbols) {
|
for (CompanySymbolNewRequest cSymbolReq : companySymbols) {
|
||||||
if (IEnumKey.contains(cSymbolReq.getCompanySymbol(), CompanySymbol.INN, CompanySymbol.CIO)) {
|
if (IEnumKey.contains(cSymbolReq.getCompanySymbol(), CompanySymbol.INN, CompanySymbol.CIO)) {
|
||||||
String companySymbolType = cSymbolReq.getCompanySymbol();
|
String companySymbolType = cSymbolReq.getCompanySymbol();
|
||||||
|
log.debug("Company not found by UUID=\"{}\", try find by {}", uuid, companySymbolType);
|
||||||
log.trace("Search company by companySymbol {}={}", companySymbolType, cSymbolReq.getCompanySymbolValue());
|
log.trace("Search company by companySymbol {}={}", companySymbolType, cSymbolReq.getCompanySymbolValue());
|
||||||
Collection<CompanySymbols> companySymbolsFromImdg = companySymbolsImdg.getCollectionObjectsByFieldValues(
|
Collection<CompanySymbols> companySymbolsFromImdg = companySymbolsImdg.getCollectionObjectsByFieldValues(
|
||||||
Map.of(
|
Map.of(
|
||||||
|
|
@ -399,32 +398,6 @@ public class MultiCompanyService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long getCompanyIdForCompanySymbols(List<CompanySymbolNewRequest> otherRequests) {
|
|
||||||
CompanySymbols companySymbol = null;
|
|
||||||
for (CompanySymbolNewRequest req : otherRequests) {
|
|
||||||
if (req.getCompanySymbol() == null) continue;
|
|
||||||
log.trace("Search company by companySymbol {}={}", req.getCompanySymbol(), req.getCompanySymbolValue());
|
|
||||||
Collection<CompanySymbols> companySymbolsFromImdg = companySymbolsImdg.getCollectionObjectsByFieldValues(
|
|
||||||
Map.of(
|
|
||||||
"companySymbol", req.getCompanySymbol(),
|
|
||||||
"companySymbolValue", req.getCompanySymbolValue()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (!companySymbolsFromImdg.isEmpty()) {
|
|
||||||
companySymbol = companySymbolsFromImdg.iterator().next();
|
|
||||||
if (companySymbolsFromImdg.size() > 1) {
|
|
||||||
log.warn("For {} found > 1 company_symbols, use first (id = {})", req.getCompanySymbol(), req.getCompanySymbolValue());
|
|
||||||
}
|
|
||||||
log.debug("Found by company symbol {} {}", req.getCompanySymbol(), req.getCompanySymbolValue());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (companySymbol != null)
|
|
||||||
return companySymbol.getCompanyId();
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T> BaseRequest<T> wrapRequest(BaseRequest<?> template, T payload, ActionType action) {
|
private <T> BaseRequest<T> wrapRequest(BaseRequest<?> template, T payload, ActionType action) {
|
||||||
BaseRequest<T> r = new BaseRequest<>();
|
BaseRequest<T> r = new BaseRequest<>();
|
||||||
r.setId(template.getId());
|
r.setId(template.getId());
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ public class CompanyProcessor {
|
||||||
map(companyRequestAdapter::toCategoryRequest).toList();
|
map(companyRequestAdapter::toCategoryRequest).toList();
|
||||||
|
|
||||||
CompanyGatewayRequest companyGatewayRequest = new CompanyGatewayRequest();
|
CompanyGatewayRequest companyGatewayRequest = new CompanyGatewayRequest();
|
||||||
|
if (companyId != null)
|
||||||
|
companyGatewayRequest.setUuid(companyId.toString());
|
||||||
companyGatewayRequest.setCompany(companyRequestAdapter.toCompanyRequest(memberCompany));
|
companyGatewayRequest.setCompany(companyRequestAdapter.toCompanyRequest(memberCompany));
|
||||||
request.getCompanyInfoList()
|
request.getCompanyInfoList()
|
||||||
.stream()
|
.stream()
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
||||||
log.debug("AdmittedLiabilitiesRegisterNewRequest received from {}", Consts.REGISTRY_ADMITTED_LIABILITIES_REGISTER_NEW);
|
log.debug("AdmittedLiabilitiesRegisterNewRequest received from {}", Consts.REGISTRY_ADMITTED_LIABILITIES_REGISTER_NEW);
|
||||||
String sqlConditionForRegistry = getSqlForRegistries();
|
String sqlConditionForRegistry = getSqlForRegistries();
|
||||||
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlConditionForRegistry);
|
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlConditionForRegistry);
|
||||||
if (registries == null) {
|
if (registries.isEmpty()) {
|
||||||
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -131,6 +131,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
||||||
@Override
|
@Override
|
||||||
public Optional<AdmittedLiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
public Optional<AdmittedLiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
//todo для всех isDuplicateInMap: сказали надо по критерию чистить мапу перед вставкой записей, критерий уточнят.
|
||||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
// Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
||||||
// "companyId", entity.getRegistryCode(),
|
// "companyId", entity.getRegistryCode(),
|
||||||
// "sessionId", entity.getSessionId(),
|
// "sessionId", entity.getSessionId(),
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class CoveredLiabilitiesRegisterService extends QueueConsumer implements
|
||||||
log.debug("CoveredLiabilitiesRegisterNew received");
|
log.debug("CoveredLiabilitiesRegisterNew received");
|
||||||
String sqlConditionForRegistry = getSqlForRegistries();
|
String sqlConditionForRegistry = getSqlForRegistries();
|
||||||
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlConditionForRegistry);
|
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlConditionForRegistry);
|
||||||
if (registries == null) {
|
if (registries.isEmpty()) {
|
||||||
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
|
@ -63,7 +64,7 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
||||||
ImdgPredicate prdctForRegistries = getPredicateForRegistries(userRequest.getRequestPayload().getCompanyId());
|
ImdgPredicate prdctForRegistries = getPredicateForRegistries(userRequest.getRequestPayload().getCompanyId());
|
||||||
Collection<Registry> registries = registryMap.getCollectionObjectsByPredicate(prdctForRegistries);
|
Collection<Registry> registries = registryMap.getCollectionObjectsByPredicate(prdctForRegistries);
|
||||||
log.trace("Started searching depoBalanceRegister in register by '{}'", prdctForRegistries);
|
log.trace("Started searching depoBalanceRegister in register by '{}'", prdctForRegistries);
|
||||||
if (registries == null) {
|
if (registries.isEmpty()) {
|
||||||
log.debug("No registry with such conditions '{}'", prdctForRegistries);
|
log.debug("No registry with such conditions '{}'", prdctForRegistries);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -83,8 +84,12 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
||||||
depoBalanceRegister.setCreated(depoBalanceRegister.getUpdated());
|
depoBalanceRegister.setCreated(depoBalanceRegister.getUpdated());
|
||||||
depoBalanceRegister.setCompanyId(registry.getCompanyId());
|
depoBalanceRegister.setCompanyId(registry.getCompanyId());
|
||||||
depoBalanceRegister.setSessionId(registry.getSessionId());
|
depoBalanceRegister.setSessionId(registry.getSessionId());
|
||||||
depoBalanceRegister.setDepoCode(registry.getAccountType());
|
if (AccountType.Depo.equalsByKey(registry.getAccountType())) {
|
||||||
depoBalanceRegister.setQuantity(registry.getCloseBalance());
|
depoBalanceRegister.setDepoCode(registry.getAccount());
|
||||||
|
} else if (registry.getAccountType() != null) {
|
||||||
|
log.warn("Unexpected registry[{}].accountType={}", registry.getId(), registry.getAccountType());
|
||||||
|
}
|
||||||
|
depoBalanceRegister.setQuantity(registry.getBalance());
|
||||||
depoBalanceRegister.setSecuritySymbol(registry.getSecuritySymbol());
|
depoBalanceRegister.setSecuritySymbol(registry.getSecuritySymbol());
|
||||||
depoBalanceRegisterMap.insert(depoBalanceRegister);
|
depoBalanceRegisterMap.insert(depoBalanceRegister);
|
||||||
log.debug("inserted successfully DepoBalanceRegister entity with id: {}", depoBalanceRegister.getId());
|
log.debug("inserted successfully DepoBalanceRegister entity with id: {}", depoBalanceRegister.getId());
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme
|
||||||
public void depoPaymentInstructionRegisterNew(BaseRequest<LauncherCommandRequest> userRequest) {
|
public void depoPaymentInstructionRegisterNew(BaseRequest<LauncherCommandRequest> userRequest) {
|
||||||
log.debug("LauncherCommandRequest received from {}", createRegistry_GORR.topic());
|
log.debug("LauncherCommandRequest received from {}", createRegistry_GORR.topic());
|
||||||
Collection<Session> actualSessions = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND"));
|
Collection<Session> actualSessions = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND"));
|
||||||
if (actualSessions == null) {
|
if (actualSessions.isEmpty()) {
|
||||||
log.debug("No Session with such conditions section = FOND");
|
log.debug("No Session with such conditions section = FOND");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +89,8 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme
|
||||||
private void insertDepoPaymentInstructionRegister(PaymentInstruction paymentInstruction) {
|
private void insertDepoPaymentInstructionRegister(PaymentInstruction paymentInstruction) {
|
||||||
log.trace("Started generating DepoPaymentInstructionRegister entity...");
|
log.trace("Started generating DepoPaymentInstructionRegister entity...");
|
||||||
DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister();
|
DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister();
|
||||||
TradingClearingRegistry tradingClearingRegistry = paymentInstruction.getSenderId() == null ? null : tradingClearingRegistryMap.getFirstObjectByFieldValues(Map.of("companyId", paymentInstruction.getSenderId()));
|
TradingClearingRegistry tradingClearingRegistry = paymentInstruction.getCreditLeg_accountId() == null ? null :
|
||||||
|
tradingClearingRegistryMap.getFirstObjectByFieldValues(Map.of("depoAccountId", paymentInstruction.getCreditLeg_accountId()));
|
||||||
InOutDirectionDictionary inOutDirectionDictionary = InOutDirectionDictionaryMap.getFirstObjectByFieldValues(Map.of("code", paymentInstruction.getCreditLeg_direction()));
|
InOutDirectionDictionary inOutDirectionDictionary = InOutDirectionDictionaryMap.getFirstObjectByFieldValues(Map.of("code", paymentInstruction.getCreditLeg_direction()));
|
||||||
depoPaymentInstructionRegister.setCreated(Instant.now());
|
depoPaymentInstructionRegister.setCreated(Instant.now());
|
||||||
depoPaymentInstructionRegister.setUpdated(Instant.now());
|
depoPaymentInstructionRegister.setUpdated(Instant.now());
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class ExcludeLiabilitiesRegisterService extends QueueConsumer implements
|
||||||
log.debug("ExcludeLiabilitiesRegisterNew received");
|
log.debug("ExcludeLiabilitiesRegisterNew received");
|
||||||
String sqlForRegistries = getSqlForRegistries();
|
String sqlForRegistries = getSqlForRegistries();
|
||||||
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlForRegistries);
|
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlForRegistries);
|
||||||
if (registries == null) {
|
if (registries.isEmpty()) {
|
||||||
log.debug("No registry with such conditions {}", sqlForRegistries);
|
log.debug("No registry with such conditions {}", sqlForRegistries);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,19 @@ public class ExecutionRegisterService extends QueueConsumer implements Initializ
|
||||||
|
|
||||||
private void insertExecutionRegister(Boolean isFond, ExecutionCommon common) {
|
private void insertExecutionRegister(Boolean isFond, ExecutionCommon common) {
|
||||||
log.trace("Started generating ExecutionRegister entity...");
|
log.trace("Started generating ExecutionRegister entity...");
|
||||||
|
/* todo сверить с ТЗ, замечания от 28.09.2023:
|
||||||
|
executionRegister - Реестр сделок
|
||||||
|
sellerId - Если executionDeposit/Fond.side=BUY - company.shortName [executionDeposit/Fond.counterPartyId = company.id]. Если executionDeposit/Fond.side=SELL - company.shortName [executionDeposit/Fond.companyId = company.id]
|
||||||
|
sellerClearingCode - не заполняется
|
||||||
|
sellerTradingClearingRegister - не заполняется
|
||||||
|
sellerMoneyAccount - не заполняется
|
||||||
|
sellerDepoAccount - не заполняется
|
||||||
|
buyerId - Если executionDeposit/Fond.side=BUY - company.shortName [executionDeposit/Fond.counterPartyId = company.id]. Если executionDeposit/Fond.side=SELL - company.shortName [executionDeposit/Fond.counterPartyId = company.id]
|
||||||
|
buyerClearingCode - не заполняется
|
||||||
|
buyerTradingClearingRegister - не заполняется
|
||||||
|
buyerMoneyAccount - не заполняется
|
||||||
|
buyerDepoAccount - не заполняется
|
||||||
|
*/
|
||||||
String sellerClearingCode = null;
|
String sellerClearingCode = null;
|
||||||
String sellerTradingClearingRegister = null;
|
String sellerTradingClearingRegister = null;
|
||||||
String sellerMoneyAccount = null;
|
String sellerMoneyAccount = null;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.LiabilitiesRegisterNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.registry.LiabilitiesRegisterNewRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
|
import ru.spcex.platform.enumeration.CompanySymbol;
|
||||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||||
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
import ru.spcex.platform.enumeration.RegistryInstrumentType;
|
||||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||||
|
|
@ -97,10 +98,8 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
CompanySymbols companySymbols = companySymbolsMap.getFirstObjectByFieldValues(
|
CompanySymbols companySymbols = companySymbolsMap.getFirstObjectByFieldValues(
|
||||||
Map.of("companyId",
|
Map.of("companyId", registry.getCompanyId(),
|
||||||
registry.getCompanyId(),
|
"companySymbol", CompanySymbol.INN.getKey()
|
||||||
"companySymbol",
|
|
||||||
"INN"
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
MoneyMarketSecurity moneyMarketSecurity = moneyMarketSecurityMap.getFirstObjectByFieldValues(
|
MoneyMarketSecurity moneyMarketSecurity = moneyMarketSecurityMap.getFirstObjectByFieldValues(
|
||||||
|
|
@ -116,7 +115,7 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
||||||
liabilitiesRegister.setValidToDate(TimeUtil.toLocalDate(session.getUpdated()));
|
liabilitiesRegister.setValidToDate(TimeUtil.toLocalDate(session.getUpdated()));
|
||||||
}
|
}
|
||||||
if (companySymbols == null) {
|
if (companySymbols == null) {
|
||||||
log.warn("CompanySymbols is empty!");
|
log.warn("CompanySymbols is empty! For companyId={}", registry.getCompanyId());
|
||||||
} else {
|
} else {
|
||||||
liabilitiesRegister.setInn(companySymbols.getCompanySymbolValue());
|
liabilitiesRegister.setInn(companySymbols.getCompanySymbolValue());
|
||||||
}
|
}
|
||||||
|
|
@ -127,6 +126,7 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
||||||
}
|
}
|
||||||
liabilitiesRegister.setSessionId(registry.getSessionId());
|
liabilitiesRegister.setSessionId(registry.getSessionId());
|
||||||
liabilitiesRegister.setCompanyId(registry.getCompanyId());
|
liabilitiesRegister.setCompanyId(registry.getCompanyId());
|
||||||
|
liabilitiesRegister.setCompanyFullName(registry.getFullName());
|
||||||
liabilitiesRegister.setRegistryCode(registry.getRegistryCode());
|
liabilitiesRegister.setRegistryCode(registry.getRegistryCode());
|
||||||
liabilitiesRegister.setAccount(registry.getAccount());
|
liabilitiesRegister.setAccount(registry.getAccount());
|
||||||
liabilitiesRegister.setRegistryStatus(registry.getRegistryStatus());
|
liabilitiesRegister.setRegistryStatus(registry.getRegistryStatus());
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
|
import ru.spcex.platform.enumeration.CompanySymbol;
|
||||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
|
@ -76,6 +77,7 @@ public class MoneyBalanceRegisterService extends QueueConsumer implements Initia
|
||||||
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//todo надо группировать!
|
||||||
registries.forEach((registry -> {
|
registries.forEach((registry -> {
|
||||||
if (isDuplicateInMap(registry).isEmpty()) {
|
if (isDuplicateInMap(registry).isEmpty()) {
|
||||||
insertMoneyBalanceRegister(registry);
|
insertMoneyBalanceRegister(registry);
|
||||||
|
|
@ -92,7 +94,7 @@ public class MoneyBalanceRegisterService extends QueueConsumer implements Initia
|
||||||
Registry registryForBlockedSum = registryMap.getFirstObjectByPredicate(getSqlForBlockedSum(registry.getCompanyId(), registry.getAccount()));
|
Registry registryForBlockedSum = registryMap.getFirstObjectByPredicate(getSqlForBlockedSum(registry.getCompanyId(), registry.getAccount()));
|
||||||
Registry registryForUnblockedSum = registryMap.getFirstObjectByPredicate(getSqlForUnblockedSum(registry.getCompanyId(), registry.getAccount()));
|
Registry registryForUnblockedSum = registryMap.getFirstObjectByPredicate(getSqlForUnblockedSum(registry.getCompanyId(), registry.getAccount()));
|
||||||
Company company = companyMap.getFirstObjectByFieldValues(Map.of("id", 2L));
|
Company company = companyMap.getFirstObjectByFieldValues(Map.of("id", 2L));
|
||||||
CompanySymbols companySymbol = companySymbolsMap.getFirstObjectByFieldValues(Map.of("companyId", registry.getCompanyId()));
|
CompanySymbols companySymbol = companySymbolsMap.getFirstObjectByFieldValues(Map.of("companySymbol", CompanySymbol.INN.getKey(), "companyId", registry.getCompanyId()));
|
||||||
String setHouseName = company != null ? company.getShortName() : null;
|
String setHouseName = company != null ? company.getShortName() : null;
|
||||||
String inn = companySymbol != null ? companySymbol.getCompanySymbolValue() : null;
|
String inn = companySymbol != null ? companySymbol.getCompanySymbolValue() : null;
|
||||||
String accountType = registry.getAccountType();
|
String accountType = registry.getAccountType();
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,11 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
|
|
||||||
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
||||||
String sql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.TM_T, RegistryTradingParams.OM_T).build();
|
String sql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.TM_T, RegistryTradingParams.OM_T).build();
|
||||||
|
List<Long> sessionIds = params.getSessionId();
|
||||||
|
if (sessionIds == null || sessionIds.isEmpty()) sessionIds = getSessionIdsForCurrentDate(sessionImdg);
|
||||||
ImdgPredicate finalPredicate = pb.and(
|
ImdgPredicate finalPredicate = pb.and(
|
||||||
pb.not(pb.in("registryStatus",
|
pb.in("sessionId", sessionIds.toArray(new Long[0])),
|
||||||
RegistryStatus.CLRD.getKey(),
|
pb.equals("clearingDate", nowDate),
|
||||||
RegistryStatus.UNCV.getKey(),
|
|
||||||
RegistryStatus.FAIL.getKey(),
|
|
||||||
RegistryStatus.NACK.getKey(),
|
|
||||||
RegistryStatus.NACC.getKey())),
|
|
||||||
pb.sql(sql),
|
pb.sql(sql),
|
||||||
pb.or(
|
pb.or(
|
||||||
pb.equals("accountType", AccountType.Clrn.getKey()),
|
pb.equals("accountType", AccountType.Clrn.getKey()),
|
||||||
|
|
|
||||||
|
|
@ -66,14 +66,12 @@ public class KSRepDepoNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
LocalDate nowDate = LocalDate.now();
|
LocalDate nowDate = LocalDate.now();
|
||||||
|
|
||||||
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
||||||
|
List<Long> sessionIds = params.getSessionId();
|
||||||
|
if (sessionIds == null || sessionIds.isEmpty()) sessionIds = getSessionIdsForCurrentDate(sessionImdg);
|
||||||
String sql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.TS_T, RegistryTradingParams.OS_T).build();
|
String sql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.TS_T, RegistryTradingParams.OS_T).build();
|
||||||
ImdgPredicate finalPredicate = pb.and(
|
ImdgPredicate finalPredicate = pb.and(
|
||||||
pb.not(pb.in("registryStatus",
|
pb.in("sessionId", sessionIds.toArray(new Long[0])),
|
||||||
RegistryStatus.CLRD.getKey(),
|
pb.equals("clearingDate", nowDate),
|
||||||
RegistryStatus.UNCV.getKey(),
|
|
||||||
RegistryStatus.FAIL.getKey(),
|
|
||||||
RegistryStatus.NACK.getKey(),
|
|
||||||
RegistryStatus.NACC.getKey())),
|
|
||||||
pb.sql(sql),
|
pb.sql(sql),
|
||||||
pb.equals("accountType", AccountType.Depo.getKey()),
|
pb.equals("accountType", AccountType.Depo.getKey()),
|
||||||
pb.notNull("account")
|
pb.notNull("account")
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ public class KSRepDepoRegisterQuantitiesReportBuilder extends CSVReportBuilder<E
|
||||||
}
|
}
|
||||||
|
|
||||||
KSRepDepoRegisterQuantitiesReport ksRepDepoRegisterQuantitiesReport = new KSRepDepoRegisterQuantitiesReport();
|
KSRepDepoRegisterQuantitiesReport ksRepDepoRegisterQuantitiesReport = new KSRepDepoRegisterQuantitiesReport();
|
||||||
ksRepDepoRegisterQuantitiesReport.setFirmId(String.valueOf(statement.getAddresseeId()));
|
ksRepDepoRegisterQuantitiesReport.setFirmId(company.getTradingCode());
|
||||||
ksRepDepoRegisterQuantitiesReport.setAccount(statement.getAccount());
|
ksRepDepoRegisterQuantitiesReport.setAccount(statement.getAccount());
|
||||||
ksRepDepoRegisterQuantitiesReport.setTkr(registry.getTradingClearingRegistry());
|
ksRepDepoRegisterQuantitiesReport.setTkr(registry.getTradingClearingRegistry());
|
||||||
ksRepDepoRegisterQuantitiesReport.setSecurityId(security.getSecuritySymbol());
|
ksRepDepoRegisterQuantitiesReport.setSecurityId(security.getSecuritySymbol());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue