send eks account
This commit is contained in:
parent
7c655c2c18
commit
06cd123666
1 changed files with 22 additions and 2 deletions
|
|
@ -49,7 +49,9 @@ import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
import ru.spcex.clearing.util.security.UserRoleVerification;
|
||||||
import ru.spcex.clearing.util.services.RequestHelper;
|
import ru.spcex.clearing.util.services.RequestHelper;
|
||||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||||
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
import ru.spcex.platform.enumeration.CompanySymbol;
|
import ru.spcex.platform.enumeration.CompanySymbol;
|
||||||
|
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||||
import ru.spcex.platform.enumeration.ServiceStatus;
|
import ru.spcex.platform.enumeration.ServiceStatus;
|
||||||
import ru.spcex.platform.enumeration.Status;
|
import ru.spcex.platform.enumeration.Status;
|
||||||
import static ru.spcex.platform.enumeration.Task.makeFiles_MTCR;
|
import static ru.spcex.platform.enumeration.Task.makeFiles_MTCR;
|
||||||
|
|
@ -460,13 +462,13 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "MoneyAccountId", req.getMoneyAccountId());
|
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "MoneyAccountId", req.getMoneyAccountId());
|
||||||
}
|
}
|
||||||
if (tradingClearingRegistry.getDepoAccountId() != null && // но можно с null заменить
|
if (tradingClearingRegistry.getDepoAccountId() != null && // но можно с null заменить
|
||||||
req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())) {
|
req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())) {
|
||||||
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "DepoAccountId", req.getDepoAccountId());
|
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "DepoAccountId", req.getDepoAccountId());
|
||||||
}
|
}
|
||||||
// tradingClearingRegistry.setMoneyAccountId(req.getMoneyAccountId());
|
// tradingClearingRegistry.setMoneyAccountId(req.getMoneyAccountId());
|
||||||
|
|
||||||
if (req.getStatus() != null && !Objects.equals(req.getStatus(), tradingClearingRegistry.getStatus())
|
if (req.getStatus() != null && !Objects.equals(req.getStatus(), tradingClearingRegistry.getStatus())
|
||||||
|| req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())
|
|| req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())
|
||||||
) {
|
) {
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
tradingClearingRegistry.setUpdated(now);
|
tradingClearingRegistry.setUpdated(now);
|
||||||
|
|
@ -586,6 +588,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
MoneyAccountMsgResponse moneyAccountMsg = new MoneyAccountMsgResponse();
|
MoneyAccountMsgResponse moneyAccountMsg = new MoneyAccountMsgResponse();
|
||||||
moneyAccountMsg.setAccount(moneyAccount.getAccount());
|
moneyAccountMsg.setAccount(moneyAccount.getAccount());
|
||||||
moneyAccountMsg.setCurrCode(StringUtils.hasText(moneyAccount.getCurrency()) ? moneyAccount.getCurrency() : "RUB");
|
moneyAccountMsg.setCurrCode(StringUtils.hasText(moneyAccount.getCurrency()) ? moneyAccount.getCurrency() : "RUB");
|
||||||
|
getEksAccount(moneyAccount).ifPresent(moneyAccountMsg::setEksAccount);
|
||||||
moneyAccountMsg.setActive(Status.Active.equalsByKey(moneyAccount.getStatus()));
|
moneyAccountMsg.setActive(Status.Active.equalsByKey(moneyAccount.getStatus()));
|
||||||
tkr.getMoneyAccounts().add(moneyAccountMsg);
|
tkr.getMoneyAccounts().add(moneyAccountMsg);
|
||||||
}
|
}
|
||||||
|
|
@ -600,6 +603,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
Account additionalAcc = accountImdg.getSingleObjectByID(tkrList.getAccountId());
|
Account additionalAcc = accountImdg.getSingleObjectByID(tkrList.getAccountId());
|
||||||
MoneyAccountMsgResponse moneyAccountMsg = new MoneyAccountMsgResponse();
|
MoneyAccountMsgResponse moneyAccountMsg = new MoneyAccountMsgResponse();
|
||||||
moneyAccountMsg.setAccount(additionalAcc.getAccount());
|
moneyAccountMsg.setAccount(additionalAcc.getAccount());
|
||||||
|
getEksAccount(additionalAcc).ifPresent(moneyAccountMsg::setEksAccount);
|
||||||
moneyAccountMsg.setCurrCode(StringUtils.hasText(additionalAcc.getCurrency()) ? additionalAcc.getCurrency() : "RUB");
|
moneyAccountMsg.setCurrCode(StringUtils.hasText(additionalAcc.getCurrency()) ? additionalAcc.getCurrency() : "RUB");
|
||||||
moneyAccountMsg.setActive(Status.Active.equalsByKey(additionalAcc.getStatus()));
|
moneyAccountMsg.setActive(Status.Active.equalsByKey(additionalAcc.getStatus()));
|
||||||
tkr.getMoneyAccounts().add(moneyAccountMsg);
|
tkr.getMoneyAccounts().add(moneyAccountMsg);
|
||||||
|
|
@ -610,6 +614,22 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Optional<String> getEksAccount(Account account) {
|
||||||
|
if (AccountType.Info.equalsByKey(account.getAccountType())) {
|
||||||
|
String currency = StringUtils.hasText(account.getCurrency()) ? account.getCurrency() : CurrencyCode.RUB.getKey();
|
||||||
|
Account anltAcc = accountImdg.getFirstObjectByFieldValues(
|
||||||
|
Map.of(
|
||||||
|
"currency", currency,
|
||||||
|
"accountType", AccountType.Anlt.getKey()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (anltAcc != null) {
|
||||||
|
return Optional.of(anltAcc.getAccount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* company-service сообщение об успешном добавлении ТКР клиента с параметром tradingClearingRegistry.code
|
* company-service сообщение об успешном добавлении ТКР клиента с параметром tradingClearingRegistry.code
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue