This commit is contained in:
AKurakin 2023-10-10 20:00:58 +03:00
parent dc3ea5d48a
commit 3eaa2a9ac6
5 changed files with 40 additions and 12 deletions

View file

@ -171,7 +171,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
} else if (AccountType.Info.equalsByKey(account.getAccountType()))
makeInfoPart(imdgTransaction, account);
else if (AccountType.Depo.equalsByKey(account.getAccountType()))
makeDepoPart(imdgTransaction, account);
makeDepoPart(imdgTransaction, account, req);
else if (AccountType.Clrn.equalsByKey(account.getAccountType()))
makeClrnPart(imdgTransaction, account);
else {
@ -210,17 +210,22 @@ public class AccountService extends QueueConsumer implements InitializingBean {
log.debug("For account id={} make InformationAccount id={}", account.getId(), infoId);
}
protected void makeDepoPart(ImdgTransaction imdgTransaction, Account account) {
Imdg<DepoAccount> depoAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);;
protected void makeDepoPart(ImdgTransaction imdgTransaction, Account account, CorrespondentAccountNewRequest req) {
Imdg<DepoAccount> depoAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
DepoAccount depoAcc = new DepoAccount();
depoAcc.setAccountId(account.getId());
depoAcc.setCompanyId(account.getCompanyId());
if (account.getAccount() != null && account.getAccount().contains("BC")) {
depoAcc.setDepoAccountType(DepoAccountType.C.getKey());
} else {
//todo в реквесте нет поля depoAcc.setDepoAccountType(req.getDepoAccountType());
}
Long depoId = depoAccountMap.insert(depoAcc);
log.debug("For account id={} make DepoAccount id={}", account.getId(), depoId);
}
protected void makeClrnPart(ImdgTransaction imdgTransaction, Account account) {
Imdg<ClearingAccount> clearingAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);;
Imdg<ClearingAccount> clearingAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
ClearingAccount clnrAcc = new ClearingAccount();
clnrAcc.setAccountId(account.getId());
clnrAcc.setCompanyId(account.getCompanyId());

View file

@ -23,10 +23,7 @@ import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
import ru.spcex.clearing.validation.common.ValidationHelper;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.SdfTable;
import ru.spcex.platform.enumeration.ServiceStatus;
import ru.spcex.platform.enumeration.WorkflowStatus;
import ru.spcex.platform.enumeration.*;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.imdg.api.ImdgTransaction;
@ -114,7 +111,11 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
depoAccount = new DepoAccount();
depoAccount.setCompanyId(req.getCompanyId());
depoAccount.setAccountId(accountId);
depoAccount.setDepoAccountType(req.getDepoAccountType());
if (account.getAccount() != null && account.getAccount().contains("BC")) {
depoAccount.setDepoAccountType(DepoAccountType.C.getKey());
} else {
depoAccount.setDepoAccountType(req.getDepoAccountType());
}
depoAccountId = depoAccountImdg.insert(depoAccount);
txOk = true;
} finally {
@ -188,7 +189,11 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
DepoAccount depoAccount = new DepoAccount();
depoAccount.setCompanyId(accountReq.getCompanyId());
depoAccount.setAccountId(accountId);
depoAccount.setDepoAccountType(accountReq.getAccountType());
if (account.getAccount() != null && account.getAccount().contains("BC")) {
depoAccount.setDepoAccountType(DepoAccountType.C.getKey());
} else {
depoAccount.setDepoAccountType(accountReq.getAccountType());
}
depoAccountId = depoAccountImdg.insert(depoAccount);

View file

@ -214,7 +214,7 @@
<accountType id="10" code="DTRN" name="Депозитарный транзакционный счет"/>
<depoAccountType id="1" code="A" name="Счет участника"/>
<depoAccountType id="2" code="B" name="Счет клиента"/>
<depoAccountType id="3" code="C" name="Счет попечителя"/>
<depoAccountType id="3" code="C" name="Счет нерезидента"/>
<depoAccountType id="4" code="D" name="Счет доверительного управляющего"/>
<depoAccountType id="5" code="Z" name="Счет к размещению/выкупу"/>
<depoAccountType id="6" code="F" name="Счет держателя"/>

View file

@ -429,7 +429,7 @@ INSERT INTO DEPO_ACCOUNT_TYPE_DICTIONARY(ID, CODE, NAME) values (1, 'A', 'Сче
INSERT INTO DEPO_ACCOUNT_TYPE_DICTIONARY(ID, CODE, NAME) values (2, 'B', 'Счет клиента') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
INSERT INTO DEPO_ACCOUNT_TYPE_DICTIONARY(ID, CODE, NAME) values (3, 'C', 'Счет попечителя') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
INSERT INTO DEPO_ACCOUNT_TYPE_DICTIONARY(ID, CODE, NAME) values (3, 'C', 'Счет нерезидента') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
INSERT INTO DEPO_ACCOUNT_TYPE_DICTIONARY(ID, CODE, NAME) values (4, 'D', 'Счет доверительного управляющего') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;

View file

@ -0,0 +1,18 @@
package ru.spcex.platform.enumeration;
import ru.spcex.platform.utils.enumeration.IEnumKey;
public enum DepoAccountType implements IEnumKey {
A("A"), B("B"), C("C"), D("D");
private final String key;
DepoAccountType(String key) {
this.key = key;
}
@Override
public String getKey() {
return key;
}
}