ClearingAccount in progress
This commit is contained in:
parent
5cefa961b1
commit
441546dd18
8 changed files with 289 additions and 17 deletions
|
|
@ -17,6 +17,7 @@ import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
import ru.spcex.platform.enumeration.AccountStatus;
|
import ru.spcex.platform.enumeration.AccountStatus;
|
||||||
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
|
@ -64,7 +65,10 @@ public class BankAccountValidationConfig {
|
||||||
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
ImdgPredicate accountValuePredicate = pb.equals("account", accountValue);
|
ImdgPredicate accountValuePredicate = pb.equals("account", accountValue);
|
||||||
ImdgPredicate accountStatusPredicate = pb.equals("status", AccountStatus.ACTIVE.getKey());
|
ImdgPredicate accountStatusPredicate = pb.equals("status", AccountStatus.ACTIVE.getKey());
|
||||||
ImdgPredicate finalPredicate = pb.and(accountValuePredicate, accountStatusPredicate);
|
ImdgPredicate accountTypePredicate = pb.equals("accountType", AccountType.Bank.getKey());
|
||||||
|
ImdgPredicate finalPredicate = pb.and(accountValuePredicate,
|
||||||
|
accountStatusPredicate,
|
||||||
|
accountTypePredicate);
|
||||||
Collection<Account> accounts = accountImdg.getCollectionObjectsByPredicate(finalPredicate);
|
Collection<Account> accounts = accountImdg.getCollectionObjectsByPredicate(finalPredicate);
|
||||||
if (accounts.isEmpty()) return null;
|
if (accounts.isEmpty()) return null;
|
||||||
return AccountError.AccountAlreadyExist;
|
return AccountError.AccountAlreadyExist;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,116 @@
|
||||||
package ru.spcex.clearing.account.config.validation;
|
package ru.spcex.clearing.account.config.validation;
|
||||||
|
|
||||||
|
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.company.Company;
|
||||||
|
import ru.spcex.clearing.account.errors.AccountError;
|
||||||
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClearingAccountNewRequest;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClearingAccountUpdateRequest;
|
||||||
|
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||||
|
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||||
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
import ru.spcex.platform.enumeration.AccountStatus;
|
||||||
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
|
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||||
|
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.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;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ClearingAccountValidationConfig {
|
public class ClearingAccountValidationConfig {
|
||||||
|
|
||||||
|
@Bean("clearingAccountNewRequestValidator")
|
||||||
|
public Function<ClearingAccountNewRequest, IValidator> clearingAccountNewRequestValidator(
|
||||||
|
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||||
|
) {
|
||||||
|
return clearingAccountNewRequest -> {
|
||||||
|
ImdgValidationContext<ClearingAccountNewRequest> context = new ImdgValidationContext<>();
|
||||||
|
context.setValidatedObject(clearingAccountNewRequest);
|
||||||
|
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||||
|
addImdg.accept(IMDGDistributedNames.Map_Company);
|
||||||
|
addImdg.accept(IMDGDistributedNames.Map_ClearingAccount);
|
||||||
|
return new ValidatorImpl<>(context,
|
||||||
|
IdPresentRule.instance("companyId",
|
||||||
|
ClearingAccountNewRequest::getCompanyId,
|
||||||
|
IMDGDistributedNames.Map_Company,
|
||||||
|
Company.class,
|
||||||
|
AccountError.RequiredFieldEmpty,
|
||||||
|
AccountError.CompanyNotFound,
|
||||||
|
company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null),
|
||||||
|
FieldRequiredRule.instance("account",
|
||||||
|
ClearingAccountNewRequest::getAccount,
|
||||||
|
AccountError.RequiredFieldEmpty,
|
||||||
|
accountValue -> {
|
||||||
|
Imdg<Account> accountImdg = context.obtainMap(
|
||||||
|
IMDGDistributedNames.Map_Account, Account.class
|
||||||
|
);
|
||||||
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
|
ImdgPredicate accountValuePredicate = pb.equals("account", accountValue);
|
||||||
|
ImdgPredicate accountStatusPredicate = pb.equals("status", AccountStatus.ACTIVE.getKey());
|
||||||
|
ImdgPredicate accountTypePredicate = pb.equals("accountType", AccountType.Clrn.getKey());
|
||||||
|
ImdgPredicate finalPredicate = pb.and(accountValuePredicate,
|
||||||
|
accountStatusPredicate,
|
||||||
|
accountTypePredicate);
|
||||||
|
Collection<Account> accounts = accountImdg.getCollectionObjectsByPredicate(finalPredicate);
|
||||||
|
if (!accounts.isEmpty()) return null;
|
||||||
|
return AccountError.AccountAlreadyExist;
|
||||||
|
}),
|
||||||
|
FieldRequiredRule.instance("clearingAccountType",
|
||||||
|
ClearingAccountNewRequest::getClearingAccountType,
|
||||||
|
AccountError.RequiredFieldEmpty)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean("clearingAccountUpdateRequestValidator")
|
||||||
|
public Function<ClearingAccountUpdateRequest, IValidator> clearingAccountUpdateRequestValidator(
|
||||||
|
Map<String, Imdg<? extends SpcexObjectBase>> imdgForValidation
|
||||||
|
) {
|
||||||
|
return clearingAccountUpdateRequest -> {
|
||||||
|
ImdgValidationContext<ClearingAccountUpdateRequest> context = new ImdgValidationContext<>();
|
||||||
|
context.setValidatedObject(clearingAccountUpdateRequest);
|
||||||
|
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||||
|
addImdg.accept(IMDGDistributedNames.Map_Company);
|
||||||
|
addImdg.accept(IMDGDistributedNames.Map_ClearingAccount);
|
||||||
|
return new ValidatorImpl<>(context,
|
||||||
|
IdPresentRule.instance("companyId",
|
||||||
|
ClearingAccountUpdateRequest::getCompanyId,
|
||||||
|
IMDGDistributedNames.Map_Company,
|
||||||
|
Company.class,
|
||||||
|
AccountError.RequiredFieldEmpty,
|
||||||
|
AccountError.CompanyNotFound,
|
||||||
|
company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null),
|
||||||
|
FieldRequiredRule.instance("account",
|
||||||
|
ClearingAccountUpdateRequest::getAccount,
|
||||||
|
AccountError.RequiredFieldEmpty,
|
||||||
|
accountValue -> {
|
||||||
|
Imdg<Account> accountImdg = context.obtainMap(
|
||||||
|
IMDGDistributedNames.Map_Account, Account.class
|
||||||
|
);
|
||||||
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
|
ImdgPredicate accountValuePredicate = pb.equals("account", accountValue);
|
||||||
|
ImdgPredicate accountStatusPredicate = pb.equals("status", AccountStatus.ACTIVE.getKey());
|
||||||
|
ImdgPredicate accountTypePredicate = pb.equals("accountType", AccountType.Clrn.getKey());
|
||||||
|
ImdgPredicate finalPredicate = pb.and(accountValuePredicate,
|
||||||
|
accountStatusPredicate,
|
||||||
|
accountTypePredicate);
|
||||||
|
Collection<Account> accounts = accountImdg.getCollectionObjectsByPredicate(finalPredicate);
|
||||||
|
if (accounts.isEmpty()) return AccountError.AccountNotFound;
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
|
||||||
bankAccount.setTaxRegistrationReasonCode(req.getTaxRegistrationReasonCode());
|
bankAccount.setTaxRegistrationReasonCode(req.getTaxRegistrationReasonCode());
|
||||||
bankAccount.setAccount(req.getAccount());
|
bankAccount.setAccount(req.getAccount());
|
||||||
bankAccount.setCompanyId(req.getCompanyId());
|
bankAccount.setCompanyId(req.getCompanyId());
|
||||||
bankAccount.setAccountId(account.getId());
|
bankAccount.setAccountId(accountId);
|
||||||
bankAccountId = bankAccountMap.insert(bankAccount);
|
bankAccountId = bankAccountMap.insert(bankAccount);
|
||||||
|
|
||||||
txOk = true;
|
txOk = true;
|
||||||
|
|
|
||||||
|
|
@ -6,41 +6,138 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
|
import ru.clearing.classes.statics.data.account.ClearingAccount;
|
||||||
|
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.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
|
||||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||||
|
import ru.spcex.platform.enumeration.AccountStatus;
|
||||||
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
|
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.validation.IValidator;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ClearingAccountService extends QueueConsumer implements InitializingBean {
|
public class ClearingAccountService extends QueueConsumer implements InitializingBean {
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final UserRoleVerification userRoleVerification;
|
private final AccountService accountService;
|
||||||
private final ValidationHelper validationHelper;
|
private final ValidationHelper validationHelper;
|
||||||
|
private final ImdgProvider imdgProvider;
|
||||||
|
private final Imdg<Account> accountImdg;
|
||||||
|
private final Imdg<ClearingAccount> clearingAccountImdg;
|
||||||
|
private final Function<ClearingAccountNewRequest, IValidator> clearingAccountNewRequestValidator;
|
||||||
|
private final Function<ClearingAccountUpdateRequest, IValidator> clearingAccountUpdateRequestValidator;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClearingAccountService(Consumer<String, Object> kafkaQueue,
|
public ClearingAccountService(Consumer<String, Object> kafkaQueue,
|
||||||
Producer<String, Object> kafkaResponseQueue,
|
Producer<String, Object> kafkaResponseQueue,
|
||||||
UserRoleVerification userRoleVerification,
|
AccountService accountService,
|
||||||
ValidationHelper validationHelper) {
|
ValidationHelper validationHelper,
|
||||||
|
ImdgProvider imdgProvider,
|
||||||
|
@Qualifier("clearingAccountNewRequestValidator")
|
||||||
|
Function<ClearingAccountNewRequest, IValidator> clearingAccountNewRequestValidator,
|
||||||
|
@Qualifier("clearingAccountUpdateRequestValidator")
|
||||||
|
Function<ClearingAccountUpdateRequest, IValidator> clearingAccountUpdateRequestValidator) {
|
||||||
super(kafkaQueue, kafkaResponseQueue);
|
super(kafkaQueue, kafkaResponseQueue);
|
||||||
this.userRoleVerification = userRoleVerification;
|
this.accountService = accountService;
|
||||||
this.validationHelper = validationHelper;
|
this.validationHelper = validationHelper;
|
||||||
|
this.imdgProvider = imdgProvider;
|
||||||
|
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
this.clearingAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
||||||
|
this.clearingAccountNewRequestValidator = clearingAccountNewRequestValidator;
|
||||||
|
this.clearingAccountUpdateRequestValidator = clearingAccountUpdateRequestValidator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
init();
|
init();
|
||||||
|
callback(ClearingAccountNewRequest.class)
|
||||||
|
.setFunction(this::clearingAccountNew)
|
||||||
|
.forDestination(Consts.DESTINATION_CLEARING_ACCOUNT_NEW, callbacks::put);
|
||||||
|
callback(ClearingAccountUpdateRequest.class)
|
||||||
|
.setFunction(this::clearingAccountUpdate)
|
||||||
|
.forDestination(Consts.DESTINATION_CLEARING_ACCOUNT_UPDATE, callbacks::put);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate clearingAccountNew() {
|
public RequestInfoUpdate clearingAccountNew(BaseRequest<ClearingAccountNewRequest> userRequest) {
|
||||||
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(
|
||||||
|
userRequest, clearingAccountNewRequestValidator
|
||||||
|
);
|
||||||
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
|
ClearingAccountNewRequest req = userRequest.getRequestPayload();
|
||||||
|
|
||||||
|
Instant now = Instant.now();
|
||||||
|
Account account = new Account();
|
||||||
|
account.setAccount(req.getAccount());
|
||||||
|
account.setAccountType(AccountType.Clrn.getKey());
|
||||||
|
account.setStatus(AccountStatus.ACTIVE.getKey());
|
||||||
|
account.setCompanyId(req.getCompanyId());
|
||||||
|
account.setCreated(now);
|
||||||
|
account.setUpdated(now);
|
||||||
|
requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId());
|
||||||
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
|
Long clearingAccountId = -1L;
|
||||||
|
Long accountId = -1L;
|
||||||
|
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
||||||
|
boolean txOk = false;
|
||||||
|
imdgTransaction.beginTransaction();
|
||||||
|
try {
|
||||||
|
accountId = accountImdg.insert(account);
|
||||||
|
|
||||||
|
ClearingAccount clearingAccount = new ClearingAccount();
|
||||||
|
clearingAccount.setCompanyId(req.getCompanyId());
|
||||||
|
clearingAccount.setAccountId(accountId);
|
||||||
|
clearingAccountId = clearingAccountImdg.insert(clearingAccount);
|
||||||
|
txOk = true;
|
||||||
|
} finally {
|
||||||
|
if (txOk) {
|
||||||
|
imdgTransaction.commitTransaction();
|
||||||
|
log.debug("successfully processed, new clearing account id {}, account id {}", clearingAccountId, accountId);
|
||||||
|
} else {
|
||||||
|
// todo выяснить, что возвращать из метода в этой ситуации
|
||||||
|
log.debug("failed insert, new clearing account id {}, new account id {} (if id = -1, insert is failed)",
|
||||||
|
clearingAccountId,
|
||||||
|
accountId);
|
||||||
|
imdgTransaction.rollbackTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate clearingAccountUpdate() {
|
public RequestInfoUpdate clearingAccountUpdate(BaseRequest<ClearingAccountUpdateRequest> userRequest) {
|
||||||
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(
|
||||||
|
userRequest, clearingAccountUpdateRequestValidator
|
||||||
|
);
|
||||||
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
|
ClearingAccountUpdateRequest req = userRequest.getRequestPayload();
|
||||||
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
|
ImdgPredicate accountValuePredicate = pb.equals("account", req.getAccount());
|
||||||
|
ImdgPredicate accountStatusPredicate = pb.equals("status", AccountStatus.ACTIVE.getKey());
|
||||||
|
ImdgPredicate accountTypePredicate = pb.equals("accountType", AccountType.Clrn.getKey());
|
||||||
|
ImdgPredicate finalPredicate = pb.and(accountValuePredicate,
|
||||||
|
accountStatusPredicate,
|
||||||
|
accountTypePredicate);
|
||||||
|
Account account = accountImdg.getCollectionObjectsByPredicate(finalPredicate).iterator().next();
|
||||||
|
Long accountId = account.getId();
|
||||||
|
|
||||||
|
ClearingAccount clearingAccount = clearingAccountImdg.getSingleObjectByFieldValues(Map.of("accountId", accountId));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import ru.spcex.clearing.platform.messaging.domain.cud.account.InformationAccoun
|
||||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||||
import ru.spcex.clearing.platform.messaging.service.Status;
|
import ru.spcex.clearing.platform.messaging.service.Status;
|
||||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
|
||||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||||
import ru.spcex.platform.enumeration.AccountStatus;
|
import ru.spcex.platform.enumeration.AccountStatus;
|
||||||
import ru.spcex.platform.enumeration.AccountType;
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
|
|
@ -40,7 +39,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final IMessageResolver messageResolver;
|
private final IMessageResolver messageResolver;
|
||||||
private final ImdgProvider imdgProvider;
|
private final ImdgProvider imdgProvider;
|
||||||
private final UserRoleVerification userRoleVerification;
|
|
||||||
private final ValidationHelper validationHelper;
|
private final ValidationHelper validationHelper;
|
||||||
private final AccountService accountService;
|
private final AccountService accountService;
|
||||||
private final Function<InformationAccountNewRequest, IValidator> infoAccountNewRequestValidator;
|
private final Function<InformationAccountNewRequest, IValidator> infoAccountNewRequestValidator;
|
||||||
|
|
@ -52,7 +50,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
Producer<String, Object> kafkaResponseQueue,
|
Producer<String, Object> kafkaResponseQueue,
|
||||||
IMessageResolver messageResolver,
|
IMessageResolver messageResolver,
|
||||||
ImdgProvider imdgProvider,
|
ImdgProvider imdgProvider,
|
||||||
UserRoleVerification userRoleVerification,
|
|
||||||
ValidationHelper validationHelper,
|
ValidationHelper validationHelper,
|
||||||
AccountService accountService,
|
AccountService accountService,
|
||||||
@Qualifier("informationAccountNewRequestValidator")
|
@Qualifier("informationAccountNewRequestValidator")
|
||||||
|
|
@ -60,7 +57,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
super(kafkaQueue, kafkaResponseQueue);
|
super(kafkaQueue, kafkaResponseQueue);
|
||||||
this.messageResolver = messageResolver;
|
this.messageResolver = messageResolver;
|
||||||
this.imdgProvider = imdgProvider;
|
this.imdgProvider = imdgProvider;
|
||||||
this.userRoleVerification = userRoleVerification;
|
|
||||||
this.validationHelper = validationHelper;
|
this.validationHelper = validationHelper;
|
||||||
this.accountService = accountService;
|
this.accountService = accountService;
|
||||||
this.infoAccountNewRequestValidator = infoAccountNewRequestValidator;
|
this.infoAccountNewRequestValidator = infoAccountNewRequestValidator;
|
||||||
|
|
@ -83,10 +79,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
public RequestInfoUpdate informationAccountNew(BaseRequest<InformationAccountNewRequest> userRequest) {
|
public RequestInfoUpdate informationAccountNew(BaseRequest<InformationAccountNewRequest> userRequest) {
|
||||||
log.debug("InformationAccountNewRequest received");
|
log.debug("InformationAccountNewRequest received");
|
||||||
|
|
||||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, infoAccountNewRequestValidator);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
|
||||||
|
|
||||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, infoAccountNewRequestValidator);
|
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ 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_CLEARING_ACCOUNT_NEW = "clearing-account-new";
|
||||||
|
String DESTINATION_CLEARING_ACCOUNT_UPDATE = "clearing-account-update";
|
||||||
|
|
||||||
String DESTINATION_INFORMATION_ACCOUNT_NEW = "information-account-new";
|
String DESTINATION_INFORMATION_ACCOUNT_NEW = "information-account-new";
|
||||||
|
|
||||||
String DESTINATION_CORRESPONDENT_ACCOUNT_NEW = "correspondent-account-new";
|
String DESTINATION_CORRESPONDENT_ACCOUNT_NEW = "correspondent-account-new";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package ru.spcex.clearing.platform.messaging.domain.cud.account;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ClearingAccountNewRequest {
|
||||||
|
@JsonProperty
|
||||||
|
public String account;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
public String clearingAccountType;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
public Long companyId;
|
||||||
|
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClearingAccountType() {
|
||||||
|
return clearingAccountType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClearingAccountType(String clearingAccountType) {
|
||||||
|
this.clearingAccountType = clearingAccountType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCompanyId() {
|
||||||
|
return companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyId(Long companyId) {
|
||||||
|
this.companyId = companyId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package ru.spcex.clearing.platform.messaging.domain.cud.account;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ClearingAccountUpdateRequest {
|
||||||
|
@JsonProperty
|
||||||
|
public String account;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
public Long companyId;
|
||||||
|
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCompanyId() {
|
||||||
|
return companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyId(Long companyId) {
|
||||||
|
this.companyId = companyId;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue