filled accountType
fix build account field
This commit is contained in:
parent
5739606f8b
commit
10fe89dd10
3 changed files with 36 additions and 26 deletions
|
|
@ -14,6 +14,7 @@ import ru.clearing.classes.statics.data.account.DepoAccount;
|
|||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
||||
import ru.clearing.classes.statics.data.company.relation.Relation;
|
||||
import ru.clearing.classes.statics.data.misc.Currency;
|
||||
import ru.spcex.clearing.account.errors.AccountError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
|
|
@ -51,6 +52,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
private final Imdg<Account> accountMap;
|
||||
private final Imdg<ClearingMemberCategory> clearingMemberCategoryMap;
|
||||
private final Imdg<Relation> relationMap;
|
||||
private final Imdg<Currency> currencyMap;
|
||||
private final KafkaSender kafkaSender;
|
||||
private final IMessageResolver messageResolver;
|
||||
private final UserRoleVerification userRoleVerification;
|
||||
|
|
@ -89,6 +91,9 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
this.relationMap = imdgProvider.getImdg(
|
||||
IMDGDistributedNames.Map_Relation, Relation.class
|
||||
);
|
||||
this.currencyMap = imdgProvider.getImdg(
|
||||
IMDGDistributedNames.Map_Currency, Currency.class
|
||||
);
|
||||
this.kafkaSender = kafkaSender;
|
||||
this.messageResolver = messageResolver;
|
||||
this.userRoleVerification = userRoleVerification;
|
||||
|
|
@ -130,6 +135,10 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
|
||||
CorrespondentAccountNewRequest req = userRequest.getRequestPayload();
|
||||
String currency = req.getCurrency() == null ? CurrencyCode.RUB.getKey() : req.getCurrency();
|
||||
Currency currencyByCode = currencyMap.getFirstObjectByPredicate(
|
||||
currencyMap.predicateBuilder().equals("currencyCode", currency)
|
||||
);
|
||||
Long currencyCodeId = CurrencyCode.RUB.getKey().equals(currency) ? 810 : currencyByCode.getId();
|
||||
|
||||
Instant now = Instant.now();
|
||||
Account account = new Account();
|
||||
|
|
@ -137,7 +146,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
|||
account.setAccount(req.getAccount());
|
||||
if (AccountType.Info.equalsByKey(req.getAccountType())) {
|
||||
Long infoSequenceId = informationAccountService.accountNextId(currency);
|
||||
String accountValue = informationAccountService.generateInfoAccount(infoSequenceId);
|
||||
String accountValue = informationAccountService.generateInfoAccount(currencyCodeId, infoSequenceId);
|
||||
log.trace("New info-account SequenceId={} account={}", infoSequenceId, accountValue);
|
||||
account.setAccount(accountValue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
|||
Instant now = Instant.now();
|
||||
Account account = new Account();
|
||||
account.setAccount(accountValue);
|
||||
account.setAccountType(AccountType.Clrn.getKey());
|
||||
account.setStatus(ServiceStatus.Active.getKey());
|
||||
if (accountValue.length() >= 7) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
|
||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||
Long infoSequenceId = accountNextId(currency);
|
||||
String accountValue = generateInfoAccount(infoSequenceId);
|
||||
String accountValue = generateInfoAccount(810L, infoSequenceId);
|
||||
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
||||
|
||||
ImdgPredicateBuilder accountPredicateBuilder = accountImdg.predicateBuilder();
|
||||
|
|
@ -217,7 +217,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
currency = CurrencyCode.RUB.getKey();
|
||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||
Long infoSequenceId = accountNextId(currency); // требуется последовательность n+1
|
||||
String accountValue = generateInfoAccount(infoSequenceId);
|
||||
String accountValue = generateInfoAccount(810L, infoSequenceId);
|
||||
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
||||
|
||||
Long anltAccountId = null;
|
||||
|
|
@ -301,8 +301,8 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
|||
kafkaSender.sendRequestToQueue(Consts.CREATE_NOTIFICATION_NCMP, request);
|
||||
}
|
||||
|
||||
public String generateInfoAccount(Long id) {
|
||||
return "%d%d%08d%d".formatted(39911, 810, id, 7000);
|
||||
public String generateInfoAccount(Long currencyCodeId, Long id) {
|
||||
return "%d%d%08d%d".formatted(39911, currencyCodeId, id, 7000);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue