backend-api http://jira.mfd.msk:8088/browse/CLS-525 выдача некоторых Account по meta (составное поле)
This commit is contained in:
parent
d1b368d0b5
commit
8e73a2eced
3 changed files with 73 additions and 8 deletions
|
|
@ -8,11 +8,16 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
import ru.clearing.classes.statics.data.account.ClearingAccount;
|
import ru.clearing.classes.statics.data.account.ClearingAccount;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
|
||||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -20,10 +25,16 @@ import java.util.Map;
|
||||||
@RequestMapping("/accounting/clearing-accounts")
|
@RequestMapping("/accounting/clearing-accounts")
|
||||||
public class ClearingAccountController {
|
public class ClearingAccountController {
|
||||||
private final IStateLoader stateLoader;
|
private final IStateLoader stateLoader;
|
||||||
|
private final GetResponseFactory responseFactory;
|
||||||
|
private final Imdg<Account> accountImdg;
|
||||||
|
private final Imdg<ClearingAccount> clearingAccountImdg;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClearingAccountController(IStateLoader stateLoader) {
|
public ClearingAccountController(IStateLoader stateLoader, GetResponseFactory responseFactory, ImdgProvider imdgProvider) {
|
||||||
this.stateLoader = stateLoader;
|
this.stateLoader = stateLoader;
|
||||||
|
this.responseFactory = responseFactory;
|
||||||
|
accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
clearingAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "get all clearing account.")
|
@ApiOperation(value = "get all clearing account.")
|
||||||
|
|
@ -31,7 +42,18 @@ public class ClearingAccountController {
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CommonGetAllResponse getAll() {
|
public CommonGetAllResponse getAll() {
|
||||||
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
Collection<ClearingAccount> accounts = clearingAccountImdg.getAllValues();
|
||||||
|
|
||||||
|
Collection<Map<String, Object>> all = new ArrayList<>(accounts.size());
|
||||||
|
for (ClearingAccount cAcc : accounts) {
|
||||||
|
Map<String, Object> fieldMap = responseFactory.responseFromObject(cAcc);
|
||||||
|
Account baseAccount = accountImdg.getSingleObjectByID(cAcc.getAccountId());
|
||||||
|
if (baseAccount != null) {
|
||||||
|
fieldMap.put("serviceStatus", baseAccount.getStatus());
|
||||||
|
}
|
||||||
|
all.add(fieldMap);
|
||||||
|
}
|
||||||
|
|
||||||
CommonGetAllResponse response = new CommonGetAllResponse();
|
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||||
response.fromEntity(all);
|
response.fromEntity(all);
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,16 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
import ru.clearing.classes.statics.data.account.DepoAccount;
|
import ru.clearing.classes.statics.data.account.DepoAccount;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
|
||||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -20,10 +25,16 @@ import java.util.Map;
|
||||||
@RequestMapping("/accounting/depo-accounts")
|
@RequestMapping("/accounting/depo-accounts")
|
||||||
public class DepoAccountController {
|
public class DepoAccountController {
|
||||||
private final IStateLoader stateLoader;
|
private final IStateLoader stateLoader;
|
||||||
|
private final GetResponseFactory responseFactory;
|
||||||
|
private final Imdg<Account> accountImdg;
|
||||||
|
private final Imdg<DepoAccount> depoAccountImdg;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DepoAccountController(IStateLoader stateLoader) {
|
public DepoAccountController(IStateLoader stateLoader, GetResponseFactory responseFactory, ImdgProvider imdgProvider) {
|
||||||
this.stateLoader = stateLoader;
|
this.stateLoader = stateLoader;
|
||||||
|
this.responseFactory = responseFactory;
|
||||||
|
accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
depoAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "get all depo account.")
|
@ApiOperation(value = "get all depo account.")
|
||||||
|
|
@ -31,7 +42,18 @@ public class DepoAccountController {
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CommonGetAllResponse getAll() {
|
public CommonGetAllResponse getAll() {
|
||||||
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
|
Collection<DepoAccount> accounts = depoAccountImdg.getAllValues();
|
||||||
|
|
||||||
|
Collection<Map<String, Object>> all = new ArrayList<>(accounts.size());
|
||||||
|
for (DepoAccount dAcc : accounts) {
|
||||||
|
Map<String, Object> fieldMap = responseFactory.responseFromObject(dAcc);
|
||||||
|
Account baseAccount = accountImdg.getSingleObjectByID(dAcc.getAccountId());
|
||||||
|
if (baseAccount != null) {
|
||||||
|
fieldMap.put("serviceStatus", baseAccount.getStatus());
|
||||||
|
}
|
||||||
|
all.add(fieldMap);
|
||||||
|
}
|
||||||
|
|
||||||
CommonGetAllResponse response = new CommonGetAllResponse();
|
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||||
response.fromEntity(all);
|
response.fromEntity(all);
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,22 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction;
|
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
|
|
||||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
|
||||||
import ru.spcex.clearing.backendapi.service.IOperator;
|
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
@ -31,11 +35,18 @@ import java.util.concurrent.ExecutionException;
|
||||||
@RequestMapping("/accounting/information-accounts")
|
@RequestMapping("/accounting/information-accounts")
|
||||||
public class InformationAccountController extends AbstractQueueController {
|
public class InformationAccountController extends AbstractQueueController {
|
||||||
private final IStateLoader stateLoader;
|
private final IStateLoader stateLoader;
|
||||||
|
private final GetResponseFactory responseFactory;
|
||||||
|
private final Imdg<Account> accountImdg;
|
||||||
|
private final Imdg<InformationAccount> informationAccountImdg;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public InformationAccountController(IOperator operator, IStateLoader stateLoader) {
|
public InformationAccountController(IOperator operator, IStateLoader stateLoader, GetResponseFactory responseFactory, ImdgProvider imdgProvider) {
|
||||||
super(operator);
|
super(operator);
|
||||||
this.stateLoader = stateLoader;
|
this.stateLoader = stateLoader;
|
||||||
|
this.responseFactory = responseFactory;
|
||||||
|
accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
informationAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_InformationAccount, InformationAccount.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "get all information accounts.")
|
@ApiOperation(value = "get all information accounts.")
|
||||||
|
|
@ -43,8 +54,18 @@ public class InformationAccountController extends AbstractQueueController {
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CommonGetAllResponse getAll() {
|
public CommonGetAllResponse getAll() {
|
||||||
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_InformationAccount,
|
Collection<InformationAccount> accounts = informationAccountImdg.getAllValues();
|
||||||
InformationAccount.class);
|
|
||||||
|
Collection<Map<String, Object>> all = new ArrayList<>(accounts.size());
|
||||||
|
for (InformationAccount iAcc : accounts) {
|
||||||
|
Map<String, Object> fieldMap = responseFactory.responseFromObject(iAcc);
|
||||||
|
Account baseAccount = accountImdg.getSingleObjectByID(iAcc.getAccountId());
|
||||||
|
if (baseAccount != null) {
|
||||||
|
fieldMap.put("serviceStatus", baseAccount.getStatus());
|
||||||
|
}
|
||||||
|
all.add(fieldMap);
|
||||||
|
}
|
||||||
|
|
||||||
CommonGetAllResponse response = new CommonGetAllResponse();
|
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||||
response.fromEntity(all);
|
response.fromEntity(all);
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue