This commit is contained in:
parent
c6fc217adc
commit
a15fae4885
5 changed files with 142 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
||||||
|
package ru.spcex.clearing.backendapi.controller.queue.company;
|
||||||
|
|
||||||
|
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.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.request.cud.company.RelationUpdateAction;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
||||||
|
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||||
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/relations")
|
||||||
|
public class RelationController extends AbstractQueueController {
|
||||||
|
private final IStateLoader stateLoader;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RelationController(IOperator operator, IStateLoader stateLoader) {
|
||||||
|
super(operator);
|
||||||
|
this.stateLoader = stateLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "update relation.")
|
||||||
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||||
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
@ResponseBody
|
||||||
|
public CudResponse update(
|
||||||
|
@ApiParam(value = "Идентификатор изменяего объекта.", required = true, example = "1234")
|
||||||
|
@PathVariable("id") Long id,
|
||||||
|
@ApiParam(value = "Новые значения полей объекта.", required = true)
|
||||||
|
@RequestBody RelationUpdateAction relationUpdateAction) throws ExecutionException, InterruptedException {
|
||||||
|
relationUpdateAction.setId(id);
|
||||||
|
return processRequest(Consts.DESTINATION_RELATION_UPDATE, relationUpdateAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package ru.spcex.clearing.backendapi.controller.request.cud.company;
|
||||||
|
|
||||||
|
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.company.RelationUpdateRequest;
|
||||||
|
import ru.spcex.platform.classes.base.interfaces.WithId;
|
||||||
|
|
||||||
|
public class RelationUpdateAction implements IAction<RelationUpdateRequest>, WithId {
|
||||||
|
@ApiModelProperty(hidden = true)
|
||||||
|
@JsonProperty
|
||||||
|
public Long id;
|
||||||
|
@ApiModelProperty(value = "Идентификатор статуса", example = "ABCD")
|
||||||
|
@JsonProperty
|
||||||
|
private String serviceStatus;
|
||||||
|
@ApiModelProperty(value = "Текст причины", example = "Example text")
|
||||||
|
@JsonProperty
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RelationUpdateRequest toRequest() {
|
||||||
|
RelationUpdateRequest request = new RelationUpdateRequest();
|
||||||
|
request.setId(this.id);
|
||||||
|
request.setServiceStatus(this.serviceStatus);
|
||||||
|
request.setComment(this.comment);
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(hidden = true)
|
||||||
|
@Override
|
||||||
|
public ActionType getActionType() {
|
||||||
|
return ActionType.UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceStatus() {
|
||||||
|
return serviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServiceStatus(String serviceStatus) {
|
||||||
|
this.serviceStatus = serviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -37,9 +37,11 @@ public class ActionValidationProvider implements InitializingBean {
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
getImdg(IMDGDistributedNames.Map_TaskDictionary, AbstractDictionary.class);
|
getImdg(IMDGDistributedNames.Map_TaskDictionary, AbstractDictionary.class);
|
||||||
getImdg(IMDGDistributedNames.Map_MoneyMarketSecurity, SpcexObjectBase.class);
|
getImdg(IMDGDistributedNames.Map_MoneyMarketSecurity, SpcexObjectBase.class);
|
||||||
|
getImdg(IMDGDistributedNames.Map_Relation, SpcexObjectBase.class);
|
||||||
|
|
||||||
validators.put(Consts.DESTINATION_MONEY_MARKET_SECURITY_UPDATE, idPresent(IMDGDistributedNames.Map_MoneyMarketSecurity));
|
validators.put(Consts.DESTINATION_MONEY_MARKET_SECURITY_UPDATE, idPresent(IMDGDistributedNames.Map_MoneyMarketSecurity));
|
||||||
validators.put(Consts.DESTINATION_MONEY_MARKET_SECURITY_DELETE, idPresent(IMDGDistributedNames.Map_MoneyMarketSecurity));
|
validators.put(Consts.DESTINATION_MONEY_MARKET_SECURITY_DELETE, idPresent(IMDGDistributedNames.Map_MoneyMarketSecurity));
|
||||||
|
validators.put(Consts.DESTINATION_RELATION_UPDATE, idPresent(IMDGDistributedNames.Map_Relation));
|
||||||
validators.put(Consts.LAUNCHER_NEW, taskRunnerNew());
|
validators.put(Consts.LAUNCHER_NEW, taskRunnerNew());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public interface Consts {
|
||||||
String DESTINATION_BANK_ACCOUNT_DELETE = "bank-account-delete";
|
String DESTINATION_BANK_ACCOUNT_DELETE = "bank-account-delete";
|
||||||
String DESTINATION_BANK_ACCOUNT_UPDATE = "bank-account-update";
|
String DESTINATION_BANK_ACCOUNT_UPDATE = "bank-account-update";
|
||||||
String DESTINATION_BANK_ACCOUNT_NEW = "bank-account-new";
|
String DESTINATION_BANK_ACCOUNT_NEW = "bank-account-new";
|
||||||
|
String DESTINATION_RELATION_UPDATE = "relation-update";
|
||||||
|
|
||||||
String DESTINATION_SDF08_NEW = "s-df-08-new";
|
String DESTINATION_SDF08_NEW = "s-df-08-new";
|
||||||
String DESTINATION_SDF02_NEW = "s-df-02-new";
|
String DESTINATION_SDF02_NEW = "s-df-02-new";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package ru.spcex.clearing.platform.messaging.domain.cud.company;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class RelationUpdateRequest {
|
||||||
|
@JsonProperty
|
||||||
|
public Long id;
|
||||||
|
@JsonProperty
|
||||||
|
private String serviceStatus;
|
||||||
|
@JsonProperty
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceStatus() {
|
||||||
|
return serviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServiceStatus(String serviceStatus) {
|
||||||
|
this.serviceStatus = serviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue