http://jira.mfd.msk:8088/browse/CLS-498 backend-api
This commit is contained in:
parent
d1082874cb
commit
d14b49ce85
4 changed files with 120 additions and 0 deletions
|
|
@ -10,6 +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.RSplitDepositActionNew;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.registry.ReturnDepositActionNew;
|
||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||
|
|
@ -68,4 +69,17 @@ public class RegistryController extends AbstractQueueController {
|
|||
returnDepositAction.setId(id);
|
||||
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 = "/changeRefundDate/{groupId}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public CudResponse changeRefundDate(
|
||||
@ApiParam(value = "Идентификатор группы связанных регистров.", required = true, example = "1234")
|
||||
@PathVariable("groupId") Long groupId,
|
||||
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||
@RequestBody ChangeRefundDateActionNew returnDepositAction) throws ExecutionException, InterruptedException {
|
||||
returnDepositAction.setGroupId(groupId);
|
||||
return processRequest(Consts.REGISTRY_CHANGE_REFUND_DATE_ACTION, returnDepositAction);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package ru.spcex.clearing.backendapi.controller.request.cud.registry;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
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.RegistryChangeRefundDateRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.LocalDateDeserializer;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.LocalDateSerializer;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class ChangeRefundDateActionNew implements IAction<RegistryChangeRefundDateRequest> {
|
||||
|
||||
@JsonIgnore
|
||||
public Long groupId;
|
||||
@JsonProperty
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
public LocalDate refundDate;
|
||||
|
||||
@Override
|
||||
public RegistryChangeRefundDateRequest toRequest() {
|
||||
var req = new RegistryChangeRefundDateRequest();
|
||||
req.setGroupId(groupId);
|
||||
req.setRefundDate(refundDate);
|
||||
return req;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EnumMessage> validate() {
|
||||
List<EnumMessage> errors = new ArrayList<>();
|
||||
if (groupId == null) {
|
||||
errors.add(new EnumMessage(BackEndError.ValidationError, "url parameter 'groupId'"));
|
||||
}
|
||||
if (refundDate == null) {
|
||||
errors.add(new EnumMessage(BackEndError.ValidationError, "refundDate"));
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@Override
|
||||
public ActionType getActionType() {
|
||||
return ActionType.UPDATE;
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public LocalDate getRefundDate() {
|
||||
return refundDate;
|
||||
}
|
||||
|
||||
public void setRefundDate(LocalDate refundDate) {
|
||||
this.refundDate = refundDate;
|
||||
}
|
||||
}
|
||||
|
|
@ -161,6 +161,7 @@ public interface Consts {
|
|||
|
||||
String REGISTRY_SPLIT_DEPOSIT_ACTION = "registry-split-deposit-action";
|
||||
String REGISTRY_RETURN_DEPOSIT_ACTION = "registry-return-deposit-action";
|
||||
String REGISTRY_CHANGE_REFUND_DATE_ACTION = "registry-change-refund-date-action";
|
||||
String REGISTRY_COVERED_DEAL_REGISTER_NEW = "registry-covered-deal-register-new";
|
||||
String REGISTRY_ADMITTED_DEAL_REGISTER_NEW = "registry-admitted-deal-register-new";
|
||||
String REGISTRY_DEAL_REGISTER_NEW = "registry-deal-register-new";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package ru.spcex.clearing.platform.messaging.domain.cud.registry;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.LocalDateDeserializer;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.LocalDateSerializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class RegistryChangeRefundDateRequest {
|
||||
@JsonProperty
|
||||
private Long groupId;
|
||||
@JsonProperty
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate refundDate;
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public LocalDate getRefundDate() {
|
||||
return refundDate;
|
||||
}
|
||||
|
||||
public void setRefundDate(LocalDate refundDate) {
|
||||
this.refundDate = refundDate;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue