fix names and add consts
This commit is contained in:
parent
ff992e6812
commit
67058ad32a
13 changed files with 151 additions and 100 deletions
|
|
@ -7,8 +7,8 @@ import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.platform.dictionary.AccountTypeDictionary;
|
import ru.clearing.platform.dictionary.AccountTypeDictionary;
|
||||||
import ru.spcex.clearing.account.errors.AccountError;
|
import ru.spcex.clearing.account.errors.AccountError;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountCorrespondentNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountCorrespondentUpdateRequest;
|
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.domain.cud.common.CommonDeleteRequest;
|
||||||
import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.EnumPresentRule;
|
import ru.spcex.clearing.validation.common.rules.EnumPresentRule;
|
||||||
|
|
@ -35,27 +35,27 @@ import java.util.function.Function;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class AccountValidationConfig {
|
public class AccountValidationConfig {
|
||||||
|
|
||||||
@Bean("accountCorrespondentNewRequestValidator")
|
@Bean("correspondentAccountNewRequestValidator")
|
||||||
public Function<AccountCorrespondentNewRequest, IValidator> accountCorrespondentNewRequestValidator(
|
public Function<CorrespondentAccountNewRequest, IValidator> correspondentAccountNewRequestValidator(
|
||||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||||
) {
|
) {
|
||||||
return accountCorrespondentNewRequest -> {
|
return correspondentAccountNewRequest -> {
|
||||||
ImdgValidationContext<AccountCorrespondentNewRequest> context = new ImdgValidationContext<>();
|
ImdgValidationContext<CorrespondentAccountNewRequest> context = new ImdgValidationContext<>();
|
||||||
context.setValidatedObject(accountCorrespondentNewRequest);
|
context.setValidatedObject(correspondentAccountNewRequest);
|
||||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||||
addImdg.accept(IMDGDistributedNames.Map_Company);
|
addImdg.accept(IMDGDistributedNames.Map_Company);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_Account);
|
addImdg.accept(IMDGDistributedNames.Map_Account);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_AccountTypeDictionary);
|
addImdg.accept(IMDGDistributedNames.Map_AccountTypeDictionary);
|
||||||
return new ValidatorImpl<>(context,
|
return new ValidatorImpl<>(context,
|
||||||
IdPresentRule.instance("companyId",
|
IdPresentRule.instance("companyId",
|
||||||
AccountCorrespondentNewRequest::getCompanyId,
|
CorrespondentAccountNewRequest::getCompanyId,
|
||||||
IMDGDistributedNames.Map_Company,
|
IMDGDistributedNames.Map_Company,
|
||||||
Company.class,
|
Company.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.CompanyNotFound,
|
AccountError.CompanyNotFound,
|
||||||
company -> WorkflowStatus.Active.getKey().equals(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive),
|
company -> WorkflowStatus.Active.getKey().equals(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive),
|
||||||
FieldRequiredRule.instance("account",
|
FieldRequiredRule.instance("account",
|
||||||
AccountCorrespondentNewRequest::getAccount,
|
CorrespondentAccountNewRequest::getAccount,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
accountValue -> {
|
accountValue -> {
|
||||||
Imdg<Account> accountImdg = context.obtainMap(
|
Imdg<Account> accountImdg = context.obtainMap(
|
||||||
|
|
@ -70,7 +70,7 @@ public class AccountValidationConfig {
|
||||||
return AccountError.AccountAlreadyExist;
|
return AccountError.AccountAlreadyExist;
|
||||||
}),
|
}),
|
||||||
FieldRequiredRule.instance("status",
|
FieldRequiredRule.instance("status",
|
||||||
AccountCorrespondentNewRequest::getStatus,
|
CorrespondentAccountNewRequest::getStatus,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
false,
|
false,
|
||||||
statusValue -> {
|
statusValue -> {
|
||||||
|
|
@ -79,12 +79,12 @@ public class AccountValidationConfig {
|
||||||
return AccountError.WrongFieldValue;
|
return AccountError.WrongFieldValue;
|
||||||
}),
|
}),
|
||||||
EnumPresentRule.instance("accountType",
|
EnumPresentRule.instance("accountType",
|
||||||
AccountCorrespondentNewRequest::getAccountType,
|
CorrespondentAccountNewRequest::getAccountType,
|
||||||
AccountType.values(),
|
AccountType.values(),
|
||||||
AccountError.WrongFieldValue,
|
AccountError.WrongFieldValue,
|
||||||
AccountError.RequiredFieldEmpty),
|
AccountError.RequiredFieldEmpty),
|
||||||
DictionaryPresentRule.instance("accountType",
|
DictionaryPresentRule.instance("accountType",
|
||||||
AccountCorrespondentNewRequest::getAccountType,
|
CorrespondentAccountNewRequest::getAccountType,
|
||||||
IMDGDistributedNames.Map_AccountTypeDictionary,
|
IMDGDistributedNames.Map_AccountTypeDictionary,
|
||||||
AccountTypeDictionary.class,
|
AccountTypeDictionary.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
|
|
@ -97,32 +97,32 @@ public class AccountValidationConfig {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("accountCorrespondentUpdateRequestValidator")
|
@Bean("correspondentAccountUpdateRequestValidator")
|
||||||
public Function<AccountCorrespondentUpdateRequest, IValidator> accountCorrespondentUpdateRequestValidator(
|
public Function<CorrespondentAccountUpdateRequest, IValidator> correspondentAccountUpdateRequestValidator(
|
||||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||||
) {
|
) {
|
||||||
return accountCorrespondentUpdateRequest -> {
|
return correspondentAccountUpdateRequest -> {
|
||||||
ImdgValidationContext<AccountCorrespondentUpdateRequest> context = new ImdgValidationContext<>();
|
ImdgValidationContext<CorrespondentAccountUpdateRequest> context = new ImdgValidationContext<>();
|
||||||
context.setValidatedObject(accountCorrespondentUpdateRequest);
|
context.setValidatedObject(correspondentAccountUpdateRequest);
|
||||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||||
addImdg.accept(IMDGDistributedNames.Map_Company);
|
addImdg.accept(IMDGDistributedNames.Map_Company);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_Account);
|
addImdg.accept(IMDGDistributedNames.Map_Account);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_AccountTypeDictionary);
|
addImdg.accept(IMDGDistributedNames.Map_AccountTypeDictionary);
|
||||||
return new ValidatorImpl<>(context,
|
return new ValidatorImpl<>(context,
|
||||||
IdPresentRule.instance("id",
|
IdPresentRule.instance("id",
|
||||||
AccountCorrespondentUpdateRequest::getId,
|
CorrespondentAccountUpdateRequest::getId,
|
||||||
IMDGDistributedNames.Map_Account,
|
IMDGDistributedNames.Map_Account,
|
||||||
Account.class,
|
Account.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.AccountNotFound,
|
AccountError.AccountNotFound,
|
||||||
account -> {
|
account -> {
|
||||||
String statusFromRequest = accountCorrespondentUpdateRequest.getStatus();
|
String statusFromRequest = correspondentAccountUpdateRequest.getStatus();
|
||||||
if (statusFromRequest != null && !statusFromRequest.equalsIgnoreCase(account.getStatus()))
|
if (statusFromRequest != null && !statusFromRequest.equalsIgnoreCase(account.getStatus()))
|
||||||
return AccountError.WrongFieldValue;
|
return AccountError.WrongFieldValue;
|
||||||
return null;
|
return null;
|
||||||
}),
|
}),
|
||||||
IdPresentRule.instance("companyId",
|
IdPresentRule.instance("companyId",
|
||||||
AccountCorrespondentUpdateRequest::getCompanyId,
|
CorrespondentAccountUpdateRequest::getCompanyId,
|
||||||
IMDGDistributedNames.Map_Company,
|
IMDGDistributedNames.Map_Company,
|
||||||
Company.class,
|
Company.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
|
|
@ -130,22 +130,22 @@ public class AccountValidationConfig {
|
||||||
false,
|
false,
|
||||||
company -> {
|
company -> {
|
||||||
IErrorEnumId error = WorkflowStatus.Active.getKey().equals(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive;
|
IErrorEnumId error = WorkflowStatus.Active.getKey().equals(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive;
|
||||||
error = Objects.equals(company.getId(), accountCorrespondentUpdateRequest.getCompanyId()) ? error : AccountError.WrongFieldValue;
|
error = Objects.equals(company.getId(), correspondentAccountUpdateRequest.getCompanyId()) ? error : AccountError.WrongFieldValue;
|
||||||
return error;
|
return error;
|
||||||
}),
|
}),
|
||||||
EnumPresentRule.instance("status",
|
EnumPresentRule.instance("status",
|
||||||
AccountCorrespondentUpdateRequest::getStatus,
|
CorrespondentAccountUpdateRequest::getStatus,
|
||||||
AccountStatus.values(),
|
AccountStatus.values(),
|
||||||
false,
|
false,
|
||||||
AccountError.WrongFieldValue,
|
AccountError.WrongFieldValue,
|
||||||
AccountError.RequiredFieldEmpty),
|
AccountError.RequiredFieldEmpty),
|
||||||
EnumPresentRule.instance("accountType",
|
EnumPresentRule.instance("accountType",
|
||||||
AccountCorrespondentUpdateRequest::getAccountType,
|
CorrespondentAccountUpdateRequest::getAccountType,
|
||||||
AccountType.values(),
|
AccountType.values(),
|
||||||
AccountError.WrongFieldValue,
|
AccountError.WrongFieldValue,
|
||||||
AccountError.RequiredFieldEmpty),
|
AccountError.RequiredFieldEmpty),
|
||||||
DictionaryPresentRule.instance("accountType",
|
DictionaryPresentRule.instance("accountType",
|
||||||
AccountCorrespondentUpdateRequest::getAccountType,
|
CorrespondentAccountUpdateRequest::getAccountType,
|
||||||
IMDGDistributedNames.Map_AccountTypeDictionary,
|
IMDGDistributedNames.Map_AccountTypeDictionary,
|
||||||
AccountTypeDictionary.class,
|
AccountTypeDictionary.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
|
|
@ -158,13 +158,13 @@ public class AccountValidationConfig {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("accountCorrespondentBlockRequestValidator")
|
@Bean("correspondentAccountBlockRequestValidator")
|
||||||
public Function<CommonDeleteRequest, IValidator> accountCorrespondentBlockRequestValidator(
|
public Function<CommonDeleteRequest, IValidator> correspondentAccountBlockRequestValidator(
|
||||||
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||||
) {
|
) {
|
||||||
return accountDeleteRequest -> {
|
return correspondentAccountBlockRequest -> {
|
||||||
ImdgValidationContext<CommonDeleteRequest> context = new ImdgValidationContext<>();
|
ImdgValidationContext<CommonDeleteRequest> context = new ImdgValidationContext<>();
|
||||||
context.setValidatedObject(accountDeleteRequest);
|
context.setValidatedObject(correspondentAccountBlockRequest);
|
||||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||||
addImdg.accept(IMDGDistributedNames.Map_Account);
|
addImdg.accept(IMDGDistributedNames.Map_Account);
|
||||||
return new ValidatorImpl<>(context,
|
return new ValidatorImpl<>(context,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package ru.spcex.clearing.account.config.validation;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ClearingAccountValidationConfig {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import ru.clearing.classes.statics.data.account.Account;
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
import ru.clearing.classes.statics.data.account.BankAccount;
|
import ru.clearing.classes.statics.data.account.BankAccount;
|
||||||
|
import ru.clearing.classes.statics.data.account.ClearingAccount;
|
||||||
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
|
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
|
||||||
|
|
@ -33,6 +34,7 @@ public class ValidationConfig {
|
||||||
addImdg.accept(IMDGDistributedNames.Map_AccountTypeDictionary, Account.class);
|
addImdg.accept(IMDGDistributedNames.Map_AccountTypeDictionary, Account.class);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_BankAccount, BankAccount.class);
|
addImdg.accept(IMDGDistributedNames.Map_BankAccount, BankAccount.class);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_CurrencyCodeDictionary, CurrencyCodeDictionary.class);
|
addImdg.accept(IMDGDistributedNames.Map_CurrencyCodeDictionary, CurrencyCodeDictionary.class);
|
||||||
|
addImdg.accept(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
||||||
|
|
||||||
return imdg;
|
return imdg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ import ru.spcex.clearing.account.errors.AccountError;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountCorrespondentNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountCorrespondentUpdateRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountUpdateRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdf01Request;
|
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.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.AccountSdfToStatementRequestPart;
|
import ru.spcex.clearing.platform.messaging.domain.cud.balance.AccountSdfToStatementRequestPart;
|
||||||
|
|
@ -57,8 +57,8 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
private final IMessageResolver messageResolver;
|
private final IMessageResolver messageResolver;
|
||||||
private final UserRoleVerification userRoleVerification;
|
private final UserRoleVerification userRoleVerification;
|
||||||
private final ValidationHelper validationHelper;
|
private final ValidationHelper validationHelper;
|
||||||
private final Function<AccountCorrespondentNewRequest, IValidator> accountNewRequestValidator;
|
private final Function<CorrespondentAccountNewRequest, IValidator> accountNewRequestValidator;
|
||||||
private final Function<AccountCorrespondentUpdateRequest, IValidator> accountUpdateRequestValidator;
|
private final Function<CorrespondentAccountUpdateRequest, IValidator> accountUpdateRequestValidator;
|
||||||
private final Function<CommonDeleteRequest, IValidator> accountBlockRequestValidator;
|
private final Function<CommonDeleteRequest, IValidator> accountBlockRequestValidator;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -69,11 +69,11 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
IMessageResolver messageResolver,
|
IMessageResolver messageResolver,
|
||||||
UserRoleVerification userRoleVerification,
|
UserRoleVerification userRoleVerification,
|
||||||
ValidationHelper validationHelper,
|
ValidationHelper validationHelper,
|
||||||
@Qualifier("accountCorrespondentNewRequestValidator")
|
@Qualifier("correspondentAccountNewRequestValidator")
|
||||||
Function<AccountCorrespondentNewRequest, IValidator> accountNewRequestValidator,
|
Function<CorrespondentAccountNewRequest, IValidator> accountNewRequestValidator,
|
||||||
@Qualifier("accountCorrespondentUpdateRequestValidator")
|
@Qualifier("correspondentAccountUpdateRequestValidator")
|
||||||
Function<AccountCorrespondentUpdateRequest, IValidator> accountUpdateRequestValidator,
|
Function<CorrespondentAccountUpdateRequest, IValidator> accountUpdateRequestValidator,
|
||||||
@Qualifier("accountCorrespondentBlockRequestValidator")
|
@Qualifier("correspondentAccountBlockRequestValidator")
|
||||||
Function<CommonDeleteRequest, IValidator> accountBlockRequestValidator) {
|
Function<CommonDeleteRequest, IValidator> accountBlockRequestValidator) {
|
||||||
super(kafkaQueue, kafkaProducer);
|
super(kafkaQueue, kafkaProducer);
|
||||||
this.accountMap = imdgProvider.getImdg(
|
this.accountMap = imdgProvider.getImdg(
|
||||||
|
|
@ -98,21 +98,21 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
callback(AccountSdf01Request.class)
|
callback(AccountSdf01Request.class)
|
||||||
.setConsumer(this::accountNewSdf01)
|
.setConsumer(this::accountNewSdf01)
|
||||||
.forDestination(Consts.ACCOUNT_NEW_SDF01, callbacks::put);
|
.forDestination(Consts.CLEARING_ACCOUNT_NEW_SDF01, callbacks::put);
|
||||||
callback(AccountCorrespondentNewRequest.class)
|
callback(CorrespondentAccountNewRequest.class)
|
||||||
.setConsumer(this::accountCorrespondentNew)
|
.setConsumer(this::accountCorrespondentNew)
|
||||||
.forDestination(Consts.DESTINATION_ACCOUNT_CORRESPONDENT_NEW, callbacks::put);
|
.forDestination(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW, callbacks::put);
|
||||||
callback(AccountCorrespondentUpdateRequest.class)
|
callback(CorrespondentAccountUpdateRequest.class)
|
||||||
.setConsumer(this::accountCorrespondentUpdate)
|
.setConsumer(this::correspondentAccountUpdate)
|
||||||
.forDestination(Consts.DESTINATION_ACCOUNT_CORRESPONDENT_UPDATE, callbacks::put);
|
.forDestination(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE, callbacks::put);
|
||||||
callback(CommonDeleteRequest.class)
|
callback(CommonDeleteRequest.class)
|
||||||
.setConsumer(this::accountCorrespondentBlock)
|
.setConsumer(this::correspondentAccountBlock)
|
||||||
.forDestination(Consts.DESTINATION_ACCOUNT_CORRESPONDENT_BLOCK, callbacks::put);
|
.forDestination(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, callbacks::put);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate accountCorrespondentNew(BaseRequest<AccountCorrespondentNewRequest> userRequest) {
|
public RequestInfoUpdate accountCorrespondentNew(BaseRequest<CorrespondentAccountNewRequest> userRequest) {
|
||||||
log.debug("AccountCorrespondentNewRequest received");
|
log.debug("CorrespondentAccountNewRequest received");
|
||||||
|
|
||||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
@ -120,42 +120,36 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, accountNewRequestValidator);
|
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, accountNewRequestValidator);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
AccountCorrespondentNewRequest req = userRequest.getRequestPayload();
|
CorrespondentAccountNewRequest req = userRequest.getRequestPayload();
|
||||||
|
|
||||||
Long companyId = req.getCompanyId();
|
Long companyId = req.getCompanyId();
|
||||||
ImdgPredicateBuilder clearingMemberCategoryPredicateBuilder = clearingMemberCategoryMap.predicateBuilder();
|
ImdgPredicateBuilder clearingMemberCategoryPredicateBuilder = clearingMemberCategoryMap.predicateBuilder();
|
||||||
ImdgPredicate companyIdEquals = clearingMemberCategoryPredicateBuilder.equals("companyId", companyId);
|
ImdgPredicate companyIdEquals = clearingMemberCategoryPredicateBuilder.equals("companyId", companyId);
|
||||||
Collection<ClearingMemberCategory> clearingMemberCategories = clearingMemberCategoryMap.getCollectionObjectsByPredicate(companyIdEquals);
|
Collection<ClearingMemberCategory> clearingMemberCategories = clearingMemberCategoryMap.getCollectionObjectsByPredicate(companyIdEquals);
|
||||||
|
|
||||||
// todo выяснить у репортера, что делать в такой ситуации (нужна ли отдельная ошибка)
|
if (clearingMemberCategories.isEmpty())
|
||||||
if (clearingMemberCategories.isEmpty()) {
|
|
||||||
return makeError(AccountError.ClearingCategoryNotFound, "clearingMemberCategory[companyId]", userRequest.getId());
|
return makeError(AccountError.ClearingCategoryNotFound, "clearingMemberCategory[companyId]", userRequest.getId());
|
||||||
}
|
if (clearingMemberCategories.size() > 1)
|
||||||
if (clearingMemberCategories.size() > 1) {
|
|
||||||
log.warn("ClearingMemberCategory for companyId {} contains multiply elements, use first", companyId);
|
log.warn("ClearingMemberCategory for companyId {} contains multiply elements, use first", companyId);
|
||||||
}
|
ClearingMemberCategory clearingMemberCategory = clearingMemberCategories.iterator().next();
|
||||||
|
|
||||||
ImdgPredicateBuilder relationPredicateBuilder = relationMap.predicateBuilder();
|
ImdgPredicateBuilder relationPredicateBuilder = relationMap.predicateBuilder();
|
||||||
ImdgPredicate consumerIdPredicate = relationPredicateBuilder.equals("consumerId", companyId);
|
ImdgPredicate consumerIdPredicate = relationPredicateBuilder.equals("consumerId", companyId);
|
||||||
ImdgPredicate servicePredicate = null;
|
ImdgPredicate servicePredicate = null;
|
||||||
ClearingMemberCategory clearingMemberCategory = clearingMemberCategories.iterator().next();
|
|
||||||
String clearingCategoryValue = clearingMemberCategory.getClearingMemberCategory();
|
String clearingCategoryValue = clearingMemberCategory.getClearingMemberCategory();
|
||||||
if (IEnumKey.contains(clearingCategoryValue, ClearingCategory.B, ClearingCategory.I, ClearingCategory.V)) {
|
if (IEnumKey.contains(clearingCategoryValue, ClearingCategory.B, ClearingCategory.I, ClearingCategory.V)) {
|
||||||
servicePredicate = relationPredicateBuilder.equals("service", ru.spcex.platform.enumeration.Service.MKR.getKey());
|
servicePredicate = relationPredicateBuilder.equals("service", ru.spcex.platform.enumeration.Service.MKR.getKey());
|
||||||
} else if (IEnumKey.contains(clearingCategoryValue, ClearingCategory.F, ClearingCategory.C)) {
|
} else if (IEnumKey.contains(clearingCategoryValue, ClearingCategory.F, ClearingCategory.C)) {
|
||||||
servicePredicate = relationPredicateBuilder.equals("service", ru.spcex.platform.enumeration.Service.FOND.getKey());
|
servicePredicate = relationPredicateBuilder.equals("service", ru.spcex.platform.enumeration.Service.FOND.getKey());
|
||||||
} else {
|
} else {
|
||||||
// todo выяснить у репортера, что делать в такой ситуации
|
|
||||||
return makeError(AccountError.ClearingCategoryNotFound, "relation[consumerId = companyId].service", userRequest.getId());
|
return makeError(AccountError.ClearingCategoryNotFound, "relation[consumerId = companyId].service", userRequest.getId());
|
||||||
}
|
}
|
||||||
ImdgPredicate finalRelationPredicate = relationPredicateBuilder.and(consumerIdPredicate, servicePredicate);
|
ImdgPredicate finalRelationPredicate = relationPredicateBuilder.and(consumerIdPredicate, servicePredicate);
|
||||||
Collection<Relation> relations = relationMap.getCollectionObjectsByPredicate(finalRelationPredicate);
|
Collection<Relation> relations = relationMap.getCollectionObjectsByPredicate(finalRelationPredicate);
|
||||||
if (relations.isEmpty()) {
|
|
||||||
return makeError(AccountError.WrongFieldValue, "companyId", userRequest.getId());
|
if (relations.isEmpty()) return makeError(AccountError.WrongFieldValue, "companyId", userRequest.getId());
|
||||||
}
|
if (relations.size() > 1)
|
||||||
if (relations.size() > 1) {
|
|
||||||
log.warn("Relation for consumerId {} contains multiply elements, use first", companyId);
|
log.warn("Relation for consumerId {} contains multiply elements, use first", companyId);
|
||||||
}
|
|
||||||
Relation relation = relations.iterator().next();
|
Relation relation = relations.iterator().next();
|
||||||
|
|
||||||
Collection<Account> companies = accountMap.getCollectionObjectsByFieldValues(Map.of("companyId", companyId));
|
Collection<Account> companies = accountMap.getCollectionObjectsByFieldValues(Map.of("companyId", companyId));
|
||||||
|
|
@ -176,8 +170,8 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate accountCorrespondentUpdate(BaseRequest<AccountCorrespondentUpdateRequest> userRequest) {
|
public RequestInfoUpdate correspondentAccountUpdate(BaseRequest<CorrespondentAccountUpdateRequest> userRequest) {
|
||||||
log.debug("AccountCorrespondentUpdateRequest received");
|
log.debug("CorrespondentAccountUpdateRequest received");
|
||||||
|
|
||||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
@ -185,7 +179,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, accountUpdateRequestValidator);
|
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, accountUpdateRequestValidator);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
AccountCorrespondentUpdateRequest request = userRequest.getRequestPayload();
|
CorrespondentAccountUpdateRequest request = userRequest.getRequestPayload();
|
||||||
|
|
||||||
Account account = accountMap.getSingleObjectByID(request.getId());
|
Account account = accountMap.getSingleObjectByID(request.getId());
|
||||||
|
|
||||||
|
|
@ -199,7 +193,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate accountCorrespondentBlock(BaseRequest<CommonDeleteRequest> userRequest) {
|
public RequestInfoUpdate correspondentAccountBlock(BaseRequest<CommonDeleteRequest> userRequest) {
|
||||||
log.debug("AccountBlockRequest received");
|
log.debug("AccountBlockRequest received");
|
||||||
|
|
||||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
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.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
|
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||||
|
import ru.spcex.clearing.util.security.UserRoleVerification;
|
||||||
|
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ClearingAccountService extends QueueConsumer implements InitializingBean {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
private final UserRoleVerification userRoleVerification;
|
||||||
|
private final ValidationHelper validationHelper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ClearingAccountService(Consumer<String, Object> kafkaQueue,
|
||||||
|
Producer<String, Object> kafkaResponseQueue,
|
||||||
|
UserRoleVerification userRoleVerification,
|
||||||
|
ValidationHelper validationHelper) {
|
||||||
|
super(kafkaQueue, kafkaResponseQueue);
|
||||||
|
this.userRoleVerification = userRoleVerification;
|
||||||
|
this.validationHelper = validationHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestInfoUpdate clearingAccountNew() {
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestInfoUpdate clearingAccountUpdate() {
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -29,8 +29,8 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountCorrespondentNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountCorrespondentUpdateRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountUpdateRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdf01Request;
|
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.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.AccountSdfToStatementRequestPart;
|
import ru.spcex.clearing.platform.messaging.domain.cud.balance.AccountSdfToStatementRequestPart;
|
||||||
|
|
@ -67,7 +67,7 @@ class AccountServiceTest {
|
||||||
public static final MatcherFactory.Matcher<Account> ACCOUNT_MATCHER = usingIgnoringFieldsComparator();
|
public static final MatcherFactory.Matcher<Account> ACCOUNT_MATCHER = usingIgnoringFieldsComparator();
|
||||||
public static final MatcherFactory.Matcher<RequestInfo> REQUEST_INFO_MATCHER_MATCHER = usingIgnoringFieldsComparator("created");
|
public static final MatcherFactory.Matcher<RequestInfo> REQUEST_INFO_MATCHER_MATCHER = usingIgnoringFieldsComparator("created");
|
||||||
private static final int PARTITION = 0;
|
private static final int PARTITION = 0;
|
||||||
private static final String TOPIC_ACCOUNT_NEW = Consts.ACCOUNT_NEW_SDF01;
|
private static final String TOPIC_ACCOUNT_NEW = Consts.CLEARING_ACCOUNT_NEW_SDF01;
|
||||||
private static final String account = "123456789123";
|
private static final String account = "123456789123";
|
||||||
private static final Long companyId = 0L;
|
private static final Long companyId = 0L;
|
||||||
private static final Long relationId = 0L;
|
private static final Long relationId = 0L;
|
||||||
|
|
@ -133,11 +133,11 @@ class AccountServiceTest {
|
||||||
void accountCorrespondentNew() {
|
void accountCorrespondentNew() {
|
||||||
String uniqueAccount = account + UUID.randomUUID();
|
String uniqueAccount = account + UUID.randomUUID();
|
||||||
|
|
||||||
AccountCorrespondentNewRequest accountCorrespondentNewRequest = new AccountCorrespondentNewRequest();
|
CorrespondentAccountNewRequest correspondentAccountNewRequest = new CorrespondentAccountNewRequest();
|
||||||
accountCorrespondentNewRequest.setAccount(uniqueAccount);
|
correspondentAccountNewRequest.setAccount(uniqueAccount);
|
||||||
accountCorrespondentNewRequest.setAccountType(AccountType.Corr.getKey());
|
correspondentAccountNewRequest.setAccountType(AccountType.Corr.getKey());
|
||||||
accountCorrespondentNewRequest.setCompanyId(companyId);
|
correspondentAccountNewRequest.setCompanyId(companyId);
|
||||||
accountCorrespondentNewRequest.setStatus(AccountStatus.ACTIVE.getKey());
|
correspondentAccountNewRequest.setStatus(AccountStatus.ACTIVE.getKey());
|
||||||
|
|
||||||
Account predictableAccount = new Account();
|
Account predictableAccount = new Account();
|
||||||
predictableAccount.setAccount(uniqueAccount);
|
predictableAccount.setAccount(uniqueAccount);
|
||||||
|
|
@ -147,10 +147,10 @@ class AccountServiceTest {
|
||||||
predictableAccount.setStatus(AccountStatus.ACTIVE.getKey());
|
predictableAccount.setStatus(AccountStatus.ACTIVE.getKey());
|
||||||
predictableAccount.setRelationId(relationId);
|
predictableAccount.setRelationId(relationId);
|
||||||
|
|
||||||
String jsonString = getJsonStringForNew(accountCorrespondentNewRequest, 0L);
|
String jsonString = getJsonStringForNew(correspondentAccountNewRequest, 0L);
|
||||||
|
|
||||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||||
Consts.DESTINATION_ACCOUNT_CORRESPONDENT_NEW,
|
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
@ -176,19 +176,19 @@ class AccountServiceTest {
|
||||||
existAccount.setCompanyId(companyId);
|
existAccount.setCompanyId(companyId);
|
||||||
Long accountId = accountImdg.insert(existAccount);
|
Long accountId = accountImdg.insert(existAccount);
|
||||||
|
|
||||||
AccountCorrespondentUpdateRequest accountCorrespondentUpdateRequest = new AccountCorrespondentUpdateRequest();
|
CorrespondentAccountUpdateRequest correspondentAccountUpdateRequest = new CorrespondentAccountUpdateRequest();
|
||||||
accountCorrespondentUpdateRequest.setAccount(updatedAccount);
|
correspondentAccountUpdateRequest.setAccount(updatedAccount);
|
||||||
accountCorrespondentUpdateRequest.setAccountType(AccountType.Corr.getKey());
|
correspondentAccountUpdateRequest.setAccountType(AccountType.Corr.getKey());
|
||||||
accountCorrespondentUpdateRequest.setStatus(AccountStatus.ACTIVE.getKey());
|
correspondentAccountUpdateRequest.setStatus(AccountStatus.ACTIVE.getKey());
|
||||||
accountCorrespondentUpdateRequest.setCompanyId(companyId);
|
correspondentAccountUpdateRequest.setCompanyId(companyId);
|
||||||
accountCorrespondentUpdateRequest.setId(accountId);
|
correspondentAccountUpdateRequest.setId(accountId);
|
||||||
|
|
||||||
|
|
||||||
String jsonString = getJsonStringForUPDATE(accountCorrespondentUpdateRequest, 0);
|
String jsonString = getJsonStringForUPDATE(correspondentAccountUpdateRequest, 0);
|
||||||
|
|
||||||
//ACT
|
//ACT
|
||||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||||
Consts.DESTINATION_ACCOUNT_CORRESPONDENT_UPDATE,
|
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
@ -220,7 +220,7 @@ class AccountServiceTest {
|
||||||
|
|
||||||
//ACT
|
//ACT
|
||||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||||
Consts.DESTINATION_ACCOUNT_CORRESPONDENT_BLOCK,
|
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public class AccountController extends AbstractQueueController {
|
||||||
public CudResponse add(
|
public CudResponse add(
|
||||||
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||||
@RequestBody AccountNewAction accountNewAction) throws ExecutionException, InterruptedException {
|
@RequestBody AccountNewAction accountNewAction) throws ExecutionException, InterruptedException {
|
||||||
return processRequest(Consts.DESTINATION_ACCOUNT_NEW, accountNewAction);
|
return processRequest(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW, accountNewAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "update account.")
|
@ApiOperation(value = "update account.")
|
||||||
|
|
@ -68,7 +68,7 @@ public class AccountController extends AbstractQueueController {
|
||||||
@ApiParam(value = "Новые значения полей объекта.", required = true)
|
@ApiParam(value = "Новые значения полей объекта.", required = true)
|
||||||
@RequestBody AccountUpdateAction accountUpdateAction) throws ExecutionException, InterruptedException {
|
@RequestBody AccountUpdateAction accountUpdateAction) throws ExecutionException, InterruptedException {
|
||||||
accountUpdateAction.setId(id);
|
accountUpdateAction.setId(id);
|
||||||
return processRequest(Consts.DESTINATION_ACCOUNT_UPDATE, accountUpdateAction);
|
return processRequest(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE, accountUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "delete account.")
|
@ApiOperation(value = "delete account.")
|
||||||
|
|
@ -79,7 +79,7 @@ public class AccountController extends AbstractQueueController {
|
||||||
@PathVariable("id") Long id) throws ExecutionException, InterruptedException {
|
@PathVariable("id") Long id) throws ExecutionException, InterruptedException {
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
return processRequest(Consts.DESTINATION_ACCOUNT_DELETE, deleteAction);
|
return processRequest(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, deleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class AccountControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
//ACT and ASSERT
|
//ACT and ASSERT
|
||||||
checkAddingByRestApi(REST_URL, accountNewAction);
|
checkAddingByRestApi(REST_URL, accountNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_ACCOUNT_NEW, accountNewAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW, accountNewAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -69,7 +69,7 @@ class AccountControllerTest extends AbstractControllerTest {
|
||||||
//ACT and ASSERT
|
//ACT and ASSERT
|
||||||
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
||||||
REST_URL, accountUpdateAction, id);
|
REST_URL, accountUpdateAction, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_ACCOUNT_UPDATE, accountUpdateAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE, accountUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -88,7 +88,7 @@ class AccountControllerTest extends AbstractControllerTest {
|
||||||
//ACT and ASSERT
|
//ACT and ASSERT
|
||||||
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
||||||
REST_URL, id);
|
REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_ACCOUNT_DELETE, deleteAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, deleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class StatementService extends QueueConsumer implements InitializingBean
|
||||||
exportRequest.setNameOfTable(service.exportTableName());
|
exportRequest.setNameOfTable(service.exportTableName());
|
||||||
kafkaReqProducer.sendRequestToQueue(Consts.EXPORT_PROCESS, exportRequest);
|
kafkaReqProducer.sendRequestToQueue(Consts.EXPORT_PROCESS, exportRequest);
|
||||||
} else {
|
} else {
|
||||||
kafkaReqProducer.sendRequestToQueue(Consts.ACCOUNT_NEW_SDF01, createAccountsRequest(statementRequest.getGroupId(), res.getAccountRequests()));
|
kafkaReqProducer.sendRequestToQueue(Consts.CLEARING_ACCOUNT_NEW_SDF01, createAccountsRequest(statementRequest.getGroupId(), res.getAccountRequests()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ class StatementServiceServiceTest extends AbstractServiceTest {
|
||||||
BaseRequest<Object> baseRequest = (BaseRequest<Object>) producerRecord.getValue().value();
|
BaseRequest<Object> baseRequest = (BaseRequest<Object>) producerRecord.getValue().value();
|
||||||
RequestInfo resultRequestInfo = requestInfoImdg.getSingleObjectByID(baseRequest.getId());
|
RequestInfo resultRequestInfo = requestInfoImdg.getSingleObjectByID(baseRequest.getId());
|
||||||
|
|
||||||
assertEquals(Consts.ACCOUNT_NEW_SDF01, producerRecord.getValue().topic());
|
assertEquals(Consts.CLEARING_ACCOUNT_NEW_SDF01, producerRecord.getValue().topic());
|
||||||
assertNotNull(baseRequest);
|
assertNotNull(baseRequest);
|
||||||
assertNotNull(resultRequestInfo);
|
assertNotNull(resultRequestInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,16 +54,17 @@ public interface Consts {
|
||||||
String DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE = "clearing-member-category-update";
|
String DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE = "clearing-member-category-update";
|
||||||
String DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE = "clearing-member-category-delete";
|
String DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE = "clearing-member-category-delete";
|
||||||
|
|
||||||
String DESTINATION_ACCOUNT_DELETE = "account-delete";
|
|
||||||
String DESTINATION_ACCOUNT_UPDATE = "account-update";
|
String DESTINATION_CORRESPONDENT_ACCOUNT_NEW = "correspondent-account-new";
|
||||||
String DESTINATION_ACCOUNT_NEW = "account-new";
|
String DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE = "correspondent-account-update";
|
||||||
|
String DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK = "correspondent-account-block";
|
||||||
|
|
||||||
String DESTINATION_BANK_ACCOUNT_DELETE = "bank-account-delete";
|
String DESTINATION_BANK_ACCOUNT_DELETE = "bank-account-delete";
|
||||||
String DESTINATION_BANK_ACCOUNT_UPDATE = "bank-account-update";
|
String DESTINATION_BANK_ACCOUNT_UPDATE = "bank-account-update";
|
||||||
String DESTINATION_BANK_ACCOUNT_NEW = "bank-account-new";
|
String DESTINATION_BANK_ACCOUNT_NEW = "bank-account-new";
|
||||||
|
|
||||||
String DESTINATION_ACCOUNT_CORRESPONDENT_NEW = "account-correspondent-new";
|
String CLEARING_ACCOUNT_NEW_SDF01 = "clearing-account-new-sdf01";
|
||||||
String DESTINATION_ACCOUNT_CORRESPONDENT_UPDATE = "account-correspondent-update";
|
String CLEARING_ACCOUNT_UPDATE_SDF52 = "clearing-account-update-sdf52";
|
||||||
String DESTINATION_ACCOUNT_CORRESPONDENT_BLOCK = "account-correspondent-block";
|
|
||||||
|
|
||||||
String DESTINATION_RELATION_UPDATE = "relation-update";
|
String DESTINATION_RELATION_UPDATE = "relation-update";
|
||||||
String DESTINATION_PROFILE_DOCUMENT_NEW = "profile-document-new";
|
String DESTINATION_PROFILE_DOCUMENT_NEW = "profile-document-new";
|
||||||
|
|
@ -91,7 +92,6 @@ public interface Consts {
|
||||||
String SDF03_PROCESS = "sdf03-process";
|
String SDF03_PROCESS = "sdf03-process";
|
||||||
String SDF11_PROCESS = "sdf11-process";
|
String SDF11_PROCESS = "sdf11-process";
|
||||||
String EXPORT_PROCESS = "export-process";
|
String EXPORT_PROCESS = "export-process";
|
||||||
String ACCOUNT_NEW_SDF01 = "account-new-sdf01";
|
|
||||||
String ACCOUNT_TERMINATION = "account-termination";
|
String ACCOUNT_TERMINATION = "account-termination";
|
||||||
String BALANCE_ACCOUNT_NEW = "balance-account-new";
|
String BALANCE_ACCOUNT_NEW = "balance-account-new";
|
||||||
String BALANCE_ACCOUNT_UPDATE = "balance-account-update";
|
String BALANCE_ACCOUNT_UPDATE = "balance-account-update";
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package ru.spcex.clearing.platform.messaging.domain.cud.account;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
public class AccountCorrespondentNewRequest {
|
public class CorrespondentAccountNewRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Long companyId;
|
public Long companyId;
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@ package ru.spcex.clearing.platform.messaging.domain.cud.account;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
public class AccountCorrespondentUpdateRequest {
|
public class CorrespondentAccountUpdateRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Long id;
|
public Long id;
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue