Compare commits
1 commit
10_01_2024
...
dev_releas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
247c02c569 |
910 changed files with 3337 additions and 16224 deletions
|
|
@ -1,101 +0,0 @@
|
|||
package ru.spcex.clearing.account.config.validation;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.account.AccountSymbols;
|
||||
import ru.spcex.clearing.account.errors.AccountError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountSymbolsNewRequest;
|
||||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.validation.ImdgValidationContext;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.validation.IValidationRule;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Configuration
|
||||
public class AccountSymbolsValidationConfig {
|
||||
|
||||
@Bean("accountSymbolsDepoNewRequest")
|
||||
public Function<AccountSymbolsNewRequest, IValidator> accountSymbolsDepoNewRequestValidator(
|
||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||
) {
|
||||
return accountSymbolsNewRequest -> {
|
||||
ImdgValidationContext<AccountSymbolsNewRequest> context = new ImdgValidationContext<>();
|
||||
context.setValidatedObject(accountSymbolsNewRequest);
|
||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||
addImdg.accept(IMDGDistributedNames.Map_Account);
|
||||
addImdg.accept(IMDGDistributedNames.Map_AccountSymbols);
|
||||
return new ValidatorImpl<>(context,
|
||||
IdPresentRule.instance("accountId",
|
||||
AccountSymbolsNewRequest::getAccountId,
|
||||
IMDGDistributedNames.Map_Account,
|
||||
Account.class,
|
||||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.AccountNotFound,
|
||||
true,
|
||||
(Account account) -> {
|
||||
if (AccountType.Depo.equalsByKey(account.getAccountType())) {
|
||||
return null;
|
||||
} else {
|
||||
return AccountError.AccountDepoTypeRequired;
|
||||
}
|
||||
}
|
||||
),
|
||||
FieldNotBlankRequiredRule.instance("accountSymbolValue",
|
||||
AccountSymbolsNewRequest::getAccountSymbolValue,
|
||||
AccountError.RequiredFieldEmpty, true),
|
||||
new DuplicateAccountSymbolsRule()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
static class DuplicateAccountSymbolsRule implements IValidationRule<ImdgValidationContext<AccountSymbolsNewRequest>> {
|
||||
@Override
|
||||
public Optional<EnumMessage> validate(ImdgValidationContext<AccountSymbolsNewRequest> context) {
|
||||
AccountSymbolsNewRequest validatedObject = context.getValidatedObject();
|
||||
Imdg<AccountSymbols> accountSymbolsImdg = context.obtainMap(IMDGDistributedNames.Map_AccountSymbols, AccountSymbols.class);
|
||||
|
||||
ImdgPredicateBuilder pb = accountSymbolsImdg.predicateBuilder();
|
||||
ImdgPredicate query = pb.or(
|
||||
pb.equals("accountId", validatedObject.getAccountId()),
|
||||
pb.equals("accountSymbolValue", validatedObject.getAccountSymbolValue())
|
||||
);
|
||||
Collection<AccountSymbols> existAccSymbols = accountSymbolsImdg.getCollectionObjectsByPredicate(query);
|
||||
|
||||
if (existAccSymbols.isEmpty()) {
|
||||
return empty();
|
||||
} else {
|
||||
AccountSymbols existAS = existAccSymbols.iterator().next();
|
||||
String duplicateMsg = "";
|
||||
if (validatedObject.getAccountId() != null && validatedObject.getAccountId().equals(existAS.getAccountId())) {
|
||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||
Account linkedAccount = accountImdg.getSingleObjectByID(existAS.getAccountId());
|
||||
if (linkedAccount != null) {
|
||||
duplicateMsg = linkedAccount.getAccount();
|
||||
} else {
|
||||
duplicateMsg = "" + existAS.getAccountId();
|
||||
}
|
||||
}
|
||||
if (validatedObject.getAccountSymbolValue() != null &&
|
||||
validatedObject.getAccountSymbolValue().equals(existAS.getAccountSymbolValue())) {
|
||||
if (!duplicateMsg.isEmpty())
|
||||
duplicateMsg += ", ";
|
||||
duplicateMsg += existAS.getAccountSymbolValue();
|
||||
}
|
||||
return of(AccountError.AccountAlreadyExist, duplicateMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -55,7 +55,6 @@ public class AccountValidationConfig {
|
|||
Company.class,
|
||||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.CompanyNotFound
|
||||
// company -> WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive
|
||||
),
|
||||
FieldRequiredSpecificRule.instance("account",
|
||||
CorrespondentAccountNewRequest::getAccount,
|
||||
|
|
@ -85,10 +84,6 @@ public class AccountValidationConfig {
|
|||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.DictionaryNotFound,
|
||||
false
|
||||
// , statusValue -> {
|
||||
// if (ServiceStatus.Active.equalsByKey(statusValue.getCode())) return null;
|
||||
// return AccountError.WrongFieldValue;
|
||||
// }
|
||||
),
|
||||
DictionaryPresentRule.instance("accountType",
|
||||
CorrespondentAccountNewRequest::getAccountType,
|
||||
|
|
@ -156,10 +151,6 @@ public class AccountValidationConfig {
|
|||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.DictionaryNotFound,
|
||||
false
|
||||
// accountType -> {
|
||||
// if (AccountType.Corr.equalsByKey(accountType.getCode())) return null;
|
||||
// return AccountError.WrongFieldValue;
|
||||
// }
|
||||
)
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
|||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||
import ru.spcex.clearing.validation.common.rules.specific.FieldRequiredSpecificRule;
|
||||
import ru.spcex.clearing.validation.common.rules.specific.IdPresentSpecificRule;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.AccountStatus;
|
||||
|
|
@ -27,7 +26,6 @@ import ru.spcex.platform.utils.enumeration.EnumMessage;
|
|||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
|
@ -110,7 +108,6 @@ public class BankAccountValidationConfig {
|
|||
);
|
||||
Account account = accountImdg.getSingleObjectByID(accountId);
|
||||
if (account == null) return AccountError.AccountNotFound;
|
||||
// if (!AccountStatus.ACTIVE.equalsByKey(account.getStatus())) return AccountError.AccountNotActive;
|
||||
return null;
|
||||
}),
|
||||
DictionaryPresentRule.instance("currency",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
|||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||
import ru.spcex.clearing.validation.common.rules.specific.FieldRequiredSpecificRule;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.enumeration.ServiceStatus;
|
||||
|
|
@ -53,7 +52,6 @@ public class ClearingAccountValidationConfig {
|
|||
Company.class,
|
||||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.CompanyNotFound
|
||||
// company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null
|
||||
),
|
||||
FieldNotBlankRequiredRule.instance("account",
|
||||
ClearingAccountNewRequest::getAccount,
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ public class ClientCodeValidationConfig {
|
|||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||
addImdg.accept(IMDGDistributedNames.Map_ClientCode);
|
||||
return new ValidatorImpl<>(context,
|
||||
// FieldRequiredRule.instance("id", CommonDeleteRequest::getId, CompanyErrors.RequiredFieldEmpty),
|
||||
IdPresentRule.instance("id",
|
||||
CommonDeleteRequest::getId,
|
||||
IMDGDistributedNames.Map_ClientCode,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package ru.spcex.clearing.account.config.validation;
|
|||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
|
||||
import ru.spcex.clearing.account.errors.AccountError;
|
||||
|
|
@ -12,7 +11,6 @@ import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
|||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||
import ru.spcex.clearing.validation.common.rules.specific.FieldRequiredSpecificRule;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
|
|
@ -20,7 +18,6 @@ import ru.spcex.platform.imdg.validation.ImdgValidationContext;
|
|||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
|
@ -47,7 +44,6 @@ public class DepoAccountValidationConfig {
|
|||
Company.class,
|
||||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.CompanyNotFound
|
||||
// company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null
|
||||
),
|
||||
FieldNotBlankRequiredRule.instance("account",
|
||||
DepoAccountNewRequest::getAccount,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class SameAccountValidationRule<R> implements IValidationRule<ImdgValidationCont
|
|||
final Function<R, String> accountGetter;
|
||||
|
||||
public SameAccountValidationRule(AccountType accountType, Function<R, String> accountGetter) {
|
||||
this.accountType = accountType.getKey(); // or req.getAccountType()
|
||||
this.accountType = accountType.getKey();
|
||||
this.accountGetter = accountGetter;
|
||||
Objects.requireNonNull(accountGetter);
|
||||
}
|
||||
|
|
@ -32,8 +32,7 @@ class SameAccountValidationRule<R> implements IValidationRule<ImdgValidationCont
|
|||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||
ImdgPredicate query = pb.and(
|
||||
pb.equals("account", accountGetter.apply(req)), // req.getAccount()
|
||||
// pb.equals("accountType", accountType), имена всех счетов уникальны, вне зависимости от типа
|
||||
pb.equals("account", accountGetter.apply(req)),
|
||||
pb.in("status", ServiceStatus.Active.getKey(), ServiceStatus.Reopened.getKey(), ServiceStatus.Appl.getKey())
|
||||
);
|
||||
Account existAccount = accountImdg.getFirstObjectByPredicate(query);
|
||||
|
|
|
|||
|
|
@ -84,26 +84,10 @@ public class TradingClearingRegistryValidationConfig {
|
|||
return AccountError.AccountNotFound;
|
||||
} else {
|
||||
if (AccountType.Clrn.equalsByKey(account.getAccountType()) || AccountType.Info.equalsByKey(account.getAccountType())) {
|
||||
// ok
|
||||
} else {
|
||||
// неправильный тип
|
||||
return AccountError.AccountNotFound;
|
||||
}
|
||||
}
|
||||
// Imdg<ClearingAccount> clearingAccountImdg = context.obtainMap(
|
||||
// IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class
|
||||
// );
|
||||
// ClearingAccount clearingAccount = clearingAccountImdg.getSingleObjectByFieldValues(
|
||||
// Map.of("accountId",moneyAccountId)
|
||||
// );
|
||||
// if (clearingAccount == null) {
|
||||
// Imdg<InformationAccount> informationAccountImdg = context.obtainMap(
|
||||
// IMDGDistributedNames.Map_InformationAccount, InformationAccount.class
|
||||
// );
|
||||
// InformationAccount infoAccount = informationAccountImdg.getSingleObjectByFieldValues(
|
||||
// Map.of("accountId",moneyAccountId));
|
||||
// if (infoAccount == null) return AccountError.AccountNotFound;
|
||||
// }
|
||||
return null;
|
||||
}),
|
||||
FieldRequiredRule.instance("depoAccountId",
|
||||
|
|
@ -140,11 +124,6 @@ public class TradingClearingRegistryValidationConfig {
|
|||
if (validatedObject.getMoneyAccountId() == null) {
|
||||
return of(AccountError.RequiredFieldEmpty, "MoneyAccountId");
|
||||
}
|
||||
//Map<String, Comparable<?>> query = new HashMap<>();
|
||||
// query.put("moneyAccountId", validatedObject.getMoneyAccountId());
|
||||
// if (validatedObject.getDepoAccountId() != null) {
|
||||
// query.put("depoAccountId", validatedObject.getDepoAccountId());
|
||||
// }
|
||||
ImdgPredicateBuilder pb = tcrMap.predicateBuilder();
|
||||
ImdgPredicate query = pb.equals("moneyAccountId", validatedObject.getMoneyAccountId());
|
||||
if (validatedObject.getDepoAccountId() != null) {
|
||||
|
|
@ -160,8 +139,6 @@ public class TradingClearingRegistryValidationConfig {
|
|||
Account account = accountImdg.getSingleObjectByID(validatedObject.getMoneyAccountId());
|
||||
if (account == null && validatedObject.getDepoAccountId() != null) account = accountImdg.getSingleObjectByID(validatedObject.getDepoAccountId());
|
||||
return of(AccountError.AccountForTradingClearingRegistryAlreadyUsed, account.getAccount());
|
||||
// String tcrIds = existTCR.stream().map(tcr -> String.valueOf(tcr.getId())).collect(Collectors.joining(";"));
|
||||
// return of(AccountError.AccountForTradingClearingRegistryAlreadyUsed, tcrIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
|||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
||||
import ru.clearing.platform.dictionary.*;
|
||||
import ru.clearing.platform.dictionary.AccountTypeDictionary;
|
||||
import ru.clearing.platform.dictionary.ClearingAccountTypeDictionary;
|
||||
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
|
||||
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
|
@ -41,9 +44,6 @@ public class ValidationConfig {
|
|||
addImdg.accept(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
|
||||
addImdg.accept(IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class);
|
||||
addImdg.accept(IMDGDistributedNames.Map_TradingClearingRegistry, TradingClearingRegistry.class);
|
||||
addImdg.accept(IMDGDistributedNames.Map_AccountSymbols, AccountSymbols.class);
|
||||
|
||||
//for ClientCodeValidationConfig
|
||||
addImdg.accept(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
|
||||
|
||||
return imdg;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,9 @@ public enum AccountError implements IErrorEnumId {
|
|||
DepoAccountNotFound(5017L),
|
||||
MoneyAccountNotFound(5018L),
|
||||
ClearingCategoryNotFound(5019L),
|
||||
ClearingCompanySymbolNotFound(5022L), // Для компании %s отсутствует клиринговый код».
|
||||
ClearingCompanySymbolNotFound(5022L),
|
||||
AccountForTradingClearingRegistryAlreadyUsed(5023L),
|
||||
AccountFieldNotSet(5024L),
|
||||
AccountDepoTypeRequired(5025L),
|
||||
TradingClearingRegistryNotFound(3022L),
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package ru.spcex.clearing.account.service;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
||||
|
|
@ -12,7 +11,7 @@ import ru.spcex.clearing.account.errors.AccountError;
|
|||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||
import ru.spcex.clearing.platform.messaging.service.Status;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.enumeration.ClearingCategory;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
|
|
@ -42,11 +41,6 @@ public class AccountHelper {
|
|||
this.messageResolver = messageResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Заполняет поля relationId и companyId из соответствующей записи Relation
|
||||
*
|
||||
* @param requestId Идентификатор запроса для вывода лога
|
||||
*/
|
||||
public RequestInfoUpdate fillAccountFromRelation(Account account, Long requestId, boolean checkClearingMemberCategory) {
|
||||
Long companyId = account.getCompanyId();
|
||||
Collection<Relation> relations;
|
||||
|
|
@ -73,7 +67,6 @@ public class AccountHelper {
|
|||
} else {
|
||||
log.info("ClearingCategoryNotFound with clearingCategoryValue={} not implemented. Do not search Relation.", clearingCategoryValue);
|
||||
return null;
|
||||
//return makeError(requestId, AccountError.ClearingCategoryNotFound, companyId, clearingCategoryValue + " (case not implemented)");
|
||||
}
|
||||
finalRelationPredicate = relationPredicateBuilder.and(consumerIdPredicate, servicePredicate);
|
||||
relations = relationMap.getCollectionObjectsByPredicate(finalRelationPredicate);
|
||||
|
|
@ -83,7 +76,6 @@ public class AccountHelper {
|
|||
}
|
||||
|
||||
if (relations.isEmpty()) {
|
||||
//return makeError(requestId, AccountError.WrongFieldValue, "companyId", finalRelationPredicate.toString());
|
||||
log.info("Relation not found: {}", finalRelationPredicate.toString());
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,7 @@ import ru.spcex.platform.enumeration.*;
|
|||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
|
||||
|
|
@ -155,10 +152,8 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
|
||||
Long newId = null;
|
||||
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
||||
// default, дополнительные таблицы не требуются
|
||||
newId = accountMap.insert(account);
|
||||
} else {
|
||||
// Транзакцией
|
||||
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
||||
imdgTransaction.beginTransaction();
|
||||
boolean txOk = false;
|
||||
|
|
@ -167,7 +162,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
newId = accountMap.insert(account);
|
||||
|
||||
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
||||
// default, дополнительные таблицы не требуются
|
||||
} else if (AccountType.Info.equalsByKey(account.getAccountType()))
|
||||
makeInfoPart(imdgTransaction, account);
|
||||
else if (AccountType.Depo.equalsByKey(account.getAccountType()))
|
||||
|
|
@ -218,7 +212,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
if (account.getAccount() != null && account.getAccount().contains("BC")) {
|
||||
depoAcc.setDepoAccountType(DepoAccountType.C.getKey());
|
||||
} else {
|
||||
//todo в реквесте нет поля depoAcc.setDepoAccountType(req.getDepoAccountType());
|
||||
}
|
||||
Long depoId = depoAccountMap.insert(depoAcc);
|
||||
log.debug("For account id={} make DepoAccount id={}", account.getId(), depoId);
|
||||
|
|
@ -286,7 +279,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
log.debug("AccountTerminationRequest received, id={}", userRequest.getId());
|
||||
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate; // never - system
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
AccountTerminationRequest req = userRequest.getRequestPayload();
|
||||
final Long companyId = req.getCompanyId();
|
||||
|
|
@ -298,7 +291,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
try {
|
||||
tx.beginTransaction();
|
||||
for (Account account : accounts) {
|
||||
//Account account = accountMap.getSingleObjectByID(request.getId());
|
||||
if (!ServiceStatus.Blocked.equalsByKey(account.getStatus())) {
|
||||
account.setStatus(ServiceStatus.Blocked.getKey());
|
||||
account.setUpdated(Instant.now());
|
||||
|
|
|
|||
|
|
@ -1,122 +0,0 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.account.*;
|
||||
import ru.spcex.clearing.account.errors.AccountError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountSymbolsNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonIdRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
||||
import ru.spcex.clearing.util.services.RequestHelper;
|
||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
public class AccountSymbolsService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final ValidationHelper validationHelper;
|
||||
private final UserRoleVerification userRoleVerification;
|
||||
|
||||
private final ImdgProvider imdgProvider;
|
||||
private final Imdg<AccountSymbols> accountSymbolsImdg;
|
||||
|
||||
private final RequestHelper requestHelper;
|
||||
private final Function<AccountSymbolsNewRequest, IValidator> accountSymbolsNewRequestValidator;
|
||||
|
||||
private final IMessageResolver messageResolver;
|
||||
private final Producer<String, Object> kafkaProducer;
|
||||
private final KafkaSender kafkaSender;
|
||||
|
||||
public AccountSymbolsService(Consumer<String, Object> kafkaQueue,
|
||||
Producer<String, Object> kafkaProducer,
|
||||
KafkaSender kafkaSender,
|
||||
ImdgProvider imdgProvider,
|
||||
ValidationHelper validationHelper,
|
||||
UserRoleVerification userRoleVerification,
|
||||
IMessageResolver messageResolver,
|
||||
RequestHelper requestHelper,
|
||||
@Qualifier("accountSymbolsDepoNewRequest")
|
||||
Function<AccountSymbolsNewRequest, IValidator> accountSymbolsNewRequestValidator
|
||||
) {
|
||||
super(kafkaQueue, kafkaProducer);
|
||||
this.kafkaProducer = kafkaProducer;
|
||||
this.kafkaSender = kafkaSender;
|
||||
this.validationHelper = validationHelper;
|
||||
this.userRoleVerification = userRoleVerification;
|
||||
this.requestHelper = requestHelper;
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.accountSymbolsImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_AccountSymbols, AccountSymbols.class);
|
||||
this.accountSymbolsNewRequestValidator = accountSymbolsNewRequestValidator;
|
||||
this.messageResolver = messageResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
imdgProvider.waitAvailable();
|
||||
callback(AccountSymbolsNewRequest.class)
|
||||
.setFunction(this::accountSymbolsNew)
|
||||
.forDestination(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_NEW, callbacks::put);
|
||||
callback(CommonIdRequest.class)
|
||||
.setFunction(this::accountSymbolsDelete)
|
||||
.forDestination(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_DELETE, callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
protected RequestInfoUpdate accountSymbolsNew(BaseRequest<AccountSymbolsNewRequest> userRequest) {
|
||||
log.debug("AccountSymbolsNewRequest received, id={}", userRequest.getId());
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, accountSymbolsNewRequestValidator);
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
AccountSymbolsNewRequest req = userRequest.getRequestPayload();
|
||||
|
||||
Long id = accountSymbolsImdg.nextIDSequenceFor();
|
||||
AccountSymbols accountSymbols = new AccountSymbols();
|
||||
accountSymbols.setId(id);
|
||||
accountSymbols.setAccountId(req.getAccountId());
|
||||
accountSymbols.setAccountSymbolValue(req.getAccountSymbolValue());
|
||||
|
||||
accountSymbolsImdg.insert(accountSymbols);
|
||||
|
||||
log.debug("successfully processed, id {}. New accountSymbols.id={} was created", id, accountSymbols.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
protected RequestInfoUpdate accountSymbolsDelete(BaseRequest<CommonIdRequest> userRequest) {
|
||||
log.debug("AccountSymbolsDeleteRequest(CommonIdRequest) received, id={}", userRequest.getId());
|
||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
CommonIdRequest req = userRequest.getRequestPayload();
|
||||
|
||||
AccountSymbols accountSymbols = accountSymbolsImdg.getSingleObjectByID(req.getId());
|
||||
if (accountSymbols == null) {
|
||||
return requestHelper.makeErrorResponse(userRequest, AccountError.AccountNotFound, req.getId());
|
||||
}
|
||||
|
||||
accountSymbolsImdg.delete(accountSymbols);
|
||||
|
||||
log.debug("successfully processed, id {}. New accountSymbols.id={} was deleted", userRequest.getId(), accountSymbols.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -221,7 +221,6 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
|
|||
account.setUpdated(Instant.now());
|
||||
|
||||
accountMap.update(account);
|
||||
//без изменений bankAccountMap.update(bankAccount);
|
||||
|
||||
log.debug("successfully block, existing bankAccount with id {}", bankAccount.getId());
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
private final Function<ClearingAccountUpdateRequest, IValidator> clearingAccountUpdateRequestValidator;
|
||||
|
||||
private final Imdg<Account> accountImdg;
|
||||
private final Imdg<ClearingAccount> clearingAccountImdg;
|
||||
private final Imdg<Company> companyImdg;
|
||||
private final Imdg<Relation> relationImdg;
|
||||
private final Imdg<ClearingMemberCategory> clearingMemberCategoryImdg;
|
||||
|
|
@ -104,7 +103,6 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
this.clearingAccountUpdateRequestValidator = clearingAccountUpdateRequestValidator;
|
||||
|
||||
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||
this.clearingAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
||||
this.companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.relationImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
|
||||
this.clearingMemberCategoryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingMemberCategory, ClearingMemberCategory.class);
|
||||
|
|
@ -262,11 +260,11 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
account.setUpdated(now);
|
||||
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
|
||||
if (requestInfoUpdate != null) {
|
||||
log.warn("Error fill new account from relation. {}", /*account.getId(),*/ requestInfoUpdate.getMessage());
|
||||
log.warn("Error fill new account from relation. {}", requestInfoUpdate.getMessage());
|
||||
{
|
||||
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
|
||||
responsePart.setSdfId(accountReq.getSdfId());
|
||||
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId()); // see accountService.fillAccountFromRelation
|
||||
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId());
|
||||
responsePart.setErrorText(requestInfoUpdate.getMessage());
|
||||
accountToStatement.add(responsePart);
|
||||
continue accountsLoop;
|
||||
|
|
@ -340,7 +338,7 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
|
||||
List<Pair<SDf52, Account>> toUpdate = new ArrayList<>();
|
||||
List<Triple<SDf52, Account, String>> toProcessSDF53 = new ArrayList<>();
|
||||
{ // 1. Выборка данных
|
||||
{
|
||||
for (SDf52 sDf52 : sdfs) {
|
||||
if (sdfProcessService.parseSdf52Status(sDf52.getStatus()) == null) {
|
||||
String msg = messageResolver.resolve(new EnumMessage(AccountError.WrongFieldValue, "status"));
|
||||
|
|
@ -364,42 +362,34 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
);
|
||||
Account account = sDf52.getAccount() == null ? null : accountImdg.getFirstObjectByFieldValues(accountQuery);
|
||||
if (account == null) {
|
||||
if (SDFProcessService.SDF52_STATUS_3Open.equals(sDf52.getStatus())) {
|
||||
log.debug("By generationId={} s_df52[{}].status={}, but account not found (query: {}). COntinuse with result OK for status 3",
|
||||
groupId, sDf52.getId(), sDf52.getStatus(), accountQuery);
|
||||
} else {
|
||||
String msg = messageResolver.resolve(new EnumMessage(AccountError.AccountNotFound, sDf52.getAccount()));
|
||||
log.warn("By generationId={} s_df52[{}] (query: {}) error: {}", groupId, sDf52.getId(), accountQuery, msg);
|
||||
toProcessSDF53.add(new MutableTriple<>(sDf52, null,
|
||||
makeSdfErrorText(AccountError.AccountNotFound, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND)));
|
||||
continue;
|
||||
}
|
||||
String msg = messageResolver.resolve(new EnumMessage(AccountError.AccountNotFound, sDf52.getAccount()));
|
||||
log.warn("By generationId={} s_df52[{}] (query: {}) error: {}", groupId, sDf52.getId(), accountQuery, msg);
|
||||
toProcessSDF53.add(new MutableTriple<>(sDf52, null,
|
||||
makeSdfErrorText(AccountError.AccountNotFound, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND)));
|
||||
continue;
|
||||
}
|
||||
toProcessSDF53.add(new MutableTriple<>(sDf52, account, SDFProcessService.SDF_STATUS_OK));
|
||||
toUpdate.add(new Pair<>(sDf52, account));
|
||||
}
|
||||
}
|
||||
log.debug("Selected to update {} account's", toUpdate.size());
|
||||
|
||||
// 4. to notification
|
||||
List<Long> notificationAccountIds = new ArrayList<>();
|
||||
for (Pair<SDf52, Account> item : toUpdate) {
|
||||
SDf52 sdf = item.getFirst();
|
||||
Account account = item.getSecond();
|
||||
AccountStatus newStatus = sdfProcessService.parseSdf52Status(sdf.getStatus());
|
||||
if (newStatus == null) { // never
|
||||
if (newStatus == null) {
|
||||
throw new IllegalArgumentException("Can not parse sdf status " + sdf.getStatus());
|
||||
}
|
||||
if (newStatus.equalsByKey(account.getStatus())) {
|
||||
// одинаковых обычно не бывает.
|
||||
continue;
|
||||
}
|
||||
if (AccountStatus.BLOCKED == newStatus || AccountStatus.CLOSE == newStatus) { // статус 0/2
|
||||
if (AccountStatus.BLOCKED == newStatus || AccountStatus.CLOSE == newStatus) {
|
||||
sendNotificationRequest(ObjectType.account_block, account, newStatus);
|
||||
notificationAccountIds.add(account.getId());
|
||||
putNotificationWaiting(systemRequest, item.getFirst(), item.getSecond());
|
||||
}
|
||||
if (AccountStatus.ACTIVE == newStatus) { // статус 1/3
|
||||
if (AccountStatus.ACTIVE == newStatus) {
|
||||
sendNotificationRequest(ObjectType.account_active, account, newStatus);
|
||||
notificationAccountIds.add(account.getId());
|
||||
putNotificationWaiting(systemRequest, item.getFirst(), item.getSecond());
|
||||
|
|
@ -438,32 +428,26 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
protected RequestInfoUpdate accountUpdateSdf52_part2(BaseRequest<StatementRequest> systemRequest1,
|
||||
SDf52 sdf, Account account,
|
||||
BaseRequest<NotificationFeedbackRequest> secondSystemRequest2) {
|
||||
// 5. from notification:
|
||||
StatementRequest req = systemRequest1.getRequestPayload();
|
||||
Long groupId = req.getGroupId();
|
||||
log.info("Continue Sdf52 groupId={}, first request id={}, second request id={}",
|
||||
groupId, systemRequest1 == null ? null : systemRequest1.getId(), secondSystemRequest2 == null ? null : secondSystemRequest2.getId());
|
||||
|
||||
int countOfUpdated = 0;
|
||||
|
||||
// 2. обновление данных
|
||||
Instant now = Instant.now();
|
||||
AccountStatus newStatus = sdfProcessService.parseSdf52Status(sdf.getStatus());
|
||||
if (newStatus == null) {
|
||||
throw new IllegalArgumentException("Can not parse sdf status " + sdf.getStatus());
|
||||
}
|
||||
// За долгое время ожидания пользователя счёт мог быть обновлён, прочитать его ещё раз
|
||||
account = accountImdg.getSingleObjectByID(account.getId());
|
||||
if (!newStatus.equalsByKey(account.getStatus())) {
|
||||
// Обновление счёта
|
||||
String oldStatus = account.getStatus();
|
||||
account.setStatus(newStatus.getKey());
|
||||
account.setUpdated(now);
|
||||
accountImdg.update(account);
|
||||
log.trace("S_DF52[{}] do update status to {} for account[{}]",
|
||||
sdf.getId(), newStatus.getKey(), account.getId());
|
||||
if (AccountStatus.ACTIVE.equalsByKey(oldStatus) && AccountStatus.ACTIVE != newStatus) { // счёт заблокировали - значит блокируем ТКР, наоборот не надо.
|
||||
// Отправка в ТКР
|
||||
if (AccountStatus.ACTIVE.equalsByKey(oldStatus) && AccountStatus.ACTIVE != newStatus) {
|
||||
TradingClearingRegistryUpdateRequest tcrReq = new TradingClearingRegistryUpdateRequest();
|
||||
tcrReq.setMoneyAccountId(account.getId());
|
||||
tcrReq.setCompanyId(account.getCompanyId());
|
||||
|
|
@ -507,7 +491,7 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
request.setChildGenerationId(groupSdf02Id);
|
||||
request.setAccountCreationResults(results);
|
||||
request.setContinueSdf(true);
|
||||
request.setTable(SdfTable.SDF_01); // по нему запрос получили
|
||||
request.setTable(SdfTable.SDF_01);
|
||||
log.debug("Send message to kafka \"{}\": {}", destination, LogFormatter.toStringWrapper(request));
|
||||
kafkaSender.sendRequestToQueue(destination, request);
|
||||
}
|
||||
|
|
@ -531,7 +515,6 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
}
|
||||
|
||||
|
||||
// --------- notification apply system -----------
|
||||
public static class SDF52WaitingData {
|
||||
public BaseRequest<StatementRequest> systemRequest;
|
||||
public SDf52 sdf;
|
||||
|
|
@ -565,9 +548,6 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return triggered SDF52WaitingData or null
|
||||
*/
|
||||
public SDF52WaitingData onNotificationResponse(NotificationFeedbackRequest onNotification) {
|
||||
if (onNotification.getNotificationId() == null) {
|
||||
log.trace("notificationId was empty");
|
||||
|
|
|
|||
|
|
@ -115,18 +115,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверки
|
||||
* 3.5.1 если не была найдена запись в tradingClearingRegistry по companyId, moneyAccountId, depoAccountId и tradingClearingRegistryType=B (п 3.5.1)
|
||||
* 3.5.2 если не заполнены поля moneyAccountId ИЛИ moneyAccountId и depoAccountId
|
||||
* @param userRequest
|
||||
* @param moneyAccountId req.getMoneyAccountId()
|
||||
* @param depoAccountId req.getDepoAccountId()
|
||||
* @param companyId req.getCompanyId()
|
||||
* @return
|
||||
*/
|
||||
RequestInfoUpdate crossValidate(BaseRequest<?> userRequest, Long moneyAccountId, Long depoAccountId, Long companyId) {
|
||||
if (moneyAccountId == null) { // Если не заполнены moneyAccountId ИЛИ moneyAccountId и depoAccountId
|
||||
if (moneyAccountId == null) {
|
||||
EnumMessage error = null;
|
||||
if (companyId == null) {
|
||||
error = new EnumMessage(AccountError.RequiredFieldEmpty, "companyId");
|
||||
|
|
@ -153,7 +143,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
ClientCodeNewRequest req = userRequest.getRequestPayload();
|
||||
// дополнительная проверка
|
||||
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
|
|
@ -190,7 +179,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
|
||||
|
||||
ClientCodeNewRequest req = userRequest.getRequestPayload();
|
||||
// дополнительная проверка
|
||||
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
|
|
@ -224,7 +212,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
|
||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, clientCodeUpdateRequestValidator);
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
// дополнительная проверка
|
||||
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
|
||||
|
|
@ -297,7 +284,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
}
|
||||
|
||||
private boolean checkNeedCreateTCR(Long companyId, Long moneyAccountId, Long depoAccountId) {
|
||||
// moneyAccountId обязателен, depoAccountId опционален
|
||||
if (moneyAccountId == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -321,11 +307,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
requestPayload.setCompanyId(companyId);
|
||||
requestPayload.setMoneyAccountId(moneyAccountId);
|
||||
requestPayload.setDepoAccountId(depoAccountId);
|
||||
// requestPayload.setStatus(WorkflowStatus.Active.getKey());
|
||||
requestPayload.setTradingClearingRegistryType(TradingClearingRegistryType.Client_B.getKey());
|
||||
request.setRequestPayload(requestPayload);
|
||||
|
||||
// Следующий вызываемый метод обязательно должен быть synchronized.
|
||||
RequestInfoUpdate reply = tradingClearingRegistryService.tradingClearingRegistryNew(request);
|
||||
if (reply != null && Status.Error.equals(reply.getStatus())) {
|
||||
log.warn("tradingClearingRegistryService return error: " + reply.getMessage());
|
||||
|
|
@ -355,11 +338,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param queue Consts.*
|
||||
* @param message BaseRequest
|
||||
* @return
|
||||
*/
|
||||
private Long sendMessage(String queue, BaseRequest<?> message) {
|
||||
Long sentRequestId = message.getId();
|
||||
if (sentRequestId == null) {
|
||||
|
|
@ -383,13 +361,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param req требуется заполнить tradingClearingRegistryId по tradingClearingRegistry.code
|
||||
* @return
|
||||
*/
|
||||
private ClientCode buildClientCode(ClientCodeNewRequest req) {
|
||||
ClientCode clientCode = new ClientCode();
|
||||
// clientCode.setId(idSequence.newId()); add in insert
|
||||
clientCode.setCreated(Instant.now());
|
||||
clientCode.setUpdated(clientCode.getCreated());
|
||||
|
||||
|
|
|
|||
|
|
@ -147,8 +147,6 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
|
|||
accountsLoop:
|
||||
for (AccountSdfRequestPart accountReq : req.getAccounts()) {
|
||||
|
||||
// DepoAccountNewRequest req = userRequest.getRequestPayload();
|
||||
|
||||
Instant now = Instant.now();
|
||||
Account account = new Account();
|
||||
account.setAccount(accountReq.getAccount());
|
||||
|
|
@ -159,11 +157,11 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
|
|||
account.setUpdated(now);
|
||||
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
|
||||
if (requestInfoUpdate != null) {
|
||||
log.warn("Error fill new account from relation. {}", /*account.getId(),*/ requestInfoUpdate.getMessage());
|
||||
log.warn("Error fill new account from relation. {}", requestInfoUpdate.getMessage());
|
||||
{
|
||||
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
|
||||
responsePart.setSdfId(accountReq.getSdfId());
|
||||
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId()); // see accountService.fillAccountFromRelation
|
||||
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId());
|
||||
responsePart.setErrorText(requestInfoUpdate.getMessage());
|
||||
accountToStatement.add(responsePart);
|
||||
continue accountsLoop;
|
||||
|
|
@ -228,9 +226,9 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
|
|||
StatementRequest request = new StatementRequest();
|
||||
request.setGroupId(groupingSdf01Id);
|
||||
request.setChildGenerationId(groupingSdf02Id);
|
||||
request.setContinueSdf(true); //fixme????
|
||||
request.setContinueSdf(true);
|
||||
request.setAccountCreationResults(results);
|
||||
request.setTable(SdfTable.SDF_08); // по нему запрос получили
|
||||
request.setTable(SdfTable.SDF_08);
|
||||
log.debug("Send message to kafka \"{}\": {}", Consts.STATEMENT_PROCESS, LogFormatter.toStringWrapper(request));
|
||||
kafkaSender.sendRequestToQueue(Consts.STATEMENT_PROCESS, request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
|||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.InformationAccountNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.NotificationRequest;
|
||||
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
|
|
@ -59,10 +58,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
private final Function<InformationAccountNewRequest, IValidator> infoAccountNewRequestValidator;
|
||||
private final Imdg<InformationAccount> informationAccountImdg;
|
||||
private final Imdg<Account> accountImdg;
|
||||
/**
|
||||
* Кэш-счётчик сквозных номеров счетов.
|
||||
* См. accountNextId()
|
||||
*/
|
||||
protected AtomicLong infoCounter;
|
||||
|
||||
@Autowired
|
||||
|
|
@ -191,12 +186,10 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
log.debug("InformationAccountNewRequest received (system), request id={}", userRequest.getId());
|
||||
|
||||
RequestInfoUpdate requestInfoUpdate;
|
||||
// RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, infoAccountNewRequestValidator);
|
||||
// if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||
final Long forCompanyId = userRequest.getRequestPayload().getCompanyId();
|
||||
|
||||
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||
{ // Проверка существования счёта
|
||||
{
|
||||
Collection<Account> accountsAnlt = accountImdg.getCollectionObjectsByFieldValues(Map.of(
|
||||
"companyId", forCompanyId,
|
||||
"accountType", AccountType.Info.getKey()
|
||||
|
|
@ -210,7 +203,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
|
||||
|
||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||
Long infoSequenceId = accountNextId(); // требуется последовательность n+1
|
||||
Long infoSequenceId = accountNextId();
|
||||
String accountValue = generateInfoAccount(infoSequenceId);
|
||||
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
||||
|
||||
|
|
@ -276,17 +269,12 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
imdgTransaction.rollbackTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
// send to kafka
|
||||
sendNotificationToReport(informationAccount, account);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Формирование уведолмения о регистрации УК
|
||||
*/
|
||||
protected void sendNotificationToReport(InformationAccount informationAccount, Account account) {
|
||||
NotificationRequest request = new NotificationRequest();
|
||||
request.setConsumerId(account.getCompanyId());
|
||||
|
|
@ -299,11 +287,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Сквозной номер инфо-счетов
|
||||
*
|
||||
* @return infoCounter++
|
||||
*/
|
||||
public synchronized Long accountNextId() {
|
||||
if (infoCounter == null) synchronized (this) {
|
||||
if (infoCounter == null) {
|
||||
|
|
@ -316,7 +299,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
Pattern accPattern = Pattern.compile("39911810([0-9]{8})7000");
|
||||
int maxN = 1;
|
||||
int parsedCount = 0;
|
||||
String lastAccount = null; // for debug
|
||||
String lastAccount = null;
|
||||
for (Account acc : allInfoAcc) {
|
||||
try {
|
||||
String number = acc.getAccount();
|
||||
|
|
|
|||
|
|
@ -6,42 +6,30 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.misc.Notification;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf52;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.NotificationFeedbackRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.platform.enumeration.AccountStatus;
|
||||
import ru.spcex.platform.enumeration.NotificationStatus;
|
||||
import ru.spcex.platform.enumeration.ObjectType;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
||||
import ru.spcex.platform.utils.collection.Pair;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@Service
|
||||
public class SDFProcessService {
|
||||
public static final String SDF_STATUS_OK = "OK"; // (Операция выполнена успешно) - если account обновлена по sDf52;
|
||||
public static final String SDF_STATUS_ERROR_REPEAT = "1"; // (Ошибка. Попытка повторно исполнить операцию)
|
||||
public static final String SDF_STATUS_ERROR_COMPANY_NOT_FOUND = "2"; // (Ошибка. Участник не найден) - если получена ошибка (5013) "Компания %s не найдена" (т.е. account НЕ обновлена по sDf52);
|
||||
public static final String SDF_STATUS_ERROR_LIMIT_SUMM = "3"; // (Ошибка. Сумма списания превышает сумму средств на торговом счете участника в ТС)
|
||||
public static final String SDF_STATUS_ERROR_NO_TRADE = "4"; // (Ошибка. Торги не идут)
|
||||
public static final String SDF_STATUS_ERROR = "9"; // (Другие ошибки, выявленные в КС) - если получены другие ошибки (т.е. account НЕ обновлена по sDf52).
|
||||
|
||||
protected static final Long SDF52_STATUS_0Blocked = 0L;
|
||||
protected static final Long SDF52_STATUS_1Unblocked = 1L;
|
||||
protected static final Long SDF52_STATUS_2Closed = 2L;
|
||||
protected static final Long SDF52_STATUS_3Open = 3L;
|
||||
public static final String SDF_STATUS_OK = "OK";
|
||||
public static final String SDF_STATUS_ERROR_REPEAT = "1";
|
||||
public static final String SDF_STATUS_ERROR_COMPANY_NOT_FOUND = "2";
|
||||
public static final String SDF_STATUS_ERROR_LIMIT_SUMM = "3";
|
||||
public static final String SDF_STATUS_ERROR_NO_TRADE = "4";
|
||||
public static final String SDF_STATUS_ERROR = "9";
|
||||
|
||||
final protected Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
|
@ -80,7 +68,7 @@ public class SDFProcessService {
|
|||
boolean txOk = false;
|
||||
imdgTransaction.beginTransaction();
|
||||
HashSet<String> fileNames = new HashSet<>();
|
||||
try { // 2. обновление данных, в транзакции
|
||||
try {
|
||||
Imdg<SDf53> sdf53Imdg = imdgTransaction.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
||||
|
||||
Instant now = Instant.now();
|
||||
|
|
@ -119,7 +107,7 @@ public class SDFProcessService {
|
|||
newSdf.setResult(result);
|
||||
newSdf.setGenerationTime(now);
|
||||
newSdf.setGenerationId(sdf52.getGenerationId());
|
||||
if (!Objects.equals(newGenerationId, newSdf.getGenerationId())) { // never
|
||||
if (!Objects.equals(newGenerationId, newSdf.getGenerationId())) {
|
||||
log.warn("Different GenerationId={} for sdf53[{}] and GenerationId={} for group of sdf52",
|
||||
newSdf.getGenerationId(), newSdf.getId(), newGenerationId
|
||||
);
|
||||
|
|
@ -129,17 +117,13 @@ public class SDFProcessService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param status sdf.getStatus()
|
||||
* @return AccountStatus или null
|
||||
*/
|
||||
public AccountStatus parseSdf52Status(Long status) {
|
||||
if (SDF52_STATUS_1Unblocked.equals(status) || SDF52_STATUS_3Open.equals(status)) {
|
||||
if (Long.valueOf(1L).equals(status) || Long.valueOf(3L).equals(status)) {
|
||||
return AccountStatus.ACTIVE;
|
||||
} else if (SDF52_STATUS_0Blocked.equals(status)) {
|
||||
} else if (Long.valueOf(0L).equals(status)) {
|
||||
return AccountStatus.BLOCKED;
|
||||
}
|
||||
if (SDF52_STATUS_2Closed.equals(status)) {
|
||||
if (Long.valueOf(2L).equals(status)) {
|
||||
return AccountStatus.CLOSE;
|
||||
}
|
||||
return null;
|
||||
|
|
@ -147,9 +131,9 @@ public class SDFProcessService {
|
|||
|
||||
|
||||
void messageStatementToExport53(Long groupId, String fileName) {
|
||||
final String destination = Consts.EXPORT_PROCESS; // dbf-exporter
|
||||
final String destination = Consts.EXPORT_PROCESS;
|
||||
ExportToFileRequest request = new ExportToFileRequest();
|
||||
request.setNameOfTable("DF-53"); // SdfTable.SDF_53
|
||||
request.setNameOfTable("DF-53");
|
||||
request.setSdfGroupId(groupId);
|
||||
request.setFileName(fileName);
|
||||
Long msgId = kafkaSender.sendRequestToQueue(destination, request);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||
this.relationImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
|
||||
this.tradingClearingRegistryNewRequestValidator = tradingClearingRegistryNewRequestValidator;
|
||||
this.tradingClearingRegistryAutoNewRequestValidator = tradingClearingRegistryNewRequestValidator; // без relation.
|
||||
this.tradingClearingRegistryAutoNewRequestValidator = tradingClearingRegistryNewRequestValidator;
|
||||
this.tradingClearingRegistryUpdateRequestValidator = tradingClearingRegistryUpdateRequestValidator;
|
||||
this.tradingClearingRegistryBlockRequestValidator = tradingClearingRegistryBlockRequestValidator;
|
||||
this.messageResolver = messageResolver;
|
||||
|
|
@ -108,7 +108,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
imdgProvider.waitAvailable();
|
||||
callback(TradingClearingRegistryNewRequest.class) // todo deprecated - unused.
|
||||
callback(TradingClearingRegistryNewRequest.class)
|
||||
.setFunction(this::tradingClearingRegistryAutoNew)
|
||||
.forDestination(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_AUTO_NEW, callbacks::put);
|
||||
callback(TradingClearingRegistryNewRequest.class)
|
||||
|
|
@ -143,18 +143,13 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
|
||||
Account depoAccountMain = req.getDepoAccountId() != null ? accountImdg.getSingleObjectByID(req.getDepoAccountId()) : null;
|
||||
DepoAccount depoAccount = depoAccountMain != null ? depoAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getDepoAccountId())) : null;
|
||||
|
||||
// InformationAccount infoAccount = null;
|
||||
ClearingAccount clearingAccount = null;
|
||||
Account accountMain = null;
|
||||
if (req.getMoneyAccountId() != null) {
|
||||
clearingAccount = clearingAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
|
||||
// if (clearingAccount == null) infoAccount = informationAccountImdg.getSingleObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
|
||||
Long accountId = req.getMoneyAccountId(); //clearingAccount != null ? clearingAccount.getAccountId() : infoAccount.getAccountId();
|
||||
Long accountId = req.getMoneyAccountId();
|
||||
accountMain = accountImdg.getSingleObjectByID(accountId);
|
||||
}
|
||||
|
||||
// кроссвалидация
|
||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||
if (registryByCompany == null) {
|
||||
|
|
@ -194,7 +189,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
}
|
||||
if (accountId != null) {
|
||||
accountMain = accountImdg.getSingleObjectByID(accountId);
|
||||
if (accountMain == null) { // never, только с инконсистентными данными
|
||||
if (accountMain == null) {
|
||||
log.warn("Account {} not exist.", accountId);
|
||||
} else {
|
||||
tradingClearingRegistry.setMoneyAccountId(accountId);
|
||||
|
|
@ -262,9 +257,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
|
||||
tradingClearingRegistryImdg.insert(tradingClearingRegistry);
|
||||
log.debug("New TCR.id={} was created", tradingClearingRegistry.getId());
|
||||
|
||||
// sendNotificationToCompanySvc(tradingClearingRegistry); при автосоздании ТКР в company-service не отправлять.
|
||||
// sendNotificationToClearingSvc(tradingClearingRegistry);
|
||||
sendNotificationToReportSvc(tradingClearingRegistry);
|
||||
sendNotificationToClearingSvc(tradingClearingRegistry);
|
||||
|
||||
|
|
@ -285,7 +277,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
}
|
||||
|
||||
TradingClearingRegistryNewRequest req = userRequest.getRequestPayload();
|
||||
// Дополнительная проверка
|
||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||
if (registryByCompany == null) {
|
||||
|
|
@ -394,14 +385,14 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
if (code.length() > 4)
|
||||
code = code.substring(code.length() - 4);
|
||||
code = "%4s".formatted(code).replace(' ', '0');
|
||||
code += registryPurpose.getKey(); // C / M / ...
|
||||
String trType = tradingRegistryType + "T"; // 2 символа
|
||||
code += registryPurpose.getKey();
|
||||
String trType = tradingRegistryType + "T";
|
||||
code += trType;
|
||||
String sId = "%5s".formatted(id).replace(' ', '0');
|
||||
if (sId.length() > 5)
|
||||
sId = sId.substring(sId.length() - 5);
|
||||
code += sId;
|
||||
return code; // 12 имволов
|
||||
return code;
|
||||
}
|
||||
|
||||
public RequestInfoUpdate tradingClearingRegistryUpdate(BaseRequest<TradingClearingRegistryUpdateRequest> userRequest) {
|
||||
|
|
@ -414,16 +405,12 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
|
||||
TradingClearingRegistryUpdateRequest req = userRequest.getRequestPayload();
|
||||
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByID(req.getId());
|
||||
|
||||
// кроссвалидация - нельзя менять эти поля:
|
||||
if (req.getMoneyAccountId() != null && !req.getMoneyAccountId().equals(tradingClearingRegistry.getMoneyAccountId())) {
|
||||
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "MoneyAccountId", req.getMoneyAccountId());
|
||||
}
|
||||
if (req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())) {
|
||||
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "DepoAccountId", req.getDepoAccountId());
|
||||
}
|
||||
// tradingClearingRegistry.setMoneyAccountId(req.getMoneyAccountId());
|
||||
// tradingClearingRegistry.setDepoAccountId(req.getDepoAccountId());
|
||||
|
||||
|
||||
if (req.getStatus() != null && !Objects.equals(req.getStatus(), tradingClearingRegistry.getStatus())) {
|
||||
|
|
@ -461,9 +448,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* company-service сообщение об успешном добавлении ТКР клиента с параметром tradingClearingRegistry.code
|
||||
*/
|
||||
protected void sendNotificationToCompanySvc(TradingClearingRegistry tradingClearingRegistry) {
|
||||
ClientCodeNewRequest request = new ClientCodeNewRequest();
|
||||
request.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
||||
|
|
@ -475,9 +459,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
kafkaSender.sendRequestToQueue(Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* clearing-service сообщение на открытие клиринговых регистров;
|
||||
*/
|
||||
protected void sendNotificationToClearingSvc(TradingClearingRegistry tradingClearingRegistry) {
|
||||
CreateRegistryRequest request = new CreateRegistryRequest();
|
||||
request.setCompanyId(tradingClearingRegistry.getCompanyId());
|
||||
|
|
@ -486,9 +467,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
kafkaSender.sendRequestToQueue(Consts.REGISTRY_NEW, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* report-service сообщение на формирование уведомления о создании нового ТКР
|
||||
*/
|
||||
protected void sendNotificationToReportSvc(TradingClearingRegistry tradingClearingRegistry) {
|
||||
NotificationRequest request = new NotificationRequest();
|
||||
request.setConsumerId(tradingClearingRegistry.getCompanyId());
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ public enum AccountValidationRule implements IValidationRule<ImdgValidationConte
|
|||
if (!Status.Active.equalsByKey(company.getWorkflowStatus())) {
|
||||
return of(AccountError.CompanyNotActive);
|
||||
}
|
||||
// context.storeObject(ValidationStored.Company, company);
|
||||
return empty();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ import ru.spcex.clearing.account.config.BeanConfiguration;
|
|||
import ru.spcex.clearing.account.config.validation.AccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.InformationAccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountUpdateRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
|
|
@ -41,7 +41,7 @@ import javax.annotation.PostConstruct;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
|
|
@ -186,15 +186,11 @@ class AccountServiceTest {
|
|||
|
||||
|
||||
String jsonString = getJsonStringForUpdate(correspondentAccountUpdateRequest, 0);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE,
|
||||
PARTITION,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
|
||||
Account resultUpdating = accountImdg.getSingleObjectByID(accountId);
|
||||
|
|
@ -224,15 +220,11 @@ class AccountServiceTest {
|
|||
commonDeleteRequest.setId(accountId);
|
||||
|
||||
String jsonString = getJsonStringForDelete(commonDeleteRequest, 0);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK,
|
||||
PARTITION,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
|
||||
Account resultBlock = accountImdg.getSingleObjectByID(accountId);
|
||||
|
|
|
|||
|
|
@ -1,164 +0,0 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import ru.clearing.classes.statics.data.account.*;
|
||||
import ru.spcex.clearing.account.config.BeanConfiguration;
|
||||
import ru.spcex.clearing.account.config.validation.AccountSymbolsValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountSymbolsNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
import static ru.spcex.clearing.test.config.KafkaTestConfig.setMockFuture;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
BeanConfiguration.class,
|
||||
ValidationConfig.class,
|
||||
AccountSymbolsValidationConfig.class,
|
||||
AccountSymbolsService.class,
|
||||
ImdgTestConfig.class,
|
||||
KafkaTestConfig.class})
|
||||
class AccountSymbolsServiceTest {
|
||||
public static final MatcherFactory.Matcher<AccountSymbols> ACCOUNT_SYMBOL_MATCHER = usingIgnoringFieldsComparator();
|
||||
private static final int PARTITION = 0;
|
||||
|
||||
@Autowired
|
||||
AccountSymbolsService accountSymbolsService;
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("kafkaTestTemplate")
|
||||
protected KafkaTemplate<String, Object> kafkaTemplate;
|
||||
|
||||
private Imdg<AccountSymbols> accountSymbolsImdg;
|
||||
|
||||
private Imdg<Account> accountImdg;
|
||||
private Long accountId;
|
||||
private Imdg<ClearingAccount> clearingAccountImdg;
|
||||
private Long clearingAccountId;
|
||||
|
||||
static int newRequestCnt = 0;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
hazelcastServiceTest.waitAvailable();
|
||||
accountSymbolsImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_AccountSymbols, AccountSymbols.class
|
||||
);
|
||||
accountImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_Account, Account.class
|
||||
);
|
||||
clearingAccountImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class
|
||||
);
|
||||
|
||||
Account account = new Account();
|
||||
account.setStatus(ServiceStatus.Active.getKey());
|
||||
account.setAccountType(AccountType.Clrn.getKey());
|
||||
accountId = accountImdg.insert(account);
|
||||
|
||||
ClearingAccount clearingAccount = new ClearingAccount();
|
||||
clearingAccount.setAccountId(accountId);
|
||||
clearingAccount.setClearingAccountType("CAT");
|
||||
clearingAccountId = clearingAccountImdg.insert(clearingAccount);
|
||||
|
||||
new TestObjectCreator(hazelcastServiceTest).createUserAdmin(1000L);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroyTest() {
|
||||
//clean test data
|
||||
Account account = accountImdg.getSingleObjectByID(accountId);
|
||||
if (account != null)
|
||||
accountImdg.delete(account);
|
||||
ClearingAccount clearingAccount = clearingAccountImdg.getSingleObjectByID(clearingAccountId);
|
||||
if (clearingAccount != null)
|
||||
clearingAccountImdg.delete(clearingAccount);
|
||||
}
|
||||
|
||||
@Test
|
||||
void tradingClearingRegistryNew_moneyAccount_clearingAccount() {
|
||||
setMockFuture(kafkaTemplate);
|
||||
AccountSymbolsNewRequest accountSymbolsNewRequest = new AccountSymbolsNewRequest();
|
||||
accountSymbolsNewRequest.setAccountId(accountId);
|
||||
accountSymbolsNewRequest.setAccountSymbolValue("SYMBOL1");
|
||||
|
||||
AccountSymbols predictableAccountSymbols = new AccountSymbols();
|
||||
predictableAccountSymbols.setAccountId(accountId);
|
||||
predictableAccountSymbols.setAccountSymbolValue("SYMBOL1");
|
||||
|
||||
String jsonString = getJsonStringForNew(accountSymbolsNewRequest, 0L);
|
||||
|
||||
addRecordToKafka((MockConsumer) accountSymbolsService.getConsumer(),
|
||||
Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_NEW,
|
||||
newRequestCnt,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
|
||||
AccountSymbols resultNew = accountSymbolsImdg.getAllValues().iterator().next();
|
||||
predictableAccountSymbols.setId(resultNew.getId());
|
||||
|
||||
ACCOUNT_SYMBOL_MATCHER.assertMatch(resultNew, predictableAccountSymbols);
|
||||
accountSymbolsImdg.delete(resultNew); // cleanup test
|
||||
|
||||
newRequestCnt++;
|
||||
}
|
||||
|
||||
@Test
|
||||
void tradingClearingRegistryDelete() {
|
||||
AccountSymbols existAccountSymbols = new AccountSymbols();
|
||||
existAccountSymbols.setAccountId(accountId);
|
||||
existAccountSymbols.setAccountSymbolValue("SYMBOL 2");
|
||||
Long accountSymbolId = accountSymbolsImdg.insert(existAccountSymbols);
|
||||
|
||||
CommonDeleteRequest accountSymbolsDeleteRequest = new CommonDeleteRequest();
|
||||
accountSymbolsDeleteRequest.setId(accountSymbolId);
|
||||
|
||||
String jsonString = getJsonStringForDelete(accountSymbolsDeleteRequest, 0);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) accountSymbolsService.getConsumer(),
|
||||
Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_DELETE,
|
||||
PARTITION,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
|
||||
AccountSymbols resultUpdating = accountSymbolsImdg.getSingleObjectByID(accountSymbolId);
|
||||
Assertions.assertNull(resultUpdating, "Должен был удалиться");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
|
|
@ -21,6 +25,7 @@ import ru.spcex.clearing.account.config.validation.AccountValidationConfig;
|
|||
import ru.spcex.clearing.account.config.validation.BankAccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.errors.AccountError;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory.Matcher;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
|
|
@ -29,13 +34,12 @@ import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewReq
|
|||
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountUpdateRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||
import ru.spcex.clearing.test.MatcherFactory.Matcher;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
|
||||
|
|
@ -45,10 +49,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.platform.messaging.service.Status.Error;
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
import static ru.spcex.clearing.test.config.KafkaTestConfig.getCaptor;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
|
|
@ -94,11 +97,15 @@ public class BankAccountServiceTest {
|
|||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
private HazelcastService hazelcastServiceTest;
|
||||
|
||||
@Autowired
|
||||
private BankAccountService bankAccountService;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
|
@ -126,23 +133,8 @@ public class BankAccountServiceTest {
|
|||
new TestObjectCreator(hazelcastServiceTest).createUserAdmin(1000L);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountService#bankAccountNew(BaseRequest request)}<br>
|
||||
* Тест проверяет генерацию сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.<br>
|
||||
* Входной запрос {@link BankAccountNewRequest}:<br>
|
||||
* {@link BankAccountNewRequest#bankIdentificationCode} - 99999<br>
|
||||
* {@link BankAccountNewRequest#bankName} - ооо тинькофф<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccount} - 9294189285498598598<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccountName} - BIK OF<br>
|
||||
* {@link BankAccountNewRequest#currency} - RUB<br>
|
||||
* {@link BankAccountNewRequest#destination} - OOO ROGA I KOPITA<br>
|
||||
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 848484848484<br>
|
||||
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886<br>
|
||||
* {@link BankAccountNewRequest#account} - 123456789123<br>
|
||||
*/
|
||||
@Test
|
||||
public void bankAccountNew() {
|
||||
//ARRANGE
|
||||
BankAccount predictableBankAccount = getBankAccount();
|
||||
|
||||
Company company = getTestCompany();
|
||||
|
|
@ -167,8 +159,6 @@ public class BankAccountServiceTest {
|
|||
|
||||
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
|
||||
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonString);
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
|
||||
|
|
@ -177,26 +167,10 @@ public class BankAccountServiceTest {
|
|||
predictableBankAccount.setAccountId(accountResult.getId());
|
||||
predictableBankAccount.setId(bankAccountResult.getId());
|
||||
setSameValueToField(accountResult, predictableAccount);
|
||||
|
||||
//ASSERT
|
||||
BANK_ACCOUNT_MATCHER.assertMatch(bankAccountResult, predictableBankAccount);
|
||||
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountService#bankAccountNew(BaseRequest request)}<br>
|
||||
* Тест проверяет валидацию.<br>
|
||||
* Входной запрос {@link BankAccountNewRequest}:<br>
|
||||
* {@link BankAccountNewRequest#bankIdentificationCode} - 99999<br>
|
||||
* {@link BankAccountNewRequest#bankName} - ооо тинькофф<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccount} - 9294189285498598598<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccountName} - BIK OF<br>
|
||||
* {@link BankAccountNewRequest#currency} - RUB<br>
|
||||
* {@link BankAccountNewRequest#destination} - OOO ROGA I KOPITA<br>
|
||||
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 848484848484<br>
|
||||
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886<br>
|
||||
* {@link BankAccountNewRequest#account} - 123456789123<br>
|
||||
*/
|
||||
@Test
|
||||
public void validatedBankAccountNew() {
|
||||
clearImdg(accountImdg);
|
||||
|
|
@ -206,14 +180,12 @@ public class BankAccountServiceTest {
|
|||
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
|
||||
|
||||
String errMsg;
|
||||
//AccountValidationRule.RequiredFields
|
||||
//WrongFieldValue
|
||||
bankAccountNewRequest.setCurrency(null);
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "null, currency"));
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "currency"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
|
||||
bankAccountNewRequest.setCurrency("TT0");
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.DictionaryNotFound, "TT0, CurrencyCodeDictionary"));
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.WrongFieldValue, "currency"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
|
||||
bankAccountNewRequest.setCurrency(currency);
|
||||
|
|
@ -232,26 +204,33 @@ public class BankAccountServiceTest {
|
|||
checkError(errMsg, bankAccountNewRequest);
|
||||
|
||||
bankAccountNewRequest.setAccount(acc);
|
||||
|
||||
//AccountValidationRule.CompanyPresent
|
||||
//CompanyNotFound
|
||||
bankAccountNewRequest.setCompanyId(999924535239L);
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotFound, bankAccountNewRequest.getCompanyId()+", companyId"));
|
||||
bankAccountNewRequest.setDestination(null);
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "destination"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
|
||||
bankAccountNewRequest.setDestination(destination);
|
||||
bankAccountNewRequest.setCompanyId(null);
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "companyId"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
bankAccountNewRequest.setCompanyId(addresseeIdNew);
|
||||
bankAccountNewRequest.setCompanyId(999924535239L);
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotFound, "companyId"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
company.setWorkflowStatus(Status.Blocked.getKey());
|
||||
companyImdg.insert(company);
|
||||
bankAccountNewRequest.setCompanyId(company.getId());
|
||||
|
||||
//AccountValidationRule.AccountIsNew
|
||||
//AccountAlreadyExist
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotActive, "companyId"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
company.setWorkflowStatus(Status.Active.getKey());
|
||||
companyImdg.insert(company);
|
||||
Account existAccount = getTestAccount(accountId, acc);
|
||||
accountImdg.insert(existAccount);
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.AccountAlreadyExist, existAccount.getAccount()));
|
||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.AccountAlreadyExist, "account"));
|
||||
checkError(errMsg, bankAccountNewRequest);
|
||||
accountImdg.delete(existAccount);
|
||||
}
|
||||
|
||||
private void checkError(String errorMsg, BankAccountNewRequest bankAccountNewRequest) {
|
||||
//ARRANGE
|
||||
int currentTime = countRun.getAndIncrement();
|
||||
long currentOffset = currentTime;
|
||||
BaseRequest<Object> predictableBaseRequest = new BaseRequest<>();
|
||||
|
|
@ -264,41 +243,17 @@ public class BankAccountServiceTest {
|
|||
predictableBaseRequest.setRequestPayload(requestInfoUpdate);
|
||||
|
||||
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, currentOffset, jsonString);
|
||||
|
||||
ArgumentCaptor<ProducerRecord> producerRecord = getCaptor(mockProducer);
|
||||
//waiting for kafka producer send message (finale event)
|
||||
verify(mockProducer, timeout(30_000L).times(currentTime))
|
||||
verify(producer, timeout(30_000L).times(currentTime))
|
||||
.send(producerRecord.capture());
|
||||
BaseRequest<Object> baseRequestResult = (BaseRequest<Object>) producerRecord.getValue().value();
|
||||
|
||||
//ASSERT
|
||||
assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic());
|
||||
BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountService#bankAccountUpdate(BaseRequest)}<br>
|
||||
* Тест проверяет обновление сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.<br>
|
||||
* Входной запрос {@link BankAccountUpdateRequest}:<br>
|
||||
* {@link BankAccountUpdateRequest#bankIdentificationCode} - NEW BUNK NAME<br>
|
||||
* {@link BankAccountUpdateRequest#bankName} - 88888<br>
|
||||
* {@link BankAccountUpdateRequest#correspondentAccount} - 894984646541316<br>
|
||||
* {@link BankAccountUpdateRequest#correspondentAccountName} - BIK OF NEW BUNK<br>
|
||||
* {@link BankAccountUpdateRequest#currency} - EU<br>
|
||||
* {@link BankAccountUpdateRequest#destination} - OOO NEW BUNK<br>
|
||||
* {@link BankAccountUpdateRequest#taxpayerIdentificationNumber} - 65468461321<br>
|
||||
* {@link BankAccountUpdateRequest#taxRegistrationReasonCode} - 532137<br>
|
||||
* {@link BankAccountUpdateRequest#account} - 326984656514<br>
|
||||
*/
|
||||
@Test
|
||||
void bankAccountUpdate() {
|
||||
clearImdg(accountImdg);
|
||||
//ARRANGE
|
||||
// Company company = getTestCompany();
|
||||
// companyImdg.insert(company);
|
||||
Account predictableAccount = getTestAccount(accountId, acc);
|
||||
accountImdg.insert(predictableAccount);
|
||||
|
||||
|
|
@ -329,11 +284,7 @@ public class BankAccountServiceTest {
|
|||
bankAccountUpdateRequest.setAccount(predictableUpdateBankAccount.getAccount());
|
||||
|
||||
String jsonString = getJsonStringForUpdate(bankAccountUpdateRequest, ID);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_UPDATE, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
|
||||
Account accountResult = accountImdg.getSingleObjectByID(predictableAccount.getId());
|
||||
|
|
@ -345,15 +296,8 @@ public class BankAccountServiceTest {
|
|||
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountService#bankAccountBlock(BaseRequest)}
|
||||
* Тест проверяет удаление сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.
|
||||
* Входной запрос {@link CommonDeleteRequest}:
|
||||
* {@link CommonDeleteRequest#id} - Идентификатор записи
|
||||
*/
|
||||
@Test
|
||||
void bankAccountBlock() {
|
||||
//ARRANGE
|
||||
void bankAccountDelete() {
|
||||
BankAccount bankAccountExists = getBankAccount();
|
||||
bankAccountImdg.insert(bankAccountExists);
|
||||
Account account = new Account();
|
||||
|
|
@ -364,15 +308,11 @@ public class BankAccountServiceTest {
|
|||
CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest();
|
||||
commonDeleteRequest.setId(ID);
|
||||
String jsonString = getJsonStringForDelete(commonDeleteRequest, ID);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_DELETE, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
|
||||
Account bankAccount = accountImdg.getSingleObjectByID(accountId);
|
||||
assertEquals(bankAccount.getStatus(), WorkflowStatus.Blocked.getKey());
|
||||
BankAccount bankAccount = bankAccountImdg.getSingleObjectByID(ID);
|
||||
Assertions.assertNull(bankAccount);
|
||||
}
|
||||
|
||||
private Company getTestCompany() {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
|
|
@ -22,30 +26,25 @@ import ru.spcex.clearing.account.config.validation.AccountValidationConfig;
|
|||
import ru.spcex.clearing.account.config.validation.ClearingAccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.errors.AccountError;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClearingAccountNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClearingAccountUpdateRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdf01Request;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
import static ru.spcex.clearing.test.config.ImdgTestConfig.currentID;
|
||||
import static ru.spcex.clearing.test.config.KafkaTestConfig.setMockFuture;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
|
|
@ -73,16 +72,16 @@ class ClearingAccountServiceTest {
|
|||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
private HazelcastService hazelcastServiceTest;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("kafkaTestTemplate")
|
||||
protected KafkaTemplate<String, Object> kafkaTemplate;
|
||||
|
||||
private Imdg<ClearingAccount> clearingAccountImdg;
|
||||
private Imdg<Account> accountImdg;
|
||||
private Imdg<Company> companyImdg;
|
||||
|
|
@ -163,7 +162,8 @@ class ClearingAccountServiceTest {
|
|||
0,
|
||||
jsonString);
|
||||
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
verify(producer, timeout(30_000L).times(2))
|
||||
.send(producerRecord.capture());
|
||||
|
||||
Account predictableAccount = new Account();
|
||||
predictableAccount.setAccount(ACCOUNT_VALUE);
|
||||
|
|
@ -232,59 +232,4 @@ class ClearingAccountServiceTest {
|
|||
Assertions.assertEquals("013", clearingAccountService.makeSdfErrorText(AccountError.CompanyNotFound, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND));
|
||||
Assertions.assertEquals("2", clearingAccountService.makeSdfErrorText(null, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClearingAccountService#accountNewSdf01(BaseRequest)}<br>
|
||||
* Тест проверяет создание сущности {@link BaseRequest} в Hazelcast при передаче из Apache Kafka.<br>
|
||||
* Входной запрос {@link AccountSdf01Request}:<br>
|
||||
* {@link AccountSdfRequestPart#setSdfId} - текущий Id<br>
|
||||
* {@link AccountSdfRequestPart#setAccount} - 123456789123<br>
|
||||
* {@link AccountSdfRequestPart#setCompanyId} - текущий Id<br>
|
||||
* {@link AccountSdf01Request#setGroupingSdf01Id} - текущий Id<br>
|
||||
* {@link AccountSdf01Request#setAccounts} - Collections.singletonList(AccountSdfRequestPart)<br>
|
||||
*/
|
||||
@Test
|
||||
void accountSdf01New() throws InterruptedException {
|
||||
//ARRANGE
|
||||
clearImdg(accountImdg);
|
||||
setMockFuture(kafkaTemplate);
|
||||
Long firstID = currentID.getAndIncrement();
|
||||
Long secondID = currentID.getAndIncrement();
|
||||
AccountSdfRequestPart accountSdfRequestPart = new AccountSdfRequestPart();
|
||||
accountSdfRequestPart.setSdfId(firstID);
|
||||
accountSdfRequestPart.setAccount(ACCOUNT_VALUE);
|
||||
accountSdfRequestPart.setCompanyId(firstID);
|
||||
AccountSdf01Request accountSdf01Request = new AccountSdf01Request();
|
||||
accountSdf01Request.setGroupingSdf01Id(firstID);
|
||||
accountSdf01Request.setAccounts(Collections.singletonList(accountSdfRequestPart));
|
||||
|
||||
String jsonString = getJsonStringForNew(accountSdf01Request, 0L);
|
||||
|
||||
Account predictableAccount = new Account();
|
||||
predictableAccount.setAccount(ACCOUNT_VALUE);
|
||||
predictableAccount.setCompanyId(firstID);
|
||||
predictableAccount.setAccountType(AccountType.Clrn.getKey());
|
||||
predictableAccount.setStatus(ServiceStatus.Active.getKey());
|
||||
predictableAccount.setRelationId(relationId);
|
||||
ClearingAccount predictableClearingAccount = new ClearingAccount();
|
||||
predictableClearingAccount.setCompanyId(companyId);
|
||||
// predictableClearingAccount.setClearingAccountType(CLEARING_ACCOUNT_TYPE_DICT);
|
||||
|
||||
//KAFKA
|
||||
addRecordToKafka((MockConsumer) clearingAccountService.getConsumer(), Consts.ACCOUNT_NEW_SDF01, PARTITION, 0, jsonString);
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
|
||||
ImdgHazelcast<Account> accountImdg = (ImdgHazelcast<Account>) hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||
|
||||
//ASSERT
|
||||
Account accountResult = accountImdg.getSingleObjectBySQL(String.format("account = %s", ACCOUNT_VALUE));
|
||||
ClearingAccount resultClearingAccountNew = clearingAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", accountResult.getId()));
|
||||
predictableAccount.setId(accountResult.getId());
|
||||
predictableClearingAccount.setAccountId(accountResult.getId());
|
||||
predictableClearingAccount.setId(resultClearingAccountNew.getId());
|
||||
predictableAccount.setId(accountResult.getId());
|
||||
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
|
||||
CLEARING_ACCOUNT_MATCHER.assertMatch(resultClearingAccountNew, predictableClearingAccount);
|
||||
accountImdg.delete(accountResult);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,13 +24,12 @@ import ru.spcex.clearing.account.config.BeanConfiguration;
|
|||
import ru.spcex.clearing.account.config.validation.ClientCodeValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.TradingClearingRegistryValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeUpdateRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.TestUtils;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
|
|
@ -80,15 +79,10 @@ class ClientCodeServiceTest {
|
|||
|
||||
private Imdg<ClientCode> clientCodeImdg;
|
||||
|
||||
|
||||
// ****************************-*******************
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
hazelcastServiceTest.waitAvailable();
|
||||
clientCodeImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
|
||||
|
||||
// Словари для теста, применяются в ValidationConfig
|
||||
putToDictionary(IMDGDistributedNames.Map_WorkflowStatusDictionary, new WorkflowStatusDictionary(), "ACTV");
|
||||
putToDictionary(IMDGDistributedNames.Map_CompanySymbolDictionary, new CompanySymbolDictionary(), "CLRC");
|
||||
putToDictionary(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, new CorporationSoleTypeDictionary(), "GDIR");
|
||||
|
|
@ -129,7 +123,7 @@ class ClientCodeServiceTest {
|
|||
moneyAccount.setId(131L);
|
||||
moneyAccount.setAccount("AAAA-4444");
|
||||
moneyAccount.setStatus("ACTV");
|
||||
moneyAccount.setCompanyId(COMPANY_ID); // для валидации принадлежности счёта
|
||||
moneyAccount.setCompanyId(COMPANY_ID);
|
||||
accounts.insert(moneyAccount);
|
||||
ClearingAccount clsAcc = new ClearingAccount();
|
||||
clsAcc.setId(moneyAccount.getId());
|
||||
|
|
@ -141,7 +135,7 @@ class ClientCodeServiceTest {
|
|||
depoAccount.setId(132L);
|
||||
depoAccount.setAccount("AAAB-44654");
|
||||
depoAccount.setStatus("ACTV");
|
||||
depoAccount.setCompanyId(COMPANY_ID); // для валидации принадлежности счёта
|
||||
depoAccount.setCompanyId(COMPANY_ID);
|
||||
accounts.insert(depoAccount);
|
||||
DepoAccount depoAcc = new DepoAccount();
|
||||
depoAcc.setId(depoAccount.getId());
|
||||
|
|
@ -176,14 +170,8 @@ class ClientCodeServiceTest {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
|
||||
* Тест проверяет создание {@link ClientCode} в IMDG при передаче из Apache Kafka (очередь 1).<br>
|
||||
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest}:<br>
|
||||
**/
|
||||
@Test
|
||||
void clientCodeNew1() {
|
||||
//ARRANGE
|
||||
final String ccCode = "Lucky planet";
|
||||
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
||||
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
||||
|
|
@ -197,16 +185,9 @@ class ClientCodeServiceTest {
|
|||
predictableClientCode.setCode(ccCode);
|
||||
predictableClientCode.setStatus("ACTV");
|
||||
predictableClientCode.setCompanyId(COMPANY_ID);
|
||||
// predictableClientCode.setMoneyAccountId(131L);
|
||||
// predictableClientCode.setDepoAccountId(132L);
|
||||
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
|
||||
//ACT
|
||||
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
||||
predictableClientCode.setId(resultNew.getId());
|
||||
|
|
@ -214,14 +195,8 @@ class ClientCodeServiceTest {
|
|||
assertNotNull(resultNew.getCreated());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
|
||||
* Тест проверяет создание {@link ClientCode} в IMDG при передаче из Apache Kafka (очередь 2).<br>
|
||||
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest}:<br>
|
||||
**/
|
||||
@Test
|
||||
void clientCodeNew2() {
|
||||
//ARRANGE
|
||||
final String ccCode = "Lucky planet";
|
||||
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
||||
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
||||
|
|
@ -235,16 +210,9 @@ class ClientCodeServiceTest {
|
|||
predictableClientCode.setCode(ccCode);
|
||||
predictableClientCode.setStatus("ACTV");
|
||||
predictableClientCode.setCompanyId(COMPANY_ID);
|
||||
// predictableClientCode.setMoneyAccountId(131L);
|
||||
// predictableClientCode.setDepoAccountId(132L);
|
||||
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
|
||||
//ACT
|
||||
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
TestUtils.waitingSendAndCheckRecord(ID, mockProducer, producerRecord);
|
||||
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
||||
predictableClientCode.setId(resultNew.getId());
|
||||
|
|
@ -253,15 +221,8 @@ class ClientCodeServiceTest {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
|
||||
* Тест проверяет создание {@link ClientCode} в IMDG при передаче из Apache Kafka (очередь 1).<br>
|
||||
* NEW с заполненными MoneyAccountId(131L), DepoAccountId(132L); - от этого будет создан ТКР.
|
||||
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest}:<br>
|
||||
**/
|
||||
@Test
|
||||
void clientCodeNew3() {
|
||||
//ARRANGE
|
||||
final String ccCode = "Lucky planet2";
|
||||
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
||||
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
||||
|
|
@ -278,13 +239,9 @@ class ClientCodeServiceTest {
|
|||
predictableClientCode.setMoneyAccountId(131L);
|
||||
predictableClientCode.setDepoAccountId(132L);
|
||||
predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
|
||||
//ACT
|
||||
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
||||
predictableClientCode.setId(resultNew.getId());
|
||||
|
|
@ -292,14 +249,8 @@ class ClientCodeServiceTest {
|
|||
assertNotNull(resultNew.getCreated());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
|
||||
* Тест проверяет обновление сущности {@link ClientCode} в IMDG при передаче из Apache Kafka.<br>
|
||||
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeUpdateRequest}:<br>
|
||||
**/
|
||||
@Test
|
||||
void clientCodeUpdate() {
|
||||
//ARRANGE
|
||||
ClientCode existsClientCode = new ClientCode();
|
||||
existsClientCode.setId(ID);
|
||||
existsClientCode.setCompanyId(COMPANY_ID);
|
||||
|
|
@ -327,13 +278,9 @@ class ClientCodeServiceTest {
|
|||
predictableClientCode.setMoneyAccountId(131L);
|
||||
predictableClientCode.setDepoAccountId(132L);
|
||||
predictableClientCode.setStatus("ACTV");
|
||||
|
||||
//ACT
|
||||
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeUpdateRequest, ID);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_UPDATE, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
|
||||
ClientCode resultUpdating = clientCodeImdg.getSingleObjectByID(ID);
|
||||
|
|
@ -342,19 +289,12 @@ class ClientCodeServiceTest {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
|
||||
* Тест проверяет удаление {@link ClientCode} из IMDG при передаче из Apache Kafka.<br>
|
||||
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest}:<br>
|
||||
**/
|
||||
@Test
|
||||
void clientCodeDelete1() {
|
||||
//ARRANGE
|
||||
ClientCode existsClientCode = new ClientCode();
|
||||
existsClientCode.setId(ID);
|
||||
existsClientCode.setCompanyId(COMPANY_ID);
|
||||
existsClientCode.setCode("0000");
|
||||
// Если следующие поля заполнить, то дополнительно отправит сообщение в trading-clearing-registry-update:
|
||||
existsClientCode.setTradingClearingRegistryId(null);
|
||||
existsClientCode.setMoneyAccountId(null);
|
||||
existsClientCode.setDepoAccountId(null);
|
||||
|
|
@ -365,56 +305,14 @@ class ClientCodeServiceTest {
|
|||
CommonDeleteRequest clientCodeDeleteRequest = new CommonDeleteRequest();
|
||||
clientCodeDeleteRequest.setId(ID);
|
||||
|
||||
Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID)); // verify test data
|
||||
|
||||
//ACT
|
||||
Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID));
|
||||
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeDeleteRequest, ID);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_DELETE, PARTITION, 0, jsonString);
|
||||
|
||||
//ASSERT
|
||||
|
||||
waitingSendAndCheckRecord(ID, mockProducer);
|
||||
ClientCode resultUpdate = clientCodeImdg.getSingleObjectByID(ID);
|
||||
assertEquals(WorkflowStatus.Blocked.getKey(), resultUpdate.getStatus());
|
||||
Assertions.assertNull(resultUpdate);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
|
||||
// * Тест проверяет удаление {@link ClientCode} из IMDG при передаче из Apache Kafka.<br>
|
||||
// * У ClientCode заполнены MoneyAccountId, DepoAccountId - по этому при удалении должно направиться дополнительное сообщение в очередь DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE<br>
|
||||
// * Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest}:<br>
|
||||
// **/
|
||||
// @Test
|
||||
// void clientCodeDelete2() {
|
||||
// //ARRANGE
|
||||
// ClientCode existsClientCode = new ClientCode();
|
||||
// existsClientCode.setId(ID);
|
||||
// existsClientCode.setCompanyId(COMPANY_ID);
|
||||
// existsClientCode.setCode("0000");
|
||||
// // Если следующие поля заполнить, то дополнительно отправит сообщение в trading-clearing-registry-update:
|
||||
// existsClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
// existsClientCode.setMoneyAccountId(131L);
|
||||
// existsClientCode.setDepoAccountId(132L);
|
||||
// existsClientCode.setStatus("ACTV");
|
||||
//
|
||||
// clientCodeImdg.insert(existsClientCode);
|
||||
//
|
||||
// CommonDeleteRequest clientCodeDeleteRequest = new CommonDeleteRequest();
|
||||
// clientCodeDeleteRequest.setId(ID);
|
||||
//
|
||||
// Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID)); // verify test data
|
||||
//
|
||||
// //ACT
|
||||
// String jsonString = getJsonStringForUpdate(clientCodeDeleteRequest, ID);
|
||||
//
|
||||
// addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_DELETE, PARTITION, 0, jsonString);
|
||||
//
|
||||
// //ASSERT
|
||||
//
|
||||
// waitingWhenAddedRecordAndCheckIt(ID, mockProducer, producerRecord);
|
||||
// ClientCode resultUpdate = clientCodeImdg.getSingleObjectByID(ID);
|
||||
// Assertions.assertNull(resultUpdate);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,16 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
|
|
@ -19,22 +24,25 @@ import ru.spcex.clearing.account.config.BeanConfiguration;
|
|||
import ru.spcex.clearing.account.config.validation.AccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.DepoAccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.DepoAccountNewRequest;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.addRecordToKafka;
|
||||
import static ru.spcex.clearing.test.TestUtils.getJsonStringForNew;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
|
|
@ -61,8 +69,12 @@ class DepoAccountServiceTest {
|
|||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
private HazelcastService hazelcastServiceTest;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
|
@ -147,7 +159,8 @@ class DepoAccountServiceTest {
|
|||
0,
|
||||
jsonString);
|
||||
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
verify(producer, timeout(30_000L).times(2))
|
||||
.send(producerRecord.capture());
|
||||
|
||||
Account predictableAccount = new Account();
|
||||
predictableAccount.setAccount(ACCOUNT_VALUE);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
|
|
@ -20,10 +25,10 @@ import ru.spcex.clearing.account.config.BeanConfiguration;
|
|||
import ru.spcex.clearing.account.config.validation.AccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.InformationAccountValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.InformationAccountNewRequest;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
|
|
@ -31,12 +36,16 @@ import ru.spcex.clearing.util.security.UserRoleVerification;
|
|||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.addRecordToKafka;
|
||||
import static ru.spcex.clearing.test.TestUtils.getJsonStringForNew;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
|
|
@ -62,8 +71,12 @@ class InformationAccountServiceTest {
|
|||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
private HazelcastService hazelcastServiceTest;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
|
@ -85,7 +98,6 @@ class InformationAccountServiceTest {
|
|||
accountImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_Account, Account.class
|
||||
);
|
||||
clearImdg(accountImdg);
|
||||
|
||||
companyImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_Company, Company.class
|
||||
|
|
@ -133,7 +145,6 @@ class InformationAccountServiceTest {
|
|||
void accountInformationNew() {
|
||||
InformationAccountNewRequest InformationAccountNewRequest = new InformationAccountNewRequest();
|
||||
InformationAccountNewRequest.setCompanyId(companyId);
|
||||
InformationAccountNewRequest.setAccount(account);
|
||||
|
||||
String jsonString = getJsonStringForNew(InformationAccountNewRequest, 0L);
|
||||
|
||||
|
|
@ -142,8 +153,8 @@ class InformationAccountServiceTest {
|
|||
PARTITION,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
verify(producer, timeout(30_000L).times(2))
|
||||
.send(producerRecord.capture());
|
||||
|
||||
Account predictableAccount = new Account();
|
||||
predictableAccount.setAccountType(AccountType.Info.getKey());
|
||||
|
|
@ -159,7 +170,7 @@ class InformationAccountServiceTest {
|
|||
InformationAccount resultInfoAccountNew = informationAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", resultAccountNew.getId()));
|
||||
|
||||
predictableAccount.setId(resultAccountNew.getId());
|
||||
predictableAccount.setAccount(account);
|
||||
predictableAccount.setAccount(informationAccountService.generateInfoAccount(resultInfoAccountNew.getId()));
|
||||
predictableInfoAccount.setAccountId(resultAccountNew.getId());
|
||||
predictableInfoAccount.setId(resultInfoAccountNew.getId());
|
||||
|
||||
|
|
@ -170,6 +181,7 @@ class InformationAccountServiceTest {
|
|||
accountImdg.delete(resultAccountNew);
|
||||
}
|
||||
|
||||
@Autowired ImdgProvider imdgProvider;
|
||||
@Test
|
||||
void accountIncrementSequence() {
|
||||
Imdg<InformationAccount> accountInfoImdg = hazelcastServiceTest.getImdg( IMDGDistributedNames.Map_InformationAccount, InformationAccount.class );
|
||||
|
|
@ -189,7 +201,7 @@ class InformationAccountServiceTest {
|
|||
}
|
||||
UserRoleVerification userRoleVerification = Mockito.mock(UserRoleVerification.class);
|
||||
InformationAccountService infoAccSvc=new InformationAccountService(null,null,null,
|
||||
null, userRoleVerification, hazelcastServiceTest, null, null, null, null);
|
||||
null, userRoleVerification, imdgProvider, null, null, null, null);
|
||||
Long n = infoAccSvc.accountNextId();
|
||||
Assertions.assertEquals(13L, n);
|
||||
n = infoAccSvc.accountNextId();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
|
|
@ -26,11 +27,15 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
|||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.platform.enumeration.AccountStatus;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
|
|
@ -45,7 +50,7 @@ class SDFProcessServiceTest {
|
|||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
private HazelcastService hazelcastServiceTest;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
package ru.spcex.clearing.account.service;
|
||||
|
||||
import org.apache.kafka.clients.consumer.MockConsumer;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
|
|
@ -15,30 +19,31 @@ import ru.clearing.classes.statics.data.account.ClearingAccount;
|
|||
import ru.clearing.classes.statics.data.account.DepoAccount;
|
||||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
||||
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
|
||||
import ru.spcex.clearing.account.config.BeanConfiguration;
|
||||
import ru.spcex.clearing.account.config.validation.TradingClearingRegistryValidationConfig;
|
||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryUpdateRequest;
|
||||
import ru.spcex.clearing.test.MatcherFactory;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.enumeration.ServiceStatus;
|
||||
import ru.spcex.platform.enumeration.TradingClearingRegistryPurpose;
|
||||
import ru.spcex.platform.enumeration.TradingClearingRegistryType;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import static ru.spcex.clearing.test.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
import static ru.spcex.clearing.test.TestUtils.*;
|
||||
import static ru.spcex.clearing.test.config.KafkaTestConfig.setMockFuture;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {
|
||||
|
|
@ -59,19 +64,18 @@ class TradingClearingRegistryServiceTest {
|
|||
TradingClearingRegistryService tradingClearingRegistryService;
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private ImdgProvider hazelcastServiceTest;
|
||||
private HazelcastService hazelcastServiceTest;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("kafkaTestTemplate")
|
||||
protected KafkaTemplate<String, Object> kafkaTemplate;
|
||||
|
||||
private Imdg<TradingClearingRegistry> tradingClearingRegistryImdg;
|
||||
private Imdg<Company> companyImdg;
|
||||
private Imdg<CompanySymbols> companySymbolsImdg;
|
||||
private Imdg<ServiceStatusDictionary> serviceStatusDictionaryImdg;
|
||||
|
||||
private Imdg<ClearingAccount> clearingAccountImdg;
|
||||
|
|
@ -99,9 +103,6 @@ class TradingClearingRegistryServiceTest {
|
|||
companyImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_Company, Company.class
|
||||
);
|
||||
companySymbolsImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class
|
||||
);
|
||||
serviceStatusDictionaryImdg = hazelcastServiceTest.getImdg(
|
||||
IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class
|
||||
);
|
||||
|
|
@ -128,14 +129,8 @@ class TradingClearingRegistryServiceTest {
|
|||
company.setClearingCode("77");
|
||||
companyImdg.insert(company);
|
||||
|
||||
CompanySymbols companySymbols = new CompanySymbols();
|
||||
companySymbols.setCompanyId(companyId);
|
||||
companySymbols.setCompanySymbol(CompanySymbol.CLRC.getKey());
|
||||
companySymbolsImdg.insert(companySymbols);
|
||||
|
||||
Account account = new Account();
|
||||
account.setStatus(ServiceStatus.Active.getKey());
|
||||
account.setAccountType(AccountType.Clrn.getKey());
|
||||
accountId = accountImdg.insert(account);
|
||||
|
||||
account2Id = accountImdg.insert(account);
|
||||
|
|
@ -159,17 +154,15 @@ class TradingClearingRegistryServiceTest {
|
|||
|
||||
@Test
|
||||
void tradingClearingRegistryNew_moneyAccount_clearingAccount() {
|
||||
setMockFuture(kafkaTemplate);
|
||||
TradingClearingRegistryNewRequest tradingClearingRegistryNewRequest = new TradingClearingRegistryNewRequest();
|
||||
tradingClearingRegistryNewRequest.setCompanyId(companyId);
|
||||
tradingClearingRegistryNewRequest.setMoneyAccountId(accountId);
|
||||
tradingClearingRegistryNewRequest.setTradingClearingRegistryType(TradingClearingRegistryType.Owner_A.getKey());
|
||||
|
||||
TradingClearingRegistry predictableTradingClearingRegistry = new TradingClearingRegistry();
|
||||
predictableTradingClearingRegistry.setCompanyId(companyId);
|
||||
predictableTradingClearingRegistry.setCode("0077MAT00001");
|
||||
predictableTradingClearingRegistry.setCode("0077MAT");
|
||||
predictableTradingClearingRegistry.setMoneyAccountId(accountId);
|
||||
predictableTradingClearingRegistry.setTradingClearingRegistryType(TradingClearingRegistryType.Owner_A.getKey());
|
||||
predictableTradingClearingRegistry.setTradingClearingRegistryType("CAT");
|
||||
predictableTradingClearingRegistry.setTradingClearingRegistryPurpose(TradingClearingRegistryPurpose.M.getKey());
|
||||
predictableTradingClearingRegistry.setStatus(ServiceStatus.Active.getKey());
|
||||
|
||||
|
|
@ -185,6 +178,7 @@ class TradingClearingRegistryServiceTest {
|
|||
|
||||
TradingClearingRegistry resultNew = tradingClearingRegistryImdg.getAllValues().iterator().next();
|
||||
predictableTradingClearingRegistry.setId(resultNew.getId());
|
||||
predictableTradingClearingRegistry.setCode(predictableTradingClearingRegistry.getCode() + resultNew.getId());
|
||||
predictableTradingClearingRegistry.setUpdated(resultNew.getUpdated());
|
||||
predictableTradingClearingRegistry.setCreated(resultNew.getCreated());
|
||||
|
||||
|
|
@ -196,16 +190,13 @@ class TradingClearingRegistryServiceTest {
|
|||
|
||||
@Test
|
||||
void tradingClearingRegistryNew_moneyAccount_informationAccount() {
|
||||
setMockFuture(kafkaTemplate);
|
||||
clearImdg(tradingClearingRegistryImdg);
|
||||
TradingClearingRegistryNewRequest tradingClearingRegistryNewRequest = new TradingClearingRegistryNewRequest();
|
||||
tradingClearingRegistryNewRequest.setCompanyId(companyId);
|
||||
tradingClearingRegistryNewRequest.setMoneyAccountId(account2Id);
|
||||
tradingClearingRegistryNewRequest.setTradingClearingRegistryType(TradingClearingRegistryType.Owner_A.getKey());
|
||||
|
||||
TradingClearingRegistry predictableTradingClearingRegistry = new TradingClearingRegistry();
|
||||
predictableTradingClearingRegistry.setCompanyId(companyId);
|
||||
predictableTradingClearingRegistry.setCode("0077MAT00001");
|
||||
predictableTradingClearingRegistry.setCode("0077MAT");
|
||||
predictableTradingClearingRegistry.setMoneyAccountId(account2Id);
|
||||
predictableTradingClearingRegistry.setTradingClearingRegistryType(TradingClearingRegistryType.Owner_A.getKey());
|
||||
predictableTradingClearingRegistry.setTradingClearingRegistryPurpose(TradingClearingRegistryPurpose.M.getKey());
|
||||
|
|
@ -219,10 +210,11 @@ class TradingClearingRegistryServiceTest {
|
|||
0,
|
||||
jsonString);
|
||||
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
||||
|
||||
TradingClearingRegistry resultNew = tradingClearingRegistryImdg.getAllValues().iterator().next();
|
||||
predictableTradingClearingRegistry.setId(resultNew.getId());
|
||||
predictableTradingClearingRegistry.setCode(predictableTradingClearingRegistry.getCode() + resultNew.getId());
|
||||
predictableTradingClearingRegistry.setUpdated(resultNew.getUpdated());
|
||||
predictableTradingClearingRegistry.setCreated(resultNew.getCreated());
|
||||
|
||||
|
|
@ -235,8 +227,6 @@ class TradingClearingRegistryServiceTest {
|
|||
|
||||
@Test
|
||||
void tradingClearingRegistryNew_depoAccount() {
|
||||
setMockFuture(kafkaTemplate);
|
||||
clearImdg(tradingClearingRegistryImdg);
|
||||
TradingClearingRegistryNewRequest tradingClearingRegistryNewRequest = new TradingClearingRegistryNewRequest();
|
||||
tradingClearingRegistryNewRequest.setCompanyId(companyId);
|
||||
tradingClearingRegistryNewRequest.setMoneyAccountId(accountId);
|
||||
|
|
@ -244,7 +234,7 @@ class TradingClearingRegistryServiceTest {
|
|||
|
||||
TradingClearingRegistry predictableTradingClearingRegistry = new TradingClearingRegistry();
|
||||
predictableTradingClearingRegistry.setCompanyId(companyId);
|
||||
predictableTradingClearingRegistry.setCode("0077CDATT00001");
|
||||
predictableTradingClearingRegistry.setCode("0077CDAT");
|
||||
predictableTradingClearingRegistry.setMoneyAccountId(accountId);
|
||||
predictableTradingClearingRegistry.setDepoAccountId(account2Id);
|
||||
predictableTradingClearingRegistry.setTradingClearingRegistryType("DAT");
|
||||
|
|
@ -259,12 +249,14 @@ class TradingClearingRegistryServiceTest {
|
|||
0,
|
||||
jsonString);
|
||||
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
||||
|
||||
TradingClearingRegistry resultNew = tradingClearingRegistryImdg.getAllValues().iterator().next();
|
||||
predictableTradingClearingRegistry.setId(resultNew.getId());
|
||||
predictableTradingClearingRegistry.setCode(predictableTradingClearingRegistry.getCode() + resultNew.getId());
|
||||
predictableTradingClearingRegistry.setUpdated(resultNew.getUpdated());
|
||||
predictableTradingClearingRegistry.setCreated(resultNew.getCreated());
|
||||
predictableTradingClearingRegistry.setCompanyId(123L);
|
||||
|
||||
TRADING_CLEARING_REGISTRY_MATCHER.assertMatch(resultNew, predictableTradingClearingRegistry);
|
||||
tradingClearingRegistryImdg.delete(resultNew);
|
||||
|
|
@ -283,16 +275,12 @@ class TradingClearingRegistryServiceTest {
|
|||
tradingClearingRegistryUpdateRequest.setId(registryId);
|
||||
|
||||
String jsonString = getJsonStringForUpdate(tradingClearingRegistryUpdateRequest, 0);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
|
||||
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE,
|
||||
PARTITION,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
||||
|
||||
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
|
||||
existTradingClearingRegistry.setUpdated(resultUpdating.getUpdated());
|
||||
|
|
@ -311,16 +299,12 @@ class TradingClearingRegistryServiceTest {
|
|||
tradingClearingRegistryDeleteRequest.setId(registryId);
|
||||
|
||||
String jsonString = getJsonStringForDelete(tradingClearingRegistryDeleteRequest, 0);
|
||||
|
||||
//ACT
|
||||
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
|
||||
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_BLOCK,
|
||||
PARTITION,
|
||||
0,
|
||||
jsonString);
|
||||
|
||||
//ASSERT
|
||||
waitingSendAndCheckRecord(0L, mockProducer);
|
||||
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
||||
|
||||
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
|
||||
existTradingClearingRegistry.setUpdated(resultUpdating.getUpdated());
|
||||
|
|
@ -341,8 +325,8 @@ class TradingClearingRegistryServiceTest {
|
|||
"000000105", TradingClearingRegistryPurpose.C, "ER", 100012L
|
||||
));
|
||||
|
||||
Assertions.assertEquals("0105MAT00012", tradingClearingRegistryService.makeCode(
|
||||
"000000105", TradingClearingRegistryPurpose.M, "A", 100012L
|
||||
Assertions.assertEquals("0105MAT100012", tradingClearingRegistryService.makeCode(
|
||||
"000000105", TradingClearingRegistryPurpose.M, "ER", 100012L
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package ru.spcex.clearing.account.utils;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.listener.EntryAddedListener;
|
||||
import com.hazelcast.map.listener.EntryRemovedListener;
|
||||
import com.hazelcast.map.listener.EntryUpdatedListener;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class ImapEvent<T> {
|
||||
private final IMap<Long, T> iMap;
|
||||
private final String listenerAdding;
|
||||
private final String listenerUpdating;
|
||||
private final String listenerRemoving;
|
||||
private final AtomicBoolean checkEventHappened = new AtomicBoolean(false);
|
||||
|
||||
public ImapEvent(IMap<Long, T> iMap) {
|
||||
this.iMap = iMap;
|
||||
listenerAdding = iMap.addEntryListener((EntryAddedListener<Long, T>) entryEvent -> {
|
||||
synchronized (checkEventHappened) {
|
||||
checkEventHappened.set(true);
|
||||
checkEventHappened.notify();
|
||||
}
|
||||
}, false);
|
||||
listenerUpdating = iMap.addEntryListener((EntryUpdatedListener<Long, T>) entryEvent -> {
|
||||
synchronized (checkEventHappened) {
|
||||
checkEventHappened.set(true);
|
||||
checkEventHappened.notify();
|
||||
}
|
||||
}, false);
|
||||
listenerRemoving = iMap.addEntryListener((EntryRemovedListener<Long, T>) entryEvent -> {
|
||||
synchronized (checkEventHappened) {
|
||||
checkEventHappened.set(true);
|
||||
checkEventHappened.notify();
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
public void waitWhenHappened() throws InterruptedException {
|
||||
Timer timer = new Timer(true);
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
boolean secondRan;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkEventHappened.set(secondRan);
|
||||
secondRan = true;
|
||||
}
|
||||
}, 0, 30 * 1000);
|
||||
synchronized (checkEventHappened) {
|
||||
while (!checkEventHappened.get()) {
|
||||
checkEventHappened.wait(100);
|
||||
}
|
||||
}
|
||||
iMap.removeEntryListener(listenerAdding);
|
||||
iMap.removeEntryListener(listenerUpdating);
|
||||
iMap.removeEntryListener(listenerRemoving);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package ru.spcex.clearing.account.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class MatcherFactory {
|
||||
|
||||
public static <T> Matcher<T> usingIgnoringFieldsComparator(String... fieldsToIgnore) {
|
||||
return new Matcher<>(fieldsToIgnore);
|
||||
}
|
||||
|
||||
public static class Matcher<T> {
|
||||
private final String[] fieldsToIgnore;
|
||||
|
||||
private Matcher(String... fieldsToIgnore) {
|
||||
this.fieldsToIgnore = fieldsToIgnore;
|
||||
}
|
||||
|
||||
public void assertMatch(T actual, T expected) {
|
||||
assertThat(actual).usingRecursiveComparison().ignoringFields(fieldsToIgnore).isEqualTo(expected);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final void assertMatch(Iterable<T> actual, T... expected) {
|
||||
assertMatch(actual, Arrays.asList(expected));
|
||||
}
|
||||
|
||||
public void assertMatch(Iterable<T> actual, Iterable<T> expected) {
|
||||
assertThat(actual).usingRecursiveFieldByFieldElementComparatorIgnoringFields(fieldsToIgnore).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -195,19 +195,6 @@
|
|||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>data_initial.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/data.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>data_initial.sql</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ public class BackendApiApplication extends SpringBootServletInitializer {
|
|||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
setKeycloakConfigFile();
|
||||
// springApplicationBuilder.initializers(DfaConfig.get().getLoggingInitializer());
|
||||
return builder.sources(BackendApiApplication.class);
|
||||
}
|
||||
|
||||
|
|
@ -35,9 +34,6 @@ public class BackendApiApplication extends SpringBootServletInitializer {
|
|||
return super.run(application);
|
||||
}
|
||||
|
||||
/**
|
||||
* чтобы переместить настройки keycloak в keycloak.json вместо application.properties
|
||||
*/
|
||||
private static void setKeycloakConfigFile() {
|
||||
System.setProperty("keycloak.configurationFile", "classpath:keycloak.json");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package ru.spcex.clearing.backendapi.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
@ -13,8 +11,6 @@ import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
|||
|
||||
@Configuration
|
||||
public class BackEndApiImdgConfig {
|
||||
Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Bean(name = "taskExecutorHazelcastClientInitializer")
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
|
|
@ -25,16 +21,6 @@ public class BackEndApiImdgConfig {
|
|||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Bean(name = "taskExecutorHazelcastClientInitializerHist")
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializerHist() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
}
|
||||
|
||||
@Bean(name = "taskExecutorIdGeneratorAwaiterHist")
|
||||
public ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiterHist() {
|
||||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public ImdgProvider imdgProvider(
|
||||
|
|
@ -42,32 +28,9 @@ public class BackEndApiImdgConfig {
|
|||
@Qualifier("taskExecutorIdGeneratorAwaiter") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
BackendApiSettings clientSetting
|
||||
) {
|
||||
if (clientSetting.getHazelcast() == null || clientSetting.getHazelcast().getClusterMembers() == null) {
|
||||
log.warn("Property \"backend-api.hazelcast.cluster-members\" not set!");
|
||||
throw new IllegalArgumentException("Property \"backend-api.hazelcast.cluster-members\" not set");
|
||||
}
|
||||
ImdgProvider imdg = new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||
taskExecutorIdGeneratorAwaiter,
|
||||
clientSetting.getHazelcast());
|
||||
// todo корректное ожидание готовности imdg.waitAvailable();
|
||||
return imdg;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public ImdgProvider imdgProviderHist(
|
||||
@Qualifier("taskExecutorHazelcastClientInitializerHist") ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer,
|
||||
@Qualifier("taskExecutorIdGeneratorAwaiterHist") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
BackendApiSettings clientSetting
|
||||
) {
|
||||
if (clientSetting.getHazelcastSearch() == null || clientSetting.getHazelcastSearch().getClusterMembers() == null) {
|
||||
log.warn("Property \"backend-api.hazelcast-search.cluster-members\" not set!");
|
||||
// может работать без history, но history будет недоступна
|
||||
}
|
||||
ImdgProvider imdg = new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||
taskExecutorIdGeneratorAwaiter,
|
||||
clientSetting.getHazelcastSearch());
|
||||
// todo корректное ожидание готовности imdg.waitAvailable();
|
||||
return imdg;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,177 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.HistorySubscription;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.specific.*;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class HistoryConfig {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
@Autowired
|
||||
public HistoryConfig(ImdgProvider imdgProvider) {
|
||||
this.pb = imdgProvider.getImdg(
|
||||
IMDGDistributedNames.Map_SearchMoneyBalanceRegister,
|
||||
SpcexObjectBase.class
|
||||
).predicateBuilder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public List<HistorySubscription> histSubscriptions() {
|
||||
List<HistorySubscription> hst = new LinkedList<>();
|
||||
hst.add(executionDeposit());
|
||||
hst.add(executionFond());
|
||||
hst.add(depoBalanceRegister());
|
||||
hst.add(moneyBalanceRegister());
|
||||
hst.add(admittedLiabilitiesRegister());
|
||||
hst.add(coveredLiabilitiesRegister());
|
||||
hst.add(moneyPaymentInstructionRegister());
|
||||
hst.add(depoPaymentInstructionRegister());
|
||||
hst.add(excludeLiabilitiesRegister());
|
||||
hst.add(liabilitiesRegister());
|
||||
hst.add(executionRegister());
|
||||
return hst;
|
||||
}
|
||||
|
||||
private HistorySubscription moneyBalanceRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("money-balance-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchMoneyBalanceRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_MoneyBalanceRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new CreatedFromCondition(pb),
|
||||
new CreatedToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription depoBalanceRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("depo-balance-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchDepoBalanceRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_DepoBalanceRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new CreatedFromCondition(pb),
|
||||
new CreatedToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription depoPaymentInstructionRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("depo-payment-instruction-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchDepoPaymentInstructionRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_DepoPaymentInstructionRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new CreatedFromCondition(pb),
|
||||
new CreatedToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription excludeLiabilitiesRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("exclude-liabilities-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchExcludeLiabilitiesRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_ExcludeLiabilitiesRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new CreatedFromCondition(pb),
|
||||
new CreatedToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription liabilitiesRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("liabilities-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchLiabilitiesRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_LiabilitiesRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new CreatedFromCondition(pb),
|
||||
new CreatedToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription admittedLiabilitiesRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("admitted-liabilities-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchAdmittedLiabilitiesRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_AdmittedLiabilitiesRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new ClearingDateFromCondition(pb),
|
||||
new ClearingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription executionRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("execution-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchExecutionRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_ExecutionRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new ClearingDateFromCondition(pb),
|
||||
new ClearingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription moneyPaymentInstructionRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("money-payment-instruction-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchMoneyPaymentInstructionRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_MoneyPaymentInstructionRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new ClearingDateFromCondition(pb),
|
||||
new ClearingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription coveredLiabilitiesRegister() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("covered-liabilities-registers");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchCoveredLiabilitiesRegister);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_CoveredLiabilitiesRegister);
|
||||
sbscr.setConditions(List.of(
|
||||
new ClearingDateFromCondition(pb),
|
||||
new ClearingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription executionDeposit() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("execution-deposits");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchExecutionDeposit);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_ExecutionDeposit);
|
||||
sbscr.setConditions(List.of(
|
||||
new TradingDateFromCondition(pb),
|
||||
new TradingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription executionFond() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("execution-fonds");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchExecutionFond);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_ExecutionFond);
|
||||
sbscr.setConditions(List.of(
|
||||
new TradingDateFromCondition(pb),
|
||||
new TradingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ import java.util.function.Consumer;
|
|||
@SuppressWarnings("Duplicates")
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
//todo remove? see ClearingCorsFilter
|
||||
@CrossOrigin
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
private final MappingJackson2HttpMessageConverter customJsonHttpConverter;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
|||
@ConfigurationProperties("backend-api")
|
||||
public class BackendApiSettings {
|
||||
private HazelcastClientParams hazelcast;
|
||||
private HazelcastClientParams hazelcastSearch;
|
||||
private KafkaProducerSettings kafkaProducer;
|
||||
private KafkaConsumerSettings kafkaConsumer;
|
||||
private SecuritySettings security;
|
||||
|
|
@ -58,12 +57,4 @@ public class BackendApiSettings {
|
|||
public void setSecurity(SecuritySettings security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
public HazelcastClientParams getHazelcastSearch() {
|
||||
return hazelcastSearch;
|
||||
}
|
||||
|
||||
public void setHazelcastSearch(HazelcastClientParams hazelcastSearch) {
|
||||
this.hazelcastSearch = hazelcastSearch;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
|||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public abstract class AbstractQueueController {
|
||||
|
|
@ -22,9 +21,6 @@ public abstract class AbstractQueueController {
|
|||
return responseToClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Для оптимизации передачи userId
|
||||
*/
|
||||
protected <T> CudResponse processRequest(String destination, IAction<T> iAction, Long userId) throws ExecutionException, InterruptedException {
|
||||
CudResponse responseToClient = new CudResponse();
|
||||
responseToClient.setPayload(operator.sendRequestToQueue(destination, iAction, userId));
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.account;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.clearing.classes.statics.data.account.AccountSymbols;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountSymbolsNewAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/accounting/depo-accounts-symbols")
|
||||
public class AccountSymbolsController extends AbstractQueueController {
|
||||
private final IStateLoader stateLoader;
|
||||
|
||||
@Autowired
|
||||
public AccountSymbolsController(IOperator operator, IStateLoader stateLoader) {
|
||||
super(operator);
|
||||
this.stateLoader = stateLoader;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "get all accounts-symbols.")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonGetAllResponse getAll() {
|
||||
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_AccountSymbols, AccountSymbols.class);
|
||||
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||
response.fromEntity(all);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "create AccountSymbols.")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public CudResponse add(
|
||||
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||
@RequestBody AccountSymbolsNewAction accountNewAction) throws ExecutionException, InterruptedException {
|
||||
return processRequest(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_NEW, accountNewAction);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "delete AccountSymbols.")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseBody
|
||||
public CudResponse delete(@ApiParam(value = "Идентификатор удаляемого объекта", required = true, example = "1234")
|
||||
@PathVariable("id") Long id) throws ExecutionException, InterruptedException {
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
return processRequest(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_DELETE, deleteAction);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +1,22 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.account;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
|
||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/accounting/information-accounts")
|
||||
|
|
@ -49,15 +40,4 @@ public class InformationAccountController extends AbstractQueueController {
|
|||
response.fromEntity(all);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
// @ApiOperation(value = "Добавление информационного счета.")
|
||||
// @ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||
// @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
// @ResponseBody
|
||||
// public CudResponse add(
|
||||
// @ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||
// @RequestBody AccountInformationNewAction accountNewInformationAction) throws ExecutionException, InterruptedException {
|
||||
// return processRequest(Consts.DESTINATION_INFORMATION_ACCOUNT_NEW, accountNewInformationAction);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.ConditionProvider;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.HistorySubscription;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
||||
import ru.spcex.clearing.backendapi.errors.BackEndError;
|
||||
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
|
||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/history")
|
||||
public class HistController {
|
||||
private final GetResponseFactory responseFactory;
|
||||
private final IStateLoader stateLoader;
|
||||
private final ConditionProvider conditionProvider;
|
||||
|
||||
@Autowired
|
||||
public HistController(GetResponseFactory responseFactory,
|
||||
IStateLoader stateLoader,
|
||||
ConditionProvider conditionProvider) {
|
||||
this.responseFactory = responseFactory;
|
||||
this.stateLoader = stateLoader;
|
||||
this.conditionProvider = conditionProvider;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Get history")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonGetAllResponse getHistory(
|
||||
@ApiParam(value = "destination сущности по которой запрашивается история", example = "money-balance-registers", required = true)
|
||||
@RequestParam("destination")
|
||||
String destination,
|
||||
@ApiParam(value = "Начальная точка поиска по дате", example = "2023-01-15")
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
|
||||
@RequestParam(name = "from", required = false)
|
||||
LocalDate from,
|
||||
@ApiParam(value = "Конечная точка поиска по дате", example = "2023-01-15")
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
|
||||
@RequestParam(name = "to", required = false)
|
||||
LocalDate to
|
||||
) {
|
||||
if (to == null && from == null) {
|
||||
throw new ActionValidationException(new EnumMessage(BackEndError.ValidationError, "from/to url params both empty"));
|
||||
}
|
||||
|
||||
Optional<Class<? extends SpcexObjectBase>> entityClass = responseFactory.classByDestination(destination);
|
||||
//class may be added to HistorySubscription if needed
|
||||
if (entityClass.isEmpty()) {
|
||||
throw new ActionValidationException(new EnumMessage(BackEndError.ValidationError,
|
||||
"destination " + "'" + destination + "' not supported (meta class not found)"));
|
||||
}
|
||||
|
||||
HistoryRequest req = new HistoryRequest();
|
||||
req.setTable(destination);
|
||||
req.setFrom(from);
|
||||
req.setTo(to);
|
||||
|
||||
HistorySubscription[] subscr = new HistorySubscription[1];
|
||||
ImdgPredicate[] prdct = new ImdgPredicate[1];
|
||||
conditionProvider.conditionForRequest(req).map(s -> subscr[0] = s, p -> prdct[0] = p);
|
||||
|
||||
Collection<Map<String, Object>> searchRes = stateLoader.getAllMetaTransform(
|
||||
subscr[0].getSearchProxyMapName(),
|
||||
subscr[0].getFullHistoryMapName(),
|
||||
entityClass.get(),
|
||||
prdct[0]
|
||||
);
|
||||
|
||||
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||
response.fromEntity(searchRes);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
||||
import ru.spcex.clearing.backendapi.errors.BackEndError;
|
||||
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
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.utils.collection.Pair;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
public class ConditionProvider {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final GetResponseFactory responseFactory;
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
private final Map<String, HistorySubscription> subscriptions;
|
||||
|
||||
@Autowired
|
||||
public ConditionProvider(GetResponseFactory responseFactory, ImdgProvider imdgProvider,
|
||||
List<HistorySubscription> subscriptions) {
|
||||
this.responseFactory = responseFactory;
|
||||
this.subscriptions = new HashMap<>();
|
||||
Imdg<SpcexObjectBase> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SearchMoneyBalanceRegister, SpcexObjectBase.class);
|
||||
this.pb = imdg.predicateBuilder();
|
||||
subscriptions.forEach(s -> this.subscriptions.put(s.getDestination(), s));
|
||||
}
|
||||
|
||||
public Pair<HistorySubscription, ImdgPredicate> conditionForRequest(HistoryRequest req) {
|
||||
String destination = req.getTable();
|
||||
HistorySubscription subscription = subscriptions.get(destination);
|
||||
if (subscription == null) {
|
||||
throw new ActionValidationException(new EnumMessage(BackEndError.ValidationError,
|
||||
"destination " + "'" + destination + "' not supported (subscription info not found)"));
|
||||
}
|
||||
|
||||
List<ImdgPredicate> predicates = subscription
|
||||
.getConditions()
|
||||
.stream()
|
||||
.map(c -> c.condition(req))
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.toList();
|
||||
|
||||
ImdgPredicate result;
|
||||
if (predicates.size() == 0) {
|
||||
//add boundary conditions?
|
||||
log.warn("destination '{}' zero predicates found", destination);
|
||||
result = pb.alwaysTrue();
|
||||
} else if (predicates.size() == 1) {
|
||||
result = predicates.iterator().next();
|
||||
} else {
|
||||
result = pb.and(predicates.toArray(new ImdgPredicate[0]));
|
||||
}
|
||||
|
||||
return new Pair<>(subscription, result);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class HistorySubscription {
|
||||
private String destination;
|
||||
|
||||
private List<IHistoryCondition> conditions;
|
||||
private String searchProxyMapName;
|
||||
private String fullHistoryMapName;
|
||||
//class
|
||||
|
||||
|
||||
public List<IHistoryCondition> getConditions() {
|
||||
return conditions != null ? conditions : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void setConditions(List<IHistoryCondition> conditions) {
|
||||
this.conditions = conditions;
|
||||
}
|
||||
|
||||
public String getSearchProxyMapName() {
|
||||
return searchProxyMapName;
|
||||
}
|
||||
|
||||
public void setSearchProxyMapName(String searchProxyMapName) {
|
||||
this.searchProxyMapName = searchProxyMapName;
|
||||
}
|
||||
|
||||
public String getFullHistoryMapName() {
|
||||
return fullHistoryMapName;
|
||||
}
|
||||
|
||||
public void setFullHistoryMapName(String fullHistoryMapName) {
|
||||
this.fullHistoryMapName = fullHistoryMapName;
|
||||
}
|
||||
|
||||
public String getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(String destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition;
|
||||
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface IHistoryCondition {
|
||||
Optional<ImdgPredicate> condition(HistoryRequest req);
|
||||
|
||||
default Optional<ImdgPredicate> of(ImdgPredicate predicate) {
|
||||
return Optional.of(predicate);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition.specific;
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.IHistoryCondition;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class ClearingDateFromCondition implements IHistoryCondition {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
public ClearingDateFromCondition(ImdgPredicateBuilder pb) {
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ImdgPredicate> condition(HistoryRequest req) {
|
||||
if (req.getFrom() != null) {
|
||||
return Optional.ofNullable(pb.greatEqual("clearingDate", req.getFrom()));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition.specific;
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.IHistoryCondition;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class ClearingDateToCondition implements IHistoryCondition {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
public ClearingDateToCondition(ImdgPredicateBuilder pb) {
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ImdgPredicate> condition(HistoryRequest req) {
|
||||
if (req.getTo() != null) {
|
||||
return Optional.ofNullable(pb.lessEqual("clearingDate", req.getTo()));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition.specific;
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.IHistoryCondition;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class CreatedFromCondition implements IHistoryCondition {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
public CreatedFromCondition(ImdgPredicateBuilder pb) {
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ImdgPredicate> condition(HistoryRequest req) {
|
||||
if (req.getFrom() != null) {
|
||||
return Optional.of(pb.greatEqual("created", TimeUtil.localDateToInstant(req.getFrom())));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition.specific;
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.IHistoryCondition;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class CreatedToCondition implements IHistoryCondition {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
public CreatedToCondition(ImdgPredicateBuilder pb) {
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ImdgPredicate> condition(HistoryRequest req) {
|
||||
if (req.getTo() != null) {
|
||||
return Optional.of(pb.lessEqual("created", TimeUtil.localDateToInstant(req.getTo())));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition.specific;
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.IHistoryCondition;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class TradingDateFromCondition implements IHistoryCondition {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
public TradingDateFromCondition(ImdgPredicateBuilder pb) {
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ImdgPredicate> condition(HistoryRequest req) {
|
||||
if (req.getFrom() != null) {
|
||||
return Optional.ofNullable(pb.greatEqual("tradingDate", req.getFrom()));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.history.condition.specific;
|
||||
|
||||
import ru.spcex.clearing.backendapi.controller.queue.history.condition.IHistoryCondition;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.history.HistoryRequest;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class TradingDateToCondition implements IHistoryCondition {
|
||||
|
||||
private final ImdgPredicateBuilder pb;
|
||||
|
||||
public TradingDateToCondition(ImdgPredicateBuilder pb) {
|
||||
this.pb = pb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ImdgPredicate> condition(HistoryRequest req) {
|
||||
if (req.getTo() != null) {
|
||||
return Optional.ofNullable(pb.lessEqual("tradingDate", req.getTo()));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -86,8 +86,6 @@ public class LauncherController extends AbstractQueueController {
|
|||
}
|
||||
launcherCommand.setTask(dictionaryName);
|
||||
launcherCommand.setUserId(user.getId());
|
||||
//топики ограничиваются наличием в taskDictionary
|
||||
//подписываются на разные топики в разных модулях, см. ru.spcex.platform.enumeration.Task#topic
|
||||
return processRequest(Consts.LAUNCHER_NEW, launcherCommand);
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +104,7 @@ public class LauncherController extends AbstractQueueController {
|
|||
}
|
||||
if (!IEnumKey.contains(taskEnum.getCode(), Task.startOfClearing, Task.dbfExport_OUTV)) {
|
||||
log.warn(String.format("Task %s not support request with body", taskEnum.getCode()));
|
||||
} // else В мете эти модели с дополнительными параметрами (OUTV).
|
||||
}
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String username = KeycloakUtils.getUserNameFromAuthentication(authentication);
|
||||
User user = userImdg.getFirstObjectByFieldValues(Map.of("identifier", username));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
import ru.clearing.classes.statics.data.instrument.issue.EquitySecurity;
|
||||
import ru.clearing.classes.statics.data.instrument.issue.FixedIncomeSecurity;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.Security;
|
||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
|
@ -20,9 +19,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SecurityController и MoneyMarketSecurityController разные контроллеры, не путать.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/securities")
|
||||
public class SecurityController {
|
||||
|
|
|
|||
|
|
@ -90,10 +90,6 @@ public class UserController extends AbstractQueueController {
|
|||
log.warn("user {} sended update request for user {}", username, userUpdateAction.getUsername());
|
||||
throw new IllegalStateException("cannot perform delete action for " + username);
|
||||
}
|
||||
// User user = userImdg.getSingleObjectByFieldValues(Map.of("identifier", username));
|
||||
// if (user == null) {
|
||||
// log.info("update user {} authenticated, but User object was not created", username);
|
||||
// }
|
||||
return processRequest(Consts.USER_UPDATE, userUpdateAction);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ public class StatementController extends AbstractQueueController {
|
|||
Optional<Statement> statement = stateLoader.getById(id, IMDGDistributedNames.Map_Statement, Statement.class);
|
||||
CommonGetByIdResponse response = new CommonGetByIdResponse();
|
||||
if (statement.isEmpty()) {
|
||||
//можно так, либо response.setCode(404); response.setMessage("blabla"); но тогда еще нужно
|
||||
//отдельно HTTP статус проставлять
|
||||
throw new NotFound404Exception(String.valueOf(id));
|
||||
}
|
||||
Statement stmt = statement.get();
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.request.cud.account;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountSymbolsNewRequest;
|
||||
|
||||
public class AccountSymbolsNewAction implements IAction<AccountSymbolsNewRequest> {
|
||||
|
||||
@ApiModelProperty(value = "Номер счета", example = "1200")
|
||||
@JsonProperty
|
||||
private Long accountId;
|
||||
@ApiModelProperty(value = "Значение реквизита", example = "ABCD")
|
||||
@JsonProperty
|
||||
private String accountSymbolValue;
|
||||
|
||||
@Override
|
||||
public AccountSymbolsNewRequest toRequest() {
|
||||
var req = new AccountSymbolsNewRequest();
|
||||
req.setAccountId(this.accountId);
|
||||
req.setAccountSymbolValue(this.accountSymbolValue);
|
||||
return req;
|
||||
}
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@Override
|
||||
public ActionType getActionType() {
|
||||
return ActionType.NEW;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(Long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getAccountSymbolValue() {
|
||||
return accountSymbolValue;
|
||||
}
|
||||
|
||||
public void setAccountSymbolValue(String accountSymbolValue) {
|
||||
this.accountSymbolValue = accountSymbolValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.request.cud.history;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.LocalDateDeserializer;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.LocalDateSerializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class HistoryRequest {
|
||||
|
||||
@ApiModelProperty(value = "Таблица для поиска", example = "1200")
|
||||
@JsonProperty
|
||||
private String table;
|
||||
@ApiModelProperty(value = "Начальный точка поиска по дате", example = "2022-12-25")
|
||||
@JsonProperty
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate from;
|
||||
@ApiModelProperty(value = "Конечная точка поиска по дате ", example = "2022-12-25")
|
||||
@JsonProperty
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate to;
|
||||
|
||||
public String getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
public void setTable(String table) {
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
public LocalDate getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setFrom(LocalDate from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public LocalDate getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public void setTo(LocalDate to) {
|
||||
this.to = to;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.profile.CompanyInfo;
|
||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -51,25 +50,6 @@ public class CompanyBackendGetAll extends BasicSpcexResponse {
|
|||
singleItem.setFullName(company.getFullName());
|
||||
singleItem.setCreated(company.getCreated());
|
||||
singleItem.setUpdated(company.getUpdated());
|
||||
// CompanyInfo profile = company.getProfile();
|
||||
// if (profile != null) {
|
||||
// singleItem.setCorporationSoleType(profile.getCorporationSoleType());
|
||||
// singleItem.setCountryCode(profile.getCountryCode());
|
||||
// singleItem.setDescription(profile.getDescription());
|
||||
// singleItem.setProfessionalSign(profile.getProfessionalSign());
|
||||
// singleItem.setLegalKind(profile.getLegalKind());
|
||||
// singleItem.setOrganizationType(profile.getOrganizationType());
|
||||
// singleItem.setResidence(profile.getResidence());
|
||||
// singleItem.setShortNameEng(profile.getShortNameEng());
|
||||
// singleItem.setFullNameEng(profile.getFullNameEng());
|
||||
// }
|
||||
/* todo
|
||||
CompanySymbol companySymbol = ;
|
||||
if (companySymbol!=null) {
|
||||
|
||||
singleItem.setCompanySymbol(profile.getCompanySymbol());
|
||||
singleItem.setCompanySymbolValue(profile.getCompanySymbolValue());
|
||||
}*/
|
||||
|
||||
payload.getItems().add(singleItem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||
|
||||
/**
|
||||
* Банковские реквизиты для перечисления денежных средств
|
||||
*
|
||||
* @ApiModel(description = "Ответ в результате отправки операции в топик Kafka.")
|
||||
* @ApiModelProperty(value = "Информация о принятом запросе")
|
||||
**/
|
||||
@ApiModel(description = "Ответ при получении объекта TradingClearingRegistry.")
|
||||
public class TradingClearingRegistryBackendGetById extends BasicSpcexResponse {
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,6 @@ import ru.spcex.clearing.platform.messaging.domain.json.serialize.EnumSerializer
|
|||
import ru.spcex.clearing.platform.messaging.service.Status;
|
||||
|
||||
|
||||
/**
|
||||
* Банковские реквизиты для перечисления денежных средств
|
||||
* @ApiModel(description = "Ответ в результате отправки операции в топик Kafka.")
|
||||
* @ApiModelProperty(value = "Информация о принятом запросе")
|
||||
**/
|
||||
@ApiModel(description = "Ответ при получении статуса запроса.")
|
||||
public class RequestInfoResponse extends BasicSpcexResponse {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,18 +19,14 @@ import java.io.IOException;
|
|||
public class ClearingCorsFilter extends OncePerRequestFilter {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
// private final AConfigurationProperties configuration;
|
||||
//todo cors settings
|
||||
private final String[] meth = new String[] {};//"*"
|
||||
private final String[] orig = new String[] {};//"/**"
|
||||
private final String[] meth = new String[] {};
|
||||
private final String[] orig = new String[] {};
|
||||
private final String[] head = new String[] {};
|
||||
private final CorsAllowedOriginsService allowedOriginsService;
|
||||
|
||||
public ClearingCorsFilter(
|
||||
// AConfigurationProperties configuration,
|
||||
CorsAllowedOriginsService allowedOriginsService
|
||||
) {
|
||||
// this.configuration = configuration;
|
||||
this.allowedOriginsService = allowedOriginsService;
|
||||
}
|
||||
|
||||
|
|
@ -63,21 +59,7 @@ public class ClearingCorsFilter extends OncePerRequestFilter {
|
|||
log.trace("cors filter -> effectiveOrigin={}", effectiveOrigin);
|
||||
if (effectiveOrigin != null) {
|
||||
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_ORIGIN, effectiveOrigin);
|
||||
|
||||
// String methods;
|
||||
// if (meth.length > 0) {
|
||||
// methods = String.join(", ", meth).toUpperCase(Locale.ROOT);
|
||||
// } else {
|
||||
// methods = "*";
|
||||
// }
|
||||
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_METHODS, "*");
|
||||
|
||||
// String headers;
|
||||
// if (head.length > 0) {
|
||||
// headers = String.join(", ", head).toLowerCase(Locale.ROOT);
|
||||
// } else {
|
||||
// headers = "*";
|
||||
// }
|
||||
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_HEADERS, "*");
|
||||
|
||||
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ public class CorsAllowedOriginsService {
|
|||
|
||||
private final List<Pattern> originPatterns = new ArrayList<>();
|
||||
|
||||
//todo cors settings
|
||||
public CorsAllowedOriginsService() {
|
||||
for (String originRegex : new String[]{".*"}) {
|
||||
originPatterns.add(Pattern.compile(originRegex));
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ public class ActionElement {
|
|||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Boolean isArray = null;
|
||||
|
||||
// @JsonProperty(value = "fields", required = true)
|
||||
// private List<Map<String, ActionField>> fields = new LinkedList<>();
|
||||
@JsonProperty(value = "fields", required = true)
|
||||
private List<ActionField> fields = new LinkedList<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* todo временная заглушка: нужно добавить парсинг meta.xml и получать инфу оттуда
|
||||
*/
|
||||
@Service
|
||||
public class CudMetaService {
|
||||
private final Map<String, Class<? extends IAction<?>>> mapping;
|
||||
|
|
|
|||
|
|
@ -58,10 +58,6 @@ public abstract class FieldExtracted {
|
|||
if (result == null)
|
||||
break;
|
||||
}
|
||||
|
||||
//fixme somehow externalize custom serialization for type
|
||||
// тут нужно вернуть список id объектов а не список самих объектов для случая
|
||||
// - add(r, "addresseeId", o.getAddressee() == null ? null : o.getAddressee().stream().map(ObjectBase::getId).collect(Collectors.toSet()), fieldFilter);
|
||||
if (result instanceof Set && ((Set) result).size() > 0) {
|
||||
try {
|
||||
Set t = new HashSet();
|
||||
|
|
@ -70,7 +66,7 @@ public abstract class FieldExtracted {
|
|||
t.add(citem.getMethod(RfHelper.GETTER_NAME_ID).invoke(item));
|
||||
}
|
||||
result = t;
|
||||
} catch (Throwable ignored) {// вернем сами объекты
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
} else if (result instanceof LocalDate) {
|
||||
result = result.toString();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
|
@ -35,9 +34,6 @@ public class GetResponseFactory {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* dictionaryName - это имя тэга внутри <enum>
|
||||
*/
|
||||
public Map<String, Object> responseFromDictionary(String dictionaryName, Object o) {
|
||||
ObjectExtracted objectExtracted = meta.getEnumsExtractedByTagName().get(dictionaryName);
|
||||
if (objectExtracted == null) {
|
||||
|
|
@ -54,12 +50,6 @@ public class GetResponseFactory {
|
|||
return responseFromObjectExtracted(o, objExtr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Варианты методов с Class сделаны для сценариев, когда хотим распарсить объект,
|
||||
* по мете для родительского класса объекта
|
||||
* Т.е. вместо извлечение класса o.getClass, берем clazz извне. clazz - base class для o
|
||||
*
|
||||
*/
|
||||
public <T> Collection<Map<String, Object>> responseFromObjectCollection(Collection<?> o, Class<T> clazz) {
|
||||
return o.stream()
|
||||
.map((Function<Object, Map<String, Object>>) o1 -> responseFromObject(o1, clazz))
|
||||
|
|
@ -83,7 +73,6 @@ public class GetResponseFactory {
|
|||
continue;
|
||||
}
|
||||
currentField = field;
|
||||
// if (fieldsToAdd.contains(field.getField().getCode())) {
|
||||
try {
|
||||
add(r, field, field.extractValue(o));
|
||||
} catch (Throwable e) {
|
||||
|
|
@ -96,7 +85,6 @@ public class GetResponseFactory {
|
|||
)))
|
||||
);
|
||||
}
|
||||
// }
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
|
|
@ -131,62 +119,8 @@ public class GetResponseFactory {
|
|||
response.put(name, data);
|
||||
}
|
||||
|
||||
public Optional<Class<? extends SpcexObjectBase>> classByDestination(String destination) {
|
||||
Map<String, ObjectExtracted> extracted = meta.getObjectsExtractedByDestination();
|
||||
ObjectExtracted objectExtracted = extracted.get(destination);
|
||||
if (objectExtracted == null) return Optional.empty();
|
||||
try {
|
||||
Class<? extends SpcexObjectBase> clazz = (Class<? extends SpcexObjectBase>) objectExtracted.getClazz();
|
||||
return Optional.ofNullable(clazz);
|
||||
} catch (Exception e) {
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter
|
||||
.ofPattern("yyyy-MM-dd'T'HH:mm:ss+03:00")
|
||||
.withLocale(Locale.US)
|
||||
.withZone(ZoneId.of("Europe/Moscow"));
|
||||
|
||||
|
||||
// public Map<String, Object> newX(Object o, Collection<String> fieldFilter, String destination) {
|
||||
// ObjectExtracted targetClazz = getTargetClazz(o, destination);
|
||||
// if (targetClazz == null)
|
||||
// throw new FrontendException(String.format("Unknown response class: %s", o.getClass().getName()));
|
||||
// Collection<String> fieldsToAdd = getFilteredFields(targetClazz, fieldFilter);
|
||||
// Map<String, Object> r = new LinkedHashMap<>();
|
||||
// FieldExtracted currentField = null;
|
||||
// try {
|
||||
// for (FieldExtracted field : targetClazz.getFields()) {
|
||||
// if (field.getField().isVirtual() != null && field.getField().isVirtual()) {
|
||||
// continue;
|
||||
// }
|
||||
// currentField = field;
|
||||
// if (fieldsToAdd.contains(field.getField().getCode())) {
|
||||
// try {
|
||||
// add(r, field.getField().getCode(), field.extractValue(o));
|
||||
// } catch (Throwable e) {
|
||||
// log.warn(ExceptionUtils.getStackTrace(
|
||||
// new FrontendException(String.format("Can't extract value for field='%s' of %s(%s): %s -> %s\n%s",
|
||||
// field.getField().getCode(),
|
||||
// o.getClass().getSimpleName(), targetClazz.getClazz().getSimpleName(),
|
||||
// e.getClass().getSimpleName(), e.getLocalizedMessage(),
|
||||
// JsonHelper.writeAnyClassToLog(currentField)
|
||||
// )))
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (FrontendException e) {
|
||||
// throw e;
|
||||
// } catch (Throwable e) {
|
||||
// throw new FrontendException(String.format("Can't get field of %s(%s): %s -> %s\n%s",
|
||||
// o.getClass().getSimpleName(), targetClazz.getClazz().getSimpleName(),
|
||||
// e.getClass().getSimpleName(), e.getLocalizedMessage(),
|
||||
// JsonHelper.writeAnyClassToLog(currentField)
|
||||
// ));
|
||||
// }
|
||||
// return r;
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package ru.spcex.clearing.backendapi.meta;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ru.spcex.platform.utils.log.ExceptionUtils;
|
||||
import ru.spcex.platform.utils.text.TextUtil;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
|
|
@ -68,8 +67,6 @@ public class MetaServer extends MetaBase {
|
|||
objectsExtractedByClazz.put(String.valueOf(classNameMock++), oe);
|
||||
if (objectElement.getSubscription() != null && objectElement.getSubscription().destination != null) {
|
||||
objectsExtractedByDestination.put(objectElement.getSubscription().destination, oe);
|
||||
} else if (!TextUtil.isEmpty(objectElement.getDestination())) {
|
||||
objectsExtractedByDestination.put(objectElement.getDestination(), oe);
|
||||
}
|
||||
for (ActionElement actionElement : objectElement.getActions()) {
|
||||
if (actionElement.getClazz() == null) {
|
||||
|
|
@ -85,7 +82,7 @@ public class MetaServer extends MetaBase {
|
|||
log.warn("META SERVER >>> {}", e.getLocalizedMessage());
|
||||
continue;
|
||||
}
|
||||
String actionDestination = // обычно бывают =null о этому эффективнее по имени класса а не по: objectElement.getSubscription().destination + "/"+ actionElement.getDestination();
|
||||
String actionDestination =
|
||||
oe.getClassName();
|
||||
actionObjectsExtracted.put(actionDestination, oe);
|
||||
}
|
||||
|
|
@ -104,20 +101,6 @@ public class MetaServer extends MetaBase {
|
|||
log.warn("{} {}", key, ExceptionUtils.getStackTrace(e));
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* можно было бы хранить только для нестандартных словарей (где не только id, name, code)
|
||||
*/
|
||||
// List<FieldExtracted> dictFields = oe.getFields();
|
||||
// boolean add = false;
|
||||
// for (FieldExtracted dictField : dictFields) {
|
||||
// if (!dictionaryDefaultFields.contains(dictField.getMemberName())) {
|
||||
// add = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (add) {
|
||||
// enumsExtractedByTagName.put(key, oe);
|
||||
// }
|
||||
enumsExtractedByTagName.put(key, oe);
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +113,6 @@ public class MetaServer extends MetaBase {
|
|||
if (!RfHelper.isAbstract(o.getClazz())) {
|
||||
try {
|
||||
Object instance = newInstance(o.getClassName());
|
||||
// создается успешно.
|
||||
} catch (Throwable e) {
|
||||
log.warn("META SERVER >>> Не удается создать класс {} !", o.getClassName());
|
||||
}
|
||||
|
|
@ -142,32 +124,8 @@ public class MetaServer extends MetaBase {
|
|||
throw new ClearingMetaServerValidationException(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
//
|
||||
// for (ObjectExtracted o : this.actionObjectsExtracted.values()) {
|
||||
// try {
|
||||
// if (!RfHelper.isAbstract(o.getClazz())) {
|
||||
// try {
|
||||
// Object instance = newInstance(o.getClassName());
|
||||
// // создается успешно.
|
||||
// } catch (Throwable e) {
|
||||
// log.warn("META SERVER ACTION >>> Не удается создать класс {} !", o.getClassName());
|
||||
// }
|
||||
// }
|
||||
// validateGetterForObject(o);
|
||||
// } catch (ClrxMetaServerGetterNotFoundException e) {
|
||||
// throw e;
|
||||
// } catch (Throwable e) {
|
||||
// throw new ClearingMetaServerValidationException(e.getLocalizedMessage());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* проверим наличие геттеров к полям
|
||||
*
|
||||
* @param o
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
private void validateGetterForObject(ObjectExtracted o) throws ClassNotFoundException {
|
||||
for (FieldExtracted field : o.getFields()) {
|
||||
Class<?> c = o.getClazz();
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ public class ObjectElement {
|
|||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String table = null;
|
||||
|
||||
@JsonProperty(required = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String destination = null;
|
||||
|
||||
@JsonProperty(value = "fields", required = true)
|
||||
private List<ActionField> fields = new LinkedList<>();
|
||||
|
||||
|
|
@ -80,12 +76,4 @@ public class ObjectElement {
|
|||
public Subscription getSubscriptionHistory() {
|
||||
return subscriptionHistory;
|
||||
}
|
||||
|
||||
public String getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(String destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class RfHelper {
|
|||
Class<?> raw = Class.forName(((ParameterizedType) t).getRawType().getTypeName());
|
||||
if (BUSINESS_OBJECT_REF.equals(raw.getSimpleName())) {
|
||||
return Class.forName(((ParameterizedType) t).getActualTypeArguments()[0].getTypeName());
|
||||
} else if ("Set".equals(raw.getSimpleName())) { // множества пока не распаковываем
|
||||
} else if ("Set".equals(raw.getSimpleName())) {
|
||||
return Class.forName(raw.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ public class KeycloakRestTemplateAuthenticationProvider implements Authenticatio
|
|||
throw new AuthenticationServiceException("keycloak direct access grant auth failed: bad token");
|
||||
}
|
||||
AccessToken accessToken = AdapterTokenVerifier.verifyToken(accessTokenString, deployment);
|
||||
//todo cors settings
|
||||
accessToken.setAllowedOrigins(Collections.singleton("*"));
|
||||
|
||||
RefreshableKeycloakSecurityContext skSession = new RefreshableKeycloakSecurityContext(deployment, null, accessTokenString, accessToken, null, null, refreshTokenString);
|
||||
|
|
|
|||
|
|
@ -4,18 +4,17 @@ import org.keycloak.KeycloakPrincipal;
|
|||
import org.keycloak.adapters.spi.KeycloakAccount;
|
||||
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
;
|
||||
|
||||
public class KeycloakUtils {
|
||||
static Logger log = LoggerFactory.getLogger(KeycloakUtils.class);
|
||||
|
||||
/**
|
||||
* Достать username из Keycloak имплементации Authentication
|
||||
*/
|
||||
public static String getUserNameFromAuthentication(Authentication authentication) {
|
||||
if (authentication == null) return null;
|
||||
if (!(authentication instanceof KeycloakAuthenticationToken)) { // AnonymousAuthenticationToken
|
||||
if (!(authentication instanceof KeycloakAuthenticationToken)) {
|
||||
log.trace("Authentication token class {} is not KeycloakAuthenticationToken", authentication.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* при bearer only false
|
||||
* клиент сюда не попадает
|
||||
* срабатывает KeycloakAuthenticationProvider с редиректом на логин keycloak
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/sso")
|
||||
public class LoginController {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ public class RestTemplateConfig {
|
|||
this.builder = builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* В настоящий момент используется для выгрузки AFS данных
|
||||
*/
|
||||
@Bean("clearing-rest")
|
||||
public RestTemplate restTemplate() {
|
||||
return builder
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
@Component
|
||||
public class SimpleUserDetailService
|
||||
// implements UserDetailsService
|
||||
{
|
||||
// @Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,7 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
|
|||
protected void configure(HttpSecurity http) throws Exception {
|
||||
super.configure(http);
|
||||
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.AuthorizedUrl anyReq = http
|
||||
// .formLogin()
|
||||
// .loginProcessingUrl("/backend-api-login/perform-login")
|
||||
// .and()
|
||||
//todo remove? see ClearingCorsFilter
|
||||
.cors()
|
||||
.cors()
|
||||
.and()
|
||||
.csrf().disable()
|
||||
.authorizeRequests()
|
||||
|
|
@ -84,7 +80,6 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
|
|||
|
||||
@Bean
|
||||
public GrantedAuthorityDefaults grantedAuthorityDefaults() {
|
||||
// Remove the ROLE_ prefix
|
||||
return new GrantedAuthorityDefaults("");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,16 +8,5 @@ import java.util.concurrent.ExecutionException;
|
|||
public interface IOperator {
|
||||
QueueSuccessResponse sendRequestToQueue(String destination, IAction<?> iAction, boolean appendUserId) throws ExecutionException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Для оптимизации проставления userId.
|
||||
* Аналог sendRequestToQueue(String destination, IAction<?> iAction, true)
|
||||
*
|
||||
* @param destination
|
||||
* @param iAction
|
||||
* @param userId совершивший запрос
|
||||
* @return
|
||||
* @throws ExecutionException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
QueueSuccessResponse sendRequestToQueue(String destination, IAction<?> iAction, Long userId) throws ExecutionException, InterruptedException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ import java.util.Collection;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* сделал чтобы не привязывать все контроллеры к Imdg API
|
||||
*/
|
||||
public interface IStateLoader {
|
||||
<T extends SpcexObjectBase> Optional<T> getById(Long id, String mapName, Class<T> clazz);
|
||||
<T extends SpcexObjectBase> Collection<T> getAll(String mapName, Class<T> clazz);
|
||||
|
|
@ -17,9 +14,4 @@ public interface IStateLoader {
|
|||
<T extends SpcexObjectBase> Collection<Map<String, Object>> getAllMetaTransformSpecificClass(String mapName, Class<T> clazz);
|
||||
<T extends SpcexObjectBase> Collection<Map<String, Object>> getAllMetaTransform(String mapName, Class<T> clazz, Map<String, ? extends Comparable<?>> conditions);
|
||||
<T extends SpcexObjectBase> Collection<Map<String, Object>> getAllMetaTransform(String mapName, Class<T> clazz, ImdgPredicate conditions);
|
||||
<T extends SpcexObjectBase> Collection<Map<String, Object>> getAllMetaTransform(
|
||||
String searchMapName,
|
||||
String mapName,
|
||||
Class<T> clazz,
|
||||
ImdgPredicate conditions);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@ import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
|||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
/**
|
||||
* Сервис для сигнализирования результатов запросов клиентов. Ассинхронное обновление статуса.
|
||||
* Клиент запрашивает периодически (или по событию) таблицу Map_RequestInfo и видит результат выполнения запросов.
|
||||
*/
|
||||
@Service
|
||||
public class RequestInfoAccepter extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
|
@ -39,7 +35,6 @@ public class RequestInfoAccepter extends QueueConsumer implements InitializingBe
|
|||
}
|
||||
|
||||
private void updateRequestInfo(BaseRequest<RequestInfoUpdate> requestInfoUpdateBaseRequest) {
|
||||
//will throw exception for any class other than RequestInfoUpdate
|
||||
RequestInfoUpdate statusInfo = requestInfoUpdateBaseRequest.getRequestPayload();
|
||||
if (statusInfo == null || statusInfo.getId() == null) {
|
||||
log.warn("BaseRequest id={}, RequestPayload={}: requestInfo id was null",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class UserAuthProcessor {
|
|||
requestData.setUsername(identifier);
|
||||
requestData.setTime(Instant.now());
|
||||
requestData.setRoles(new ArrayList<>(roles));
|
||||
requestData.setServerIp(serverIp + ":" + serverPort); //getServerAddress() + ":" + serverPort
|
||||
requestData.setServerIp(serverIp + ":" + serverPort);
|
||||
requestData.setClientIp(userIp);
|
||||
requestData.setEmail(email);
|
||||
requestData.setName(name);
|
||||
|
|
@ -48,7 +48,7 @@ public class UserAuthProcessor {
|
|||
requestData.setMiddleName(middleName);
|
||||
try {
|
||||
operator.sendRequestToQueue(Consts.USER_AUTH_SUCCESS, authEvent, false);
|
||||
} catch (Throwable e) { //ExecutionException | InterruptedException
|
||||
} catch (Throwable e) {
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,8 @@ public class OperatorImpl implements IOperator {
|
|||
if (user == null) {
|
||||
log.warn("UserID not found by login \"{}\"", username);
|
||||
return null;
|
||||
//throw new IllegalStateException("cannot obtain userId from logged in user " + username);
|
||||
}
|
||||
return user.getId();
|
||||
// todo добавить кэш, с очисткой по времени
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -78,7 +76,6 @@ public class OperatorImpl implements IOperator {
|
|||
if (appendUserId) {
|
||||
request.setUserId(currentUserId());
|
||||
}
|
||||
//сохраняет данные о запросе в хранилище
|
||||
saveRequestToStorage(destination, request);
|
||||
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
|
||||
send.get();
|
||||
|
|
@ -98,7 +95,6 @@ public class OperatorImpl implements IOperator {
|
|||
} else {
|
||||
request.setUserId(userId);
|
||||
}
|
||||
//сохраняет данные о запросе в хранилище
|
||||
saveRequestToStorage(destination, request);
|
||||
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
|
||||
send.get();
|
||||
|
|
@ -114,12 +110,10 @@ public class OperatorImpl implements IOperator {
|
|||
}
|
||||
|
||||
private void throwValidate(String destination, IAction<?> iAction) {
|
||||
//простая валидация - которую можно запилить прямо внутри класса (наличие полей, отношения между датами etc.)
|
||||
Collection<EnumMessage> validationErrors = iAction.validate();
|
||||
if (validationErrors.size() > 0) {
|
||||
throw new ActionValidationException(validationErrors);
|
||||
}
|
||||
// Валидация по мете (рекомендуется использовать её,а не iAction.validate();
|
||||
IValidator metaValidator = actionMetaValidation.getValidator(destination, iAction);
|
||||
if (metaValidator != null) {
|
||||
metaValidator.tillFirstError().ifPresent(enumMessage -> {
|
||||
|
|
@ -130,8 +124,6 @@ public class OperatorImpl implements IOperator {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
//валидация требующая IMDG поиска других сущностей и т.д.
|
||||
IValidator validator = validation.getValidator(destination, iAction);
|
||||
if (validator != null) {
|
||||
validator.tillFirstError().ifPresent(enumMessage -> {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package ru.spcex.clearing.backendapi.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
|
||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||
|
|
@ -10,24 +9,21 @@ import ru.spcex.platform.imdg.api.Imdg;
|
|||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Service
|
||||
public class StateLoaderImpl implements IStateLoader {
|
||||
private final Map<String, Imdg<?>> allImdgMaps;
|
||||
private final Map<String, Imdg<?>> allHistMaps;
|
||||
private final ImdgProvider imdgProvider;
|
||||
private final ImdgProvider imdgHistProvider;
|
||||
private final GetResponseFactory responseFactory;
|
||||
|
||||
@Autowired
|
||||
public StateLoaderImpl(@Qualifier("imdgProvider") ImdgProvider imdgProvider,
|
||||
@Qualifier("imdgProviderHist") ImdgProvider imdgHistProvider, GetResponseFactory responseFactory) {
|
||||
this.imdgHistProvider = imdgHistProvider;
|
||||
public StateLoaderImpl(ImdgProvider imdgProvider, GetResponseFactory responseFactory) {
|
||||
this.responseFactory = responseFactory;
|
||||
this.allImdgMaps = new ConcurrentHashMap<>();
|
||||
this.allHistMaps = new HashMap<>();
|
||||
this.imdgProvider = imdgProvider;
|
||||
}
|
||||
|
||||
|
|
@ -77,25 +73,4 @@ public class StateLoaderImpl implements IStateLoader {
|
|||
private <T extends SpcexObjectBase> Imdg<T> getImdg(String mapName, Class<T> clazz) {
|
||||
return (Imdg<T>) allImdgMaps.computeIfAbsent(mapName, (mapName1) -> imdgProvider.getImdg(mapName, clazz));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends SpcexObjectBase> Imdg<T> getHistImdg(String mapName, Class<T> clazz) {
|
||||
return (Imdg<T>) allHistMaps.computeIfAbsent(mapName, (mapName1) -> imdgHistProvider.getImdg(mapName, clazz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends SpcexObjectBase> Collection<Map<String, Object>> getAllMetaTransform(
|
||||
String searchMapName,
|
||||
String mapName,
|
||||
Class<T> clazz,
|
||||
ImdgPredicate conditions) {
|
||||
Imdg<SpcexObjectBase> imdgSearch = getHistImdg(searchMapName, SpcexObjectBase.class);
|
||||
Imdg<T> imdgHistory = getHistImdg(mapName, clazz);
|
||||
Collection<Long> ids = imdgSearch.getCollectionIdsByPredicate(conditions);
|
||||
return ids.stream()
|
||||
.map(imdgHistory::getSingleObjectByID)
|
||||
.filter(Objects::nonNull)
|
||||
.map(o -> responseFactory.responseFromObject(o, clazz))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Проверка обязательности полей для IAction по мете
|
||||
*/
|
||||
@Component
|
||||
public class ActionMetaValidation implements InitializingBean {
|
||||
protected static final Logger log = LoggerFactory.getLogger(ActionMetaValidation.class);
|
||||
|
|
@ -55,8 +52,7 @@ public class ActionMetaValidation implements InitializingBean {
|
|||
public IValidator getValidator(String destination, Object action) {
|
||||
if (action == null)
|
||||
return null;
|
||||
//if (destination == null) destination = action.getClass().getName();
|
||||
String actionDestination = action.getClass().getName(); // см. реализацию в MetaServer String actionDestination =...
|
||||
String actionDestination = action.getClass().getName();
|
||||
Function<Object, IValidator> constructor = (Function<Object, IValidator>) validators.get(actionDestination);
|
||||
if (constructor != null)
|
||||
return constructor.apply(action);
|
||||
|
|
@ -70,10 +66,8 @@ public class ActionMetaValidation implements InitializingBean {
|
|||
private <T extends Object> Function<T, IValidator> validatorConstructor(ObjectExtracted metaAction) {
|
||||
if (!metaAction.getFields().stream().anyMatch(field -> isTrue(field.getField().isRequired()))) {
|
||||
log.debug("Action {}: no any required fields. Do not need validator.", metaAction.getClassName());
|
||||
// нет обязательных полей для валидации
|
||||
return null;
|
||||
}
|
||||
// Тестирование getter
|
||||
{
|
||||
Object object;
|
||||
try {
|
||||
|
|
@ -104,7 +98,6 @@ public class ActionMetaValidation implements InitializingBean {
|
|||
ctx.setValidatedObject(iAcc);
|
||||
ValidatorImpl<ImdgValidationContext<T>> iValidator = new ValidatorImpl(ctx);
|
||||
iValidator.addRule(metaValidatorRule);
|
||||
// в дальнейшем можно улучшить и разделить валидатор по полям
|
||||
return iValidator;
|
||||
};
|
||||
}
|
||||
|
|
@ -125,12 +118,9 @@ public class ActionMetaValidation implements InitializingBean {
|
|||
Object value = field.extractValue(object);
|
||||
if (value == null)
|
||||
return of(BackEndError.ValidationError, field.getMemberName());
|
||||
// if (value instanceof String && ((String)value).isEmpty()) // пустое поле, но не null
|
||||
// return of(BackEndError.ValidationError, field.getMemberName());
|
||||
}
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
if (object instanceof MoneyMarketSecurityUpdateAction) {
|
||||
//todo в мете для moneyMarketSecurity / actions / put / для поля lotSize field="securityId" исключение - там надо оставить field, требуется для frontend
|
||||
if (((MoneyMarketSecurityUpdateAction) object).getLotSize() == null)
|
||||
return of(BackEndError.ValidationError, "LotSize");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ backend-api.example-setting=test
|
|||
backend-api.hazelcast.cluster-members=127.0.0.1:5701
|
||||
backend-api.hazelcast.login=dev
|
||||
backend-api.hazelcast.password=dev-pass
|
||||
backend-api.hazelcast-search.cluster-members=127.0.0.1:5702
|
||||
backend-api.hazelcast-search.login=dev-hist
|
||||
backend-api.hazelcast-search.password=dev-pass-hist
|
||||
backend-api.kafka-producer.bootstrap-servers=localhost:9092
|
||||
backend-api.kafka-producer.acks=all
|
||||
backend-api.kafka-producer.retries=0
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<meta version="3.9.0.68">
|
||||
<meta version="3.5.0.14">
|
||||
<enums>
|
||||
<allowed id="1" code="ALWD" name="Разрешено"/>
|
||||
<allowed id="2" code="DEND" name="Запрещено"/>
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
|
||||
<tradingClearingRegistryType id="1" code="A" name="Владелец"/>
|
||||
<tradingClearingRegistryType id="2" code="B" name="Клиентский"/>
|
||||
<tradingClearingRegistryType id="3" code="C" name="Клиентский"/>
|
||||
<tradingClearingRegistryType id="3" code="C" name="Попечитель"/>
|
||||
<tradingClearingRegistryType id="4" code="D" name="Доверительный управляющий"/>
|
||||
<tradingClearingRegistryType id="5" code="E" name="Эмитент"/>
|
||||
<tradingClearingRegistryType id="6" code="Z" name="К размещению/выкупу"/>
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
<registryUnit id="5" code="U" name="Невыясненные"/>
|
||||
<registryUnit id="5" code="I" name="Списания/зачисления"/>
|
||||
<registryUnit id="7" code="V" name="Выписка"/>
|
||||
<registryCode id="1" code="AMAT" name="Денежные средства Участника клиринга, зарезервированные на торги"/>
|
||||
<registryCode id="1" code="AMAT" name="Денежные средства - общие"/>
|
||||
<registryCode id="2" code="AMAF" name="Денежные средства - свободные"/>
|
||||
<registryCode id="3" code="AMAB" name="Денежные средства - блокированные"/>
|
||||
<registryCode id="4" code="TMAT" name="Требования по деньгам"/>
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
<registryCode id="9" code="LSAT" name="Рассчитанные обязательства по бумагам"/>
|
||||
<registryCode id="10" code="LMAT" name="Рассчитанные обязательства по деньгам"/>
|
||||
<registryCode id="11" code="CSAT" name="Рассчитанные требования по бумагам"/>
|
||||
<registryCode id="12" code="AMBT" name="Денежные средства Участника клиринга, зарезервированные на торги – клиенты"/>
|
||||
<registryCode id="12" code="AMBT" name="Денежные средства клиента - общие"/>
|
||||
<registryCode id="13" code="AMBF" name="Денежные средства клиента - свободные"/>
|
||||
<registryCode id="14" code="AMBB" name="Денежные средства клиента - блокированные"/>
|
||||
<registryCode id="15" code="TMBT" name="Требования по деньгам (кл)"/>
|
||||
|
|
@ -180,18 +180,14 @@
|
|||
<registryCode id="22" code="CSBT" name="Рассчитанные требования по бумагам (кл)"/>
|
||||
<registryCode id="23" code="DMAT" name="Возврат депозита"/>
|
||||
<registryCode id="24" code="DMBT" name="Возврат депозита (кл)"/>
|
||||
<registryCode id="25" code="ASAT" name="Ценные бумаги Участника клиринга – свои"/>
|
||||
<registryCode id="25" code="ASAT" name="Ценные бумаги - общие"/>
|
||||
<registryCode id="26" code="ASAF" name="Ценные бумаги - свободные"/>
|
||||
<registryCode id="27" code="ASAB" name="Ценные бумаги - блокированные"/>
|
||||
<registryCode id="28" code="DMAX" name="Возврат инициатору"/>
|
||||
<registryCode id="29" code="DMBX" name="Возврат инициатору (кл)"/>
|
||||
<registryCode id="30" code="DMAU" name="Денежные средства - невыясненные"/>
|
||||
<registryCode id="31" code="DMAV" name="Треб. выписки"/>
|
||||
<registryCode id="32" code="ASZT" name="Ценные бумаги для размещения/выкупа"/>
|
||||
<registryCode id="33" code="ASBT" name="Ценные бумаги Участника клиринга – клиенты"/>
|
||||
<registryCode id="34" code="ASCT" name="Ценные бумаги Участника клиринга – клиенты-нерезиденты"/>
|
||||
<registryCode id="35" code="AMCT" name="Денежные средства Участника клиринга, зарезервированные на торги – клиенты"/>
|
||||
<registryCode id="36" code="ASXT" name="Ценные бумаги Участника клиринга – ДУ"/>
|
||||
<registryCode id="32" code="ASZT" name="Ценные бумаги - общие"/>
|
||||
<registryStatus id="1" code="OK" name="Рассчитано"/>
|
||||
<registryStatus id="2" code="UNCV" name="Не исполнено"/>
|
||||
<registryStatus id="3" code="FAIL" name="Не исполнено контрагентом"/>
|
||||
|
|
@ -253,7 +249,6 @@
|
|||
<task id="26" code="SDEP" name="Время начала возврата депозитов"/>
|
||||
<task id="27" code="EDEP" name="Время завершения возврата депозитов"/>
|
||||
<task id="28" code="CHDF" name="Проверка наличия пары ДФ-01/ДФ-57 и ДФ-08/ДФ-21"/>
|
||||
<task id="29" code="CCLR" name="Завершение неудачных клиринговых сессий"/>
|
||||
<taskStatus id="1" code="ACTV" name="Активна"/>
|
||||
<taskStatus id="2" code="BLKD" name="Не активна"/>
|
||||
<taskStatus id="3" code="CNCL" name="Отмена расписания"/>
|
||||
|
|
@ -433,8 +428,7 @@
|
|||
<errorCode id="5019" code="ACNT" name="Для компании %s отсутствует категория %s."/>
|
||||
<errorCode id="5022" code="ACNT" name="Для компании %s отсутствует клиринговый код."/>
|
||||
<errorCode id="5023" code="ACNT" name="Счет %s уже используется."/>
|
||||
<errorCode id="5024" code="ACNT" name="Не указан номер счета."/>
|
||||
<errorCode id="5025" code="ACNT" name="Необходимо указать ДЕПО счет."/>
|
||||
<errorCode id="5024" code="ACNT" name="Не указан номер счета."/>
|
||||
<!-- error code for balance-service -->
|
||||
<errorCode id="5200" code="BLNC" name="Общая ошибка модуля balance-service."/>
|
||||
<errorCode id="5210" code="BLNC" name="Клиринговая сессия неактивна."/>
|
||||
|
|
@ -532,6 +526,90 @@
|
|||
|
||||
</enums>
|
||||
<objects>
|
||||
<company id="1" fullName="АО Санкт-Петербургская Валютная Биржа" shortName="СПВБ" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<company id="2" fullName="ЗАО «Петербургский Расчетный Центр»" shortName="ПРЦ" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<company id="3" fullName="Торговая организация" shortName="ТС" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<company id="4" fullName="ЗАО «Санкт-Петербургский Расчетно-Депозитарный Центр»" shortName="РДЦ" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<!--company id="5" fullName="Центральный Банк Российской Федерации" shortName="ЦБ РФ" tradingCode="" clearingCode="" workflowStatus="ACTV"/-->
|
||||
<companySymbols id="1" companyId="1" companySymbol="BIC" companySymbolValue="044030920"/>
|
||||
<companySymbols id="2" companyId="2" companySymbol="BIC" companySymbolValue="044030505"/>
|
||||
<currency id="643" currency_code="RUB"/>
|
||||
<security id="643" instrumentType="CRNC" shortName="RUB" fullName="Российский рубль" securitySymbol="RUB" workflowStatus="ACTV"/>
|
||||
<account id="1" companyId="1" account="30414810300000006000" accountType="TRAN" status="ACTV" processingSign="ALWD"/>
|
||||
<account id="2" companyId="1" account="30414810600000007000" accountType="ANLT" status="ACTV" processingSign="ALWD"/>
|
||||
<account id="3" companyId="1" account="700100000AT0" accountType="DTRN" status="ACTV" processingSign="ALWD"/>
|
||||
<market id="1" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UESC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Обыкновенные акции"/>
|
||||
<market id="2" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NESC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Обыкновенные акции"/>
|
||||
<market id="3" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DESC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Обыкновенные акции"/>
|
||||
<market id="4" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="AESC" name="Размещение: акции (аукцион по цене)" exchangeId="1" description="Размещение: акции (аукцион по цене): Обыкновенные акции"/>
|
||||
<market id="5" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WESC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Обыкновенные акции"/>
|
||||
<market id="6" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UEPC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Привилегированные акции"/>
|
||||
<market id="7" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NEPC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Привилегированные акции"/>
|
||||
<market id="8" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DEPC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Привилегированные акции"/>
|
||||
<market id="9" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="AEPC" name="Размещение: акции (аукцион по цене)" exchangeId="1" description="Размещение: акции (аукцион по цене): Привилегированные акции"/>
|
||||
<market id="10" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WEPC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Привилегированные акции"/>
|
||||
<market id="11" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABVC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Купонные облигации с переменным купоном"/>
|
||||
<market id="12" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBVC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Купонные облигации с переменным купоном"/>
|
||||
<market id="13" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBVC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Купонные облигации с переменным купоном"/>
|
||||
<market id="14" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBVC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Купонные облигации с переменным купоном"/>
|
||||
<market id="15" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBVC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Купонные облигации с переменным купоном"/>
|
||||
<market id="16" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBVC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Купонные облигации с переменным купоном"/>
|
||||
<market id="17" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABFC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Купонные облигации с постоянным купоном"/>
|
||||
<market id="18" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBFC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Купонные облигации с постоянным купоном"/>
|
||||
<market id="19" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBFC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Купонные облигации с постоянным купоном"/>
|
||||
<market id="20" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBFC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Купонные облигации с постоянным купоном"/>
|
||||
<market id="21" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBFC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Купонные облигации с постоянным купоном"/>
|
||||
<market id="22" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBFC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Купонные облигации с постоянным купоном"/>
|
||||
<market id="23" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABIC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Облигации с индексированным номиналом"/>
|
||||
<market id="24" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBIC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Облигации с индексированным номиналом"/>
|
||||
<market id="25" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBIC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Облигации с индексированным номиналом"/>
|
||||
<market id="26" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBIC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Облигации с индексированным номиналом"/>
|
||||
<market id="27" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBIC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Облигации с индексированным номиналом"/>
|
||||
<market id="28" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBIC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Облигации с индексированным номиналом"/>
|
||||
<market id="29" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABMC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Облигации с амортизацией долга"/>
|
||||
<market id="30" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBMC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Облигации с амортизацией долга"/>
|
||||
<market id="31" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBMC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Облигации с амортизацией долга"/>
|
||||
<market id="32" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBMC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Облигации с амортизацией долга"/>
|
||||
<market id="33" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBMC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Облигации с амортизацией долга"/>
|
||||
<market id="34" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBMC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Облигации с амортизацией долга"/>
|
||||
<market id="35" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BKVC" name="Размещение: Аукцион БР" exchangeId="1" description="Размещение: Аукцион БР: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="36" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SKVC" name="Доразмещение: Адресные заявки БР" exchangeId="1" description="Доразмещение: Адресные заявки БР: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="37" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UKVC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="38" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NKVC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="39" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DKVC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="45" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABEC" name="Размещение: Аукцион СПВБ" exchangeId="1" description="Размещение: Аукцион СПВБ: Биржевые облигации"/>
|
||||
<market id="46" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBEC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Биржевые облигации"/>
|
||||
<market id="47" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBEC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Биржевые облигации"/>
|
||||
<market id="48" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBEC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Биржевые облигации"/>
|
||||
<market id="61" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMVC" name="ОФЗПК-Размещение: Аукцион БР" exchangeId="1" description="ОФЗПК-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="62" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMVC" name="ОФЗПК-Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗПК-Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="63" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMVC" name="ОФЗПК-Режим непрерывных торгов" exchangeId="1" description="ОФЗПК-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="64" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMVC" name="ОФЗПК-Дискретный аукцион" exchangeId="1" description="ОФЗПК-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="65" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMVC" name="ОФЗПК-Торги в режиме выкупа" exchangeId="1" description="ОФЗПК-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="66" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMFC" name="ОФЗПД-Размещение: Аукцион БР" exchangeId="1" description="ОФЗПД-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="67" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMFC" name="ОФЗПД- Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗПД- Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="68" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMFC" name="ОФЗПД-Режим непрерывных торгов" exchangeId="1" description="ОФЗПД-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="69" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMFC" name="ОФЗПД-Дискретный аукцион" exchangeId="1" description="ОФЗПД-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="70" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMFC" name="ОФЗПД-Торги в режиме выкупа" exchangeId="1" description="ОФЗПД-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="71" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMMC" name="ОФЗАД-Размещение: Аукцион БР" exchangeId="1" description="ОФЗАД-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="72" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMMC" name="ОФЗАД-Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗАД-Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="73" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMMC" name="ОФЗАД-Режим непрерывных торгов" exchangeId="1" description="ОФЗАД-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="74" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMMC" name="ОФЗАД-Дискретный аукцион" exchangeId="1" description="ОФЗАД-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="75" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMMC" name="ОФЗАД-Торги в режиме выкупа" exchangeId="1" description="ОФЗАД-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="76" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMIC" name="ОФЗИН-Размещение: Аукцион БР" exchangeId="1" description="ОФЗИН-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="77" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMIC" name="ОФЗИН-Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗИН-Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="78" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMIC" name="ОФЗИН-Режим непрерывных торгов" exchangeId="1" description="ОФЗИН-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="79" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMIC" name="ОФЗИН-Дискретный аукцион" exchangeId="1" description="ОФЗИН-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="80" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMIC" name="ОФЗИН-Торги в режиме выкупа" exchangeId="1" description="ОФЗИН-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="82" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BBVC" name="ОФЗ-ПК - Аукцион БР" exchangeId="1" description="ОФЗ-ПК - Аукцион БР"/>
|
||||
<market id="83" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTATSS" name="СПб ГУП АТС Смольного" exchangeId="1" description="СПб ГУП АТС Смольного"/>
|
||||
<market id="88" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMTTKFSP" name="Комитет финансов СПб" exchangeId="1" description="Комитет финансов СПб"/>
|
||||
<market id="89" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDSKFLO" name="Комитет финансов ЛО" exchangeId="1" description="Комитет финансов ЛО"/>
|
||||
<market id="90" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTFSKB" name="ФСКМБ" exchangeId="1" description="ФСКМБ"/>
|
||||
<market id="91" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDSFGGE" name="ФАУ ГГЭ" exchangeId="1" description="ФАУ ГГЭ"/>
|
||||
<market id="92" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTVRGO" name="ВВО РГО" exchangeId="1" description="ВВО РГО"/>
|
||||
<market id="93" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTTDRM" name="ООО Торговый дом РМ-Рейл" exchangeId="1" description="ООО Торговый дом РМ-Рейл"/>
|
||||
<market id="95" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTRKFN" name="АО РК Финанс" exchangeId="1" description="АО РК Финанс"/>
|
||||
</objects>
|
||||
</meta>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<meta version="3.9.0.68">
|
||||
<enums>
|
||||
|
||||
</enums>
|
||||
<objects>
|
||||
<company id="1" fullName="АО Санкт-Петербургская Валютная Биржа" shortName="СПВБ" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<company id="2" fullName="ЗАО «Петербургский Расчетный Центр»" shortName="ПРЦ" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<company id="3" fullName="Торговая организация" shortName="ТС" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<company id="4" fullName="ЗАО «Санкт-Петербургский Расчетно-Депозитарный Центр»" shortName="РДЦ" tradingCode="" clearingCode="" workflowStatus="ACTV"/>
|
||||
<!--company id="5" fullName="Центральный Банк Российской Федерации" shortName="ЦБ РФ" tradingCode="" clearingCode="" workflowStatus="ACTV"/-->
|
||||
<companySymbols id="1" companyId="1" companySymbol="BIC" companySymbolValue="044030920"/>
|
||||
<companySymbols id="2" companyId="2" companySymbol="BIC" companySymbolValue="044030505"/>
|
||||
<currency id="643" currency_code="RUB"/>
|
||||
<security id="643" instrumentType="CRNC" shortName="RUB" fullName="Российский рубль" securitySymbol="RUB" workflowStatus="ACTV"/>
|
||||
<account id="1" companyId="1" account="30414810300000006000" accountType="TRAN" status="ACTV" processingSign="ALWD"/>
|
||||
<account id="2" companyId="1" account="30414810600000007000" accountType="ANLT" status="ACTV" processingSign="ALWD"/>
|
||||
<account id="3" companyId="1" account="700100000AT0" accountType="DTRN" status="ACTV" processingSign="ALWD"/>
|
||||
<market id="1" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UESC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Обыкновенные акции"/>
|
||||
<market id="2" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NESC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Обыкновенные акции"/>
|
||||
<market id="3" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DESC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Обыкновенные акции"/>
|
||||
<market id="4" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="AESC" name="Размещение: акции (аукцион по цене)" exchangeId="1" description="Размещение: акции (аукцион по цене): Обыкновенные акции"/>
|
||||
<market id="5" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WESC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Обыкновенные акции"/>
|
||||
<market id="6" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UEPC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Привилегированные акции"/>
|
||||
<market id="7" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NEPC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Привилегированные акции"/>
|
||||
<market id="8" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DEPC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Привилегированные акции"/>
|
||||
<market id="9" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="AEPC" name="Размещение: акции (аукцион по цене)" exchangeId="1" description="Размещение: акции (аукцион по цене): Привилегированные акции"/>
|
||||
<market id="10" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WEPC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Привилегированные акции"/>
|
||||
<market id="11" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABVC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Купонные облигации с переменным купоном"/>
|
||||
<market id="12" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBVC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Купонные облигации с переменным купоном"/>
|
||||
<market id="13" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBVC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Купонные облигации с переменным купоном"/>
|
||||
<market id="14" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBVC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Купонные облигации с переменным купоном"/>
|
||||
<market id="15" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBVC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Купонные облигации с переменным купоном"/>
|
||||
<market id="16" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBVC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Купонные облигации с переменным купоном"/>
|
||||
<market id="17" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABFC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Купонные облигации с постоянным купоном"/>
|
||||
<market id="18" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBFC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Купонные облигации с постоянным купоном"/>
|
||||
<market id="19" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBFC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Купонные облигации с постоянным купоном"/>
|
||||
<market id="20" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBFC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Купонные облигации с постоянным купоном"/>
|
||||
<market id="21" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBFC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Купонные облигации с постоянным купоном"/>
|
||||
<market id="22" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBFC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Купонные облигации с постоянным купоном"/>
|
||||
<market id="23" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABIC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Облигации с индексированным номиналом"/>
|
||||
<market id="24" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBIC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Облигации с индексированным номиналом"/>
|
||||
<market id="25" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBIC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Облигации с индексированным номиналом"/>
|
||||
<market id="26" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBIC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Облигации с индексированным номиналом"/>
|
||||
<market id="27" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBIC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Облигации с индексированным номиналом"/>
|
||||
<market id="28" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBIC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Облигации с индексированным номиналом"/>
|
||||
<market id="29" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABMC" name="Размещение: Аукцион по цене" exchangeId="1" description="Размещение: Аукцион по цене: Облигации с амортизацией долга"/>
|
||||
<market id="30" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="KBMC" name="Размещение: Аукцион по ставке" exchangeId="1" description="Размещение: Аукцион по ставке: Облигации с амортизацией долга"/>
|
||||
<market id="31" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBMC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Облигации с амортизацией долга"/>
|
||||
<market id="32" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBMC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Облигации с амортизацией долга"/>
|
||||
<market id="33" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBMC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Облигации с амортизацией долга"/>
|
||||
<market id="34" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="WBMC" name="Размещение: адресные заявки (подписка)" exchangeId="1" description="Размещение: адресные заявки (подписка): Облигации с амортизацией долга"/>
|
||||
<market id="35" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BKVC" name="Размещение: Аукцион БР" exchangeId="1" description="Размещение: Аукцион БР: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="36" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SKVC" name="Доразмещение: Адресные заявки БР" exchangeId="1" description="Доразмещение: Адресные заявки БР: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="37" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UKVC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="38" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NKVC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="39" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DKVC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Облигации Банка России с переменным купоном (КОБР)"/>
|
||||
<market id="45" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="ABEC" name="Размещение: Аукцион СПВБ" exchangeId="1" description="Размещение: Аукцион СПВБ: Биржевые облигации"/>
|
||||
<market id="46" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UBEC" name="Режим непрерывных торгов" exchangeId="1" description="Режим непрерывных торгов: Биржевые облигации"/>
|
||||
<market id="47" marketType="SCND" section="FOND" settlementCurrency="RUB" code="NBEC" name="Режим переговорных сделок (РПС)" exchangeId="1" description="Режим переговорных сделок (РПС): Биржевые облигации"/>
|
||||
<market id="48" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DBEC" name="Дискретный аукцион" exchangeId="1" description="Дискретный аукцион: Биржевые облигации"/>
|
||||
<market id="61" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMVC" name="ОФЗПК-Размещение: Аукцион БР" exchangeId="1" description="ОФЗПК-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="62" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMVC" name="ОФЗПК-Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗПК-Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="63" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMVC" name="ОФЗПК-Режим непрерывных торгов" exchangeId="1" description="ОФЗПК-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="64" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMVC" name="ОФЗПК-Дискретный аукцион" exchangeId="1" description="ОФЗПК-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="65" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMVC" name="ОФЗПК-Торги в режиме выкупа" exchangeId="1" description="ОФЗПК-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="66" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMFC" name="ОФЗПД-Размещение: Аукцион БР" exchangeId="1" description="ОФЗПД-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="67" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMFC" name="ОФЗПД- Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗПД- Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="68" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMFC" name="ОФЗПД-Режим непрерывных торгов" exchangeId="1" description="ОФЗПД-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="69" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMFC" name="ОФЗПД-Дискретный аукцион" exchangeId="1" description="ОФЗПД-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="70" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMFC" name="ОФЗПД-Торги в режиме выкупа" exchangeId="1" description="ОФЗПД-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="71" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMMC" name="ОФЗАД-Размещение: Аукцион БР" exchangeId="1" description="ОФЗАД-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="72" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMMC" name="ОФЗАД-Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗАД-Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="73" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMMC" name="ОФЗАД-Режим непрерывных торгов" exchangeId="1" description="ОФЗАД-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="74" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMMC" name="ОФЗАД-Дискретный аукцион" exchangeId="1" description="ОФЗАД-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="75" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMMC" name="ОФЗАД-Торги в режиме выкупа" exchangeId="1" description="ОФЗАД-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="76" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BMIC" name="ОФЗИН-Размещение: Аукцион БР" exchangeId="1" description="ОФЗИН-Размещение: Аукцион БР: Облигации Минфина"/>
|
||||
<market id="77" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="SMIC" name="ОФЗИН-Доразмещение: Адресные заявки БР" exchangeId="1" description="ОФЗИН-Доразмещение: Адресные заявки БР: Облигации Минфина"/>
|
||||
<market id="78" marketType="SCND" section="FOND" settlementCurrency="RUB" code="UMIC" name="ОФЗИН-Режим непрерывных торгов" exchangeId="1" description="ОФЗИН-Режим непрерывных торгов: Облигации Минфина"/>
|
||||
<market id="79" marketType="SCND" section="FOND" settlementCurrency="RUB" code="DMIC" name="ОФЗИН-Дискретный аукцион" exchangeId="1" description="ОФЗИН-Дискретный аукцион: Облигации Минфина"/>
|
||||
<market id="80" marketType="SCND" section="FOND" settlementCurrency="RUB" code="MMIC" name="ОФЗИН-Торги в режиме выкупа" exchangeId="1" description="ОФЗИН-Торги в режиме выкупа: Облигации Минфина"/>
|
||||
<market id="82" marketType="PRMR" section="FOND" settlementCurrency="RUB" code="BBVC" name="ОФЗ-ПК - Аукцион БР" exchangeId="1" description="ОФЗ-ПК - Аукцион БР"/>
|
||||
<market id="83" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTATSS" name="СПб ГУП АТС Смольного" exchangeId="1" description="СПб ГУП АТС Смольного"/>
|
||||
<market id="88" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMTTKFSP" name="Комитет финансов СПб" exchangeId="1" description="Комитет финансов СПб"/>
|
||||
<market id="89" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDSKFLO" name="Комитет финансов ЛО" exchangeId="1" description="Комитет финансов ЛО"/>
|
||||
<market id="90" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTFSKB" name="ФСКМБ" exchangeId="1" description="ФСКМБ"/>
|
||||
<market id="91" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDSFGGE" name="ФАУ ГГЭ" exchangeId="1" description="ФАУ ГГЭ"/>
|
||||
<market id="92" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTVRGO" name="ВВО РГО" exchangeId="1" description="ВВО РГО"/>
|
||||
<market id="93" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTTDRM" name="ООО Торговый дом РМ-Рейл" exchangeId="1" description="ООО Торговый дом РМ-Рейл"/>
|
||||
<market id="95" marketType="PRMR" section="MKR" settlementCurrency="RUB" code="XMDTRKFN" name="АО РК Финанс" exchangeId="1" description="АО РК Финанс"/>
|
||||
</objects>
|
||||
</meta>
|
||||
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.9.0.71",
|
||||
"version": "3.8.0.58",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -3328,11 +3328,11 @@
|
|||
"type": 3,"name": "Номер купона","shortname": "Номер","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "periodStartDate",
|
||||
{"code": "periodEndDate",
|
||||
"type": 6,"name": "Начало периода действия","shortname": "Начало","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "periodEndDate",
|
||||
{"code": "periodStartDate",
|
||||
"type": 6,"name": "Окончание периода действия","shortname": "Окончание","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
|
|
@ -4132,10 +4132,6 @@
|
|||
{"code": "balance",
|
||||
"type": 10,"name": "Сумма","shortname": "Сумма","required": true
|
||||
}
|
||||
,
|
||||
{"code": "companyId",
|
||||
"type": 1,"name": "Наименование компании","shortname": "Компания","link": "company","linkCode": "shortName","required": true
|
||||
}
|
||||
,
|
||||
{"code": "tradingClearingRegistryId",
|
||||
"type": 1,"name": "Торгово-клиринговый регистр","shortname": "Торгово-клиринговый регистр","link": "tradingClearingRegistry","linkCode": "code","required": true
|
||||
|
|
@ -4668,66 +4664,6 @@
|
|||
}
|
||||
]
|
||||
|
||||
}
|
||||
,
|
||||
"accountSymbols": {
|
||||
|
||||
"name": "Депо КС - РДЦ",
|
||||
|
||||
"destination": "accounting/depo-accounts-symbols",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.account.AccountSymbols",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
||||
"table": "depo_account_symbols",
|
||||
|
||||
"fields": [
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "accountId",
|
||||
"type": 1,"dbname": "Идентификатор счета","name": "Счет депо КС","shortname": "Счет депо КС","searchable": true,"sortable": true,"visible": true,"link": "account","linkCode": "account"
|
||||
}
|
||||
,
|
||||
{"code": "accountSymbolValue",
|
||||
"type": 2,"length": 255,"name": "Счет РДЦ","shortname": "Счет РДЦ","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
]
|
||||
,"actions":[
|
||||
{"method":"post",
|
||||
|
||||
"name": "Добавление депо КС - РДЦ",
|
||||
|
||||
"confirmation": "accountId,accountSymbolValue",
|
||||
|
||||
"class": "ru.spcex.clearing.backendapi.controller.request.cud.account.AccountSymbolsNewAction",
|
||||
|
||||
"fields": [
|
||||
{"code": "accountId",
|
||||
"type": 1,"dbname": "Идентификатор счета","name": "Счет депо КС","shortname": "Счет депо КС","link": "account","linkCode": "account","required": true
|
||||
}
|
||||
,
|
||||
{"code": "accountSymbolValue",
|
||||
"type": 2,"length": 255,"name": "Счет РДЦ","shortname": "Счет РДЦ","required": true
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
{"method":"delete",
|
||||
|
||||
"name": "Удаление депо КС - РДЦ",
|
||||
|
||||
"confirmation": "accountId,accountSymbolValue",
|
||||
|
||||
"fields": [
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","link": "account","linkCode": "id","required": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"clearingAccount": {
|
||||
|
|
@ -5334,15 +5270,11 @@
|
|||
|
||||
"group": "Обмен с расчетной организацией",
|
||||
|
||||
"name": "Вывод свободных средств с клирингового регистра (отправка ДФ-54 для получения ответа ДФ-55)",
|
||||
"name": "Вывод свободных средств инициаторов В (отправка ДФ-54 для получения ответа ДФ-55)",
|
||||
|
||||
"fields": [
|
||||
{"code": "fullBalance",
|
||||
"type": 10,"name": "Текущий баланс (всего)","shortname": "Текущие средства (всего)","enabled": false
|
||||
}
|
||||
,
|
||||
{"code": "balance",
|
||||
"type": 10,"name": "Текущий баланс (свободно)","shortname": "Текущие средства (свободно)","enabled": false
|
||||
"type": 10,"name": "Текущий баланс","shortname": "Текущие средства","enabled": false
|
||||
}
|
||||
,
|
||||
{"code": "securitySymbol",
|
||||
|
|
@ -5358,7 +5290,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "senderId",
|
||||
"type": 1,"group": "Отправитель","name": "Участник отправитель","shortname": "Отправитель","link": "company","linkCode": "shortName","required": true
|
||||
"type": 1,"group": "Отправитель","name": "Участник отправитель","shortname": "Отправитель","link": "company","linkCode": "shortName","required": true,"enabled": false
|
||||
}
|
||||
,
|
||||
{"code": "creditLeg_accountId",
|
||||
|
|
@ -5577,28 +5509,6 @@
|
|||
|
||||
"name": "Формирование ДФ-05 с кодом 9 (финальный)",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
,
|
||||
{"method":"post",
|
||||
|
||||
"destination": "CHDF",
|
||||
|
||||
"group": "Общее",
|
||||
|
||||
"name": "Проверка наличия пары ДФ-01/ДФ-57 и ДФ-08/ДФ-21",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
,
|
||||
{"method":"post",
|
||||
|
||||
"destination": "CCLR",
|
||||
|
||||
"group": "Клиринг",
|
||||
|
||||
"name": "Завершение неудачных клиринговых сессий",
|
||||
|
||||
"fields": []
|
||||
}
|
||||
]
|
||||
|
|
@ -5634,7 +5544,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "sessionStatus",
|
||||
"type": 12,"dbname": "Код статуса клиринговой сессии","name": "Статус клиринговой сессии","shortname": "Шаг","searchable": true,"sortable": true,"visible": true,"link": "sessionStatus"
|
||||
"type": 12,"dbname": "Код статуса клиринговой сессии","name": "Статус клиринговой сессии","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "sessionStatus"
|
||||
}
|
||||
,
|
||||
{"code": "companyId",
|
||||
|
|
@ -5866,12 +5776,10 @@
|
|||
,
|
||||
"executionDeposit": {
|
||||
|
||||
"name": "Сделки на секции МКР",
|
||||
"name": "Сделки",
|
||||
|
||||
"destination": "execution-deposits",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.execution.ExecutionDeposit",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
|
@ -6024,8 +5932,6 @@
|
|||
|
||||
"destination": "execution-fonds",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.execution.ExecutionFond",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
|
@ -6174,19 +6080,17 @@
|
|||
|
||||
"destination": "depo-balance-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.DepoBalanceRegister",
|
||||
|
||||
"table": "balance_depo_register",
|
||||
|
||||
"fields": [
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"ignore": true
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "createdAt",
|
||||
"field": "created","type": 4,"webtype": "5","dbname": "Дата-время создания записи","name": "Время создания записи","shortname": "Создано","searchable": true,"sortable": true
|
||||
"field": "created","type": 4,"webtype": "5","dbname": "Дата-время создания записи","name": "Время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true
|
||||
}
|
||||
,
|
||||
{"code": "updatedAt",
|
||||
|
|
@ -6198,7 +6102,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "sessionId",
|
||||
"type": 1,"dbname": "Идентификатор клиринговой сессии","name": "Клиринговая сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "session","ignore": true
|
||||
"type": 1,"dbname": "Идентификатор клиринговой сессии","name": "Клиринговая сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "session"
|
||||
}
|
||||
,
|
||||
{"code": "depoCode",
|
||||
|
|
@ -6222,8 +6126,6 @@
|
|||
|
||||
"destination": "money-balance-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.MoneyBalanceRegister",
|
||||
|
||||
"table": "money_balance_register",
|
||||
|
|
@ -6238,7 +6140,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "infoAccount",
|
||||
"type": 2,"length": 50,"name": "Номер счета внутреннего учета СПВБ","shortname": "Номер счета внутреннего учета СПВБ","searchable": true,"sortable": true,"visible": true,"ignore": true
|
||||
"type": 2,"length": 50,"name": "Номер счета внутреннего учета СПВБ","shortname": "Номер счета внутреннего учета СПВБ","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "remainderSum",
|
||||
|
|
@ -6246,23 +6148,23 @@
|
|||
}
|
||||
,
|
||||
{"code": "blockedSum",
|
||||
"type": 10,"name": "Сумма блокированных денежных средств","shortname": "Блокированные","searchable": true,"sortable": true,"ignore": true
|
||||
"type": 10,"name": "Сумма блокированных денежных средств","shortname": "Блокированные","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "unblockedSum",
|
||||
"type": 10,"name": "Сумма свободных денежных средств","shortname": "Свободные","searchable": true,"sortable": true,"ignore": true
|
||||
"type": 10,"name": "Сумма свободных денежных средств","shortname": "Свободные","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "inn",
|
||||
"type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН","searchable": true,"sortable": true,"visible": true,"ignore": true
|
||||
"type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "sessionId",
|
||||
"type": 1,"dbname": "Идентификатор клиринговой сессии","name": "Клиринговая сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "session","ignore": true
|
||||
"type": 1,"dbname": "Идентификатор клиринговой сессии","name": "Клиринговая сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "session"
|
||||
}
|
||||
,
|
||||
{"code": "companyFullName",
|
||||
"type": 2,"length": 255,"name": "Полное наименование компании","shortname": "Полное наименование компании","searchable": true,"sortable": true,"visible": true,"ignore": true
|
||||
"type": 2,"length": 255,"name": "Полное наименование компании","shortname": "Полное наименование компании","searchable": true,"sortable": true,"visible": true
|
||||
}
|
||||
,
|
||||
{"code": "companyId",
|
||||
|
|
@ -6270,7 +6172,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"ignore": true
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "createdAt",
|
||||
|
|
@ -6278,7 +6180,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "updatedAt",
|
||||
"field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true
|
||||
"field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время изменения записи","shortname": "Изменено","searchable": true,"sortable": true
|
||||
}
|
||||
]
|
||||
|
||||
|
|
@ -6290,8 +6192,6 @@
|
|||
|
||||
"destination": "admitted-liabilities-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.AdmittedLiabilitiesRegister",
|
||||
|
||||
"table": "admitted_liabilities_register",
|
||||
|
|
@ -6354,8 +6254,6 @@
|
|||
|
||||
"destination": "covered-liabilities-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.CoveredLiabilitiesRegister",
|
||||
|
||||
"table": "covered_Liabilities_register",
|
||||
|
|
@ -6418,8 +6316,6 @@
|
|||
|
||||
"destination": "money-payment-instruction-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.MoneyPaymentInstructionRegister",
|
||||
|
||||
"table": "money_payment_instruction_register",
|
||||
|
|
@ -6474,8 +6370,6 @@
|
|||
|
||||
"destination": "depo-payment-instruction-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.DepoPaymentInstructionRegister",
|
||||
|
||||
"table": "depo_payment_instruction_register",
|
||||
|
|
@ -6530,8 +6424,6 @@
|
|||
|
||||
"destination": "exclude-liabilities-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.ExcludeLiabilitiesRegister",
|
||||
|
||||
"table": "exclude_liabilities_register",
|
||||
|
|
@ -6610,8 +6502,6 @@
|
|||
|
||||
"destination": "liabilities-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.LiabilitiesRegister",
|
||||
|
||||
"table": "liabilities_register",
|
||||
|
|
@ -6690,8 +6580,6 @@
|
|||
|
||||
"destination": "execution-registers",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.register.ExecutionRegister",
|
||||
|
||||
"table": "execution_register",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
|
||||
<meta version="3.9.0.71">
|
||||
<meta version="3.8.0.62">
|
||||
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
||||
<!--Здесь словари-->
|
||||
<enums>
|
||||
|
|
@ -772,8 +772,8 @@
|
|||
<securityId type="1" dbname="Идентификатор инструмента" name="Наименование инструмента" shortname="Инструмент" searchable="true" sortable="true" link="security" linkCode="shortName"/>
|
||||
<couponRate type="11" name="Купонная ставка" shortname="Ставка" searchable="true" sortable="true" visible="true"/>
|
||||
<number type="3" name="Номер купона" shortname="Номер" searchable="true" sortable="true" visible="true"/>
|
||||
<periodStartDate type="6" name="Начало периода действия" shortname="Начало" searchable="true" sortable="true" visible="true"/>
|
||||
<periodEndDate type="6" name="Окончание периода действия" shortname="Окончание" searchable="true" sortable="true" visible="true"/>
|
||||
<periodEndDate type="6" name="Начало периода действия" shortname="Начало" searchable="true" sortable="true" visible="true"/>
|
||||
<periodStartDate type="6" name="Окончание периода действия" shortname="Окончание" searchable="true" sortable="true" visible="true"/>
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
</couponPeriod>
|
||||
<listing name="Инструменты на режимах" destination="listings" class="ru.clearing.classes.statics.data.misc.Listing" logUpdates="true" table="listing">
|
||||
|
|
@ -1084,20 +1084,6 @@
|
|||
<serviceStatus field="accountId" type="12" dbname="Код статуса" name="Наименование статуса" shortname="Статус" searchable="true" sortable="true" visible="true" linkKeyCode="id" linkCode="status" link="account" extends="account" />
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
</depoAccount>
|
||||
<accountSymbols name="Депо КС - РДЦ" destination="accounting/depo-accounts-symbols" class="ru.clearing.classes.statics.data.account.AccountSymbols" logUpdates="true" table="depo_account_symbols">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<accountId type="1" dbname="Идентификатор счета" name="Счет депо КС" shortname= "Счет депо КС" searchable="true" sortable="true" visible="true" link="account" linkCode="account"/>
|
||||
<accountSymbolValue type="2" length="255" name="Счет РДЦ" shortname="Счет РДЦ" searchable="true" sortable="true" visible="true"/>
|
||||
<actions>
|
||||
<post name="Добавление депо КС - РДЦ" confirmation="accountId,accountSymbolValue" class="ru.spcex.clearing.backendapi.controller.request.cud.account.AccountSymbolsNewAction">
|
||||
<accountId type="1" dbname="Идентификатор счета" name="Счет депо КС" shortname= "Счет депо КС" link="account" linkCode="account" required="true"/>
|
||||
<accountSymbolValue type="2" length="255" name="Счет РДЦ" shortname="Счет РДЦ" required="true"/>
|
||||
</post>
|
||||
<delete name="Удаление депо КС - РДЦ" confirmation="accountId,accountSymbolValue">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" link="account" linkCode="id" required="true"/>
|
||||
</delete>
|
||||
</actions>
|
||||
</accountSymbols>
|
||||
<clearingAccount name="Торгово-Банковские счета" destination="accounting/clearing-accounts" class="ru.clearing.classes.statics.data.account.ClearingAccount" logUpdates="true" table="clearing_account">
|
||||
<accountId type="1" dbname="Идентификатор счета" name="Номер счета" shortname="Счет" searchable="true" sortable="true" visible="true" link="account" linkCode="account"/>
|
||||
<clearingAccountType type="12" dbname="Код типа счета" name="Наименование типа счета" shortname="Тип" searchable="true" sortable="true" visible="true" link="clearingAccountType" linkCode="name"/>
|
||||
|
|
@ -1288,8 +1274,6 @@
|
|||
</post>
|
||||
<post destination="CHDF" group="Общее" name="Проверка наличия пары ДФ-01/ДФ-57 и ДФ-08/ДФ-21">
|
||||
</post>
|
||||
<post destination="CCLR" group="Клиринг" name="Завершение неудачных клиринговых сессий">
|
||||
</post>
|
||||
</actions>
|
||||
</launcher>
|
||||
|
||||
|
|
@ -1298,7 +1282,7 @@
|
|||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
<clearingDate type="6" name="Дата" shortname="Дата" searchable="true" sortable="true" visible="true"/>
|
||||
<sessionStatus type="12" dbname="Код статуса клиринговой сессии" name="Статус клиринговой сессии" shortname="Шаг" searchable="true" sortable="true" visible="true" link="sessionStatus"/>
|
||||
<sessionStatus type="12" dbname="Код статуса клиринговой сессии" name="Статус клиринговой сессии" shortname="Статус" searchable="true" sortable="true" visible="true" link="sessionStatus"/>
|
||||
<companyId type="1" dbname="Идентификатор инициатора торгов" name="Наименование инициатора торгов" shortname="Инициатор" visible="false" searchable="true" sortable="true" link="company" linkCode="shortName"/>
|
||||
<securityId type="1" dbname="Идентификатор инструмента" name="Наименование инструмента" shortname="Инструмент" searchable="false" sortable="true" visible="true" link="security" linkCode="shortName"/>
|
||||
<userId type="1" dbname="Идентификатор пользователя" name="Наименование пользователя" shortname="Пользователь" searchable="true" sortable="true" visible="true" link="userCls" linkCode="identifier"/>
|
||||
|
|
@ -1355,7 +1339,7 @@
|
|||
<bankAccId type="2" length="12" name="Идентификатор расчетного счета/кода в клиринговой организации" shortname="Код позиции" searchable="true" sortable="true"/>
|
||||
<section type="12" dbname="Код наименования секции" name="Наименование секции" shortname="Секция" searchable="true" sortable="true" visible="true" link="section"/>
|
||||
</sTrades>
|
||||
<executionDeposit name="Сделки на секции МКР" destination="execution-deposits" historyDestination="history" class="ru.clearing.classes.statics.data.execution.ExecutionDeposit" logUpdates="true" table="execution_deposit">
|
||||
<executionDeposit name="Сделки" destination="execution-deposits" class="ru.clearing.classes.statics.data.execution.ExecutionDeposit" logUpdates="true" table="execution_deposit">
|
||||
<exchangeExecutionId type="1" name="Идентификационный номер сделки в Торговой системе" shortname="Номер сделки" visible="true" searchable="true" sortable="true"/>
|
||||
<exchangeExecutionTime type="4" name="Время заключения сделки в Торговой системе" shortname="Время заключения сделки" visible="true" searchable="true" sortable="true"/>
|
||||
<tradingDate type="6" name="Дата заключения сделки" shortname="Дата заключения сделки" visible="true" searchable="true" sortable="true"/>
|
||||
|
|
@ -1391,7 +1375,7 @@
|
|||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" visible="false" searchable="true" sortable="true"/>
|
||||
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
|
||||
</executionDeposit>
|
||||
<executionFond name="Сделки на Фондовой секции" destination="execution-fonds" historyDestination="history" class="ru.clearing.classes.statics.data.execution.ExecutionFond" logUpdates="true" table="execution_fond">
|
||||
<executionFond name="Сделки на Фондовой секции" destination="execution-fonds" class="ru.clearing.classes.statics.data.execution.ExecutionFond" logUpdates="true" table="execution_fond">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" visible="false" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" visible="false" searchable="true" sortable="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" visible="false" searchable="true" sortable="true"/>
|
||||
|
|
@ -1426,32 +1410,32 @@
|
|||
<coverageStatus type="12" dbname="Код статуса достаточности обеспечения" name="Cтатус достаточности обеспечения" shortname="Обеспеченность" searchable="true" sortable="true" link="allowed"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
</executionFond>
|
||||
<depoBalanceRegister name="Реестр остатков ценных бумаг" destination="depo-balance-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.DepoBalanceRegister" table="balance_depo_register">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true" ignore="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true"/>
|
||||
<depoBalanceRegister name="Реестр остатков ценных бумаг" destination="depo-balance-registers" class="ru.clearing.classes.statics.data.register.DepoBalanceRegister" table="balance_depo_register">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
<companyId type="1" dbname="Идентификатор компании" name="Наименование компании" shortname="Компания" visible="true" searchable="true" sortable="true" link="company" linkCode="shortName"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session" ignore="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
<depoCode type="2" length="50" name="Код раздела субсчета/счета депо" shortname="Код счета депо" searchable="true" sortable="true"/>
|
||||
<quantity type="11" name="Количество" shortname="Количество" searchable="true" sortable="true"/>
|
||||
<securitySymbol type="2" length="255" name="Код ценной бумаги" shortname="Ценная бумага" searchable="true" sortable="true"/>
|
||||
</depoBalanceRegister>
|
||||
<moneyBalanceRegister name="Реестр остатков денежных средств" destination="money-balance-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.MoneyBalanceRegister" table="money_balance_register">
|
||||
<moneyBalanceRegister name="Реестр остатков денежных средств" destination="money-balance-registers" class="ru.clearing.classes.statics.data.register.MoneyBalanceRegister" table="money_balance_register">
|
||||
<setHouseName type="2" length="255" name="Наименование РО" shortname="Наименование РО" searchable="true" sortable="true" visible="true"/>
|
||||
<account type="2" length="50" name="Номер торгового/клирингового счета" shortname="Номер торгового/клирингового счета" searchable="true" sortable="true" visible="true"/>
|
||||
<infoAccount type="2" length="50" name="Номер счета внутреннего учета СПВБ" shortname="Номер счета внутреннего учета СПВБ" searchable="true" sortable="true" visible="true" ignore="true"/>
|
||||
<infoAccount type="2" length="50" name="Номер счета внутреннего учета СПВБ" shortname="Номер счета внутреннего учета СПВБ" searchable="true" sortable="true" visible="true"/>
|
||||
<remainderSum type="10" name="Остаток денежных средств" shortname="Остаток" searchable="true" sortable="true"/>
|
||||
<blockedSum type="10" name="Сумма блокированных денежных средств" shortname="Блокированные" searchable="true" sortable="true" ignore="true"/>
|
||||
<unblockedSum type="10" name="Сумма свободных денежных средств" shortname="Свободные" searchable="true" sortable="true" ignore="true"/>
|
||||
<inn type="2" length="255" name="Идентификационный номер налогоплательщика (ИНН)" shortname="ИНН" searchable="true" sortable="true" visible="true" ignore="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session" ignore="true"/>
|
||||
<companyFullName type="2" length="255" name="Полное наименование компании" shortname="Полное наименование компании" searchable="true" sortable="true" visible="true" ignore="true"/>
|
||||
<blockedSum type="10" name="Сумма блокированных денежных средств" shortname="Блокированные" searchable="true" sortable="true"/>
|
||||
<unblockedSum type="10" name="Сумма свободных денежных средств" shortname="Свободные" searchable="true" sortable="true"/>
|
||||
<inn type="2" length="255" name="Идентификационный номер налогоплательщика (ИНН)" shortname="ИНН" searchable="true" sortable="true" visible="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
<companyFullName type="2" length="255" name="Полное наименование компании" shortname="Полное наименование компании" searchable="true" sortable="true" visible="true"/>
|
||||
<companyId type="1" dbname="Идентификатор компании" name="Наименование компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true" ignore="true"/>
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true"/>
|
||||
</moneyBalanceRegister>
|
||||
<admittedLiabilitiesRegister name="Реестр обязательств, допущенных к клирингу" destination="admitted-liabilities-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.AdmittedLiabilitiesRegister" table="admitted_liabilities_register">
|
||||
<admittedLiabilitiesRegister name="Реестр обязательств, допущенных к клирингу" destination="admitted-liabilities-registers" class="ru.clearing.classes.statics.data.register.AdmittedLiabilitiesRegister" table="admitted_liabilities_register">
|
||||
<companyFullName type="2" length="255" name="Полное наименование компании" shortname="Полное наименование компании" searchable="true" sortable="true" visible="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
<securitySymbol type="2" length="255" name="Финансовый инструмент" shortname="Код биржевого инструмента / товара" searchable="true" sortable="true" visible="true"/>
|
||||
|
|
@ -1465,7 +1449,7 @@
|
|||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" visible="false"/>
|
||||
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" searchable="true" sortable="true" visible="false"/>
|
||||
</admittedLiabilitiesRegister>
|
||||
<coveredLiabilitiesRegister name="Реестр обязательств, прошедших процедуру контроля обеспечения" destination="covered-liabilities-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.CoveredLiabilitiesRegister" table="covered_Liabilities_register">
|
||||
<coveredLiabilitiesRegister name="Реестр обязательств, прошедших процедуру контроля обеспечения" destination="covered-liabilities-registers" class="ru.clearing.classes.statics.data.register.CoveredLiabilitiesRegister" table="covered_Liabilities_register">
|
||||
<companyFullName type="2" length="255" name="Полное наименование компании" shortname="Полное наименование компании" searchable="true" sortable="true" visible="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
<securitySymbol type="2" length="255" name="Финансовый инструмент" shortname="Код биржевого инструмента / товара" searchable="true" sortable="true" visible="true"/>
|
||||
|
|
@ -1479,7 +1463,7 @@
|
|||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" visible="false"/>
|
||||
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" searchable="true" sortable="true" visible="false"/>
|
||||
</coveredLiabilitiesRegister>
|
||||
<moneyPaymentInstructionRegister name="Реестр распоряжений, направленных расчетной организации" destination="money-payment-instruction-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.MoneyPaymentInstructionRegister" table="money_payment_instruction_register">
|
||||
<moneyPaymentInstructionRegister name="Реестр распоряжений, направленных расчетной организации" destination="money-payment-instruction-registers" class="ru.clearing.classes.statics.data.register.MoneyPaymentInstructionRegister" table="money_payment_instruction_register">
|
||||
<creditLegAccount type="2" length="50" name="Счет отправителя" shortname="Счет отправителя" searchable="true" sortable="true" visible="true"/>
|
||||
<creditLegAmount type="10" name="Сумма отправителя" shortname="Сумма отправителя" searchable="true" sortable="true" visible="true"/>
|
||||
<creditLegCurrencyCode type="12" dbname="Код валюты отправителя" name="Наименование валюты отправителя" shortname="Валюта отправителя" searchable="true" sortable="true" visible="true" link="currency"/>
|
||||
|
|
@ -1491,7 +1475,7 @@
|
|||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
<clearingDate type="6" name="Дата расчета" shortname="Дата расчета" searchable="true" sortable="true" visible="true"/>
|
||||
</moneyPaymentInstructionRegister>
|
||||
<depoPaymentInstructionRegister name="Реестр распоряжений, направленных расчетному депозитарию" destination="depo-payment-instruction-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.DepoPaymentInstructionRegister" table="depo_payment_instruction_register">
|
||||
<depoPaymentInstructionRegister name="Реестр распоряжений, направленных расчетному депозитарию" destination="depo-payment-instruction-registers" class="ru.clearing.classes.statics.data.register.DepoPaymentInstructionRegister" table="depo_payment_instruction_register">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
|
|
@ -1503,7 +1487,7 @@
|
|||
<direction type="1" name="Направление" shortname="Направление" searchable="true" sortable="true" link="inOutDirection" ignore="true"/>
|
||||
<sessionId type="1" dbname="Идентификатор клиринговой сессии" name="Клиринговая сессия" shortname="Сессия" visible="true" searchable="true" sortable="true" link="session"/>
|
||||
</depoPaymentInstructionRegister>
|
||||
<excludeLiabilitiesRegister name="Реестр обязательств, исключенных из клирингового пула" destination="exclude-liabilities-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.ExcludeLiabilitiesRegister" table="exclude_liabilities_register">
|
||||
<excludeLiabilitiesRegister name="Реестр обязательств, исключенных из клирингового пула" destination="exclude-liabilities-registers" class="ru.clearing.classes.statics.data.register.ExcludeLiabilitiesRegister" table="exclude_liabilities_register">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
|
|
@ -1521,7 +1505,7 @@
|
|||
<sumLiabilities type="10" name="Сумма обязательств" shortname="Обязательства" searchable="true" sortable="true" visible="true"/>
|
||||
<settlementDate type="6" name="Дата расчета" shortname="Расчет" searchable="true" sortable="true"/>
|
||||
</excludeLiabilitiesRegister>
|
||||
<liabilitiesRegister name="Реестр учета обязательств" destination="liabilities-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.LiabilitiesRegister" table="liabilities_register">
|
||||
<liabilitiesRegister name="Реестр учета обязательств" destination="liabilities-registers" class="ru.clearing.classes.statics.data.register.LiabilitiesRegister" table="liabilities_register">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true" ignore="true"/>
|
||||
|
|
@ -1539,7 +1523,7 @@
|
|||
<sumLiabilities type="10" name="Сумма обязательств" shortname="Обязательства" searchable="true" sortable="true" visible="true"/>
|
||||
<settlementDate type="6" name="Дата расчета" shortname="Расчет" searchable="true" sortable="true"/>
|
||||
</liabilitiesRegister>
|
||||
<executionRegister name="Реестр сделок" destination="execution-registers" historyDestination="history" class="ru.clearing.classes.statics.data.register.ExecutionRegister" table="execution_register">
|
||||
<executionRegister name="Реестр сделок" destination="execution-registers" class="ru.clearing.classes.statics.data.register.ExecutionRegister" table="execution_register">
|
||||
<tradingDate type="6" name="Дата заключения сделки" shortname="Дата заключения сделки" visible="true" searchable="true" sortable="true"/>
|
||||
<exchangeExecutionId type="1" name="Идентификационный номер сделки в Торговой системе" shortname="Номер сделки" visible="true" searchable="true" sortable="true"/>
|
||||
<exchangeExecutionTime type="4" name="Время заключения сделки в Торговой системе" shortname="Время заключения сделки" visible="true" searchable="true" sortable="true"/>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ DROP TABLE IF EXISTS <xsl:value-of select="$dbTableName"/>;
|
|||
CREATE TABLE <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="*" mode="field"/>);
|
||||
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/> IS '<xsl:value-of select="$dbNameComment"/>';
|
||||
<xsl:apply-templates select="*" mode="comment-enums"/>
|
||||
GRANT ALL PRIVILEGES ON TABLE <xsl:value-of select="$dbTableName"/> TO clearing;
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
|
|
@ -54,7 +53,6 @@ DROP TABLE IF EXISTS <xsl:value-of select="$dbTableName"/>;
|
|||
CREATE TABLE <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="*[@name or @dbname or @type]" mode="field"/>);
|
||||
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/> IS '<xsl:value-of select="$dbNameTComment"/>';
|
||||
<xsl:apply-templates select="*[@name or @dbname or @type]" mode="comment-objects"/>
|
||||
GRANT ALL PRIVILEGES ON TABLE <xsl:value-of select="$dbTableName"/> TO clearing;
|
||||
<xsl:if test="@logUpdates">
|
||||
|
||||
-- History log of <xsl:value-of select="name()"/> - <xsl:value-of select="$dbNameTComment"/>
|
||||
|
|
@ -67,7 +65,6 @@ COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_TIME IS '
|
|||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_USER_ID IS 'Инициатор изменения';
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_TYPE IS 'Тип изменения';
|
||||
<xsl:apply-templates select="*[@name or @dbname or @type]" mode="comment-history-objects"/>
|
||||
GRANT ALL PRIVILEGES ON TABLE <xsl:value-of select="$dbTableName"/>_HISTORY TO clearing;
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ public class StateLoaderImplTestConfig {
|
|||
|
||||
@Bean(name = "stateLoaderImplTest")
|
||||
public StateLoaderImpl createStateLoaderImpl(@Qualifier("responseFactoryTest") GetResponseFactory responseFactory) {
|
||||
return new StateLoaderImpl(hazelcastServiceTest, null, responseFactory);
|
||||
return new StateLoaderImpl(hazelcastServiceTest, responseFactory);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,15 +81,11 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
|||
|
||||
|
||||
@ContextConfiguration(classes = {
|
||||
//account
|
||||
AccountController.class,
|
||||
BankAccountController.class,
|
||||
ClearingAccountController.class,
|
||||
DepoAccountController.class,
|
||||
//account misc
|
||||
ClientCodeController.class,
|
||||
AccountSymbolsController.class,
|
||||
//company
|
||||
CompanyRoleSetController.class,
|
||||
CompanyController.class,
|
||||
ClearingMemberCategoryController.class,
|
||||
|
|
@ -98,24 +94,18 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
|||
ContactController.class,
|
||||
ProfileDocumentController.class,
|
||||
RelationController.class,
|
||||
//execution
|
||||
ExecutionDepositController.class,
|
||||
ExecutionFondController.class,
|
||||
//journal
|
||||
InDocumentJournalController.class,
|
||||
ManagementJournalController.class,
|
||||
OutDocumentJournalController.class,
|
||||
//liabilities
|
||||
//misc
|
||||
CurrencyController.class,
|
||||
ErrorTextController.class,
|
||||
ListingController.class,
|
||||
MarketController.class,
|
||||
NotificationController.class,
|
||||
SessionController.class,
|
||||
//payment
|
||||
PaymentInstructionController.class,
|
||||
//register
|
||||
AdmittedLiabilitiesRegisterController.class,
|
||||
CoveredLiabilitiesRegisterController.class,
|
||||
DepoBalanceRegisterController.class,
|
||||
|
|
@ -126,16 +116,13 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
|||
MoneyBalanceRegisterController.class,
|
||||
ContractRegisterController.class,
|
||||
ReportRegisterController.class,
|
||||
//registry
|
||||
RegistryController.class,
|
||||
TradingClearingRegistryController.class,
|
||||
//scheduler
|
||||
ClearingCalendarController.class,
|
||||
LauncherController.class,
|
||||
PlannerAllTodayController.class,
|
||||
PlannerController.class,
|
||||
PlannerTemplateController.class,
|
||||
//securities
|
||||
MoneyMarketSecurityController.class,
|
||||
CouponPeriodController.class,
|
||||
EquitySecurityController.class,
|
||||
|
|
@ -143,13 +130,10 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
|||
FixedIncomeSecurityController.class,
|
||||
InformationAccountController.class,
|
||||
SecurityController.class,
|
||||
//user
|
||||
UserController.class,
|
||||
UserRoleSessionController.class,
|
||||
//utilities
|
||||
StatementController.class,
|
||||
UserSettingsController.class,
|
||||
//******* common configs *******
|
||||
WebTestConfig.class,
|
||||
IOperatorTest.class,
|
||||
HazelcastServiceTestConfiguration.class,
|
||||
|
|
@ -157,10 +141,8 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
|||
WebSecurityTestConfigurer.class,
|
||||
MessagesTestConfig.class,
|
||||
Jackson2HttpConverterTestConfig.class})
|
||||
//todo может быть указать пакедж а не список контроллеров
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebMvcTest
|
||||
//@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/")
|
||||
public abstract class AbstractControllerTest {
|
||||
protected static final MatcherFactoryWithJson.Matcher<BaseRequest> BASE_REQUEST_MATCHER = usingIgnoringFieldsComparatorForClass(BaseRequest.class,"userId");
|
||||
protected static final MatcherFactoryWithJson.Matcher<CudResponse> CUD_RESPONSE_MATCHER = usingIgnoringFieldsComparatorForClass(CudResponse.class);
|
||||
|
|
@ -201,8 +183,7 @@ public abstract class AbstractControllerTest {
|
|||
mockMvc = MockMvcBuilders
|
||||
.webAppContextSetup(webApplicationContext)
|
||||
.addFilter(CHARACTER_ENCODING_FILTER)
|
||||
// .apply(springSecurity())
|
||||
.build();
|
||||
.build();
|
||||
TestUtils.FutureRecordMetadata future = spy(TestUtils.FutureRecordMetadata.class);
|
||||
doReturn(future).when(producer).send(producerRecord.capture());
|
||||
userImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_User, User.class);
|
||||
|
|
@ -226,15 +207,12 @@ public abstract class AbstractControllerTest {
|
|||
CudResponse expected = new CudResponse();
|
||||
expected.setCode(0L);
|
||||
expected.setMessage("success");
|
||||
//ACT
|
||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(writeValue(action)))
|
||||
.andDo(print())//output to the log request and response
|
||||
//ASSERT
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
//.andExpect(content().json(writeValue(expected)))
|
||||
.andReturn();
|
||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
||||
|
|
@ -246,16 +224,12 @@ public abstract class AbstractControllerTest {
|
|||
expected.setCode(0L);
|
||||
expected.setMessage("success");
|
||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
|
||||
|
||||
//ACT
|
||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL + existsId)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(writeValue(action)))
|
||||
.andDo(print())//output to the log request and response
|
||||
//ASSERT
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
//.andExpect(content().json(writeValue(expected)));
|
||||
.andReturn();
|
||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
|
||||
|
|
@ -274,16 +248,12 @@ public abstract class AbstractControllerTest {
|
|||
expected.setCode(0L);
|
||||
expected.setMessage("success");
|
||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
|
||||
|
||||
//ACT
|
||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(writeValue(action)))
|
||||
.andDo(print())//output to the log request and response
|
||||
//ASSERT
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
//.andExpect(content().json(writeValue(expected)));
|
||||
.andReturn();
|
||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
|
||||
|
|
@ -297,15 +267,12 @@ public abstract class AbstractControllerTest {
|
|||
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, existsId));
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(existsId);
|
||||
//ACT
|
||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.delete(REST_URL + existsId)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())//output to the log request and response
|
||||
//ASSERT
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
// .andExpect(content().json(writeValue(expected)));
|
||||
.andReturn();
|
||||
.andReturn();
|
||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, cudResponseTest.getPayload().getId()));
|
||||
CUD_RESPONSE_MATCHER.assertMatch(cudResponseTest, expected);
|
||||
|
|
@ -321,18 +288,15 @@ public abstract class AbstractControllerTest {
|
|||
protected <T extends SpcexObjectBase> void checkGettingAllFromRestApi(String imdgDistributedNames, T existsObj, String restUrl) throws Exception {
|
||||
Class<T> clazz = (Class<T>) existsObj.getClass();
|
||||
Imdg<T> testingImdg = hazelcastServiceTest.getImdg(imdgDistributedNames, clazz);
|
||||
// ((ImdgHazelcast<T>)testingImdg).clear(); // предварительная очистка
|
||||
testingImdg.insert(existsObj);
|
||||
|
||||
Collection<T> values = testingImdg.getAllValues();
|
||||
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||
expected.fromEntity(all);
|
||||
//ACT
|
||||
perform(MockMvcRequestBuilders.get(restUrl)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())//output to the log request and response
|
||||
// ASSERT
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(content().json(writeValue(expected)));
|
||||
|
|
|
|||
|
|
@ -12,51 +12,28 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
|
|||
class AccountControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/accounting/accounts/";
|
||||
|
||||
/**
|
||||
* {@link AccountController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
||||
* Входной запрос /accounting/accounts/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
Account existBankAccount = new Account();
|
||||
existBankAccount.setAccountType("99");
|
||||
existBankAccount.setAccount("123456789123");
|
||||
existBankAccount.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Account, existBankAccount, REST_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link AccountController#add(AccountNewAction)} <br>
|
||||
* Тест проверяет получение сущности {@link AccountNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link AccountNewAction}:<br>
|
||||
*/
|
||||
@Test
|
||||
void add() throws Exception {
|
||||
//ARRANGE
|
||||
AccountNewAction accountNewAction = new AccountNewAction();
|
||||
accountNewAction.setStatus("ACTV");
|
||||
accountNewAction.setAccount("A11112222333");
|
||||
accountNewAction.setCompanyId(5L);
|
||||
accountNewAction.setAccountType("BANK");
|
||||
|
||||
//ACT and ASSERT
|
||||
checkAddingByRestApi(REST_URL, accountNewAction);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW, accountNewAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link AccountController#update(Long, AccountUpdateAction)} <br>
|
||||
* Тест проверяет получение сущности {@link AccountUpdateAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link AccountUpdateAction}:<br>
|
||||
*/
|
||||
@Test
|
||||
void update() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
AccountUpdateAction accountUpdateAction = new AccountUpdateAction();
|
||||
accountUpdateAction.setId(id);
|
||||
|
|
@ -65,27 +42,17 @@ class AccountControllerTest extends AbstractControllerTest {
|
|||
accountUpdateAction.setCompanyId(5L);
|
||||
accountUpdateAction.setAccountType("BANK");
|
||||
Account account = getAccount(id);
|
||||
|
||||
//ACT and ASSERT
|
||||
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
||||
REST_URL, accountUpdateAction, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE, accountUpdateAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link AccountController#delete(Long)} <br>
|
||||
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос /securities/account/{@link Long}: - 0L<br>
|
||||
*/
|
||||
@Test
|
||||
void delete() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
Account account = getAccount(id);
|
||||
|
||||
//ACT and ASSERT
|
||||
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
||||
REST_URL, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, deleteAction);
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
package ru.spcex.clearing.backendapi.controller.queue.account;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import ru.clearing.classes.statics.data.account.AccountSymbols;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountSymbolsNewAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
|
||||
|
||||
class AccountSymbolsControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/accounting/depo-accounts-symbols/";
|
||||
|
||||
/**
|
||||
* {@link AccountSymbolsController#add(AccountSymbolsNewAction)}<br>
|
||||
* Тест проверяет получение сущности {@link AccountSymbolsNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link AccountSymbolsNewAction}: {111L, "VALUE-1234"}
|
||||
*/
|
||||
@Test
|
||||
void add() throws Exception {
|
||||
//ARRANGE
|
||||
AccountSymbolsNewAction accountSymbolsNewAction = new AccountSymbolsNewAction();
|
||||
accountSymbolsNewAction.setAccountId(111L);
|
||||
accountSymbolsNewAction.setAccountSymbolValue("VALUE-1234");
|
||||
|
||||
//ACT and ASSERT
|
||||
checkAddingByRestApi(REST_URL, accountSymbolsNewAction);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_NEW, accountSymbolsNewAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link AccountSymbolsController#delete(Long)} <br>
|
||||
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос /accounting/depo-accounts-symbols/{@link Long}: - 0L<br>
|
||||
*/
|
||||
@Test
|
||||
void delete() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
//ACT and ASSERT
|
||||
checkDeletingByRestApi(REST_URL, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_DELETE, deleteAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClientCode.<br>
|
||||
* Входной запрос /client-codes/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
AccountSymbols existAccountSymbols = new AccountSymbols();
|
||||
existAccountSymbols.setAccountId(111L);
|
||||
existAccountSymbols.setAccountSymbolValue("AAABBBVVCD");
|
||||
existAccountSymbols.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_AccountSymbols, existAccountSymbols, REST_URL);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -9,13 +9,11 @@ import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
|||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetByIdResponse;
|
||||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -30,23 +28,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
|||
class BankAccountControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/accounting/bank-accounts/";
|
||||
|
||||
/**
|
||||
* {@link BankAccountController#add(BankAccountNewAction)}<br>
|
||||
* Тест проверяет получение сущности {@link BankAccountNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link BankAccountNewRequest}:<br>
|
||||
* {@link BankAccountNewRequest#bankIdentificationCode} - 044525776<br>
|
||||
* {@link BankAccountNewRequest#bankName} - Beta Money Bank<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccount} - 30101111111111111776<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccountName} - correspondent<br>
|
||||
* {@link BankAccountNewRequest#currency} - RUB<br>
|
||||
* {@link BankAccountNewRequest#destination} - destination<br>
|
||||
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 3664011397<br>
|
||||
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 01<br>
|
||||
* {@link BankAccountNewRequest#account} - 11111222223333344444<br>
|
||||
*/
|
||||
@Test
|
||||
void add() throws Exception {
|
||||
//ARRANGE
|
||||
BankAccountNewAction bankAccountNewAction = getBankAccountNewAction(
|
||||
0, "044525776",
|
||||
"Beta Money Bank",
|
||||
|
|
@ -57,26 +40,10 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
|||
"3664011397",
|
||||
"01",
|
||||
"11111222223333344444");
|
||||
|
||||
//ACT and ASSERT
|
||||
checkAddingByRestApi(REST_URL, bankAccountNewAction);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountController#add(BankAccountNewAction)}<br>
|
||||
* Тест проверяет работу валидации сущности {@link BankAccountNewAction} принятой по REST API для отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link BankAccountNewRequest}:<br>
|
||||
* {@link BankAccountNewRequest#bankIdentificationCode} - 044525776 или ""<br>
|
||||
* {@link BankAccountNewRequest#bankName} - Beta Money Bank или ""<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccount} - 30101111111111111776 или ""<br>
|
||||
* {@link BankAccountNewRequest#correspondentAccountName} - correspondent или ""<br>
|
||||
* {@link BankAccountNewRequest#currency} - RUB или ""<br>
|
||||
* {@link BankAccountNewRequest#destination} - destinatio или ""n<br>
|
||||
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 3664011397 или ""<br>
|
||||
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 01 или ""<br>
|
||||
* {@link BankAccountNewRequest#account} - 11111222223333344444 или ""<br>
|
||||
*/
|
||||
@Test
|
||||
void addWithException() {
|
||||
assertThrowsFor(getBankAccountNewAction(0, "", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", "11111222223333344444"));
|
||||
|
|
@ -90,22 +57,8 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
|||
assertThrowsFor(getBankAccountNewAction(0, "044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountController#update(Long, BankAccountUpdateAction)}<br>
|
||||
* Тест проверяет получение сущности {@link BankAccountUpdateAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link BankAccountUpdateAction}:<br>
|
||||
* {@link BankAccountUpdateAction#bankIdentificationCode} - 044525776<br>
|
||||
* {@link BankAccountUpdateAction#bankName} - Beta Money Bank<br>
|
||||
* {@link BankAccountUpdateAction#correspondentAccount} - 30101111111111111776<br>
|
||||
* {@link BankAccountUpdateAction#correspondentAccountName} - correspondent<br>
|
||||
* {@link BankAccountUpdateAction#currency} - RUB<br>
|
||||
* {@link BankAccountUpdateAction#destination} - destination<br>
|
||||
* {@link BankAccountUpdateAction#taxpayerIdentificationNumber} - 3664011397<br>
|
||||
* {@link BankAccountUpdateAction#taxRegistrationReasonCode} - 01<br>
|
||||
*/
|
||||
@Test
|
||||
void update() throws Exception {
|
||||
//ARRANGE
|
||||
long id = 0;
|
||||
BankAccountUpdateAction bankAccountUpdateAction = getBankAccountUpdateAction(
|
||||
id,
|
||||
|
|
@ -118,37 +71,21 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
|||
"3664011397",
|
||||
"01",
|
||||
"11111222223333344444");
|
||||
|
||||
//ACT and ASSERT
|
||||
checkUpdatingByRestApi(REST_URL, bankAccountUpdateAction, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_UPDATE, bankAccountUpdateAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountController#delete(Long)} <br>
|
||||
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос /accounting/bank-accounts/{@link Long}: - 0L<br>
|
||||
*/
|
||||
@Test
|
||||
void delete() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
//ACT and ASSERT
|
||||
checkDeletingByRestApi(REST_URL, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_BLOCK, deleteAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountController#getById(Long)} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
||||
* Входной запрос /accounting/bank-accounts/{@link Long}: - 0L <br>
|
||||
* Ответ BankAccountBackendGetById <br>
|
||||
*/
|
||||
@Test
|
||||
void getById() throws Exception {
|
||||
//ARRANGE
|
||||
BankAccount existBankAccount = new BankAccount();
|
||||
existBankAccount.setBankName("ooo tinkoff");
|
||||
existBankAccount.setBankIdentificationCode("99999");
|
||||
|
|
@ -164,7 +101,6 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
|||
inDocumentJournalImdg.insert(existBankAccount);
|
||||
|
||||
CommonGetByIdResponse expected = new CommonGetByIdResponse();
|
||||
//expected.getPayload().
|
||||
Map<String, Object> payload = new HashMap<>();
|
||||
payload.put("bankName", "ooo tinkoff");
|
||||
payload.put("bankIdentificationCode", "99999");
|
||||
|
|
@ -176,25 +112,16 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
|||
payload.put("taxRegistrationReasonCode", "886886");
|
||||
payload.put("id", existBankAccount.getId());
|
||||
expected.fromEntity(payload);
|
||||
//ACT
|
||||
perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId())
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())//output to the log request and response
|
||||
// ASSERT
|
||||
.andExpect(status().isOk())
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(content().json(writeValue(expected)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link BankAccountController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
||||
* Входной запрос /accounting/bank-accounts/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
BankAccount existBankAccount = new BankAccount();
|
||||
existBankAccount.setBankName("ooo tinkoff");
|
||||
existBankAccount.setBankIdentificationCode("99999");
|
||||
|
|
@ -205,8 +132,6 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
|||
existBankAccount.setTaxpayerIdentificationNumber("848484848484");
|
||||
existBankAccount.setTaxRegistrationReasonCode("886886");
|
||||
existBankAccount.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_BankAccount, existBankAccount, REST_URL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,22 +8,13 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
|||
class ClearingAccountControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/accounting/clearing-accounts/";
|
||||
|
||||
/**
|
||||
* {@link ClearingAccountController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingAccount.<br>
|
||||
* Входной запрос /securities/clearing-accounts/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
ClearingAccount existClearingAccount = new ClearingAccount();
|
||||
existClearingAccount.setAccountId(99L);
|
||||
existClearingAccount.setClearingAccountType("CATPE-1");
|
||||
existClearingAccount.setCompanyId(6L);
|
||||
existClearingAccount.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingAccount, existClearingAccount, REST_URL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,16 +22,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
|||
class ClientCodeControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/client-codes/";
|
||||
|
||||
/**
|
||||
* {@link ClientCodeController#add(ClientCodeNewAction)}<br>
|
||||
* Тест проверяет получение сущности {@link ClientCodeNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link ClientCodeNewRequest}:<br>
|
||||
* {@link ClientCodeNewRequest#} - 044525776<br>
|
||||
* ...
|
||||
*/
|
||||
@Test
|
||||
void add() throws Exception {
|
||||
//ARRANGE
|
||||
ClientCodeNewAction clientCodeNewAction = getClientCodeNewAction(
|
||||
0,
|
||||
"044525776",
|
||||
|
|
@ -40,24 +32,10 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
|||
1010L,
|
||||
1020L,
|
||||
1030L);
|
||||
|
||||
//ACT and ASSERT
|
||||
checkAddingByRestApi(REST_URL, clientCodeNewAction);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_NEW, clientCodeNewAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeController#add(ClientCodeNewAction)}<br>
|
||||
* Тест проверяет работу валидации сущности {@link ClientCodeNewAction} принятой по REST API для отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link ClientCodeNewAction}:<br>
|
||||
* {@link ClientCodeNewAction#id} - (generated)<br>
|
||||
* {@link ClientCodeNewAction#code} - "044525776" или null или ""<br>
|
||||
* {@link ClientCodeNewAction#status} - "ACTV"<br>
|
||||
* {@link ClientCodeNewAction#companyId} - 1000L или null<br>
|
||||
* {@link ClientCodeNewAction#depoAccountId} - 1010L<br>
|
||||
* {@link ClientCodeNewAction#moneyAccountId} - 1020L<br>
|
||||
* {@link ClientCodeNewAction#tradingClearingRegistryId} - 1030L<br>
|
||||
*/
|
||||
@Test
|
||||
void addWithException() {
|
||||
assertThrowsFor(getClientCodeNewAction(0, "", "ACTV", 1000L, 1010L, 1020L, 1030L));
|
||||
|
|
@ -65,21 +43,8 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
|||
assertThrowsFor(getClientCodeNewAction(0, "044525776", "ACTV", null, 1010L, 1020L, 1030L));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeController#update(Long, ClientCodeUpdateAction)}<br>
|
||||
* Тест проверяет получение сущности {@link ClientCodeUpdateAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link ClientCodeUpdateAction}:<br>
|
||||
* {@link ClientCodeUpdateAction#id} - (generated)<br>
|
||||
* {@link ClientCodeUpdateAction#code} - "044525776"<br>
|
||||
* {@link ClientCodeUpdateAction#status} - "ACTV"<br>
|
||||
* {@link ClientCodeUpdateAction#companyId} - 1000L<br>
|
||||
* {@link ClientCodeUpdateAction#depoAccountId} - 1010L<br>
|
||||
* {@link ClientCodeUpdateAction#moneyAccountId} - 1020L<br>
|
||||
* {@link ClientCodeUpdateAction#tradingClearingRegistryId} - 1030L<br>
|
||||
*/
|
||||
@Test
|
||||
void update() throws Exception {
|
||||
//ARRANGE
|
||||
long id = 0;
|
||||
ClientCodeUpdateAction clientCodeUpdateAction = getClientCodeUpdateAction(
|
||||
id,
|
||||
|
|
@ -89,37 +54,21 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
|||
1010L,
|
||||
1020L,
|
||||
1030L);
|
||||
|
||||
//ACT and ASSERT
|
||||
checkUpdatingByRestApi(REST_URL, clientCodeUpdateAction, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_UPDATE, clientCodeUpdateAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeController#delete(Long)} <br>
|
||||
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос /client-codes/{@link Long}: - 0L<br>
|
||||
*/
|
||||
@Test
|
||||
void delete() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
//ACT and ASSERT
|
||||
checkDeletingByRestApi(REST_URL, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_DELETE, deleteAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClientCodeController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClientCode.<br>
|
||||
* Входной запрос /client-codes/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
ClientCode existClientCode = new ClientCode();
|
||||
existClientCode.setCode("ooo tinkoff");
|
||||
existClientCode.setCompanyId(1000L);
|
||||
|
|
@ -130,8 +79,6 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
|||
existClientCode.setCreated(Instant.now());
|
||||
existClientCode.setUpdated(Instant.now());
|
||||
existClientCode.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClientCode, existClientCode, REST_URL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,22 +8,13 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
|||
class DepoAccountControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/accounting/depo-accounts/";
|
||||
|
||||
/**
|
||||
* {@link DepoAccountController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingAccount.<br>
|
||||
* Входной запрос /securities/depo-accounts/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
DepoAccount existDepoAccount = new DepoAccount();
|
||||
existDepoAccount.setAccountId(99L);
|
||||
existDepoAccount.setDepoAccountType("T1001");
|
||||
existDepoAccount.setCompanyId(6L);
|
||||
existDepoAccount.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoAccount, existDepoAccount, REST_URL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,28 +3,18 @@ package ru.spcex.clearing.backendapi.controller.queue.account;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.account.InformationAccountController;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
||||
class InformationAccountControllerTest extends AbstractControllerTest {
|
||||
public static final String REST_URL = "/accounting/information-accounts/";
|
||||
|
||||
/**
|
||||
* {@link InformationAccountController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API.<br>
|
||||
* Входной запрос /accounting/information-accounts/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
InformationAccount informationAccount = new InformationAccount();
|
||||
informationAccount.setId(currentId.get());
|
||||
informationAccount.setCompanyId(currentId.get());
|
||||
informationAccount.setClearingAccountId(currentId.get());
|
||||
informationAccount.setAccountId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InformationAccount, informationAccount, REST_URL);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,88 +20,44 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
|||
class ClearingMemberCategoryControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/clearing-member-categories/";
|
||||
|
||||
/**
|
||||
* {@link ClearingMemberCategoryController#add(ClearingMemberCategoryNewAction)}<br>
|
||||
* Тест проверяет получение сущности {@link ClearingMemberCategoryNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link ClearingMemberCategoryNewAction}:<br>
|
||||
* {@link ClearingMemberCategoryNewAction#clearingMemberCategory} - "Category"<br>
|
||||
* {@link ClearingMemberCategoryNewAction#companyId} - currentId<br>
|
||||
*/
|
||||
@Test
|
||||
void add() throws Exception {
|
||||
//ARRANGE
|
||||
ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction();
|
||||
clearingMemberCategoryNewAction.setClearingMemberCategory("Category");
|
||||
clearingMemberCategoryNewAction.setCompanyId(0L);
|
||||
|
||||
//ACT and ASSERT
|
||||
checkAddingByRestApi(REST_URL, clearingMemberCategoryNewAction);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_NEW, clearingMemberCategoryNewAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClearingMemberCategoryController#add(ClearingMemberCategoryNewAction)}<br>
|
||||
* Тест проверяет получение сущности {@link ClearingMemberCategoryNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link ClearingMemberCategoryNewAction}:<br>
|
||||
* {@link ClearingMemberCategoryNewAction#clearingMemberCategory} - "Category"<br>
|
||||
* {@link ClearingMemberCategoryNewAction#companyId} - currentId<br>
|
||||
*/
|
||||
// @Test валидации пока нет
|
||||
void addWithException() {
|
||||
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
||||
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClearingMemberCategoryController#update(Long, ClearingMemberCategoryUpdateAction)}<br>
|
||||
* Тест проверяет получение сущности {@link ClearingMemberCategoryUpdateAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link ClearingMemberCategoryUpdateAction}:<br>
|
||||
* {@link ClearingMemberCategoryUpdateAction#clearingMemberCategory} - Category<br>
|
||||
* {@link ClearingMemberCategoryUpdateAction#id} - currentId<br>
|
||||
*/
|
||||
@Test
|
||||
void update() throws Exception {
|
||||
//ARRANGE
|
||||
ClearingMemberCategoryUpdateAction clearingMemberCategoryUpdateAction = new ClearingMemberCategoryUpdateAction();
|
||||
clearingMemberCategoryUpdateAction.setClearingMemberCategory("Category");
|
||||
clearingMemberCategoryUpdateAction.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkUpdatingByRestApi(REST_URL, clearingMemberCategoryUpdateAction, clearingMemberCategoryUpdateAction.getId());
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE, clearingMemberCategoryUpdateAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClearingMemberCategoryController#delete(Long)} <br>
|
||||
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос /clearing-member-categories/{@link Long}: - currentId<br>
|
||||
*/
|
||||
@Test
|
||||
void delete() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
//ACT and ASSERT
|
||||
checkDeletingByRestApi(REST_URL, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE, deleteAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ClearingMemberCategoryController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingMemberCategory.<br>
|
||||
* Входной запрос /clearing-member-categories/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
ClearingMemberCategory clearingMemberCategory = new ClearingMemberCategory();
|
||||
clearingMemberCategory.setClearingMemberCategory("Category");
|
||||
clearingMemberCategory.setCompanyId(1000000L);
|
||||
clearingMemberCategory.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingMemberCategory, clearingMemberCategory, REST_URL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,41 +3,25 @@ package ru.spcex.clearing.backendapi.controller.queue.company;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.registry.TradingClearingRegistryController;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyNewAction;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.registry.TradingClearingRegistryNewAction;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
|
||||
|
||||
class CompanyControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/companies/";
|
||||
|
||||
/**
|
||||
* {@link CompanyController#delete(Long)} <br>
|
||||
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос /companies/{@link Long}: - 0L<br>
|
||||
*/
|
||||
@Test
|
||||
void delete() throws Exception {
|
||||
//ARRANGE
|
||||
long id = currentId.getAndIncrement();
|
||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||
deleteAction.setId(id);
|
||||
//ACT and ASSERT
|
||||
checkDeletingByRestApi(REST_URL, id);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_DELETE, deleteAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link CompanyController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.<br>
|
||||
* Входной запрос /companies <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
Company existCompany = new Company();
|
||||
existCompany.setTradingCode("ooo tinkoff");
|
||||
existCompany.setClearingCode("99999");
|
||||
|
|
@ -45,26 +29,12 @@ class CompanyControllerTest extends AbstractControllerTest {
|
|||
existCompany.setShortName("OOO ROGA I KOPITA");
|
||||
existCompany.setTradingCode("848484848484");
|
||||
existCompany.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Company, existCompany, REST_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link CompanyController#add(CompanyNewAction)}<br>
|
||||
* Тест проверяет создание сущности {@link CompanyNewAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link CompanyNewAction}:<br>
|
||||
* {@link CompanyNewAction#fullName "Full name"<br>
|
||||
* {@link CompanyNewAction#companySymbol "CLRC"<br>
|
||||
* {@link CompanyNewAction#companySymbolValue "NAME1"<br>
|
||||
* {@link CompanyNewAction#workflowStatus "ACTV"<br>
|
||||
*/
|
||||
@Test
|
||||
void add() throws Exception {
|
||||
//ARRANGE
|
||||
CompanyNewAction newAction = getCompanyNewAction();
|
||||
|
||||
//ACT and ASSERT
|
||||
checkAddingByRestApi(REST_URL, newAction);
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_NEW, newAction);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,51 +30,13 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
|||
class CompanyInfoControllerTest extends AbstractControllerTest {
|
||||
private static final String REST_URL = "/company-infos/";
|
||||
|
||||
/**
|
||||
* {@link CompanyInfoController#update(Long, CompanyInfoUpdateAction)}<br>
|
||||
* Тест проверяет получение сущности {@link CompanyInfoUpdateAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link CompanyInfoUpdateAction}:<br>
|
||||
* {@link CompanyInfoUpdateAction#workflowStatus} - ACTV<br>
|
||||
* {@link CompanyInfoUpdateAction#corporationSoleType} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#countryCode} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#description} - exists description<br>
|
||||
* {@link CompanyInfoUpdateAction#professionalSign} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#legalKind} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#organizationType} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#residence} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#shortNameEng} - exists shortNameEng<br>
|
||||
* {@link CompanyInfoUpdateAction#fullNameEng} - exists fullNameEng<br>
|
||||
* {@link CompanyInfoUpdateAction#shortName} - exists shortName<br>
|
||||
* {@link CompanyInfoUpdateAction#fullName} - exists fullName<br>
|
||||
* {@link CompanyInfoUpdateAction#id} - currentId<br>
|
||||
*/
|
||||
// @Test валидации пока нет
|
||||
void addWithException() {
|
||||
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
||||
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link CompanyInfoController#update(Long, CompanyInfoUpdateAction)}<br>
|
||||
* Тест проверяет получение сущности {@link CompanyInfoUpdateAction} по REST API и отправку в Apache Kafka.<br>
|
||||
* Входной запрос {@link CompanyInfoUpdateAction}:<br>
|
||||
* {@link CompanyInfoUpdateAction#workflowStatus} - ACTV<br>
|
||||
* {@link CompanyInfoUpdateAction#corporationSoleType} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#countryCode} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#description} - exists description<br>
|
||||
* {@link CompanyInfoUpdateAction#professionalSign} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#legalKind} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#organizationType} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#residence} - 0000<br>
|
||||
* {@link CompanyInfoUpdateAction#shortNameEng} - exists shortNameEng<br>
|
||||
* {@link CompanyInfoUpdateAction#fullNameEng} - exists fullNameEng<br>
|
||||
* {@link CompanyInfoUpdateAction#shortName} - exists shortName<br>
|
||||
* {@link CompanyInfoUpdateAction#fullName} - exists fullName<br>
|
||||
* {@link CompanyInfoUpdateAction#id} - currentId<br>
|
||||
*/
|
||||
@Test
|
||||
void update() throws Exception {
|
||||
//ARRANGE
|
||||
CompanyInfoUpdateAction companyInfoUpdateAction = new CompanyInfoUpdateAction();
|
||||
companyInfoUpdateAction.setWorkflowStatus("ACTV");
|
||||
companyInfoUpdateAction.setCorporationSoleType("0000");
|
||||
|
|
@ -89,21 +51,12 @@ class CompanyInfoControllerTest extends AbstractControllerTest {
|
|||
companyInfoUpdateAction.setShortName("exists shortName");
|
||||
companyInfoUpdateAction.setFullName("exists fullName");
|
||||
companyInfoUpdateAction.setId(currentId.get());
|
||||
|
||||
//ACT and ASSERT
|
||||
checkUpdatingByRestApi(REST_URL, companyInfoUpdateAction, companyInfoUpdateAction.getId());
|
||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_INFO_UPDATE, companyInfoUpdateAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link CompanyInfoController#getAll()} <br>
|
||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.<br>
|
||||
* Входной запрос /company-infos/ <br>
|
||||
* Ответ CommonGetAllResponse <br>
|
||||
*/
|
||||
@Test
|
||||
void getAll() throws Exception {
|
||||
//ARRANGE
|
||||
Long ID = 0L;
|
||||
CompanyInfo existsCompanyInfo = new CompanyInfo();
|
||||
existsCompanyInfo.setId(ID);
|
||||
|
|
@ -128,17 +81,15 @@ class CompanyInfoControllerTest extends AbstractControllerTest {
|
|||
Collection<Map<String, Object>> all = new ArrayList<>();
|
||||
Collection<Company> companies = companyImdg.getAllValues();
|
||||
for (Company company : companies) {
|
||||
if (company.getProfile() != null && company.getProfile().getId() != null) { // пока возвращает "пустой" CompanyInfo если его нет для Company
|
||||
if (company.getProfile() != null && company.getProfile().getId() != null) {
|
||||
all.add(responseFactory.responseFromObject(company.getProfile()));
|
||||
}
|
||||
}
|
||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||
expected.fromEntity(all);
|
||||
//ACT
|
||||
perform(MockMvcRequestBuilders.get(REST_URL)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())//output to the log request and response
|
||||
//ASSERT
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(content().json(writeValue(expected)));
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue