parent
8c4bee0b84
commit
b5dee6c1de
3 changed files with 200 additions and 0 deletions
|
|
@ -0,0 +1,56 @@
|
|||
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.OrderRegister;
|
||||
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.OrderRegisterNewRequest;
|
||||
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 OrderRegisterService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final Imdg<OrderRegister> orderRegisterMap;
|
||||
|
||||
@Autowired
|
||||
public OrderRegisterService(Consumer<String, Object> kafkaQueue, Producer<String, Object> kafkaProducer,
|
||||
ImdgProvider imdgProvider) {
|
||||
super(kafkaQueue, kafkaProducer);
|
||||
this.orderRegisterMap = imdgProvider.getImdg(IMDGDistributedNames.Map_OrderRegister, OrderRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
callback(OrderRegisterNewRequest.class)
|
||||
.setConsumer(this::orderRegisterNew)
|
||||
.forDestination(Consts.REGISTRY_ORDER_REGISTER_NEW, callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
public void orderRegisterNew(BaseRequest<OrderRegisterNewRequest> userRequest) {
|
||||
OrderRegisterNewRequest req = userRequest.getRequestPayload();
|
||||
log.debug("OrderRegisterNewRequest received");
|
||||
OrderRegister register = new OrderRegister();
|
||||
register.setCreditLegAccount(req.getCreditLegAccount());
|
||||
register.setCreditLegAmount(req.getCreditLegAmount());
|
||||
register.setCreditLegCurrencyCode(req.getCreditLegCurrencyCode());
|
||||
register.setCreditLegDirection(req.getCreditLegDirection());
|
||||
register.setDebitLegAccount(req.getDebitLegAccount());
|
||||
register.setSender(req.getSender());
|
||||
register.setAddressee(req.getAddressee());
|
||||
register.setDocumentNumber(req.getDocumentNumber());
|
||||
register.setClearingDate(req.getClearingDate());
|
||||
orderRegisterMap.insert(register);
|
||||
log.debug("successfully processed, id {}", register.getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -57,4 +57,5 @@ public interface Consts {
|
|||
|
||||
String REGISTRY_COVERED_DEAL_REGISTER_NEW = "registry-covered-deal-register-new";
|
||||
String REGISTRY_ADMITTED_DEAL_REGISTER_NEW = "registry-admitted-deal-register-new";
|
||||
String REGISTRY_ORDER_REGISTER_NEW = "registry-order-register-new";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
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 OrderRegisterNewRequest {
|
||||
|
||||
@JsonProperty
|
||||
private String creditLegAccount;
|
||||
|
||||
@JsonProperty
|
||||
private BigDecimal creditLegAmount;
|
||||
|
||||
@JsonProperty
|
||||
private String creditLegCurrencyCode;
|
||||
|
||||
@JsonProperty
|
||||
private Long creditLegDirection;
|
||||
|
||||
@JsonProperty
|
||||
private String debitLegAccount;
|
||||
|
||||
@JsonProperty
|
||||
private String sender;
|
||||
|
||||
@JsonProperty
|
||||
private String addressee;
|
||||
|
||||
@JsonProperty
|
||||
private String documentNumber;
|
||||
|
||||
@JsonProperty
|
||||
private Long id;
|
||||
|
||||
@JsonProperty
|
||||
private Instant createdAt;
|
||||
|
||||
@JsonProperty
|
||||
private Instant updatedAt;
|
||||
|
||||
@JsonProperty
|
||||
private LocalDate clearingDate;
|
||||
|
||||
public String getCreditLegAccount() {
|
||||
return creditLegAccount;
|
||||
}
|
||||
|
||||
public void setCreditLegAccount(String creditLegAccount) {
|
||||
this.creditLegAccount = creditLegAccount;
|
||||
}
|
||||
|
||||
public BigDecimal getCreditLegAmount() {
|
||||
return creditLegAmount;
|
||||
}
|
||||
|
||||
public void setCreditLegAmount(BigDecimal creditLegAmount) {
|
||||
this.creditLegAmount = creditLegAmount;
|
||||
}
|
||||
|
||||
public String getCreditLegCurrencyCode() {
|
||||
return creditLegCurrencyCode;
|
||||
}
|
||||
|
||||
public void setCreditLegCurrencyCode(String creditLegCurrencyCode) {
|
||||
this.creditLegCurrencyCode = creditLegCurrencyCode;
|
||||
}
|
||||
|
||||
public Long getCreditLegDirection() {
|
||||
return creditLegDirection;
|
||||
}
|
||||
|
||||
public void setCreditLegDirection(Long creditLegDirection) {
|
||||
this.creditLegDirection = creditLegDirection;
|
||||
}
|
||||
|
||||
public String getDebitLegAccount() {
|
||||
return debitLegAccount;
|
||||
}
|
||||
|
||||
public void setDebitLegAccount(String debitLegAccount) {
|
||||
this.debitLegAccount = debitLegAccount;
|
||||
}
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getAddressee() {
|
||||
return addressee;
|
||||
}
|
||||
|
||||
public void setAddressee(String addressee) {
|
||||
this.addressee = addressee;
|
||||
}
|
||||
|
||||
public String getDocumentNumber() {
|
||||
return documentNumber;
|
||||
}
|
||||
|
||||
public void setDocumentNumber(String documentNumber) {
|
||||
this.documentNumber = documentNumber;
|
||||
}
|
||||
|
||||
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