diff --git a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/register/RegistryController.java b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/register/RegistryController.java index 7f2606e7e..f896bf8c2 100644 --- a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/register/RegistryController.java +++ b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/register/RegistryController.java @@ -10,10 +10,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import ru.clearing.classes.statics.data.registry.Registry; import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController; -import ru.spcex.clearing.backendapi.controller.request.cud.registry.ChangeRefundDateActionNew; -import ru.spcex.clearing.backendapi.controller.request.cud.registry.ChangeStatusExtractActionNew; -import ru.spcex.clearing.backendapi.controller.request.cud.registry.RSplitDepositActionNew; -import ru.spcex.clearing.backendapi.controller.request.cud.registry.ReturnDepositActionNew; +import ru.spcex.clearing.backendapi.controller.request.cud.registry.*; 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; @@ -71,6 +68,19 @@ public class RegistryController extends AbstractQueueController { return processRequest(Consts.REGISTRY_RETURN_DEPOSIT_ACTION, returnDepositAction); } + @ApiOperation(value = "Отметить средства на возврат депозита") + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)}) + @RequestMapping(value = "/identificationFunds/{id}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CudResponse identificationFundsAction( + @ApiParam(value = "Идентификатор изменяемого объекта.", required = true, example = "1234") + @PathVariable("id") Long id, + @ApiParam(value = "Параметры команды в JSON формате.", required = true) + @RequestBody IdentificationFundsActionNew identificationFundsActionNew) throws ExecutionException, InterruptedException { + identificationFundsActionNew.setId(id); + return processRequest(Consts.REGISTRY_IDENTIFICATION_FUNDS, identificationFundsActionNew); + } + @ApiOperation(value = "Изменение даты возврата депозита") @ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)}) @RequestMapping(value = "/changeRefundDate/{groupId}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) diff --git a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/registry/IdentificationFundsActionNew.java b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/registry/IdentificationFundsActionNew.java new file mode 100644 index 000000000..d6f62b92b --- /dev/null +++ b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/registry/IdentificationFundsActionNew.java @@ -0,0 +1,77 @@ +package ru.spcex.clearing.backendapi.controller.request.cud.registry; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.BackEndError; +import ru.spcex.clearing.platform.messaging.domain.ActionType; +import ru.spcex.clearing.platform.messaging.domain.cud.registry.IdentificationFundsRequest; +import ru.spcex.platform.classes.base.interfaces.WithId; +import ru.spcex.platform.utils.enumeration.EnumMessage; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class IdentificationFundsActionNew implements IAction, WithId { + + @JsonIgnore + public Long id; + @ApiModelProperty(value = "Сумма", example = "1600.20") + @JsonProperty + public BigDecimal balance; + @ApiModelProperty(value = "Торгово-клиринговый регистр", example = "1234") + @JsonProperty + public Long tradingClearingRegistryId; + + @Override + public IdentificationFundsRequest toRequest() { + var req = new IdentificationFundsRequest(); + req.setId(id); + req.setBalance(balance); + req.setTradingClearingRegistryId(tradingClearingRegistryId); + return req; + } + + @Override + public Collection validate() { + List errors = new ArrayList<>(); + if (id == null) { + errors.add(new EnumMessage(BackEndError.ValidationError, "url parameter 'id'")); + } + return errors; + } + + @ApiModelProperty(hidden = true) + @Override + public ActionType getActionType() { + return ActionType.NEW; + } + + @Override + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } + + public Long getTradingClearingRegistryId() { + return tradingClearingRegistryId; + } + + public void setTradingClearingRegistryId(Long tradingClearingRegistryId) { + this.tradingClearingRegistryId = tradingClearingRegistryId; + } +} diff --git a/clearing-parent/backend-api/src/main/resources/meta/meta.json b/clearing-parent/backend-api/src/main/resources/meta/meta.json index 568e0c945..3f7bdffce 100644 --- a/clearing-parent/backend-api/src/main/resources/meta/meta.json +++ b/clearing-parent/backend-api/src/main/resources/meta/meta.json @@ -4111,6 +4111,31 @@ {"code": "balance", "type": 10,"name": "Сумма","shortname": "Сумма","required": true } + ] + } + , + {"method":"post", + + "name": "Идентификация неразмеченных средств", + + "destination": "registries/identificationFunds", + + "confirmation": "balance,tradingClearingRegistryId", + + "class": "ru.spcex.clearing.backendapi.controller.request.cud.registry.IdentificationFundsActionNew", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "registry","linkCode": "id","required": true + } + , + {"code": "balance", + "type": 10,"name": "Сумма","shortname": "Сумма","required": true + } + , + {"code": "tradingClearingRegistryId", + "type": 1,"name": "Торгово-клиринговый регистр","shortname": "Торгово-клиринговый регистр","link": "tradingClearingRegistry","linkCode": "code","required": true + } ] } , diff --git a/clearing-parent/backend-api/src/main/resources/meta/meta.xml b/clearing-parent/backend-api/src/main/resources/meta/meta.xml index 387cebacf..0961cd17b 100644 --- a/clearing-parent/backend-api/src/main/resources/meta/meta.xml +++ b/clearing-parent/backend-api/src/main/resources/meta/meta.xml @@ -956,6 +956,11 @@ + + + + + diff --git a/clearing-parent/backend-api/src/test/resources/meta.json b/clearing-parent/backend-api/src/test/resources/meta.json index 568e0c945..3f7bdffce 100644 --- a/clearing-parent/backend-api/src/test/resources/meta.json +++ b/clearing-parent/backend-api/src/test/resources/meta.json @@ -4111,6 +4111,31 @@ {"code": "balance", "type": 10,"name": "Сумма","shortname": "Сумма","required": true } + ] + } + , + {"method":"post", + + "name": "Идентификация неразмеченных средств", + + "destination": "registries/identificationFunds", + + "confirmation": "balance,tradingClearingRegistryId", + + "class": "ru.spcex.clearing.backendapi.controller.request.cud.registry.IdentificationFundsActionNew", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "registry","linkCode": "id","required": true + } + , + {"code": "balance", + "type": 10,"name": "Сумма","shortname": "Сумма","required": true + } + , + {"code": "tradingClearingRegistryId", + "type": 1,"name": "Торгово-клиринговый регистр","shortname": "Торгово-клиринговый регистр","link": "tradingClearingRegistry","linkCode": "code","required": true + } ] } , diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java index 40d1fb693..f1035f463 100644 --- a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java @@ -178,6 +178,7 @@ public interface Consts { String REGISTRY_LIABILITIES_REGISTER_NEW = "registry-liabilities-register-new"; String REGISTRY_EXECUTION_REGISTER_ON_SAVE = "registry-execution-register-on-save"; String REGISTRY_EXECUTION_REGISTER_UPDATE = "registry-execution-register-update"; + String REGISTRY_IDENTIFICATION_FUNDS = "registry-identification-funds"; //TODO IS IT NEEDED RIGHT HERE? String REGISTRY_CONTRACT_REGISTER_NEW = "registry-contract-register-new"; diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/registry/IdentificationFundsRequest.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/registry/IdentificationFundsRequest.java new file mode 100644 index 000000000..c0ffa349a --- /dev/null +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/registry/IdentificationFundsRequest.java @@ -0,0 +1,39 @@ +package ru.spcex.clearing.platform.messaging.domain.cud.registry; + +import com.fasterxml.jackson.annotation.JsonProperty; +import ru.spcex.platform.classes.base.interfaces.WithId; + +import java.math.BigDecimal; + +public class IdentificationFundsRequest implements WithId { + @JsonProperty + private Long id; + @JsonProperty + private BigDecimal balance; + @JsonProperty + private Long tradingClearingRegistryId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } + + public Long getTradingClearingRegistryId() { + return tradingClearingRegistryId; + } + + public void setTradingClearingRegistryId(Long tradingClearingRegistryId) { + this.tradingClearingRegistryId = tradingClearingRegistryId; + } +}