backend-api http://jira.mfd.msk:8088/browse/CLS-577 AccountSymbols
This commit is contained in:
parent
7b24b1d6ab
commit
fba4a07513
4 changed files with 147 additions and 0 deletions
|
|
@ -0,0 +1,71 @@
|
||||||
|
package ru.spcex.clearing.backendapi.controller.queue.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import ru.clearing.classes.statics.data.account.AccountSymbols;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountSymbolsNewAction;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||||
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/accounting/depo-accounts-symbols")
|
||||||
|
public class AccountSymbolsController extends AbstractQueueController {
|
||||||
|
private final IStateLoader stateLoader;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AccountSymbolsController(IOperator operator, IStateLoader stateLoader) {
|
||||||
|
super(operator);
|
||||||
|
this.stateLoader = stateLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "get all accounts-symbols.")
|
||||||
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
|
||||||
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public CommonGetAllResponse getAll() {
|
||||||
|
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_AccountSymbols, AccountSymbols.class);
|
||||||
|
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||||
|
response.fromEntity(all);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "create AccountSymbols.")
|
||||||
|
@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)
|
||||||
|
@ResponseBody
|
||||||
|
public CudResponse add(
|
||||||
|
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||||
|
@RequestBody AccountSymbolsNewAction accountNewAction) throws ExecutionException, InterruptedException {
|
||||||
|
return processRequest(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_NEW, accountNewAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "delete AccountSymbols.")
|
||||||
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||||
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||||
|
@ResponseBody
|
||||||
|
public CudResponse delete(@ApiParam(value = "Идентификатор удаляемого объекта", required = true, example = "1234")
|
||||||
|
@PathVariable("id") Long id) throws ExecutionException, InterruptedException {
|
||||||
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
|
deleteAction.setId(id);
|
||||||
|
return processRequest(Consts.DESTINATION_DEPO_ACCOUNT_SYMBOLS_BLOCK, deleteAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package ru.spcex.clearing.backendapi.controller.request.cud.account;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.AccountSymbolsNewRequest;
|
||||||
|
|
||||||
|
public class AccountSymbolsNewAction implements IAction<AccountSymbolsNewRequest> {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "Номер счета", example = "1200")
|
||||||
|
@JsonProperty
|
||||||
|
private Long accountId;
|
||||||
|
@ApiModelProperty(value = "Значение реквизита", example = "ABCD")
|
||||||
|
@JsonProperty
|
||||||
|
private String accountSymbolValue;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccountSymbolsNewRequest toRequest() {
|
||||||
|
var req = new AccountSymbolsNewRequest();
|
||||||
|
req.setAccountId(this.accountId);
|
||||||
|
req.setAccountSymbolValue(this.accountSymbolValue);
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(hidden = true)
|
||||||
|
@Override
|
||||||
|
public ActionType getActionType() {
|
||||||
|
return ActionType.NEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAccountId() {
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountId(Long accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountSymbolValue() {
|
||||||
|
return accountSymbolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountSymbolValue(String accountSymbolValue) {
|
||||||
|
this.accountSymbolValue = accountSymbolValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -155,6 +155,9 @@ public interface Consts {
|
||||||
String CONTINUE_CLEARING = "continue-clearing";
|
String CONTINUE_CLEARING = "continue-clearing";
|
||||||
String LAUNCHER_NEW = "launcher-new";
|
String LAUNCHER_NEW = "launcher-new";
|
||||||
|
|
||||||
|
String DESTINATION_DEPO_ACCOUNT_SYMBOLS_NEW = "depo-accounts-symbols-new";
|
||||||
|
String DESTINATION_DEPO_ACCOUNT_SYMBOLS_BLOCK = "depo-accounts-symbols-block";
|
||||||
|
|
||||||
|
|
||||||
String REQUEST_INFO_UPDATE = "request-info-update";
|
String REQUEST_INFO_UPDATE = "request-info-update";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package ru.spcex.clearing.platform.messaging.domain.cud.account;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class AccountSymbolsNewRequest {
|
||||||
|
@JsonProperty
|
||||||
|
private Long accountId;
|
||||||
|
@JsonProperty
|
||||||
|
private String accountSymbolValue;
|
||||||
|
|
||||||
|
public Long getAccountId() {
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountId(Long accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountSymbolValue() {
|
||||||
|
return accountSymbolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountSymbolValue(String accountSymbolValue) {
|
||||||
|
this.accountSymbolValue = accountSymbolValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue