account service bug fix

This commit is contained in:
etreschenkov 2024-10-10 16:05:42 +03:00
parent 52fc4f50b1
commit 115fcc1aac
2 changed files with 5 additions and 5 deletions

View file

@ -169,7 +169,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
specialAnltAccId = anltAccount.getAccount().substring(anltAccount.getAccount().length() - 4);
}
Long infoSequenceId = informationAccountService.accountNextId(currencyCode, currencyCodeId);
Long infoSequenceId = informationAccountService.accountNextId(currencyCode, currencyCodeId, specialAnltAccId);
String accountValue = informationAccountService.generateInfoAccount(currencyCodeId, infoSequenceId, specialAnltAccId);
log.trace("New info-account SequenceId={} account={}", infoSequenceId, accountValue);
account.setAccount(accountValue);

View file

@ -237,7 +237,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
specialAnltAccId = anltAccount.getAccount().substring(anltAccount.getAccount().length() - 4);
}
Long newId = informationAccountImdg.nextIDSequenceFor();
Long infoSequenceId = accountNextId(currency, 810L); // требуется последовательность n+1
Long infoSequenceId = accountNextId(currency, 810L, "7000"); // требуется последовательность n+1
String accountValue = generateInfoAccount(810L, infoSequenceId, specialAnltAccId);
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
@ -309,7 +309,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
}
public synchronized Long accountNextId(String currency) {
return accountNextId(currency, 810L);
return accountNextId(currency, 810L, "7000");
}
/**
@ -318,7 +318,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
* @param
* @return infoCounter++
*/
public synchronized Long accountNextId(String currency, Long currencyCodeId) {
public synchronized Long accountNextId(String currency, Long currencyCodeId, String specialAnltAccId) {
String idWithTrailingZero = String.format("%03d", currencyCodeId);
if (currency == null)
currency = CurrencyCode.RUB.getKey(); // default
@ -342,7 +342,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
infoCounter = new AtomicLong(1);
log.debug("No account information on map. n={}", infoCounter.get());
} else {
Pattern accPattern = Pattern.compile("39911%s([0-9]{8})7000".formatted(idWithTrailingZero));
Pattern accPattern = Pattern.compile(("39911%s([0-9]{8})" + specialAnltAccId).formatted(idWithTrailingZero));
int maxN = 1;
int parsedCount = 0;
String lastAccount = null; // for debug