backend-api поправил поля в CompanyInfo

This commit is contained in:
AKurakin 2023-05-05 14:30:08 +03:00
parent 1b98981c9f
commit 5938786f84
3 changed files with 277 additions and 9 deletions

View file

@ -14,6 +14,7 @@ import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyInfoUp
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.controller.response.entity.company.CompanyInfoBackendGetAll;
import ru.spcex.clearing.backendapi.meta.GetResponseFactory;
import ru.spcex.clearing.backendapi.service.IOperator;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
@ -53,19 +54,14 @@ public class CompanyInfoController extends AbstractQueueController {
}
@ApiOperation(value = "get all CompanyInfo's.")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CompanyInfoBackendGetAll.class)})
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public CommonGetAllResponse getAll() {
public CompanyInfoBackendGetAll getAll() {
Collection<Map<String, Object>> all = new ArrayList<>();
Collection<Company> companies = companyImdg.getAllValues();
for (Company company : companies) {
if (company.getProfile() != null && company.getProfile().getId() != null) { // пока возвращает "пустой" CompanyInfo если его нет для Company
all.add(responseFactory.responseFromObject(company.getProfile()));
}
}
CommonGetAllResponse response = new CommonGetAllResponse();
response.fromEntity(all);
CompanyInfoBackendGetAll response = new CompanyInfoBackendGetAll();
response.fromEntity(companies);
return response;
}
}

View file

@ -0,0 +1,48 @@
package ru.spcex.clearing.backendapi.controller.response.entity.company;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import ru.clearing.classes.statics.data.company.Company;
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ApiModel(description = "Ответ при получении объектов CompanyInfos.")
public class CompanyInfoBackendGetAll extends BasicSpcexResponse {
@JsonProperty
@ApiModelProperty(value = "Полезная нагрузка")
private CompanyInfoBackendPayload payload = new CompanyInfoBackendPayload();
private static class CompanyInfoBackendPayload {
private List<CompanyInfoBackendGetFields> items = new ArrayList<>();
public List<CompanyInfoBackendGetFields> getItems() {
return items;
}
public void setItems(List<CompanyInfoBackendGetFields> items) {
this.items = items;
}
}
public CompanyInfoBackendPayload getPayload() {
return payload;
}
public void setPayload(CompanyInfoBackendPayload payload) {
this.payload = payload;
}
public void fromEntity(Collection<Company> companys) {
var payload = this.getPayload();
for (var company : companys) {
var singleItem = CompanyInfoBackendGetFields.fromEntity(company);
payload.getItems().add(singleItem);
}
}
}

View file

@ -0,0 +1,224 @@
package ru.spcex.clearing.backendapi.controller.response.entity.company;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.profile.CompanyInfo;
public class CompanyInfoBackendGetFields {
@JsonProperty
@ApiModelProperty(value = "Идентификатор записи")
private Long id;
@JsonProperty
@ApiModelProperty(value = "Идентификатор компании")
private Long companyId;
@JsonProperty
@ApiModelProperty(value = "Код единоличного исполнительного органа")
private String corporationSoleType;
@JsonProperty
@ApiModelProperty(value = "Код юрисдикции")
private String countryCode;
@JsonProperty
@ApiModelProperty(value = "Описание компании")
private String description;
@JsonProperty
@ApiModelProperty(value = "Код признака профессионального участника")
private String professionalSign;
@JsonProperty
@ApiModelProperty(value = "Код вида субъекта")
private String legalKind;
@JsonProperty
@ApiModelProperty(value = "Код типа организации")
private String organizationType;
@JsonProperty
@ApiModelProperty(value = "Код резиденции")
private String residence;
@JsonProperty
@ApiModelProperty(value = "Краткое наименование компании")
private String shortName;
@JsonProperty
@ApiModelProperty(value = "Полное наименование компании")
private String fullName;
@JsonProperty
@ApiModelProperty(value = "Краткое наименование компании на английском")
private String shortNameEng;
@JsonProperty
@ApiModelProperty(value = "Краткое наименование компании на английском")
private String fullNameEng;
@JsonProperty
@ApiModelProperty(value = "Код участника торгов")
private String tradingCode;
@JsonProperty
@ApiModelProperty(value = "Код участника клиринга")
private String clearingCode;
@JsonProperty
@ApiModelProperty(value = "Регистрационный код участника")
private String registrationCode;
@JsonProperty
@ApiModelProperty(value = "Наименование статуса")
private String workflowStatus;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public String getCorporationSoleType() {
return corporationSoleType;
}
public void setCorporationSoleType(String corporationSoleType) {
this.corporationSoleType = corporationSoleType;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getProfessionalSign() {
return professionalSign;
}
public void setProfessionalSign(String professionalSign) {
this.professionalSign = professionalSign;
}
public String getLegalKind() {
return legalKind;
}
public void setLegalKind(String legalKind) {
this.legalKind = legalKind;
}
public String getOrganizationType() {
return organizationType;
}
public void setOrganizationType(String organizationType) {
this.organizationType = organizationType;
}
public String getResidence() {
return residence;
}
public void setResidence(String residence) {
this.residence = residence;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getShortNameEng() {
return shortNameEng;
}
public void setShortNameEng(String shortNameEng) {
this.shortNameEng = shortNameEng;
}
public String getFullNameEng() {
return fullNameEng;
}
public void setFullNameEng(String fullNameEng) {
this.fullNameEng = fullNameEng;
}
public String getTradingCode() {
return tradingCode;
}
public void setTradingCode(String tradingCode) {
this.tradingCode = tradingCode;
}
public String getClearingCode() {
return clearingCode;
}
public void setClearingCode(String clearingCode) {
this.clearingCode = clearingCode;
}
public String getRegistrationCode() {
return registrationCode;
}
public void setRegistrationCode(String registrationCode) {
this.registrationCode = registrationCode;
}
public String getWorkflowStatus() {
return workflowStatus;
}
public void setWorkflowStatus(String workflowStatus) {
this.workflowStatus = workflowStatus;
}
public static CompanyInfoBackendGetFields fromEntity(Company company) {
if (company == null || company.getProfile() == null) {
return null;
}
CompanyInfo info = company.getProfile();
CompanyInfoBackendGetFields fields = new CompanyInfoBackendGetFields();
fields.setId(info.getId());
fields.setCompanyId(info.getCompanyId());
fields.setCorporationSoleType(info.getCorporationSoleType());
fields.setCountryCode(info.getCountryCode());
fields.setDescription(info.getDescription());
fields.setProfessionalSign(info.getProfessionalSign());
fields.setLegalKind(info.getLegalKind());
fields.setOrganizationType(info.getOrganizationType());
fields.setResidence(info.getResidence());
fields.setShortNameEng(info.getShortNameEng());
fields.setFullNameEng(info.getFullNameEng());
fields.setShortName(company.getShortName());
fields.setFullName(company.getFullName());
fields.setTradingCode(company.getTradingCode());
fields.setClearingCode(company.getClearingCode());
fields.setRegistrationCode(company.getRegistrationCode());
fields.setWorkflowStatus(company.getWorkflowStatus());
return fields;
}
}