parent
b67d4fb7a1
commit
5cd4531638
3 changed files with 260 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.ContractRegister;
|
||||
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.ContractRegisterNewRequest;
|
||||
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 ContractRegisterService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final Imdg<ContractRegister> contractRegisterMap;
|
||||
|
||||
@Autowired
|
||||
public ContractRegisterService(Consumer<String, Object> kafkaQueue, Producer<String, Object> kafkaProducer,
|
||||
ImdgProvider imdgProvider) {
|
||||
super(kafkaQueue, kafkaProducer);
|
||||
this.contractRegisterMap = imdgProvider.getImdg(IMDGDistributedNames.Map_ContractRegister, ContractRegister.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
callback(ContractRegisterNewRequest.class)
|
||||
.setConsumer(this::contractRegisterNew)
|
||||
.forDestination(Consts.REGISTRY_CONTRACT_REGISTER_NEW, callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
public void contractRegisterNew(BaseRequest<ContractRegisterNewRequest> userRequest) {
|
||||
ContractRegisterNewRequest req = userRequest.getRequestPayload();
|
||||
log.debug("ContractRegisterNewRequest received");
|
||||
ContractRegister register = new ContractRegister();
|
||||
register.setName(req.getName());
|
||||
register.setNumber(req.getNumber());
|
||||
register.setIssueDate(req.getIssueDate());
|
||||
register.setCompanyFullName(req.getCompanyFullName());
|
||||
register.setCompanyId(req.getCompanyId());
|
||||
register.setDocumentType(req.getDocumentType());
|
||||
register.setIssuePlace(req.getIssuePlace());
|
||||
register.setIssuer(req.getIssuer());
|
||||
register.setIssuerCode(req.getIssuerCode());
|
||||
register.setPlace(req.getPlace());
|
||||
register.setValidFromDate(req.getValidFromDate());
|
||||
register.setValidToDate(req.getValidToDate());
|
||||
register.setCloseDate(req.getCloseDate());
|
||||
register.setComment(req.getComment());
|
||||
|
||||
contractRegisterMap.insert(register);
|
||||
log.debug("successfully processed, id {}", register.getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -58,4 +58,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";
|
||||
String REGISTRY_CONTRACT_REGISTER_NEW = "registry-contract-register-new";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,196 @@
|
|||
package ru.spcex.clearing.platform.messaging.domain.cud.registry;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class ContractRegisterNewRequest {
|
||||
|
||||
@JsonProperty
|
||||
private String name;
|
||||
|
||||
@JsonProperty
|
||||
private String number;
|
||||
|
||||
@JsonProperty
|
||||
private LocalDate issueDate;
|
||||
|
||||
@JsonProperty
|
||||
private Long companyFullName;
|
||||
|
||||
@JsonProperty
|
||||
private Long companyId;
|
||||
|
||||
@JsonProperty
|
||||
private String documentType;
|
||||
|
||||
@JsonProperty
|
||||
private String issuePlace;
|
||||
|
||||
@JsonProperty
|
||||
private String issuer;
|
||||
|
||||
@JsonProperty
|
||||
private String issuerCode;
|
||||
|
||||
@JsonProperty
|
||||
private String place;
|
||||
|
||||
@JsonProperty
|
||||
private LocalDate validFromDate;
|
||||
|
||||
@JsonProperty
|
||||
private LocalDate validToDate;
|
||||
|
||||
@JsonProperty
|
||||
private LocalDate closeDate;
|
||||
|
||||
@JsonProperty
|
||||
private String comment;
|
||||
|
||||
@JsonProperty
|
||||
private Long id;
|
||||
|
||||
@JsonProperty
|
||||
private Instant createdAt;
|
||||
|
||||
@JsonProperty
|
||||
private Instant updatedAt;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public LocalDate getCloseDate() {
|
||||
return closeDate;
|
||||
}
|
||||
|
||||
public void setCloseDate(LocalDate closeDate) {
|
||||
this.closeDate = closeDate;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
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 String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public LocalDate getIssueDate() {
|
||||
return issueDate;
|
||||
}
|
||||
|
||||
public void setIssueDate(LocalDate issueDate) {
|
||||
this.issueDate = issueDate;
|
||||
}
|
||||
|
||||
public Long getCompanyFullName() {
|
||||
return companyFullName;
|
||||
}
|
||||
|
||||
public void setCompanyFullName(Long companyFullName) {
|
||||
this.companyFullName = companyFullName;
|
||||
}
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getDocumentType() {
|
||||
return documentType;
|
||||
}
|
||||
|
||||
public void setDocumentType(String documentType) {
|
||||
this.documentType = documentType;
|
||||
}
|
||||
|
||||
public String getIssuePlace() {
|
||||
return issuePlace;
|
||||
}
|
||||
|
||||
public void setIssuePlace(String issuePlace) {
|
||||
this.issuePlace = issuePlace;
|
||||
}
|
||||
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
|
||||
public void setIssuer(String issuer) {
|
||||
this.issuer = issuer;
|
||||
}
|
||||
|
||||
public String getIssuerCode() {
|
||||
return issuerCode;
|
||||
}
|
||||
|
||||
public void setIssuerCode(String issuerCode) {
|
||||
this.issuerCode = issuerCode;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public LocalDate getValidFromDate() {
|
||||
return validFromDate;
|
||||
}
|
||||
|
||||
public void setValidFromDate(LocalDate validFromDate) {
|
||||
this.validFromDate = validFromDate;
|
||||
}
|
||||
|
||||
public LocalDate getValidToDate() {
|
||||
return validToDate;
|
||||
}
|
||||
|
||||
public void setValidToDate(LocalDate validToDate) {
|
||||
this.validToDate = validToDate;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue