This commit is contained in:
AKurakin 2023-09-19 11:26:03 +03:00
parent 70e0c499ed
commit f09b02b693
5 changed files with 173 additions and 8 deletions

View file

@ -1,22 +1,28 @@
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import ru.clearing.classes.statics.data.company.CompanyRoleSet;
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyRoleSetNewAction;
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("/company-role-sets")
@ -41,4 +47,26 @@ public class CompanyRoleSetController extends AbstractQueueController {
response.fromEntity(all);
return response;
}
@ApiOperation(value = "create CompanyRoleSet.")
@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)
@ResponseBody
public CudResponse create(
@ApiParam(value = "Значения полей нового объекта.", required = true)
@RequestBody CompanyRoleSetNewAction companyRoleSetNewAction) throws ExecutionException, InterruptedException {
return processRequest(Consts.DESTINATION_COMPANY_ROLE_SET_NEW, companyRoleSetNewAction);
}
@ApiOperation(value = "delete CompanyRoleSet.")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.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_COMPANY_ROLE_SET_DELETE, deleteAction);
}
}

View file

@ -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.CompanyRoleSetNewRequest;
public class CompanyRoleSetNewAction implements IAction<CompanyRoleSetNewRequest> {
@ApiModelProperty(value = "Наименование компании", example = "1234")
@JsonProperty
Long companyId;
@ApiModelProperty(value = "Код роли компании", example = "ABCD")
@JsonProperty
String companyRole;
@ApiModelProperty(value = "Код статуса", example = "ACTV")
@JsonProperty
String workflowStatus;
@Override
public CompanyRoleSetNewRequest toRequest() {
CompanyRoleSetNewRequest request = new CompanyRoleSetNewRequest();
request.setCompanyId(this.companyId);
request.setCompanyRole(this.companyRole);
request.setWorkflowStatus(this.workflowStatus);
return request;
}
@ApiModelProperty(hidden = true)
@Override
public ActionType getActionType() {
return ActionType.NEW;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public String getCompanyRole() {
return companyRole;
}
public void setCompanyRole(String companyRole) {
this.companyRole = companyRole;
}
public String getWorkflowStatus() {
return workflowStatus;
}
public void setWorkflowStatus(String workflowStatus) {
this.workflowStatus = workflowStatus;
}
}

View file

@ -1,6 +1,6 @@
{
"version": "3.8.0.52",
"version": "3.8.0.53",
"enums": {
@ -2361,7 +2361,41 @@
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
}
]
,"actions":[
{"method":"post",
"name": "Добавление роли участнику",
"class": "ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyRoleSetNewAction",
"fields": [
{"code": "companyId",
"type": 1,"name": "Наименование компании","shortname": "Компания","link": "company","linkCode": "shortName","required": true
}
,
{"code": "companyRole",
"type": 12,"dbname": "Код роли компании","name": "Наименование роли компании","shortname": "Роль","link": "companyRole","required": true
}
,
{"code": "workflowStatus",
"type": 12,"dbname": "Код статуса","name": "Наименование статуса","shortname": "Статус","link": "workflowStatus","required": true
}
]
}
,
{"method":"delete",
"name": "Удаление роли участнику",
"class": "ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction",
"fields": [
{"code": "id",
"type": 1,"name": "Идентификатор записи","shortname": "ID","link": "companyRoleSet","linkCode": "id","required": true
}
]
}
]
}
,
"security": {

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
<meta version="3.8.0.52">
<meta version="3.8.0.53">
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
<!--Здесь словари-->
<enums>
@ -545,6 +545,16 @@
<companyRole type="12" dbname="Код роли компании" name="Наименование роли компании" shortname="Роль" searchable="true" sortable="true" visible="true" link="companyRole"/>
<workflowStatus type="12" dbname="Код статуса" name="Наименование статуса" shortname="Статус" searchable="true" sortable="true" link="workflowStatus"/>
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
<actions>
<post name="Добавление роли участнику" class="ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyRoleSetNewAction">
<companyId type="1" name="Наименование компании" shortname="Компания" link="company" linkCode="shortName" required="true"/>
<companyRole type="12" dbname="Код роли компании" name="Наименование роли компании" shortname="Роль" link="companyRole" required="true"/>
<workflowStatus type="12" dbname="Код статуса" name="Наименование статуса" shortname="Статус" link="workflowStatus" required="true"/>
</post>
<delete name="Удаление роли участнику" class="ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction">
<id type="1" name="Идентификатор записи" shortname="ID" link="companyRoleSet" linkCode="id" required="true"/>
</delete>
</actions>
</companyRoleSet>
<security name="Инструменты" destination="securities" class="ru.clearing.classes.statics.data.security.Security" logUpdates="true" table="security">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>

View file

@ -1,6 +1,6 @@
{
"version": "3.8.0.52",
"version": "3.8.0.53",
"enums": {
@ -2361,7 +2361,41 @@
"type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true
}
]
,"actions":[
{"method":"post",
"name": "Добавление роли участнику",
"class": "ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyRoleSetNewAction",
"fields": [
{"code": "companyId",
"type": 1,"name": "Наименование компании","shortname": "Компания","link": "company","linkCode": "shortName","required": true
}
,
{"code": "companyRole",
"type": 12,"dbname": "Код роли компании","name": "Наименование роли компании","shortname": "Роль","link": "companyRole","required": true
}
,
{"code": "workflowStatus",
"type": 12,"dbname": "Код статуса","name": "Наименование статуса","shortname": "Статус","link": "workflowStatus","required": true
}
]
}
,
{"method":"delete",
"name": "Удаление роли участнику",
"class": "ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction",
"fields": [
{"code": "id",
"type": 1,"name": "Идентификатор записи","shortname": "ID","link": "companyRoleSet","linkCode": "id","required": true
}
]
}
]
}
,
"security": {