fix build account field
This commit is contained in:
parent
10fe89dd10
commit
6e2364d91c
2 changed files with 9 additions and 6 deletions
|
|
@ -145,7 +145,8 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
account.setCompanyId(req.getCompanyId());
|
account.setCompanyId(req.getCompanyId());
|
||||||
account.setAccount(req.getAccount());
|
account.setAccount(req.getAccount());
|
||||||
if (AccountType.Info.equalsByKey(req.getAccountType())) {
|
if (AccountType.Info.equalsByKey(req.getAccountType())) {
|
||||||
Long infoSequenceId = informationAccountService.accountNextId(currency);
|
Long infoSequenceId = informationAccountService.accountNextId(currency, currencyCodeId);
|
||||||
|
|
||||||
String accountValue = informationAccountService.generateInfoAccount(currencyCodeId, infoSequenceId);
|
String accountValue = informationAccountService.generateInfoAccount(currencyCodeId, infoSequenceId);
|
||||||
log.trace("New info-account SequenceId={} account={}", infoSequenceId, accountValue);
|
log.trace("New info-account SequenceId={} account={}", infoSequenceId, accountValue);
|
||||||
account.setAccount(accountValue);
|
account.setAccount(accountValue);
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
String currency = req.getCurrency() == null ? CurrencyCode.RUB.getKey() : req.getCurrency(); //userRequest.getRequestPayload().getCurrency();
|
String currency = req.getCurrency() == null ? CurrencyCode.RUB.getKey() : req.getCurrency(); //userRequest.getRequestPayload().getCurrency();
|
||||||
|
|
||||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||||
Long infoSequenceId = accountNextId(currency);
|
Long infoSequenceId = accountNextId(currency, 810L);
|
||||||
String accountValue = generateInfoAccount(810L, infoSequenceId);
|
String accountValue = generateInfoAccount(810L, infoSequenceId);
|
||||||
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
||||||
|
|
||||||
|
|
@ -216,7 +216,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
if (currency == null)
|
if (currency == null)
|
||||||
currency = CurrencyCode.RUB.getKey();
|
currency = CurrencyCode.RUB.getKey();
|
||||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||||
Long infoSequenceId = accountNextId(currency); // требуется последовательность n+1
|
Long infoSequenceId = accountNextId(currency, 810L); // требуется последовательность n+1
|
||||||
String accountValue = generateInfoAccount(810L, infoSequenceId);
|
String accountValue = generateInfoAccount(810L, infoSequenceId);
|
||||||
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
||||||
|
|
||||||
|
|
@ -305,14 +305,16 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
return "%d%d%08d%d".formatted(39911, currencyCodeId, id, 7000);
|
return "%d%d%08d%d".formatted(39911, currencyCodeId, id, 7000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized Long accountNextId(String currency) {
|
||||||
|
return accountNextId(currency, 810L);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Сквозной номер инфо-счетов
|
* Сквозной номер инфо-счетов
|
||||||
*
|
*
|
||||||
* @param
|
* @param
|
||||||
* @return infoCounter++
|
* @return infoCounter++
|
||||||
*/
|
*/
|
||||||
public synchronized Long accountNextId(String currency) {
|
public synchronized Long accountNextId(String currency, Long currencyCodeId) {
|
||||||
if (currency == null)
|
if (currency == null)
|
||||||
currency = CurrencyCode.RUB.getKey(); // default
|
currency = CurrencyCode.RUB.getKey(); // default
|
||||||
AtomicLong infoCounter = infoCounterByCurrency.get(currency);
|
AtomicLong infoCounter = infoCounterByCurrency.get(currency);
|
||||||
|
|
@ -327,7 +329,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
infoCounter = new AtomicLong(1);
|
infoCounter = new AtomicLong(1);
|
||||||
log.debug("No account information on map. n={}", infoCounter.get());
|
log.debug("No account information on map. n={}", infoCounter.get());
|
||||||
} else {
|
} else {
|
||||||
Pattern accPattern = Pattern.compile("39911810([0-9]{8})7000");
|
Pattern accPattern = Pattern.compile("39911%d[0-9]{8})7000".formatted(currencyCodeId));
|
||||||
int maxN = 1;
|
int maxN = 1;
|
||||||
int parsedCount = 0;
|
int parsedCount = 0;
|
||||||
String lastAccount = null; // for debug
|
String lastAccount = null; // for debug
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue