account-service backend-api http://jira.mfd.msk:8088/browse/CLS-548 information-account-new теперь не нужен, вместо него используется account-new
This commit is contained in:
parent
80fcb32abe
commit
155b899e5d
6 changed files with 56 additions and 99 deletions
|
|
@ -49,9 +49,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final ImdgProvider imdgProvider;
|
private final ImdgProvider imdgProvider;
|
||||||
private final Imdg<Account> accountMap;
|
private final Imdg<Account> accountMap;
|
||||||
private final Imdg<InformationAccount> informationAccountMap;
|
|
||||||
private final Imdg<DepoAccount> depoAccountMap;
|
|
||||||
private final Imdg<ClearingAccount> clearingAccountMap;
|
|
||||||
private final Imdg<ClearingMemberCategory> clearingMemberCategoryMap;
|
private final Imdg<ClearingMemberCategory> clearingMemberCategoryMap;
|
||||||
private final Imdg<Relation> relationMap;
|
private final Imdg<Relation> relationMap;
|
||||||
private final KafkaSender kafkaSender;
|
private final KafkaSender kafkaSender;
|
||||||
|
|
@ -87,9 +84,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
this.relationMap = imdgProvider.getImdg(
|
this.relationMap = imdgProvider.getImdg(
|
||||||
IMDGDistributedNames.Map_Relation, Relation.class
|
IMDGDistributedNames.Map_Relation, Relation.class
|
||||||
);
|
);
|
||||||
this.informationAccountMap = imdgProvider.getImdg(IMDGDistributedNames.Map_InformationAccount, InformationAccount.class);
|
|
||||||
this.depoAccountMap = imdgProvider.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
|
|
||||||
this.clearingAccountMap = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
|
||||||
this.kafkaSender = kafkaSender;
|
this.kafkaSender = kafkaSender;
|
||||||
this.messageResolver = messageResolver;
|
this.messageResolver = messageResolver;
|
||||||
this.userRoleVerification = userRoleVerification;
|
this.userRoleVerification = userRoleVerification;
|
||||||
|
|
@ -147,25 +141,47 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
requestInfoUpdate = fillAccountFromRelation(account, userRequest.getId(), false);
|
requestInfoUpdate = fillAccountFromRelation(account, userRequest.getId(), false);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
Long newId = accountMap.insert(account);
|
Long newId = null;
|
||||||
|
|
||||||
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
||||||
// default, дополнительные таблицы не требуются
|
// default, дополнительные таблицы не требуются
|
||||||
} else if (AccountType.Info.equalsByKey(account.getAccountType()))
|
newId = accountMap.insert(account);
|
||||||
makeInfoPart(account);
|
} else {
|
||||||
else if (AccountType.Depo.equalsByKey(account.getAccountType()))
|
// Транзакцией
|
||||||
makeDepoPart(account);
|
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
||||||
else if (AccountType.Clrn.equalsByKey(account.getAccountType()))
|
imdgTransaction.beginTransaction();
|
||||||
makeClrnPart(account);
|
boolean txOk = false;
|
||||||
else {
|
try {
|
||||||
log.warn("Unexpected AccountType={}. Do not create additional record to other table's", account.getAccountType());
|
Imdg<Account> accountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
newId = accountMap.insert(account);
|
||||||
|
|
||||||
|
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
||||||
|
// default, дополнительные таблицы не требуются
|
||||||
|
} else if (AccountType.Info.equalsByKey(account.getAccountType()))
|
||||||
|
makeInfoPart(imdgTransaction, account);
|
||||||
|
else if (AccountType.Depo.equalsByKey(account.getAccountType()))
|
||||||
|
makeDepoPart(imdgTransaction, account);
|
||||||
|
else if (AccountType.Clrn.equalsByKey(account.getAccountType()))
|
||||||
|
makeClrnPart(imdgTransaction, account);
|
||||||
|
else {
|
||||||
|
log.warn("Unexpected AccountType={}. Do not create additional record to other table's", account.getAccountType());
|
||||||
|
}
|
||||||
|
txOk = true;
|
||||||
|
} finally {
|
||||||
|
if (txOk) {
|
||||||
|
imdgTransaction.commitTransaction();
|
||||||
|
} else {
|
||||||
|
log.debug("failed insert, new account id {} rollback", newId);
|
||||||
|
imdgTransaction.rollbackTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("successfully processed, new account id {}", newId);
|
log.debug("successfully processed, new account id {}", newId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void makeInfoPart(Account account) {
|
protected void makeInfoPart(ImdgTransaction imdgTransaction, Account account) {
|
||||||
|
Imdg<InformationAccount> informationAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_InformationAccount, InformationAccount.class);
|
||||||
InformationAccount infoAcc = new InformationAccount();
|
InformationAccount infoAcc = new InformationAccount();
|
||||||
infoAcc.setAccountId(account.getId());
|
infoAcc.setAccountId(account.getId());
|
||||||
Account firstAccountAntl = accountMap.getFirstObjectByFieldValues(Map.of(
|
Account firstAccountAntl = accountMap.getFirstObjectByFieldValues(Map.of(
|
||||||
|
|
@ -182,20 +198,22 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
log.debug("For account id={} make InformationAccount id={}", account.getId(), infoId);
|
log.debug("For account id={} make InformationAccount id={}", account.getId(), infoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void makeDepoPart(Account account) {
|
protected void makeDepoPart(ImdgTransaction imdgTransaction, Account account) {
|
||||||
|
Imdg<DepoAccount> depoAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);;
|
||||||
DepoAccount depoAcc = new DepoAccount();
|
DepoAccount depoAcc = new DepoAccount();
|
||||||
depoAcc.setAccountId(account.getId());
|
depoAcc.setAccountId(account.getId());
|
||||||
depoAcc.setCompanyId(account.getCompanyId());
|
depoAcc.setCompanyId(account.getCompanyId());
|
||||||
Long infoId = depoAccountMap.insert(depoAcc);
|
Long depoId = depoAccountMap.insert(depoAcc);
|
||||||
log.debug("For account id={} make DepoAccount id={}", account.getId(), infoId);
|
log.debug("For account id={} make DepoAccount id={}", account.getId(), depoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void makeClrnPart(Account account) {
|
protected void makeClrnPart(ImdgTransaction imdgTransaction, Account account) {
|
||||||
|
Imdg<ClearingAccount> clearingAccountMap = imdgTransaction.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);;
|
||||||
ClearingAccount clnrAcc = new ClearingAccount();
|
ClearingAccount clnrAcc = new ClearingAccount();
|
||||||
clnrAcc.setAccountId(account.getId());
|
clnrAcc.setAccountId(account.getId());
|
||||||
clnrAcc.setCompanyId(account.getCompanyId());
|
clnrAcc.setCompanyId(account.getCompanyId());
|
||||||
Long infoId = clearingAccountMap.insert(clnrAcc);
|
Long clrnId = clearingAccountMap.insert(clnrAcc);
|
||||||
log.debug("For account id={} make ClearingAccount id={}", account.getId(), infoId);
|
log.debug("For account id={} make ClearingAccount id={}", account.getId(), clrnId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate correspondentAccountUpdate(BaseRequest<CorrespondentAccountUpdateRequest> userRequest) {
|
public RequestInfoUpdate correspondentAccountUpdate(BaseRequest<CorrespondentAccountUpdateRequest> userRequest) {
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public RequestInfoUpdate informationAccountNew(BaseRequest<InformationAccountNewRequest> userRequest) {
|
public RequestInfoUpdate informationAccountNew(BaseRequest<InformationAccountNewRequest> userRequest) {
|
||||||
log.debug("InformationAccountNewRequest received");
|
log.debug("InformationAccountNewRequest received");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,13 @@ public class InformationAccountController extends AbstractQueueController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Добавление информационного счета.")
|
// @ApiOperation(value = "Добавление информационного счета.")
|
||||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
// @ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
// @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
// @ResponseBody
|
||||||
public CudResponse add(
|
// public CudResponse add(
|
||||||
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
// @ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||||
@RequestBody AccountInformationNewAction accountNewInformationAction) throws ExecutionException, InterruptedException {
|
// @RequestBody AccountInformationNewAction accountNewInformationAction) throws ExecutionException, InterruptedException {
|
||||||
return processRequest(Consts.DESTINATION_INFORMATION_ACCOUNT_NEW, accountNewInformationAction);
|
// return processRequest(Consts.DESTINATION_INFORMATION_ACCOUNT_NEW, accountNewInformationAction);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"version": "3.8.0.54",
|
"version": "3.8.0.55",
|
||||||
|
|
||||||
"enums": {
|
"enums": {
|
||||||
|
|
||||||
|
|
@ -4627,34 +4627,7 @@
|
||||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
,"actions":[
|
|
||||||
{"method":"post",
|
|
||||||
|
|
||||||
"name": "Добавление информационного счета",
|
|
||||||
|
|
||||||
"confirmation": "companyId,account,status",
|
|
||||||
|
|
||||||
"class": "ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction",
|
|
||||||
|
|
||||||
"fields": [
|
|
||||||
{"code": "companyId",
|
|
||||||
"type": 1,"name": "Наименование компании","shortname": "Компания","link": "company","linkCode": "shortName","required": true
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{"code": "account",
|
|
||||||
"type": 2,"length": 50,"name": "Номер счета","shortname": "Счет","required": true
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{"code": "status",
|
|
||||||
"type": 12,"name": "Наименование статуса","shortname": "Статус","link": "serviceStatus"
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{"code": "accountType",
|
|
||||||
"type": 12,"name": "Наименование типа счета","shortname": "Тип","link": "accountType","required": true,"visible": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
"depoAccount": {
|
"depoAccount": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
|
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
|
||||||
<meta version="3.8.0.54">
|
<meta version="3.8.0.55">
|
||||||
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
||||||
<!--Здесь словари-->
|
<!--Здесь словари-->
|
||||||
<enums>
|
<enums>
|
||||||
|
|
@ -1075,14 +1075,6 @@
|
||||||
<companyId type="1" dbname="Идентификатор компании" name="Наименование компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
|
<companyId type="1" dbname="Идентификатор компании" name="Наименование компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
|
||||||
<serviceStatus field="accountId" type="12" dbname="Код статуса" name="Наименование статуса" shortname="Статус" searchable="true" sortable="true" visible="true" linkKeyCode="id" linkCode="status" link="account" extends="account" />
|
<serviceStatus field="accountId" type="12" dbname="Код статуса" name="Наименование статуса" shortname="Статус" searchable="true" sortable="true" visible="true" linkKeyCode="id" linkCode="status" link="account" extends="account" />
|
||||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||||
<actions>
|
|
||||||
<post name="Добавление информационного счета" confirmation="companyId,account,status" class="ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction">
|
|
||||||
<companyId type="1" name="Наименование компании" shortname="Компания" link="company" linkCode="shortName" required="true"/>
|
|
||||||
<account type="2" length="50" name="Номер счета" shortname="Счет" required="true"/>
|
|
||||||
<status type="12" name="Наименование статуса" shortname="Статус" link="serviceStatus"/>
|
|
||||||
<accountType type="12" name="Наименование типа счета" shortname="Тип" link="accountType" required="true" visible="false"/>
|
|
||||||
</post>
|
|
||||||
</actions>
|
|
||||||
</informationAccount>
|
</informationAccount>
|
||||||
<depoAccount name="Депозитарные счета" destination="accounting/depo-accounts" class="ru.clearing.classes.statics.data.account.DepoAccount" logUpdates="true" table="depo_account">
|
<depoAccount name="Депозитарные счета" destination="accounting/depo-accounts" class="ru.clearing.classes.statics.data.account.DepoAccount" logUpdates="true" table="depo_account">
|
||||||
<accountId type="1" dbname="Идентификатор счета" name="Номер счета" shortname="Счет" searchable="true" sortable="true" visible="true" link="account" linkCode="account"/>
|
<accountId type="1" dbname="Идентификатор счета" name="Номер счета" shortname="Счет" searchable="true" sortable="true" visible="true" link="account" linkCode="account"/>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"version": "3.8.0.54",
|
"version": "3.8.0.55",
|
||||||
|
|
||||||
"enums": {
|
"enums": {
|
||||||
|
|
||||||
|
|
@ -4627,34 +4627,7 @@
|
||||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
,"actions":[
|
|
||||||
{"method":"post",
|
|
||||||
|
|
||||||
"name": "Добавление информационного счета",
|
|
||||||
|
|
||||||
"confirmation": "companyId,account,status",
|
|
||||||
|
|
||||||
"class": "ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction",
|
|
||||||
|
|
||||||
"fields": [
|
|
||||||
{"code": "companyId",
|
|
||||||
"type": 1,"name": "Наименование компании","shortname": "Компания","link": "company","linkCode": "shortName","required": true
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{"code": "account",
|
|
||||||
"type": 2,"length": 50,"name": "Номер счета","shortname": "Счет","required": true
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{"code": "status",
|
|
||||||
"type": 12,"name": "Наименование статуса","shortname": "Статус","link": "serviceStatus"
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{"code": "accountType",
|
|
||||||
"type": 12,"name": "Наименование типа счета","shortname": "Тип","link": "accountType","required": true,"visible": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
"depoAccount": {
|
"depoAccount": {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue