registry-service правки заполнения регистров
This commit is contained in:
parent
4b089a91ae
commit
252b89652d
8 changed files with 36 additions and 14 deletions
|
|
@ -74,7 +74,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
log.debug("AdmittedLiabilitiesRegisterNewRequest received from {}", Consts.REGISTRY_ADMITTED_LIABILITIES_REGISTER_NEW);
|
||||
String sqlConditionForRegistry = getSqlForRegistries();
|
||||
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlConditionForRegistry);
|
||||
if (registries == null) {
|
||||
if (registries.isEmpty()) {
|
||||
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
||||
return;
|
||||
}
|
||||
|
|
@ -131,6 +131,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
@Override
|
||||
public Optional<AdmittedLiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
||||
return Optional.empty();
|
||||
//todo для всех isDuplicateInMap: сказали надо по критерию чистить мапу перед вставкой записей, критерий уточнят.
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
||||
// "companyId", entity.getRegistryCode(),
|
||||
// "sessionId", entity.getSessionId(),
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class CoveredLiabilitiesRegisterService extends QueueConsumer implements
|
|||
log.debug("CoveredLiabilitiesRegisterNew received");
|
||||
String sqlConditionForRegistry = getSqlForRegistries();
|
||||
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlConditionForRegistry);
|
||||
if (registries == null) {
|
||||
if (registries.isEmpty()) {
|
||||
log.debug("No registry with such conditions {}", sqlConditionForRegistry);
|
||||
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.cud.schedule.LauncherCommandRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
|
@ -63,7 +64,7 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
|||
ImdgPredicate prdctForRegistries = getPredicateForRegistries(userRequest.getRequestPayload().getCompanyId());
|
||||
Collection<Registry> registries = registryMap.getCollectionObjectsByPredicate(prdctForRegistries);
|
||||
log.trace("Started searching depoBalanceRegister in register by '{}'", prdctForRegistries);
|
||||
if (registries == null) {
|
||||
if (registries.isEmpty()) {
|
||||
log.debug("No registry with such conditions '{}'", prdctForRegistries);
|
||||
return;
|
||||
}
|
||||
|
|
@ -83,8 +84,12 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
|||
depoBalanceRegister.setCreated(depoBalanceRegister.getUpdated());
|
||||
depoBalanceRegister.setCompanyId(registry.getCompanyId());
|
||||
depoBalanceRegister.setSessionId(registry.getSessionId());
|
||||
depoBalanceRegister.setDepoCode(registry.getAccountType());
|
||||
depoBalanceRegister.setQuantity(registry.getCloseBalance());
|
||||
if (AccountType.Depo.equalsByKey(registry.getAccountType())) {
|
||||
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());
|
||||
depoBalanceRegisterMap.insert(depoBalanceRegister);
|
||||
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) {
|
||||
log.debug("LauncherCommandRequest received from {}", createRegistry_GORR.topic());
|
||||
Collection<Session> actualSessions = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND"));
|
||||
if (actualSessions == null) {
|
||||
if (actualSessions.isEmpty()) {
|
||||
log.debug("No Session with such conditions section = FOND");
|
||||
return;
|
||||
}
|
||||
|
|
@ -89,7 +89,8 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme
|
|||
private void insertDepoPaymentInstructionRegister(PaymentInstruction paymentInstruction) {
|
||||
log.trace("Started generating DepoPaymentInstructionRegister entity...");
|
||||
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()));
|
||||
depoPaymentInstructionRegister.setCreated(Instant.now());
|
||||
depoPaymentInstructionRegister.setUpdated(Instant.now());
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class ExcludeLiabilitiesRegisterService extends QueueConsumer implements
|
|||
log.debug("ExcludeLiabilitiesRegisterNew received");
|
||||
String sqlForRegistries = getSqlForRegistries();
|
||||
Collection<Registry> registries = registryMap.getCollectionObjectsBySQL(sqlForRegistries);
|
||||
if (registries == null) {
|
||||
if (registries.isEmpty()) {
|
||||
log.debug("No registry with such conditions {}", sqlForRegistries);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,19 @@ public class ExecutionRegisterService extends QueueConsumer implements Initializ
|
|||
|
||||
private void insertExecutionRegister(Boolean isFond, ExecutionCommon common) {
|
||||
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 sellerTradingClearingRegister = 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.schedule.LauncherCommandRequest;
|
||||
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.RegistryInstrumentType;
|
||||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
|
|
@ -97,10 +98,8 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
|||
)
|
||||
);
|
||||
CompanySymbols companySymbols = companySymbolsMap.getFirstObjectByFieldValues(
|
||||
Map.of("companyId",
|
||||
registry.getCompanyId(),
|
||||
"companySymbol",
|
||||
"INN"
|
||||
Map.of("companyId", registry.getCompanyId(),
|
||||
"companySymbol", CompanySymbol.INN.getKey()
|
||||
)
|
||||
);
|
||||
MoneyMarketSecurity moneyMarketSecurity = moneyMarketSecurityMap.getFirstObjectByFieldValues(
|
||||
|
|
@ -116,7 +115,7 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
|||
liabilitiesRegister.setValidToDate(TimeUtil.toLocalDate(session.getUpdated()));
|
||||
}
|
||||
if (companySymbols == null) {
|
||||
log.warn("CompanySymbols is empty!");
|
||||
log.warn("CompanySymbols is empty! For companyId={}", registry.getCompanyId());
|
||||
} else {
|
||||
liabilitiesRegister.setInn(companySymbols.getCompanySymbolValue());
|
||||
}
|
||||
|
|
@ -127,6 +126,7 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
|||
}
|
||||
liabilitiesRegister.setSessionId(registry.getSessionId());
|
||||
liabilitiesRegister.setCompanyId(registry.getCompanyId());
|
||||
liabilitiesRegister.setCompanyFullName(registry.getFullName());
|
||||
liabilitiesRegister.setRegistryCode(registry.getRegistryCode());
|
||||
liabilitiesRegister.setAccount(registry.getAccount());
|
||||
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.cud.schedule.LauncherCommandRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.platform.enumeration.CompanySymbol;
|
||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
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);
|
||||
return;
|
||||
}
|
||||
//todo надо группировать!
|
||||
registries.forEach((registry -> {
|
||||
if (isDuplicateInMap(registry).isEmpty()) {
|
||||
insertMoneyBalanceRegister(registry);
|
||||
|
|
@ -92,7 +94,7 @@ public class MoneyBalanceRegisterService extends QueueConsumer implements Initia
|
|||
Registry registryForBlockedSum = registryMap.getFirstObjectByPredicate(getSqlForBlockedSum(registry.getCompanyId(), registry.getAccount()));
|
||||
Registry registryForUnblockedSum = registryMap.getFirstObjectByPredicate(getSqlForUnblockedSum(registry.getCompanyId(), registry.getAccount()));
|
||||
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 inn = companySymbol != null ? companySymbol.getCompanySymbolValue() : null;
|
||||
String accountType = registry.getAccountType();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue