--- CoveredDealRegisterService settled
This commit is contained in:
parent
ff5d2c22d0
commit
dc6d2d681a
3 changed files with 274 additions and 0 deletions
|
|
@ -0,0 +1,63 @@
|
|||
package ru.spcex.clearing.registry.service;
|
||||
|
||||
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.register.CoveredDealRegister;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.CoveredDealRegisterNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Service
|
||||
public class CoveredDealRegisterService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final Imdg<CoveredDealRegister> coveredDealRegisterMap;
|
||||
|
||||
@Autowired
|
||||
public CoveredDealRegisterService(Consumer<String, Object> kafkaQueue, Producer<String, Object> kafkaProducer,
|
||||
ImdgProvider imdgProvider) {
|
||||
super(kafkaQueue, kafkaProducer);
|
||||
this.coveredDealRegisterMap = imdgProvider.getImdg(IMDGDistributedNames.Map_CoveredDealRegister, CoveredDealRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
callback(CoveredDealRegisterNewRequest.class)
|
||||
.setConsumer(this::coveredDealRegisterNew)
|
||||
.forDestination(Consts.REGISTRY_COVERED_DEAL_REGISTER_NEW, callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
public void coveredDealRegisterNew(BaseRequest<CoveredDealRegisterNewRequest> userRequest) {
|
||||
CoveredDealRegisterNewRequest req = userRequest.getRequestPayload();
|
||||
log.debug("CoveredDealRegisterNewRequest received");
|
||||
CoveredDealRegister register = new CoveredDealRegister();
|
||||
register.setExecutionId(req.getExecutionId());
|
||||
register.setCompanyFullName(req.getCompanyFullName());
|
||||
register.setTradingDate(req.getTradingDate());
|
||||
register.setExchangeExecutionId(req.getExchangeExecutionId());
|
||||
register.setExchangeExecutionTime(req.getExchangeExecutionTime());
|
||||
register.setSecuritySymbol(req.getSecuritySymbol());
|
||||
register.setSecurityFullName(req.getSecurityFullName());
|
||||
register.setSellerFullName(req.getSellerFullName());
|
||||
register.setSellerClearingCode(req.getSellerClearingCode());
|
||||
register.setSellerAccount(req.getSellerAccount());
|
||||
register.setBuyerFullName(req.getBuyerFullName());
|
||||
register.setBuyerClearingCode(req.getBuyerClearingCode());
|
||||
register.setBuyerAccount(req.getBuyerAccount());
|
||||
register.setAmount(req.getAmount());
|
||||
register.setClearingDate(req.getClearingDate());
|
||||
coveredDealRegisterMap.insert(register);
|
||||
log.debug("successfully processed, id {}", register.getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -55,4 +55,5 @@ public interface Consts {
|
|||
|
||||
String REQUEST_INFO_UPDATE = "request-info-update";
|
||||
|
||||
String REGISTRY_COVERED_DEAL_REGISTER_NEW = "registry-covered-deal-register-new";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,210 @@
|
|||
package ru.spcex.clearing.platform.messaging.domain.cud.registry;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class CoveredDealRegisterNewRequest {
|
||||
|
||||
|
||||
@JsonProperty
|
||||
public Long executionId;
|
||||
|
||||
@JsonProperty
|
||||
public String companyFullName;
|
||||
|
||||
@JsonProperty
|
||||
public LocalDate tradingDate;
|
||||
|
||||
@JsonProperty
|
||||
public Long exchangeExecutionId;
|
||||
|
||||
@JsonProperty
|
||||
public Instant exchangeExecutionTime; //todo clarify is timestamp suitable for this request or not
|
||||
|
||||
@JsonProperty
|
||||
public String securitySymbol;
|
||||
|
||||
@JsonProperty
|
||||
public String securityFullName;
|
||||
|
||||
@JsonProperty
|
||||
public String sellerFullName;
|
||||
|
||||
@JsonProperty
|
||||
public String sellerClearingCode;
|
||||
|
||||
@JsonProperty
|
||||
public String sellerAccount;
|
||||
|
||||
@JsonProperty
|
||||
public String buyerFullName;
|
||||
|
||||
@JsonProperty
|
||||
public String buyerClearingCode;
|
||||
|
||||
@JsonProperty
|
||||
public String buyerAccount;
|
||||
|
||||
@JsonProperty
|
||||
public BigDecimal amount;
|
||||
|
||||
@JsonProperty
|
||||
public Long id;
|
||||
|
||||
@JsonProperty
|
||||
public Instant createdAt;
|
||||
|
||||
@JsonProperty
|
||||
public Instant updatedAt;
|
||||
|
||||
@JsonProperty
|
||||
public LocalDate clearingDate;
|
||||
|
||||
public Long getExecutionId() {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public void setExecutionId(Long executionId) {
|
||||
this.executionId = executionId;
|
||||
}
|
||||
|
||||
public String getCompanyFullName() {
|
||||
return companyFullName;
|
||||
}
|
||||
|
||||
public void setCompanyFullName(String companyFullName) {
|
||||
this.companyFullName = companyFullName;
|
||||
}
|
||||
|
||||
public LocalDate getTradingDate() {
|
||||
return tradingDate;
|
||||
}
|
||||
|
||||
public void setTradingDate(LocalDate tradingDate) {
|
||||
this.tradingDate = tradingDate;
|
||||
}
|
||||
|
||||
public Long getExchangeExecutionId() {
|
||||
return exchangeExecutionId;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionId(Long exchangeExecutionId) {
|
||||
this.exchangeExecutionId = exchangeExecutionId;
|
||||
}
|
||||
|
||||
public Instant getExchangeExecutionTime() {
|
||||
return exchangeExecutionTime;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionTime(Instant exchangeExecutionTime) {
|
||||
this.exchangeExecutionTime = exchangeExecutionTime;
|
||||
}
|
||||
|
||||
public String getSecuritySymbol() {
|
||||
return securitySymbol;
|
||||
}
|
||||
|
||||
public void setSecuritySymbol(String securitySymbol) {
|
||||
this.securitySymbol = securitySymbol;
|
||||
}
|
||||
|
||||
public String getSecurityFullName() {
|
||||
return securityFullName;
|
||||
}
|
||||
|
||||
public void setSecurityFullName(String securityFullName) {
|
||||
this.securityFullName = securityFullName;
|
||||
}
|
||||
|
||||
public String getSellerFullName() {
|
||||
return sellerFullName;
|
||||
}
|
||||
|
||||
public void setSellerFullName(String sellerFullName) {
|
||||
this.sellerFullName = sellerFullName;
|
||||
}
|
||||
|
||||
public String getSellerClearingCode() {
|
||||
return sellerClearingCode;
|
||||
}
|
||||
|
||||
public void setSellerClearingCode(String sellerClearingCode) {
|
||||
this.sellerClearingCode = sellerClearingCode;
|
||||
}
|
||||
|
||||
public String getSellerAccount() {
|
||||
return sellerAccount;
|
||||
}
|
||||
|
||||
public void setSellerAccount(String sellerAccount) {
|
||||
this.sellerAccount = sellerAccount;
|
||||
}
|
||||
|
||||
public String getBuyerFullName() {
|
||||
return buyerFullName;
|
||||
}
|
||||
|
||||
public void setBuyerFullName(String buyerFullName) {
|
||||
this.buyerFullName = buyerFullName;
|
||||
}
|
||||
|
||||
public String getBuyerClearingCode() {
|
||||
return buyerClearingCode;
|
||||
}
|
||||
|
||||
public void setBuyerClearingCode(String buyerClearingCode) {
|
||||
this.buyerClearingCode = buyerClearingCode;
|
||||
}
|
||||
|
||||
public String getBuyerAccount() {
|
||||
return buyerAccount;
|
||||
}
|
||||
|
||||
public void setBuyerAccount(String buyerAccount) {
|
||||
this.buyerAccount = buyerAccount;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public LocalDate getClearingDate() {
|
||||
return clearingDate;
|
||||
}
|
||||
|
||||
public void setClearingDate(LocalDate clearingDate) {
|
||||
this.clearingDate = clearingDate;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue