http://jira.mfd.msk:8088/browse/CLS-424 issuerId для instrument_type = RATE
This commit is contained in:
parent
2a109ed496
commit
315d1e43ec
4 changed files with 44 additions and 11 deletions
|
|
@ -2,13 +2,16 @@ package ru.spcex.clearing.gatewayapi.service.adapter;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.spcex.clearing.gatewayapi.controller.inbound.request.listing.mkr.ExchangeInstrument;
|
import ru.spcex.clearing.gatewayapi.controller.inbound.request.listing.mkr.ExchangeInstrument;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.MoneyMarketSecurityNewGatewayRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.MoneyMarketSecurityNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.MoneyMarketSecurityNewRequest;
|
||||||
import ru.spcex.platform.enumeration.InstrumentType;
|
import ru.spcex.platform.enumeration.InstrumentType;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MoneyMarketSecurityRequestAdapter {
|
public class MoneyMarketSecurityRequestAdapter {
|
||||||
|
|
||||||
public MoneyMarketSecurityNewRequest toMoneyMarketSecurityNewRequest(ExchangeInstrument exchangeInstrument) {
|
public MoneyMarketSecurityNewGatewayRequest toMoneyMarketSecurityNewRequest(ExchangeInstrument exchangeInstrument) {
|
||||||
|
MoneyMarketSecurityNewGatewayRequest req = new MoneyMarketSecurityNewGatewayRequest();
|
||||||
|
|
||||||
MoneyMarketSecurityNewRequest moneyMarketSecurityNewRequest = new MoneyMarketSecurityNewRequest();
|
MoneyMarketSecurityNewRequest moneyMarketSecurityNewRequest = new MoneyMarketSecurityNewRequest();
|
||||||
String code = exchangeInstrument.getCode();
|
String code = exchangeInstrument.getCode();
|
||||||
moneyMarketSecurityNewRequest.setSecuritySymbol(code.substring(0, Math.min(7, code.length())));
|
moneyMarketSecurityNewRequest.setSecuritySymbol(code.substring(0, Math.min(7, code.length())));
|
||||||
|
|
@ -19,6 +22,9 @@ public class MoneyMarketSecurityRequestAdapter {
|
||||||
moneyMarketSecurityNewRequest.setLotSize(exchangeInstrument.getLot());
|
moneyMarketSecurityNewRequest.setLotSize(exchangeInstrument.getLot());
|
||||||
moneyMarketSecurityNewRequest.setTermType(exchangeInstrument.getBankDepositAgreementType());
|
moneyMarketSecurityNewRequest.setTermType(exchangeInstrument.getBankDepositAgreementType());
|
||||||
moneyMarketSecurityNewRequest.setWorkflowStatus(exchangeInstrument.getWorkflowStatus());
|
moneyMarketSecurityNewRequest.setWorkflowStatus(exchangeInstrument.getWorkflowStatus());
|
||||||
return moneyMarketSecurityNewRequest;
|
|
||||||
|
req.setMoneyMarketSecurityNewRequest(moneyMarketSecurityNewRequest);
|
||||||
|
req.setUuid(exchangeInstrument.getInitiatorId() != null ? exchangeInstrument.getInitiatorId().toString() : null);
|
||||||
|
return req;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import ru.spcex.clearing.gatewayapi.controller.inbound.request.listing.mkr.Excha
|
||||||
import ru.spcex.clearing.gatewayapi.controller.inbound.request.listing.mkr.MMListingsRequest;
|
import ru.spcex.clearing.gatewayapi.controller.inbound.request.listing.mkr.MMListingsRequest;
|
||||||
import ru.spcex.clearing.gatewayapi.service.adapter.MoneyMarketSecurityRequestAdapter;
|
import ru.spcex.clearing.gatewayapi.service.adapter.MoneyMarketSecurityRequestAdapter;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.MoneyMarketSecurityNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.MoneyMarketSecurityNewGatewayRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||||
import ru.spcex.platform.utils.log.ExceptionUtils;
|
import ru.spcex.platform.utils.log.ExceptionUtils;
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class ListingMMProcessor {
|
||||||
log.warn("Incorrect code : {}, skip record", exchangeInstrument.getCode());
|
log.warn("Incorrect code : {}, skip record", exchangeInstrument.getCode());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MoneyMarketSecurityNewRequest moneyMarketSecurityNewRequest = moneyMarketSecurityRequestAdapter
|
MoneyMarketSecurityNewGatewayRequest moneyMarketSecurityNewRequest = moneyMarketSecurityRequestAdapter
|
||||||
.toMoneyMarketSecurityNewRequest(exchangeInstrument);
|
.toMoneyMarketSecurityNewRequest(exchangeInstrument);
|
||||||
kafkaSender.sendRequestToQueue(Consts.DESTINATION_GATEWAY_MONEY_MARKET_SECURITY, moneyMarketSecurityNewRequest);
|
kafkaSender.sendRequestToQueue(Consts.DESTINATION_GATEWAY_MONEY_MARKET_SECURITY, moneyMarketSecurityNewRequest);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
||||||
|
|
@ -115,15 +115,14 @@ public class GatewaySecurityService extends QueueConsumer implements Initializin
|
||||||
callback(EquitySecurityGatewayRequest.class)
|
callback(EquitySecurityGatewayRequest.class)
|
||||||
.setFunction(this::newSecurities)
|
.setFunction(this::newSecurities)
|
||||||
.forDestination(Consts.DESTINATION_SECURITY_EQTY_GATEWAY, callbacks::put);
|
.forDestination(Consts.DESTINATION_SECURITY_EQTY_GATEWAY, callbacks::put);
|
||||||
callback(MoneyMarketSecurityNewRequest.class)
|
callback(MoneyMarketSecurityNewGatewayRequest.class)
|
||||||
.setFunction(this::newMoneyMarketSecurity)
|
.setFunction(this::newMoneyMarketSecurity)
|
||||||
.forDestination(Consts.DESTINATION_GATEWAY_MONEY_MARKET_SECURITY, callbacks::put);
|
.forDestination(Consts.DESTINATION_GATEWAY_MONEY_MARKET_SECURITY, callbacks::put);
|
||||||
imdgProvider.waitAvailable();
|
imdgProvider.waitAvailable();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Long findCompany(SecurityFondGatewayRequest byReq) {
|
Long findCompany(String byUuid) {
|
||||||
String byUuid = byReq.getUuid();
|
|
||||||
if (byUuid == null) {
|
if (byUuid == null) {
|
||||||
log.warn("Request without company UUID");
|
log.warn("Request without company UUID");
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -172,7 +171,7 @@ public class GatewaySecurityService extends QueueConsumer implements Initializin
|
||||||
private RequestInfoUpdate newSecurities(BaseRequest<?> baseRequest) {
|
private RequestInfoUpdate newSecurities(BaseRequest<?> baseRequest) {
|
||||||
log.debug("SecurityFondGatewayRequest id={} received", baseRequest.getId());
|
log.debug("SecurityFondGatewayRequest id={} received", baseRequest.getId());
|
||||||
SecurityFondGatewayRequest req = (SecurityFondGatewayRequest) baseRequest.getRequestPayload();
|
SecurityFondGatewayRequest req = (SecurityFondGatewayRequest) baseRequest.getRequestPayload();
|
||||||
Long companyId = findCompany(req);//issuerId findCompany
|
Long companyId = findCompany(req.getUuid());//issuerId findCompany
|
||||||
if (companyId == null) {
|
if (companyId == null) {
|
||||||
log.debug("CompanyId (issuer) not found.");
|
log.debug("CompanyId (issuer) not found.");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -429,11 +428,13 @@ public class GatewaySecurityService extends QueueConsumer implements Initializin
|
||||||
|
|
||||||
// --- DESTINATION_GATEWAY_MONEY_MARKET_SECURITY ---
|
// --- DESTINATION_GATEWAY_MONEY_MARKET_SECURITY ---
|
||||||
|
|
||||||
private RequestInfoUpdate newMoneyMarketSecurity(BaseRequest<MoneyMarketSecurityNewRequest> baseRequest) {
|
private RequestInfoUpdate newMoneyMarketSecurity(BaseRequest<MoneyMarketSecurityNewGatewayRequest> baseRequest) {
|
||||||
log.debug("MoneyMarketSecurityNewRequest id={} received", baseRequest.getId());
|
log.debug("MoneyMarketSecurityNewRequest id={} received", baseRequest.getId());
|
||||||
MoneyMarketSecurityNewRequest req = baseRequest.getRequestPayload();
|
MoneyMarketSecurityNewGatewayRequest gatewayReq = baseRequest.getRequestPayload();
|
||||||
|
Long companyId = findCompany(gatewayReq.getUuid());
|
||||||
synchronized (moneyMarketSecurityService) {
|
synchronized (moneyMarketSecurityService) {
|
||||||
|
MoneyMarketSecurityNewRequest req = gatewayReq.getMoneyMarketSecurityNewRequest();
|
||||||
|
req.setIssuerId(companyId);
|
||||||
MoneyMarketSecurity existMMS = findSecurityBySecuritySymbol(moneyMarketSecurityImdg, req.getSecuritySymbol());
|
MoneyMarketSecurity existMMS = findSecurityBySecuritySymbol(moneyMarketSecurityImdg, req.getSecuritySymbol());
|
||||||
try {
|
try {
|
||||||
if (existMMS == null) {
|
if (existMMS == null) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package ru.spcex.clearing.platform.messaging.domain.cud.securitites;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class MoneyMarketSecurityNewGatewayRequest {
|
||||||
|
@JsonProperty
|
||||||
|
private String uuid;
|
||||||
|
@JsonProperty
|
||||||
|
private MoneyMarketSecurityNewRequest moneyMarketSecurityNewRequest;
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MoneyMarketSecurityNewRequest getMoneyMarketSecurityNewRequest() {
|
||||||
|
return moneyMarketSecurityNewRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoneyMarketSecurityNewRequest(MoneyMarketSecurityNewRequest moneyMarketSecurityNewRequest) {
|
||||||
|
this.moneyMarketSecurityNewRequest = moneyMarketSecurityNewRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue