по sdf01 и sdf52 в случае если currencyId из счета == 810, то это всегда RUB

This commit is contained in:
etreschenkov 2024-07-10 18:02:24 +03:00
parent 3bf8c690a5
commit d6865f8395

View file

@ -52,6 +52,7 @@ import ru.spcex.clearing.validation.common.ValidationHelper;
import ru.spcex.platform.enumeration.AccountStatus;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.ClearingAccountType;
import ru.spcex.platform.enumeration.CurrencyCode;
import ru.spcex.platform.enumeration.NotificationStatus;
import ru.spcex.platform.enumeration.ObjectType;
import ru.spcex.platform.enumeration.Priority;
@ -281,8 +282,15 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
Account account = new Account();
try {
Long currencyId = Long.valueOf(accountReq.getAccount().substring(5, 8));
Currency currency = currImdg.getSingleObjectByID(currencyId);
account.setCurrency(currency.getCurrencyCode());
String currencyCode = CurrencyCode.RUB.getKey();
if (!currencyId.equals(810L)){
Currency currency = currImdg.getSingleObjectByID(currencyId);
currencyCode = currency != null ? currency.getCurrencyCode() : null;
}
if (currencyCode == null){
throw new IllegalArgumentException("Not found currency by id " + currencyId);
}
account.setCurrency(currencyCode);
} catch (Throwable e) {
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
responsePart.setSdfId(accountReq.getSdfId());
@ -414,10 +422,18 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
if (accountValue.length() >= 7) {
try {
Long currencyId = Long.valueOf(accountValue.substring(5, 8));
Currency currency = currImdg.getSingleObjectByID(currencyId);
account.setCurrency(currency.getCurrencyCode());
String currencyCode = CurrencyCode.RUB.getKey();
if (!currencyId.equals(810L)){
Currency currency = currImdg.getSingleObjectByID(currencyId);
currencyCode = currency != null ? currency.getCurrencyCode() : null;
}
if (currencyCode == null){
throw new IllegalArgumentException("Not found currency by id " + currencyId);
}
account.setCurrency(currencyCode);
} catch (Throwable e) {
log.trace("When obtain currency from accountValue: {}", e.toString());
return null;
}
}
if (TextUtil.isEmpty(account.getCurrency())) {