This commit is contained in:
AKurakin 2023-05-12 15:25:03 +03:00
parent 9db47584ec
commit 97da625d64
6 changed files with 339 additions and 103 deletions

View file

@ -10,7 +10,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import ru.clearing.classes.statics.data.company.CompanySymbols;
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.CompanySymbolNewAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanySymbolUpdateAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactNewAction;
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;
@ -35,6 +38,17 @@ public class CompanySymbolController extends AbstractQueueController {
this.stateLoader = stateLoader;
}
@ApiOperation(value = "create company symbol.")
@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 CompanySymbolNewAction companySymbolNewAction) throws ExecutionException, InterruptedException {
return processRequest(Consts.DESTINATION_COMPANY_SYMBOL_NEW, companySymbolNewAction);
}
@ApiOperation(value = "update company symbol.")
@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)
@ -58,4 +72,15 @@ public class CompanySymbolController extends AbstractQueueController {
response.fromEntity(all);
return response;
}
@ApiOperation(value = "delete company symbol.")
@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_SYMBOL_DELETE, deleteAction);
}
}

View file

@ -10,6 +10,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import ru.clearing.classes.statics.data.profile.Contact;
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.ContactNewAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactUpdateAction;
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
@ -58,6 +59,17 @@ public class ContactController extends AbstractQueueController {
return processRequest(Consts.DESTINATION_CONTACT_NEW, contactNewAction);
}
@ApiOperation(value = "delete contact.")
@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_CONTACT_DELETE, deleteAction);
}
@ApiOperation(value = "get all Contacts.")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
@RequestMapping(method = RequestMethod.GET)

View file

@ -21,7 +21,25 @@ import java.util.Collections;
import java.util.List;
public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurityNewRequest>, WithSecuritySymbol {
@ApiModelProperty(value = "Дата начала действия", example = "2022-01-20")
@ApiModelProperty(value = "Код инструмента", example = "CDE")
@JsonProperty
public String securitySymbol;
@ApiModelProperty(value = "Краткое наименование инструмента", example = "NAME")
@JsonProperty
public String shortName;
@ApiModelProperty(value = "Полное наименование инструмента", example = "NAME A")
@JsonProperty
public String fullName;
@ApiModelProperty(value = "Размер лота", example = "21.55")
@JsonProperty
public BigDecimal lotSize;
@ApiModelProperty(value = "Номинал", example = "20.5554")
@JsonProperty
public BigDecimal nominalValue;
@ApiModelProperty(value = "Наименование валюты номинала", example = "RUB")
@JsonProperty
public String nominalCurrency;
@ApiModelProperty(value = "Дата начала действия", example = "2022-02-20")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonProperty
@ -31,27 +49,30 @@ public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurity
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonProperty
public LocalDate endDate;
@ApiModelProperty(value = "Номинал", example = "20.5")
@ApiModelProperty(value = "Наименование вида инструмента", example = "ABCD")
@JsonProperty
public BigDecimal nominalValue;
@ApiModelProperty(value = "Идентификатор валюты номинала", example = "1000")
public String termType;
@ApiModelProperty(value = "Описание", example = "ABCD E")
@JsonProperty
public String nominalCurrency;
@ApiModelProperty(value = "Идентификатор типа инструмента", example = "ABCD")
public String description;
@ApiModelProperty(value = "Наименование эмитента", example = "1234")
@JsonProperty
public Long issuerId;
@ApiModelProperty(value = "Краткое наименование инструмента на английском", example = "ABSDE")
@JsonProperty
public String shortNameEng;
@ApiModelProperty(value = "Полное наименование инструмента на английском", example = "ABCD")
@JsonProperty
public String fullNameEng;
@ApiModelProperty(value = "Наименование инструмента ISIN", example = "ABCD")
@JsonProperty
public String isin;
@ApiModelProperty(value = "Наименование статуса", example = "ABCD")
@JsonProperty
public String workflowStatus;
@ApiModelProperty(value = "Наименование типа инструмента", example = "ABCDE")
@JsonProperty
public String instrumentType;
@ApiModelProperty(value = "Полное наименование инструмента", example = "Treasury bills")
@JsonProperty
public String fullName;
@ApiModelProperty(value = "Код инструмента", example = "ABSDEFJ")
@JsonProperty
public String securitySymbol;
@ApiModelProperty(value = "Размер лота", example = "300.5")
@JsonProperty
public BigDecimal lotSize;
@ApiModelProperty(value = "Краткое наименование инструмента", example = "ABSDE")
@JsonProperty
public String shortName;
@Override
public Collection<EnumMessage> validate() {
@ -70,8 +91,8 @@ public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurity
errors.add(new EnumMessage(BackEndError.ValidationError, "startDate"));
if (this.endDate == null)
errors.add(new EnumMessage(BackEndError.ValidationError, "endDate"));
// if (this.termType == null)
// errors.add(new EnumMessage(BackEndError.ValidationError, "termType"));
if (this.termType == null)
errors.add(new EnumMessage(BackEndError.ValidationError, "termType"));
if (TextUtil.isEmpty(instrumentType))
errors.add(new EnumMessage(BackEndError.ValidationError, "instrumentType"));
return errors.size() > 0 ? errors : Collections.emptyList();
@ -89,6 +110,13 @@ public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurity
req.setSecuritySymbol(this.getSecuritySymbol());
req.setLotSize(this.getLotSize());
req.setShortName(this.getShortName());
req.setTermType(this.getTermType());
req.setDescription(this.getDescription());
req.setIssuerId(this.getIssuerId());
req.setShortNameEng(this.getShortNameEng());
req.setFullNameEng(this.getFullNameEng());
req.setIsin(this.getIsin());
req.setWorkflowStatus(this.getWorkflowStatus());
return req;
}
@ -98,20 +126,37 @@ public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurity
return ActionType.NEW;
}
public LocalDate getStartDate() {
return startDate;
@Override
public String getSecuritySymbol() {
return securitySymbol;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
public void setSecuritySymbol(String securitySymbol) {
this.securitySymbol = securitySymbol;
}
public LocalDate getEndDate() {
return endDate;
public String getShortName() {
return shortName;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public BigDecimal getLotSize() {
return lotSize;
}
public void setLotSize(BigDecimal lotSize) {
this.lotSize = lotSize;
}
public BigDecimal getNominalValue() {
@ -130,6 +175,78 @@ public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurity
this.nominalCurrency = nominalCurrency;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public String getTermType() {
return termType;
}
public void setTermType(String termType) {
this.termType = termType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getIssuerId() {
return issuerId;
}
public void setIssuerId(Long issuerId) {
this.issuerId = issuerId;
}
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 getIsin() {
return isin;
}
public void setIsin(String isin) {
this.isin = isin;
}
public String getWorkflowStatus() {
return workflowStatus;
}
public void setWorkflowStatus(String workflowStatus) {
this.workflowStatus = workflowStatus;
}
public String getInstrumentType() {
return instrumentType;
}
@ -137,36 +254,4 @@ public class MoneyMarketSecurityNewAction implements IAction<MoneyMarketSecurity
public void setInstrumentType(String instrumentType) {
this.instrumentType = instrumentType;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getSecuritySymbol() {
return securitySymbol;
}
public void setSecuritySymbol(String securitySymbol) {
this.securitySymbol = securitySymbol;
}
public BigDecimal getLotSize() {
return lotSize;
}
public void setLotSize(BigDecimal lotSize) {
this.lotSize = lotSize;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
}

View file

@ -23,7 +23,25 @@ public class MoneyMarketSecurityUpdateAction implements IAction<MoneyMarketSecur
@ApiModelProperty(hidden = true)
@JsonProperty
public Long id;
@ApiModelProperty(value = "Дата начала действия", example = "2022-02-21")
@ApiModelProperty(value = "Код инструмента", example = "CDE")
@JsonProperty
public String securitySymbol;
@ApiModelProperty(value = "Краткое наименование инструмента", example = "NAME")
@JsonProperty
public String shortName;
@ApiModelProperty(value = "Полное наименование инструмента", example = "NAME A")
@JsonProperty
public String fullName;
@ApiModelProperty(value = "Размер лота", example = "21.55")
@JsonProperty
public BigDecimal lotSize;
@ApiModelProperty(value = "Номинал", example = "20.5554")
@JsonProperty
public BigDecimal nominalValue;
@ApiModelProperty(value = "Наименование валюты номинала", example = "RUB")
@JsonProperty
public String nominalCurrency;
@ApiModelProperty(value = "Дата начала действия", example = "2022-02-20")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonProperty
@ -33,24 +51,30 @@ public class MoneyMarketSecurityUpdateAction implements IAction<MoneyMarketSecur
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonProperty
public LocalDate endDate;
@ApiModelProperty(value = "Номинал", example = "20.5")
@ApiModelProperty(value = "Наименование вида инструмента", example = "ABCD")
@JsonProperty
public BigDecimal nominalValue;
@ApiModelProperty(value = "Валюта номинала", example = "RUB")
public String termType;
@ApiModelProperty(value = "Описание", example = "ABCD E")
@JsonProperty
public String nominalCurrency;
@ApiModelProperty(value = "Идентификатор типа инструмента", example = "ABCD")
public String description;
@ApiModelProperty(value = "Наименование эмитента", example = "1234")
@JsonProperty
public Long issuerId;
@ApiModelProperty(value = "Краткое наименование инструмента на английском", example = "ABSDE")
@JsonProperty
public String shortNameEng;
@ApiModelProperty(value = "Полное наименование инструмента на английском", example = "ABCD")
@JsonProperty
public String fullNameEng;
@ApiModelProperty(value = "Наименование инструмента ISIN", example = "ABCD")
@JsonProperty
public String isin;
@ApiModelProperty(value = "Наименование статуса", example = "ABCD")
@JsonProperty
public String workflowStatus;
@ApiModelProperty(value = "Наименование типа инструмента", example = "ABCDE")
@JsonProperty
public String instrumentType;
@ApiModelProperty(value = "Полное наименование инструмента", example = "Treasury bills")
@JsonProperty
public String fullName;
@ApiModelProperty(value = "Размер лота", example = "300.5")
@JsonProperty
public BigDecimal lotSize;
@ApiModelProperty(value = "Краткое наименование инструмента", example = "ABSDE")
@JsonProperty
public String shortName;
@Override
public MoneyMarketSecurityUpdateRequest toRequest() {
@ -62,8 +86,16 @@ public class MoneyMarketSecurityUpdateAction implements IAction<MoneyMarketSecur
req.setNominalCurrency(this.getNominalCurrency());
req.setInstrumentType(this.getInstrumentType());
req.setFullName(this.getFullName());
req.setSecuritySymbol(this.getSecuritySymbol());
req.setLotSize(this.getLotSize());
req.setShortName(this.getShortName());
req.setTermType(this.getTermType());
req.setDescription(this.getDescription());
req.setIssuerId(this.getIssuerId());
req.setShortNameEng(this.getShortNameEng());
req.setFullNameEng(this.getFullNameEng());
req.setIsin(this.getIsin());
req.setWorkflowStatus(this.getWorkflowStatus());
return req;
}
@ -82,36 +114,29 @@ public class MoneyMarketSecurityUpdateAction implements IAction<MoneyMarketSecur
}
public LocalDate getEndDate() {
return endDate;
@Override
public Long getId() {
return id;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
public void setId(Long id) {
this.id = id;
}
public BigDecimal getNominalValue() {
return nominalValue;
public String getSecuritySymbol() {
return securitySymbol;
}
public void setNominalValue(BigDecimal nominalValue) {
this.nominalValue = nominalValue;
public void setSecuritySymbol(String securitySymbol) {
this.securitySymbol = securitySymbol;
}
public String getNominalCurrency() {
return nominalCurrency;
public String getShortName() {
return shortName;
}
public void setNominalCurrency(String nominalCurrency) {
this.nominalCurrency = nominalCurrency;
}
public String getInstrumentType() {
return instrumentType;
}
public void setInstrumentType(String instrumentType) {
this.instrumentType = instrumentType;
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getFullName() {
@ -130,12 +155,20 @@ public class MoneyMarketSecurityUpdateAction implements IAction<MoneyMarketSecur
this.lotSize = lotSize;
}
public Long getId() {
return id;
public BigDecimal getNominalValue() {
return nominalValue;
}
public void setId(Long id) {
this.id = id;
public void setNominalValue(BigDecimal nominalValue) {
this.nominalValue = nominalValue;
}
public String getNominalCurrency() {
return nominalCurrency;
}
public void setNominalCurrency(String nominalCurrency) {
this.nominalCurrency = nominalCurrency;
}
public LocalDate getStartDate() {
@ -146,11 +179,75 @@ public class MoneyMarketSecurityUpdateAction implements IAction<MoneyMarketSecur
this.startDate = startDate;
}
public String getShortName() {
return shortName;
public LocalDate getEndDate() {
return endDate;
}
public void setShortName(String shortName) {
this.shortName = shortName;
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public String getTermType() {
return termType;
}
public void setTermType(String termType) {
this.termType = termType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getIssuerId() {
return issuerId;
}
public void setIssuerId(Long issuerId) {
this.issuerId = issuerId;
}
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 getIsin() {
return isin;
}
public void setIsin(String isin) {
this.isin = isin;
}
public String getWorkflowStatus() {
return workflowStatus;
}
public void setWorkflowStatus(String workflowStatus) {
this.workflowStatus = workflowStatus;
}
public String getInstrumentType() {
return instrumentType;
}
public void setInstrumentType(String instrumentType) {
this.instrumentType = instrumentType;
}
}

View file

@ -34,6 +34,13 @@ class MoneyMarketSecurityControllerTest extends AbstractControllerTest {
moneyMarketSecurityNewAction.setShortName("shortName");
moneyMarketSecurityNewAction.setSecuritySymbol("s-symbol");
moneyMarketSecurityNewAction.setLotSize(new BigDecimal("3.5"));
moneyMarketSecurityNewAction.setTermType("TYPE");
moneyMarketSecurityNewAction.setDescription("Sample text of desc");
moneyMarketSecurityNewAction.setIssuerId(111L);
moneyMarketSecurityNewAction.setShortNameEng("Short");
moneyMarketSecurityNewAction.setFullNameEng("Short LLC");
moneyMarketSecurityNewAction.setIsin("ISIN");
moneyMarketSecurityNewAction.setWorkflowStatus("ACTV");
//ACT and ASSERT
checkAddingByRestApi(REST_URL, moneyMarketSecurityNewAction);
@ -58,6 +65,14 @@ class MoneyMarketSecurityControllerTest extends AbstractControllerTest {
moneyMarketSecurityUpdateAction.setInstrumentType("status");
moneyMarketSecurityUpdateAction.setFullName("fname");
moneyMarketSecurityUpdateAction.setLotSize(new BigDecimal("3.5"));
moneyMarketSecurityUpdateAction.setSecuritySymbol("s-symbol");
moneyMarketSecurityUpdateAction.setTermType("TYPE");
moneyMarketSecurityUpdateAction.setDescription("Sample text of desc");
moneyMarketSecurityUpdateAction.setIssuerId(111L);
moneyMarketSecurityUpdateAction.setShortNameEng("Short");
moneyMarketSecurityUpdateAction.setFullNameEng("Short LLC");
moneyMarketSecurityUpdateAction.setIsin("ISIN");
moneyMarketSecurityUpdateAction.setWorkflowStatus("ACTV");
MoneyMarketSecurity moneyMarketSecurity = getMoneyMarketSecurity(id);
//ACT and ASSERT

View file

@ -45,11 +45,13 @@ public interface Consts {
String DESTINATION_COMPANY_INFO_UPDATE = "company-info-update";
String DESTINATION_COMPANY_SYMBOL_NEW = "company-symbol-new";
String DESTINATION_COMPANY_SYMBOL_UPDATE = "company-symbol-update";
String DESTINATION_COMPANY_SYMBOL_DELETE = "company-symbol-delete";
String DESTINATION_COMPANY_ROLE_SET_NEW = "companyroleset-new";
String DESTINATION_COMPANY_ROLE_SET_DELETE = "companyroleset-delete";
String DESTINATION_COMPANY_ROLE_SET_UPDATE = "companyroleset-update";
String DESTINATION_CONTACT_NEW = "contact-new";
String DESTINATION_CONTACT_UPDATE = "contact-update";
String DESTINATION_CONTACT_DELETE = "contact-delete";
String DESTINATION_CLEARING_MEMBER_CATEGORY_NEW = "clearing-member-category-new";
String DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE = "clearing-member-category-update";
String DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE = "clearing-member-category-delete";