parent
5cd4531638
commit
b3c7ec99d3
3 changed files with 259 additions and 0 deletions
|
|
@ -0,0 +1,62 @@
|
||||||
|
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.misc.BalanceRegister;
|
||||||
|
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.BalanceRegisterNewRequest;
|
||||||
|
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 BalanceRegisterService extends QueueConsumer implements InitializingBean {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
private final Imdg<BalanceRegister> balanceRegisterMap;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public BalanceRegisterService(Consumer<String, Object> kafkaQueue, Producer<String, Object> kafkaProducer,
|
||||||
|
ImdgProvider imdgProvider) {
|
||||||
|
super(kafkaQueue, kafkaProducer);
|
||||||
|
this.balanceRegisterMap = imdgProvider.getImdg(IMDGDistributedNames.Map_BalanceRegister, BalanceRegister.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() {
|
||||||
|
callback(BalanceRegisterNewRequest.class)
|
||||||
|
.setConsumer(this::balanceRegisterNew)
|
||||||
|
.forDestination(Consts.REGISTRY_BALANCE_REGISTER_NEW, callbacks::put);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void balanceRegisterNew(BaseRequest<BalanceRegisterNewRequest> userRequest) {
|
||||||
|
BalanceRegisterNewRequest req = userRequest.getRequestPayload();
|
||||||
|
log.debug("BalanceRegisterNewRequest received");
|
||||||
|
BalanceRegister register = new BalanceRegister();
|
||||||
|
register.setsDf01Date(req.getsDf01Date());
|
||||||
|
register.setCurrencyCode(req.getCurrencyCode());
|
||||||
|
register.setSetHouseName(req.getSetHouseName());
|
||||||
|
register.setAccount(req.getAccount());
|
||||||
|
register.setInfoAccount(req.getInfoAccount());
|
||||||
|
register.setRemainderSum(req.getRemainderSum());
|
||||||
|
register.setBlockedSum(req.getBlockedSum());
|
||||||
|
register.setUnblockedSum(req.getUnblockedSum());
|
||||||
|
register.setInn(req.getInn());
|
||||||
|
register.setMarket(req.getMarket());
|
||||||
|
register.setFullName(req.getFullName());
|
||||||
|
register.setTypeRemains(req.getTypeRemains());
|
||||||
|
register.setDocNumber(req.getDocNumber());
|
||||||
|
register.setCompanyId(req.getCompanyId());
|
||||||
|
balanceRegisterMap.insert(register);
|
||||||
|
log.debug("successfully processed, id {}", register.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -59,4 +59,5 @@ public interface Consts {
|
||||||
String REGISTRY_ADMITTED_DEAL_REGISTER_NEW = "registry-admitted-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_ORDER_REGISTER_NEW = "registry-order-register-new";
|
||||||
String REGISTRY_CONTRACT_REGISTER_NEW = "registry-contract-register-new";
|
String REGISTRY_CONTRACT_REGISTER_NEW = "registry-contract-register-new";
|
||||||
|
String REGISTRY_BALANCE_REGISTER_NEW = "registry-balance-register-new";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
package ru.spcex.clearing.platform.messaging.domain.cud.registry;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
public class BalanceRegisterNewRequest {
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private Instant sDf01Date;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String currencyCode;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String setHouseName;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String infoAccount;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private BigDecimal remainderSum;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private BigDecimal blockedSum;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private BigDecimal unblockedSum;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String inn;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private Long market;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String fullName;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String typeRemains;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private String docNumber;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public Instant getsDf01Date() {
|
||||||
|
return sDf01Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setsDf01Date(Instant sDf01Date) {
|
||||||
|
this.sDf01Date = sDf01Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrencyCode() {
|
||||||
|
return currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrencyCode(String currencyCode) {
|
||||||
|
this.currencyCode = currencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSetHouseName() {
|
||||||
|
return setHouseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSetHouseName(String setHouseName) {
|
||||||
|
this.setHouseName = setHouseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount(String account) {
|
||||||
|
this.account = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfoAccount() {
|
||||||
|
return infoAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfoAccount(String infoAccount) {
|
||||||
|
this.infoAccount = infoAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRemainderSum() {
|
||||||
|
return remainderSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemainderSum(BigDecimal remainderSum) {
|
||||||
|
this.remainderSum = remainderSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getBlockedSum() {
|
||||||
|
return blockedSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlockedSum(BigDecimal blockedSum) {
|
||||||
|
this.blockedSum = blockedSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getUnblockedSum() {
|
||||||
|
return unblockedSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnblockedSum(BigDecimal unblockedSum) {
|
||||||
|
this.unblockedSum = unblockedSum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInn() {
|
||||||
|
return inn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInn(String inn) {
|
||||||
|
this.inn = inn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMarket() {
|
||||||
|
return market;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarket(Long market) {
|
||||||
|
this.market = market;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullName() {
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullName(String fullName) {
|
||||||
|
this.fullName = fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeRemains() {
|
||||||
|
return typeRemains;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeRemains(String typeRemains) {
|
||||||
|
this.typeRemains = typeRemains;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDocNumber() {
|
||||||
|
return docNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocNumber(String docNumber) {
|
||||||
|
this.docNumber = docNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCompanyId() {
|
||||||
|
return companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyId(Long companyId) {
|
||||||
|
this.companyId = companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue