This commit is contained in:
parent
7a564fce21
commit
c773017570
4 changed files with 244 additions and 2 deletions
|
|
@ -1,28 +1,39 @@
|
|||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import ru.clearing.classes.statics.data.profile.ProfileDocument;
|
||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||
import ru.spcex.clearing.backendapi.controller.request.cud.company.ProfileDocumentNewAction;
|
||||
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("/profile-documents")
|
||||
public class ProfileDocumentController {
|
||||
public class ProfileDocumentController extends AbstractQueueController {
|
||||
private final IStateLoader stateLoader;
|
||||
|
||||
@Autowired
|
||||
public ProfileDocumentController(IStateLoader stateLoader) {
|
||||
public ProfileDocumentController(IStateLoader stateLoader, IOperator operator) {
|
||||
super(operator);
|
||||
this.stateLoader = stateLoader;
|
||||
}
|
||||
|
||||
|
|
@ -36,4 +47,14 @@ public class ProfileDocumentController {
|
|||
response.fromEntity(all);
|
||||
return response;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "new profile document.")
|
||||
@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 ProfileDocumentNewAction profileDocumentNewAction) throws ExecutionException, InterruptedException {
|
||||
return processRequest(Consts.DESTINATION_PROFILE_DOCUMENT_NEW, profileDocumentNewAction);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package ru.spcex.clearing.backendapi.controller.request.cud.company;
|
||||
|
||||
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.platform.messaging.domain.ActionType;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.company.ProfileDocumentNewRequest;
|
||||
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 ProfileDocumentNewAction implements IAction<ProfileDocumentNewRequest> {
|
||||
@ApiModelProperty(value = "Идентификатор Компании", example = "123")
|
||||
@JsonProperty
|
||||
private Long companyId;
|
||||
@ApiModelProperty(value = "Идентификатор типа документа", example = "ABCD")
|
||||
@JsonProperty
|
||||
private String documentType;
|
||||
@ApiModelProperty(value = "Дата выдачи", example = "2022-12-25")
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate issueDate;
|
||||
@ApiModelProperty(value = "Место выдачи", example = "Example string")
|
||||
@JsonProperty
|
||||
private String issuePlace;
|
||||
@ApiModelProperty(value = "Кем выдан", example = "Example string")
|
||||
@JsonProperty
|
||||
private String issuer;
|
||||
@ApiModelProperty(value = "Код выдавшего органа", example = "Example string")
|
||||
@JsonProperty
|
||||
private String issuerCode;
|
||||
@ApiModelProperty(value = "Наименование", example = "Example string")
|
||||
@JsonProperty
|
||||
private String name;
|
||||
@ApiModelProperty(value = "Номер", example = "Example string")
|
||||
@JsonProperty
|
||||
private String number;
|
||||
@ApiModelProperty(value = "Место", example = "Example string")
|
||||
@JsonProperty
|
||||
private String place;
|
||||
@ApiModelProperty(value = "Дата начала срока действия", example = "2022-12-25")
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate validFromDate;
|
||||
@ApiModelProperty(value = "Дата окончания срока действия", example = "2022-12-25")
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate validToDate;
|
||||
@ApiModelProperty(value = "Ссылка на документ", example = "Example string")
|
||||
@JsonProperty
|
||||
private String link;
|
||||
|
||||
@Override
|
||||
public ProfileDocumentNewRequest toRequest() {
|
||||
ProfileDocumentNewRequest request = new ProfileDocumentNewRequest();
|
||||
request.setCompanyId(this.companyId);
|
||||
request.setDocumentType(this.documentType);
|
||||
request.setIssueDate(this.issueDate);
|
||||
request.setIssuePlace(this.issuePlace);
|
||||
request.setIssuer(this.issuer);
|
||||
request.setIssuerCode(this.issuerCode);
|
||||
request.setName(this.name);
|
||||
request.setNumber(this.number);
|
||||
request.setPlace(this.place);
|
||||
request.setValidFromDate(this.validFromDate);
|
||||
request.setValidToDate(this.validToDate);
|
||||
request.setLink(this.link);
|
||||
return request;
|
||||
}
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@Override
|
||||
public ActionType getActionType() {
|
||||
return ActionType.NEW;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ public interface Consts {
|
|||
String DESTINATION_BANK_ACCOUNT_UPDATE = "bank-account-update";
|
||||
String DESTINATION_BANK_ACCOUNT_NEW = "bank-account-new";
|
||||
String DESTINATION_RELATION_UPDATE = "relation-update";
|
||||
String DESTINATION_PROFILE_DOCUMENT_NEW = "profile-document-new";
|
||||
|
||||
String DESTINATION_SDF08_NEW = "s-df-08-new";
|
||||
String DESTINATION_SDF02_NEW = "s-df-02-new";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
package ru.spcex.clearing.platform.messaging.domain.cud.company;
|
||||
|
||||
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 ProfileDocumentNewRequest {
|
||||
@JsonProperty
|
||||
private Long companyId;
|
||||
@JsonProperty
|
||||
private String documentType;
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate issueDate;
|
||||
@JsonProperty
|
||||
private String issuePlace;
|
||||
@JsonProperty
|
||||
private String issuer;
|
||||
@JsonProperty
|
||||
private String issuerCode;
|
||||
@JsonProperty
|
||||
private String name;
|
||||
@JsonProperty
|
||||
private String number;
|
||||
@JsonProperty
|
||||
private String place;
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate validFromDate;
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate validToDate;
|
||||
@JsonProperty
|
||||
private String link;
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getDocumentType() {
|
||||
return documentType;
|
||||
}
|
||||
|
||||
public void setDocumentType(String documentType) {
|
||||
this.documentType = documentType;
|
||||
}
|
||||
|
||||
public LocalDate getIssueDate() {
|
||||
return issueDate;
|
||||
}
|
||||
|
||||
public void setIssueDate(LocalDate issueDate) {
|
||||
this.issueDate = issueDate;
|
||||
}
|
||||
|
||||
public String getIssuePlace() {
|
||||
return issuePlace;
|
||||
}
|
||||
|
||||
public void setIssuePlace(String issuePlace) {
|
||||
this.issuePlace = issuePlace;
|
||||
}
|
||||
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
|
||||
public void setIssuer(String issuer) {
|
||||
this.issuer = issuer;
|
||||
}
|
||||
|
||||
public String getIssuerCode() {
|
||||
return issuerCode;
|
||||
}
|
||||
|
||||
public void setIssuerCode(String issuerCode) {
|
||||
this.issuerCode = issuerCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public LocalDate getValidFromDate() {
|
||||
return validFromDate;
|
||||
}
|
||||
|
||||
public void setValidFromDate(LocalDate validFromDate) {
|
||||
this.validFromDate = validFromDate;
|
||||
}
|
||||
|
||||
public LocalDate getValidToDate() {
|
||||
return validToDate;
|
||||
}
|
||||
|
||||
public void setValidToDate(LocalDate validToDate) {
|
||||
this.validToDate = validToDate;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue