From f9044dcc1ccb0ae83797c77c8fa1e902b54ab5e7 Mon Sep 17 00:00:00 2001 From: etreschenkov Date: Wed, 24 May 2023 15:54:06 +0300 Subject: [PATCH 1/3] http://jira.mfd.msk:8088/browse/CLS-290 --- .../ru/spcex/clearing/config/ValidationConfig.java | 1 + .../java/ru/spcex/clearing/error/ClearingError.java | 3 ++- .../service/validation/Sdf01ValidationRule.java | 6 +++--- .../service/validation/Sdf57ValidationRule.java | 12 ++++++------ .../session/stage/PrimaryAuctionBnSession.java | 3 +++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java index 0e7dfc67d..0cb4c69b7 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java @@ -137,6 +137,7 @@ public class ValidationConfig { Sdf57ValidationRule.CompanyDebPresent, Sdf57ValidationRule.CompanyCredPresent, Sdf57ValidationRule.AccountDebPresent, + Sdf57ValidationRule.AccountCredPresent, Sdf57ValidationRule.CurrencyCode ); }; diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/error/ClearingError.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/error/ClearingError.java index 6cc1b6d75..578fd53ac 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/error/ClearingError.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/error/ClearingError.java @@ -4,12 +4,13 @@ import ru.spcex.platform.utils.enumeration.IErrorEnumId; public enum ClearingError implements IErrorEnumId { GeneralError(5400L), + IncorrectValue(5404L), RecordNotFound(5406L), CompanyNotFound(5410L), CompanyNotActive(5411L), CompanyCreditCheck(5412L), CompanyDebitCheck(5413L), - CurrentDateOnly(5214L), + AccountNotFound(5414L), AccountNotActive(5415L), SecurityNotFound(5416L), AccountNotPresent(5417L), diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf01ValidationRule.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf01ValidationRule.java index 0dee8747c..9fbaa9e42 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf01ValidationRule.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf01ValidationRule.java @@ -66,16 +66,16 @@ public enum Sdf01ValidationRule implements IValidationRule validate(ImdgValidationContext context) { SDf01 sdf01 = context.getValidatedObject(); if (sdf01.getDat() == null) { - return of(ClearingError.CurrentDateOnly); + return of(ClearingError.IncorrectValue); } LocalDate date; try { date = LocalDate.parse(sdf01.getDat(), datFormatter); } catch (DateTimeParseException e) { - return of(ClearingError.CurrentDateOnly); + return of(ClearingError.IncorrectValue); } if (!LocalDate.now().equals(date)) { - return of(ClearingError.CurrentDateOnly); + return of(ClearingError.IncorrectValue); } return empty(); } diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java index 464062c48..b39c990bc 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java @@ -34,12 +34,12 @@ public enum Sdf57ValidationRule implements IValidationRule validate(ImdgValidationContext context) { SDf57 sdf57 = context.getValidatedObject(); if (TextUtil.isEmpty(sdf57.getDeal_cred())) { - return of(ClearingError.CompanyNotFound, sdf57.getDeal_deb()); + return of(ClearingError.CompanyNotFound, sdf57.getDeal_cred()); } Imdg companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class); Company found = companyImdg.getSingleObjectBySQL("tradingCode = '" + sdf57.getDeal_cred() + "'"); if (found == null) { - return of(ClearingError.CompanyNotFound, sdf57.getDeal_deb()); + return of(ClearingError.CompanyNotFound, sdf57.getDeal_cred()); } context.storeObject(ValidationStored.Sdf57CompanyCred, found); return empty(); @@ -49,12 +49,12 @@ public enum Sdf57ValidationRule implements IValidationRule validate(ImdgValidationContext context) { SDf57 sdf57 = context.getValidatedObject(); if (TextUtil.isEmpty(sdf57.getC_acc_deb())) { - return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb()); + return of(ClearingError.AccountNotPresent, sdf57.getC_acc_deb()); } Imdg accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class); Account found = accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_deb() + "'"); if (found == null) { - return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb()); + return of(ClearingError.AccountNotPresent, sdf57.getC_acc_deb()); } context.storeObject(ValidationStored.Sdf57AccountDeb, found); return empty(); @@ -65,12 +65,12 @@ public enum Sdf57ValidationRule implements IValidationRule validate(ImdgValidationContext context) { SDf57 sdf57 = context.getValidatedObject(); if (TextUtil.isEmpty(sdf57.getC_acc_cred())) { - return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb()); + return of(ClearingError.AccountNotPresent, sdf57.getC_acc_cred()); } Imdg accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class); Account found = accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_cred() + "'"); if (found == null) { - return of(ClearingError.AccountNotPresent, sdf57.getDeal_deb()); + return of(ClearingError.AccountNotPresent, sdf57.getC_acc_cred()); } context.storeObject(ValidationStored.Sdf57AccountCred, found); return empty(); diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/session/stage/PrimaryAuctionBnSession.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/session/stage/PrimaryAuctionBnSession.java index e3d4c4312..7beadc73e 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/session/stage/PrimaryAuctionBnSession.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/session/stage/PrimaryAuctionBnSession.java @@ -21,6 +21,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider; import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder; import ru.spcex.platform.utils.enumeration.IMessageResolver; +import java.time.LocalDate; import java.util.List; @Service @@ -153,6 +154,8 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali newSession.setSection(Section.FOND.getKey()); newSession.setSessionType(SessionType.IPOB.getKey()); newSession.setSessionStatus(SessionStatus.CLRN.getKey()); + newSession.setClearingDate(LocalDate.now()); + //todo companyId/securityId/userId передается из сообщения очереди sessionImdg.insert(newSession); currSession = newSession; From fac24548fa3b5c4cc2a0b5b35378fcf52cf718a4 Mon Sep 17 00:00:00 2001 From: AKurakin Date: Wed, 24 May 2023 16:20:49 +0300 Subject: [PATCH 2/3] backend-api http://jira.mfd.msk:8088/browse/CLS-325 + meta 3.5.0.25 --- .../queue/misc/ListingController.java | 49 +++++- .../request/cud/company/ListingNewAction.java | 86 +++++++++ .../cud/company/ListingUpdateAction.java | 97 +++++++++++ .../src/main/resources/meta/meta.json | 163 +++++++++++++----- .../src/main/resources/meta/meta.xml | 64 ++++--- .../backend-api/src/test/resources/meta.json | 163 +++++++++++++----- .../platform/messaging/domain/Consts.java | 4 + .../cud/securitites/ListingNewRequest.java | 58 +++++++ .../cud/securitites/ListingUpdateRequest.java | 68 ++++++++ 9 files changed, 639 insertions(+), 113 deletions(-) create mode 100644 clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingNewAction.java create mode 100644 clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingUpdateAction.java create mode 100644 platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingNewRequest.java create mode 100644 platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingUpdateRequest.java diff --git a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/misc/ListingController.java b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/misc/ListingController.java index 583801df2..45cf6dd43 100644 --- a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/misc/ListingController.java +++ b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/queue/misc/ListingController.java @@ -1,22 +1,29 @@ package ru.spcex.clearing.backendapi.controller.queue.misc; 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.misc.Listing; 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.ListingNewAction; +import ru.spcex.clearing.backendapi.controller.request.cud.company.ListingUpdateAction; +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("/listings") @@ -39,4 +46,40 @@ public class ListingController extends AbstractQueueController { response.fromEntity(all); return response; } + + + + @ApiOperation(value = "create Listing.") + @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 ListingNewAction listingNewAction) throws ExecutionException, InterruptedException { + return processRequest(Consts.LISTING_NEW, listingNewAction); + } + + @ApiOperation(value = "update Listing.") + @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 ListingUpdateAction listingUpdateAction) throws ExecutionException, InterruptedException { + listingUpdateAction.setId(id); + return processRequest(Consts.LISTING_UPDATE, listingUpdateAction); + } + + @ApiOperation(value = "delete Listing.") + @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.LISTING_DELETE, deleteAction); + } } diff --git a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingNewAction.java b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingNewAction.java new file mode 100644 index 000000000..ca4768af3 --- /dev/null +++ b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingNewAction.java @@ -0,0 +1,86 @@ +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.CompanySymbolUpdateRequest; +import ru.spcex.clearing.platform.messaging.domain.cud.securitites.ListingNewRequest; + +import java.math.BigDecimal; + +public class ListingNewAction implements IAction { + @ApiModelProperty(value = "Наименование инструмента", example = "1234") + @JsonProperty + private Long securityId; + @ApiModelProperty(value = "Наименование режима", example = "ABCD") + @JsonProperty + private String market; + @ApiModelProperty(value = "Размер лота", example = "1234.56") + @JsonProperty + private BigDecimal lotSize; + @ApiModelProperty(value = "Наименование валюты расчета", example = "RUB") + @JsonProperty + private String tradingCurrency; + @ApiModelProperty(value = "Наименование статуса листинга в системе", example = "ACTV") + @JsonProperty + private String workflowStatus; + + @Override + public ListingNewRequest toRequest() { + ListingNewRequest request = new ListingNewRequest(); + request.setSecurityId(this.securityId); + request.setMarket(this.market); + request.setLotSize(this.lotSize); + request.setTradingCurrency(this.tradingCurrency); + request.setWorkflowStatus(this.workflowStatus); + return request; + } + + @ApiModelProperty(hidden = true) + @Override + public ActionType getActionType() { + return ActionType.NEW; + } + + + public Long getSecurityId() { + return securityId; + } + + public void setSecurityId(Long securityId) { + this.securityId = securityId; + } + + public String getMarket() { + return market; + } + + public void setMarket(String market) { + this.market = market; + } + + public BigDecimal getLotSize() { + return lotSize; + } + + public void setLotSize(BigDecimal lotSize) { + this.lotSize = lotSize; + } + + public String getTradingCurrency() { + return tradingCurrency; + } + + public void setTradingCurrency(String tradingCurrency) { + this.tradingCurrency = tradingCurrency; + } + + public String getWorkflowStatus() { + return workflowStatus; + } + + public void setWorkflowStatus(String workflowStatus) { + this.workflowStatus = workflowStatus; + } +} diff --git a/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingUpdateAction.java b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingUpdateAction.java new file mode 100644 index 000000000..afaf2591f --- /dev/null +++ b/clearing-parent/backend-api/src/main/java/ru/spcex/clearing/backendapi/controller/request/cud/company/ListingUpdateAction.java @@ -0,0 +1,97 @@ +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.ContactUpdateRequest; +import ru.spcex.clearing.platform.messaging.domain.cud.securitites.ListingUpdateRequest; + +import java.math.BigDecimal; + +public class ListingUpdateAction implements IAction { + @ApiModelProperty(hidden = true) + @JsonProperty + public Long id; + @ApiModelProperty(value = "Наименование инструмента", example = "1234") + @JsonProperty + private Long securityId; + @ApiModelProperty(value = "Наименование режима", example = "ABCD") + @JsonProperty + private String market; + @ApiModelProperty(value = "Размер лота", example = "1234.56") + @JsonProperty + private BigDecimal lotSize; + @ApiModelProperty(value = "Наименование валюты расчета", example = "RUB") + @JsonProperty + private String tradingCurrency; + @ApiModelProperty(value = "Наименование статуса листинга в системе", example = "ACTV") + @JsonProperty + private String workflowStatus; + + @Override + public ListingUpdateRequest toRequest() { + ListingUpdateRequest request = new ListingUpdateRequest(); + request.setId(this.id); + request.setSecurityId(this.securityId); + request.setMarket(this.market); + request.setLotSize(this.lotSize); + request.setTradingCurrency(this.tradingCurrency); + request.setWorkflowStatus(this.workflowStatus); + 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 Long getSecurityId() { + return securityId; + } + + public void setSecurityId(Long securityId) { + this.securityId = securityId; + } + + public String getMarket() { + return market; + } + + public void setMarket(String market) { + this.market = market; + } + + public BigDecimal getLotSize() { + return lotSize; + } + + public void setLotSize(BigDecimal lotSize) { + this.lotSize = lotSize; + } + + public String getTradingCurrency() { + return tradingCurrency; + } + + public void setTradingCurrency(String tradingCurrency) { + this.tradingCurrency = tradingCurrency; + } + + public String getWorkflowStatus() { + return workflowStatus; + } + + public void setWorkflowStatus(String workflowStatus) { + this.workflowStatus = workflowStatus; + } +} diff --git a/clearing-parent/backend-api/src/main/resources/meta/meta.json b/clearing-parent/backend-api/src/main/resources/meta/meta.json index 7b96718d8..84394d492 100644 --- a/clearing-parent/backend-api/src/main/resources/meta/meta.json +++ b/clearing-parent/backend-api/src/main/resources/meta/meta.json @@ -1,6 +1,6 @@ { - "version": "3.5.0.24", + "version": "3.5.0.25", "enums": { @@ -2502,6 +2502,10 @@ "confirmation": "securitySymbol,shortName,fullName,lotSize,nominalValue,nominalCurrency", "fields": [ + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } + , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","required": true } @@ -2539,7 +2543,7 @@ } , {"code": "termType", - "type": 12,"name": "Наименование вида инструмента","shortname": "Вид инструмента","link": "termType","visible": false + "type": 12,"name": "Наименование вида инструмента","shortname": "Вид инструмента","link": "termType" } , {"code": "description", @@ -2565,10 +2569,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"visible": false - } ] } , @@ -2582,6 +2582,10 @@ {"code": "id", "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "moneyMarketSecurity","linkCode": "id","required": true } + , + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","enabled": false @@ -2600,7 +2604,7 @@ } , {"code": "lotSize", - "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing","required": true } , {"code": "nominalValue", @@ -2646,10 +2650,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","visible": false - } ] } , @@ -2768,9 +2768,13 @@ "name": "Добавление акции", - "confirmation": "securitySymbol,shortName,fullName,isin,shareType,lotSize", + "confirmation": "securitySymbol,shortName,fullName,isin,shareType", "fields": [ + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } + , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","required": true } @@ -2792,7 +2796,7 @@ } , {"code": "lotSize", - "type": 11,"name": "Размер лота","shortname": "Лот","required": true + "type": 11,"name": "Размер лота","shortname": "Лот","visible": false } , {"code": "issuerId", @@ -2810,10 +2814,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"visible": false - } ] } , @@ -2821,12 +2821,16 @@ "name": "Изменение акции", - "confirmation": "securitySymbol,shortName,fullName,isin,shareType,lotSize", + "confirmation": "securitySymbol,shortName,fullName,isin,shareType", "fields": [ {"code": "id", "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "equitySecurity","linkCode": "id","required": true } + , + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","enabled": false @@ -2849,7 +2853,7 @@ } , {"code": "lotSize", - "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing","visible": false } , {"code": "issuerId", @@ -2867,10 +2871,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","visible": false - } ] } , @@ -2979,9 +2979,13 @@ "name": "Добавление облигации", - "confirmation": "securitySymbol,shortName,fullName,isin,bondType,lotSize,nominalValue,nominalCurrency", + "confirmation": "securitySymbol,shortName,fullName,isin,bondType,nominalValue,nominalCurrency", "fields": [ + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } + , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","required": true } @@ -3003,7 +3007,7 @@ } , {"code": "lotSize", - "type": 11,"name": "Размер лота","shortname": "Лот","required": true + "type": 11,"name": "Размер лота","shortname": "Лот","visible": false } , {"code": "nominalValue", @@ -3041,10 +3045,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"visible": false - } ] } , @@ -3052,12 +3052,16 @@ "name": "Изменение облигации", - "confirmation": "securitySymbol,shortName,fullName,isin,bondType,lotSize,nominalValue,nominalCurrency", + "confirmation": "securitySymbol,shortName,fullName,isin,bondType,nominalValue,nominalCurrency", "fields": [ {"code": "id", "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "fixedIncomeSecurity","linkCode": "id","required": true } + , + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","enabled": false @@ -3080,7 +3084,7 @@ } , {"code": "lotSize", - "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing","visible": false } , {"code": "nominalValue", @@ -3118,10 +3122,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","visible": false - } ] } , @@ -3222,7 +3222,7 @@ , "listing": { - "name": "Листинг инструментов", + "name": "Инструменты на режимах", "destination": "listings", @@ -3236,21 +3236,21 @@ {"code": "securityId", "type": 1,"dbname": "Идентификатор инструмента","name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"link": "security","linkCode": "shortName" } + , + {"code": "market", + "type": 12,"dbname": "Код торговой секции","name": "Наименование режима","shortname": "Режим","searchable": true,"sortable": true,"link": "market","linkCode": "description" + } , {"code": "lotSize", "type": 11,"name": "Размер лота","shortname": "Лот","searchable": true,"sortable": true } - , - {"code": "market", - "type": 12,"dbname": "Код торговой секции","name": "Наименование торговой секции","shortname": "Секция","searchable": true,"sortable": true,"link": "market","linkCode": "name" - } , {"code": "symbolCode", - "type": 2,"length": 255,"name": "Код инструмента на торговой площадке","shortname": "Код инструмента на торговой площадке","searchable": true,"sortable": true + "type": 2,"length": 255,"name": "Код инструмента на торговой площадке","shortname": "Код инструмента на режиме","searchable": true,"sortable": true } , {"code": "symbolName", - "type": 2,"length": 255,"name": "Наименование инструмента на торговой площадке","shortname": "Инструмент на торговой площадке","searchable": true,"sortable": true + "type": 2,"length": 255,"name": "Наименование инструмента на торговой площадке","shortname": "Наименование инструмента на режиме","searchable": true,"sortable": true } , {"code": "tradingCurrency", @@ -3273,7 +3273,82 @@ "field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true } ] - + ,"actions":[ + {"method":"post", + + "name": "Добавление инструмента на режимах", + + "confirmation": "securityId,market,lotSize,tradingCurrency,workflowStatus", + + "fields": [ + {"code": "securityId", + "type": 1,"name": "Наименование инструмента","shortname": "Инструмент","link": "security","linkCode": "shortName","required": true + } + , + {"code": "market", + "type": 12,"name": "Наименование режима","shortname": "Режим","link": "market","required": true,"linkCode": "code" + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Лот","required": true + } + , + {"code": "tradingCurrency", + "type": 12,"name": "Наименование валюты расчета","shortname": "Валюта","link": "currencyCode","linkCode": "code","required": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Наименование статуса листинга в системе","shortname": "Статус","link": "workflowStatus","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение инструмента на режимах", + + "confirmation": "securityId,market,lotSize,tradingCurrency,workflowStatus", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "listing","linkCode": "id","required": true + } + , + {"code": "securityId", + "type": 1,"name": "Наименование инструмента","shortname": "Инструмент","link": "security","linkCode": "shortName","required": true,"enabled": false + } + , + {"code": "market", + "type": 12,"name": "Наименование режима","shortname": "Режим","link": "market","linkCode": "code","required": true,"enabled": false + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Лот","required": true + } + , + {"code": "tradingCurrency", + "type": 12,"name": "Наименование валюты расчета","shortname": "Валюта","link": "currencyCode","linkCode": "code","required": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Наименование статуса листинга в системе","shortname": "Статус","link": "workflowStatus","required": true + } + ] + } + , + {"method":"delete", + + "name": "Блокировка инструмента на режимах", + + "confirmation": "securityId,market", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "listing","linkCode": "id","required": true + } + ] + } + ] } , "market": { @@ -5235,7 +5310,7 @@ , "session": { - "name": "Клиринговая сессия", + "name": "Клиринговые сессии", "destination": "sessions", diff --git a/clearing-parent/backend-api/src/main/resources/meta/meta.xml b/clearing-parent/backend-api/src/main/resources/meta/meta.xml index 7735e5c00..d7d11b810 100644 --- a/clearing-parent/backend-api/src/main/resources/meta/meta.xml +++ b/clearing-parent/backend-api/src/main/resources/meta/meta.xml @@ -1,6 +1,6 @@ - + @@ -579,6 +579,7 @@ + @@ -588,22 +589,22 @@ - + - + - + @@ -615,7 +616,6 @@ - @@ -643,32 +643,32 @@ - + + - + - - + + - + - @@ -695,13 +695,14 @@ - + + - + @@ -711,16 +712,16 @@ - - + + - + @@ -730,7 +731,6 @@ - @@ -753,17 +753,37 @@ - + + - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1218,7 +1238,7 @@ - + diff --git a/clearing-parent/backend-api/src/test/resources/meta.json b/clearing-parent/backend-api/src/test/resources/meta.json index 7b96718d8..84394d492 100644 --- a/clearing-parent/backend-api/src/test/resources/meta.json +++ b/clearing-parent/backend-api/src/test/resources/meta.json @@ -1,6 +1,6 @@ { - "version": "3.5.0.24", + "version": "3.5.0.25", "enums": { @@ -2502,6 +2502,10 @@ "confirmation": "securitySymbol,shortName,fullName,lotSize,nominalValue,nominalCurrency", "fields": [ + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } + , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","required": true } @@ -2539,7 +2543,7 @@ } , {"code": "termType", - "type": 12,"name": "Наименование вида инструмента","shortname": "Вид инструмента","link": "termType","visible": false + "type": 12,"name": "Наименование вида инструмента","shortname": "Вид инструмента","link": "termType" } , {"code": "description", @@ -2565,10 +2569,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"visible": false - } ] } , @@ -2582,6 +2582,10 @@ {"code": "id", "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "moneyMarketSecurity","linkCode": "id","required": true } + , + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","enabled": false @@ -2600,7 +2604,7 @@ } , {"code": "lotSize", - "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing","required": true } , {"code": "nominalValue", @@ -2646,10 +2650,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","visible": false - } ] } , @@ -2768,9 +2768,13 @@ "name": "Добавление акции", - "confirmation": "securitySymbol,shortName,fullName,isin,shareType,lotSize", + "confirmation": "securitySymbol,shortName,fullName,isin,shareType", "fields": [ + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } + , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","required": true } @@ -2792,7 +2796,7 @@ } , {"code": "lotSize", - "type": 11,"name": "Размер лота","shortname": "Лот","required": true + "type": 11,"name": "Размер лота","shortname": "Лот","visible": false } , {"code": "issuerId", @@ -2810,10 +2814,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"visible": false - } ] } , @@ -2821,12 +2821,16 @@ "name": "Изменение акции", - "confirmation": "securitySymbol,shortName,fullName,isin,shareType,lotSize", + "confirmation": "securitySymbol,shortName,fullName,isin,shareType", "fields": [ {"code": "id", "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "equitySecurity","linkCode": "id","required": true } + , + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","enabled": false @@ -2849,7 +2853,7 @@ } , {"code": "lotSize", - "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing","visible": false } , {"code": "issuerId", @@ -2867,10 +2871,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","visible": false - } ] } , @@ -2979,9 +2979,13 @@ "name": "Добавление облигации", - "confirmation": "securitySymbol,shortName,fullName,isin,bondType,lotSize,nominalValue,nominalCurrency", + "confirmation": "securitySymbol,shortName,fullName,isin,bondType,nominalValue,nominalCurrency", "fields": [ + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } + , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","required": true } @@ -3003,7 +3007,7 @@ } , {"code": "lotSize", - "type": 11,"name": "Размер лота","shortname": "Лот","required": true + "type": 11,"name": "Размер лота","shortname": "Лот","visible": false } , {"code": "nominalValue", @@ -3041,10 +3045,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"visible": false - } ] } , @@ -3052,12 +3052,16 @@ "name": "Изменение облигации", - "confirmation": "securitySymbol,shortName,fullName,isin,bondType,lotSize,nominalValue,nominalCurrency", + "confirmation": "securitySymbol,shortName,fullName,isin,bondType,nominalValue,nominalCurrency", "fields": [ {"code": "id", "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "fixedIncomeSecurity","linkCode": "id","required": true } + , + {"code": "instrumentType", + "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","required": true,"enabled": false + } , {"code": "securitySymbol", "type": 2,"length": 255,"name": "Код инструмента","shortname": "Код","enabled": false @@ -3080,7 +3084,7 @@ } , {"code": "lotSize", - "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + "field": "securityId","type": 11,"name": "Размер лота","shortname": "Лот","linkKeyCode": "securityId","linkCode": "lotSize","link": "listing","visible": false } , {"code": "nominalValue", @@ -3118,10 +3122,6 @@ {"code": "workflowStatus", "type": 12,"name": "Наименование статуса","shortname": "Статус","link": "workflowStatus" } - , - {"code": "instrumentType", - "type": 12,"name": "Наименование типа инструмента","shortname": "Тип инструмента","link": "instrumentType","visible": false - } ] } , @@ -3222,7 +3222,7 @@ , "listing": { - "name": "Листинг инструментов", + "name": "Инструменты на режимах", "destination": "listings", @@ -3236,21 +3236,21 @@ {"code": "securityId", "type": 1,"dbname": "Идентификатор инструмента","name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"link": "security","linkCode": "shortName" } + , + {"code": "market", + "type": 12,"dbname": "Код торговой секции","name": "Наименование режима","shortname": "Режим","searchable": true,"sortable": true,"link": "market","linkCode": "description" + } , {"code": "lotSize", "type": 11,"name": "Размер лота","shortname": "Лот","searchable": true,"sortable": true } - , - {"code": "market", - "type": 12,"dbname": "Код торговой секции","name": "Наименование торговой секции","shortname": "Секция","searchable": true,"sortable": true,"link": "market","linkCode": "name" - } , {"code": "symbolCode", - "type": 2,"length": 255,"name": "Код инструмента на торговой площадке","shortname": "Код инструмента на торговой площадке","searchable": true,"sortable": true + "type": 2,"length": 255,"name": "Код инструмента на торговой площадке","shortname": "Код инструмента на режиме","searchable": true,"sortable": true } , {"code": "symbolName", - "type": 2,"length": 255,"name": "Наименование инструмента на торговой площадке","shortname": "Инструмент на торговой площадке","searchable": true,"sortable": true + "type": 2,"length": 255,"name": "Наименование инструмента на торговой площадке","shortname": "Наименование инструмента на режиме","searchable": true,"sortable": true } , {"code": "tradingCurrency", @@ -3273,7 +3273,82 @@ "field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true } ] - + ,"actions":[ + {"method":"post", + + "name": "Добавление инструмента на режимах", + + "confirmation": "securityId,market,lotSize,tradingCurrency,workflowStatus", + + "fields": [ + {"code": "securityId", + "type": 1,"name": "Наименование инструмента","shortname": "Инструмент","link": "security","linkCode": "shortName","required": true + } + , + {"code": "market", + "type": 12,"name": "Наименование режима","shortname": "Режим","link": "market","required": true,"linkCode": "code" + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Лот","required": true + } + , + {"code": "tradingCurrency", + "type": 12,"name": "Наименование валюты расчета","shortname": "Валюта","link": "currencyCode","linkCode": "code","required": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Наименование статуса листинга в системе","shortname": "Статус","link": "workflowStatus","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение инструмента на режимах", + + "confirmation": "securityId,market,lotSize,tradingCurrency,workflowStatus", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "listing","linkCode": "id","required": true + } + , + {"code": "securityId", + "type": 1,"name": "Наименование инструмента","shortname": "Инструмент","link": "security","linkCode": "shortName","required": true,"enabled": false + } + , + {"code": "market", + "type": 12,"name": "Наименование режима","shortname": "Режим","link": "market","linkCode": "code","required": true,"enabled": false + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Лот","required": true + } + , + {"code": "tradingCurrency", + "type": 12,"name": "Наименование валюты расчета","shortname": "Валюта","link": "currencyCode","linkCode": "code","required": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Наименование статуса листинга в системе","shortname": "Статус","link": "workflowStatus","required": true + } + ] + } + , + {"method":"delete", + + "name": "Блокировка инструмента на режимах", + + "confirmation": "securityId,market", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "listing","linkCode": "id","required": true + } + ] + } + ] } , "market": { @@ -5235,7 +5310,7 @@ , "session": { - "name": "Клиринговая сессия", + "name": "Клиринговые сессии", "destination": "sessions", diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java index f19bf4da3..e0197d92c 100644 --- a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/Consts.java @@ -16,6 +16,10 @@ public interface Consts { String DESTINATION_FIXED_INCOME_CASH_FLOW_NEW = "fixed-income-cash-flow-new"; String DESTINATION_FIXED_INCOME_CASH_FLOW_UPDATE = "fixed-income-cash-flow-update"; + String LISTING_NEW = "listing-new"; + String LISTING_UPDATE = "listing-update"; + String LISTING_DELETE = "listing-delete"; + String DESTINATION_CURRENCY_NEW = "currency-new"; String DESTINATION_CURRENCY_UPDATE = "currency-update"; String DESTINATION_COUPON_PERIOD_NEW = "coupon_period-new"; diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingNewRequest.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingNewRequest.java new file mode 100644 index 000000000..d5784e5c4 --- /dev/null +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingNewRequest.java @@ -0,0 +1,58 @@ +package ru.spcex.clearing.platform.messaging.domain.cud.securitites; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.math.BigDecimal; + +public class ListingNewRequest { + @JsonProperty + private Long securityId; + @JsonProperty + private String market; + @JsonProperty + private BigDecimal lotSize; + @JsonProperty + private String tradingCurrency; + @JsonProperty + private String workflowStatus; + + public Long getSecurityId() { + return securityId; + } + + public void setSecurityId(Long securityId) { + this.securityId = securityId; + } + + public String getMarket() { + return market; + } + + public void setMarket(String market) { + this.market = market; + } + + public BigDecimal getLotSize() { + return lotSize; + } + + public void setLotSize(BigDecimal lotSize) { + this.lotSize = lotSize; + } + + public String getTradingCurrency() { + return tradingCurrency; + } + + public void setTradingCurrency(String tradingCurrency) { + this.tradingCurrency = tradingCurrency; + } + + public String getWorkflowStatus() { + return workflowStatus; + } + + public void setWorkflowStatus(String workflowStatus) { + this.workflowStatus = workflowStatus; + } +} diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingUpdateRequest.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingUpdateRequest.java new file mode 100644 index 000000000..fc414f37b --- /dev/null +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/domain/cud/securitites/ListingUpdateRequest.java @@ -0,0 +1,68 @@ +package ru.spcex.clearing.platform.messaging.domain.cud.securitites; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.math.BigDecimal; + +public class ListingUpdateRequest { + @JsonProperty + private Long id; + @JsonProperty + private Long securityId; + @JsonProperty + private String market; + @JsonProperty + private BigDecimal lotSize; + @JsonProperty + private String tradingCurrency; + @JsonProperty + private String workflowStatus; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSecurityId() { + return securityId; + } + + public void setSecurityId(Long securityId) { + this.securityId = securityId; + } + + public String getMarket() { + return market; + } + + public void setMarket(String market) { + this.market = market; + } + + public BigDecimal getLotSize() { + return lotSize; + } + + public void setLotSize(BigDecimal lotSize) { + this.lotSize = lotSize; + } + + public String getTradingCurrency() { + return tradingCurrency; + } + + public void setTradingCurrency(String tradingCurrency) { + this.tradingCurrency = tradingCurrency; + } + + public String getWorkflowStatus() { + return workflowStatus; + } + + public void setWorkflowStatus(String workflowStatus) { + this.workflowStatus = workflowStatus; + } +} From 37335728cf208b7c5256a128a73e923a75a930a1 Mon Sep 17 00:00:00 2001 From: etreschenkov Date: Wed, 24 May 2023 16:53:28 +0300 Subject: [PATCH 3/3] http://jira.mfd.msk:8088/browse/CLS-290 fix valadators --- .../clearing/config/ValidationConfig.java | 6 +- .../validation/Sdf57ValidationRule.java | 84 ++++++++----------- 2 files changed, 37 insertions(+), 53 deletions(-) diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java index 0cb4c69b7..afa056312 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/config/ValidationConfig.java @@ -134,10 +134,8 @@ public class ValidationConfig { addImdg.accept(IMDGDistributedNames.Map_Account); addImdg.accept(IMDGDistributedNames.Map_Company); return new ValidatorImpl<>(context, - Sdf57ValidationRule.CompanyDebPresent, - Sdf57ValidationRule.CompanyCredPresent, - Sdf57ValidationRule.AccountDebPresent, - Sdf57ValidationRule.AccountCredPresent, + Sdf57ValidationRule.CompanyDebOrCredPresent, + Sdf57ValidationRule.AccountDebOrCredPresent, Sdf57ValidationRule.CurrencyCode ); }; diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java index b39c990bc..b5c2414ae 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/validation/Sdf57ValidationRule.java @@ -14,65 +14,51 @@ import ru.spcex.platform.utils.validation.IValidationRule; import java.util.Optional; public enum Sdf57ValidationRule implements IValidationRule> { - CompanyDebPresent() { + CompanyDebOrCredPresent() { @Override public Optional validate(ImdgValidationContext context) { SDf57 sdf57 = context.getValidatedObject(); - if (TextUtil.isEmpty(sdf57.getDeal_deb())) { - return of(ClearingError.CompanyNotFound, sdf57.getDeal_deb()); - } Imdg companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class); - Company found = companyImdg.getSingleObjectBySQL("tradingCode = '" + sdf57.getDeal_deb() + "'"); - if (found == null) { - return of(ClearingError.CompanyNotFound, sdf57.getDeal_deb()); - } - context.storeObject(ValidationStored.Sdf57CompanyDeb, found); - return empty(); - } - }, CompanyCredPresent() { - @Override - public Optional validate(ImdgValidationContext context) { - SDf57 sdf57 = context.getValidatedObject(); - if (TextUtil.isEmpty(sdf57.getDeal_cred())) { - return of(ClearingError.CompanyNotFound, sdf57.getDeal_cred()); - } - Imdg companyImdg = context.obtainMap(IMDGDistributedNames.Map_Company, Company.class); - Company found = companyImdg.getSingleObjectBySQL("tradingCode = '" + sdf57.getDeal_cred() + "'"); - if (found == null) { - return of(ClearingError.CompanyNotFound, sdf57.getDeal_cred()); - } - context.storeObject(ValidationStored.Sdf57CompanyCred, found); - return empty(); - } - }, AccountDebPresent() { - @Override - public Optional validate(ImdgValidationContext context) { - SDf57 sdf57 = context.getValidatedObject(); - if (TextUtil.isEmpty(sdf57.getC_acc_deb())) { - return of(ClearingError.AccountNotPresent, sdf57.getC_acc_deb()); - } - Imdg accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class); - Account found = accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_deb() + "'"); - if (found == null) { - return of(ClearingError.AccountNotPresent, sdf57.getC_acc_deb()); - } - context.storeObject(ValidationStored.Sdf57AccountDeb, found); - return empty(); - } - }, AccountCredPresent() { + Optional companyDebFound = Optional.empty(); + Optional companyCredFound = Optional.empty(); + + if (!TextUtil.isEmpty(sdf57.getDeal_deb())) { + companyDebFound = Optional.ofNullable(companyImdg.getSingleObjectBySQL("tradingCode = '" + sdf57.getDeal_deb() + "'")); + companyDebFound.ifPresent(companyDeb -> context.storeObject(ValidationStored.Sdf57CompanyDeb, companyDeb)); + } + if (!TextUtil.isEmpty(sdf57.getDeal_cred())) { + companyCredFound = Optional.ofNullable(companyImdg.getSingleObjectBySQL("tradingCode = '" + sdf57.getDeal_cred() + "'")); + companyCredFound.ifPresent(companyCred -> context.storeObject(ValidationStored.Sdf57CompanyCred, companyCred)); + } + + if (companyDebFound.isEmpty() && companyCredFound.isEmpty()) { + return of(ClearingError.CompanyNotFound, String.format("dealDeb = '%s'/ deal_cred = '%s'", + sdf57.getDeal_deb(), sdf57.getDeal_cred())); + } + return empty(); + } + }, AccountDebOrCredPresent() { @Override public Optional validate(ImdgValidationContext context) { SDf57 sdf57 = context.getValidatedObject(); - if (TextUtil.isEmpty(sdf57.getC_acc_cred())) { - return of(ClearingError.AccountNotPresent, sdf57.getC_acc_cred()); - } Imdg accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class); - Account found = accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_cred() + "'"); - if (found == null) { - return of(ClearingError.AccountNotPresent, sdf57.getC_acc_cred()); + + Optional accountDebFound = Optional.empty(); + Optional accountCredFound = Optional.empty(); + if (!TextUtil.isEmpty(sdf57.getC_acc_deb())) { + accountDebFound = Optional.ofNullable(accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_deb() + "'")); + accountDebFound.ifPresent(accountDeb -> context.storeObject(ValidationStored.Sdf57AccountDeb, accountDeb)); + } + + if (!TextUtil.isEmpty(sdf57.getC_acc_cred())) { + accountCredFound = Optional.ofNullable(accountImdg.getSingleObjectBySQL("account = '" + sdf57.getC_acc_cred() + "'")); + accountCredFound.ifPresent(accountCred -> context.storeObject(ValidationStored.Sdf57AccountCred, accountCred)); + } + if (accountDebFound.isEmpty() && accountCredFound.isEmpty()) { + return of(ClearingError.AccountNotPresent, String.format("accDeb = '%s'/ accDred = '%s'", + sdf57.getC_acc_deb(), sdf57.getC_acc_cred())); } - context.storeObject(ValidationStored.Sdf57AccountCred, found); return empty(); }