Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
3f5ca4176c
88 changed files with 6673 additions and 502 deletions
|
|
@ -11,6 +11,7 @@ import ru.spcex.clearing.platform.messaging.domain.cud.utilities.KeyRateNewReque
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
||||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -19,7 +20,7 @@ import java.util.List;
|
||||||
public class KeyRateNewAction implements IAction<KeyRateNewRequest> {
|
public class KeyRateNewAction implements IAction<KeyRateNewRequest> {
|
||||||
@ApiModelProperty(value = "Ключевая ставка ЦБ РФ", example = "12.5")
|
@ApiModelProperty(value = "Ключевая ставка ЦБ РФ", example = "12.5")
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double keyRate;
|
public BigDecimal keyRate;
|
||||||
@ApiModelProperty(value = "Дата начала действия ключевой ставки", example = "2022-01-20")
|
@ApiModelProperty(value = "Дата начала действия ключевой ставки", example = "2022-01-20")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
|
|
@ -57,11 +58,11 @@ public class KeyRateNewAction implements IAction<KeyRateNewRequest> {
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getKeyRate() {
|
public BigDecimal getKeyRate() {
|
||||||
return keyRate;
|
return keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyRate(Double keyRate) {
|
public void setKeyRate(BigDecimal keyRate) {
|
||||||
this.keyRate = keyRate;
|
this.keyRate = keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.KeyRateUpdateRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.KeyRateUpdateRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
public class KeyRateUpdateAction implements IAction<KeyRateUpdateRequest> {
|
public class KeyRateUpdateAction implements IAction<KeyRateUpdateRequest> {
|
||||||
|
|
@ -17,7 +18,7 @@ public class KeyRateUpdateAction implements IAction<KeyRateUpdateRequest> {
|
||||||
public Long id;
|
public Long id;
|
||||||
@ApiModelProperty(value = "Ключевая ставка ЦБ РФ", example = "12.5")
|
@ApiModelProperty(value = "Ключевая ставка ЦБ РФ", example = "12.5")
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double keyRate;
|
public BigDecimal keyRate;
|
||||||
@ApiModelProperty(value = "Дата начала действия ключевой ставки", example = "2022-01-20")
|
@ApiModelProperty(value = "Дата начала действия ключевой ставки", example = "2022-01-20")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
|
|
@ -49,11 +50,11 @@ public class KeyRateUpdateAction implements IAction<KeyRateUpdateRequest> {
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getKeyRate() {
|
public BigDecimal getKeyRate() {
|
||||||
return keyRate;
|
return keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyRate(Double keyRate) {
|
public void setKeyRate(BigDecimal keyRate) {
|
||||||
this.keyRate = keyRate;
|
this.keyRate = keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,6 +78,10 @@ public class KeyRateUpdateAction implements IAction<KeyRateUpdateRequest> {
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDocument(String document) {
|
||||||
|
this.document = document;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
@ -84,8 +89,4 @@ public class KeyRateUpdateAction implements IAction<KeyRateUpdateRequest> {
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDocument(String document) {
|
|
||||||
this.document = document;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,6 @@ public class AccountBackendGetAll extends BasicSpcexResponse {
|
||||||
@ApiModelProperty(value = "Полезная нагрузка")
|
@ApiModelProperty(value = "Полезная нагрузка")
|
||||||
private AccountBackendPayload payload = new AccountBackendPayload();
|
private AccountBackendPayload payload = new AccountBackendPayload();
|
||||||
|
|
||||||
private static class AccountBackendPayload {
|
|
||||||
private List<AccountBackendGetFields> items = new ArrayList<>();
|
|
||||||
|
|
||||||
public List<AccountBackendGetFields> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(List<AccountBackendGetFields> items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AccountBackendPayload getPayload() {
|
public AccountBackendPayload getPayload() {
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +33,7 @@ public class AccountBackendGetAll extends BasicSpcexResponse {
|
||||||
singleItem.setAccount(account.getAccount());
|
singleItem.setAccount(account.getAccount());
|
||||||
singleItem.setAccountType(account.getAccountType());
|
singleItem.setAccountType(account.getAccountType());
|
||||||
singleItem.setRelationId(account.getRelationId());
|
singleItem.setRelationId(account.getRelationId());
|
||||||
singleItem.setStatus(account.getStatus());
|
singleItem.setStatus(account.getAccountStatus());
|
||||||
singleItem.setProcessingSign(account.getProcessingSign());
|
singleItem.setProcessingSign(account.getProcessingSign());
|
||||||
singleItem.setCreated(account.getCreated());
|
singleItem.setCreated(account.getCreated());
|
||||||
singleItem.setUpdated(account.getUpdated());
|
singleItem.setUpdated(account.getUpdated());
|
||||||
|
|
@ -53,4 +41,16 @@ public class AccountBackendGetAll extends BasicSpcexResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class AccountBackendPayload {
|
||||||
|
private List<AccountBackendGetFields> items = new ArrayList<>();
|
||||||
|
|
||||||
|
public List<AccountBackendGetFields> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItems(List<AccountBackendGetFields> items) {
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,13 +4,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
public class KeyRateBackendGetFields {
|
public class KeyRateBackendGetFields {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Long id;
|
private Long id;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Double rate;
|
private BigDecimal rate;
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Instant startDate;
|
private Instant startDate;
|
||||||
|
|
@ -30,11 +31,11 @@ public class KeyRateBackendGetFields {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getRate() {
|
public BigDecimal getRate() {
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRate(Double rate) {
|
public void setRate(BigDecimal rate) {
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ public class Account extends BusinessObject {
|
||||||
private String account;
|
private String account;
|
||||||
private String accountType;
|
private String accountType;
|
||||||
private Long relationId;
|
private Long relationId;
|
||||||
private String status;
|
private String accountStatus;
|
||||||
private String processingSign;
|
private String processingSign;
|
||||||
|
|
||||||
public String getAccount() {
|
public String getAccount() {
|
||||||
|
|
@ -41,12 +41,12 @@ public class Account extends BusinessObject {
|
||||||
this.relationId = value;
|
this.relationId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus() {
|
public String getAccountStatus() {
|
||||||
return status;
|
return accountStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String value) {
|
public void setAccountStatus(String value) {
|
||||||
this.status = value;
|
this.accountStatus = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProcessingSign() {
|
public String getProcessingSign() {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package ru.clearing.classes.statics.data.company.relation;
|
||||||
|
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Договорные отношения
|
* Договорные отношения
|
||||||
|
|
@ -15,8 +14,8 @@ public class Relation extends BusinessObject {
|
||||||
private Long consumerId;
|
private Long consumerId;
|
||||||
private Long supplierId;
|
private Long supplierId;
|
||||||
private String serviceStatus;
|
private String serviceStatus;
|
||||||
private Long service;
|
private String service;
|
||||||
private Long serviceProduct;
|
private String serviceProduct;
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
public Long getConsumerId() {
|
public Long getConsumerId() {
|
||||||
|
|
@ -43,19 +42,19 @@ public class Relation extends BusinessObject {
|
||||||
this.serviceStatus = value;
|
this.serviceStatus = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getService() {
|
public String getService() {
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setService(Long value) {
|
public void setService(String value) {
|
||||||
this.service = value;
|
this.service = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getServiceProduct() {
|
public String getServiceProduct() {
|
||||||
return serviceProduct;
|
return serviceProduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServiceProduct(Long value) {
|
public void setServiceProduct(String value) {
|
||||||
this.serviceProduct = value;
|
this.serviceProduct = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Журнал входящих документов
|
* Журнал входящих документов
|
||||||
|
|
@ -14,34 +15,34 @@ import java.time.Instant;
|
||||||
public class InDocumentJournal extends SpcexObjectBase {
|
public class InDocumentJournal extends SpcexObjectBase {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private Instant registrationDate;
|
private LocalDate registrationDate;
|
||||||
private Instant registrationTime;
|
private LocalTime registrationTime;
|
||||||
private Long registrationNumber;
|
private Long registrationNumber;
|
||||||
private String documentName;
|
private String documentName;
|
||||||
private String sender;
|
private String sender;
|
||||||
private Long quantity;
|
private Long quantity;
|
||||||
private String clearingCode;
|
private String clearingCode;
|
||||||
private String courierType;
|
private String courierType;
|
||||||
private Instant emailDate;
|
private LocalDate emailDate;
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
private String dossierNumber;
|
private String dossierNumber;
|
||||||
private String comment;
|
private String comment;
|
||||||
private Instant receiptDate;
|
private LocalDate receiptDate;
|
||||||
private String resultStatus;
|
private String resultStatus;
|
||||||
|
|
||||||
public Instant getRegistrationDate() {
|
public LocalDate getRegistrationDate() {
|
||||||
return registrationDate;
|
return registrationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationDate(Instant value) {
|
public void setRegistrationDate(LocalDate value) {
|
||||||
this.registrationDate = value;
|
this.registrationDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getRegistrationTime() {
|
public LocalTime getRegistrationTime() {
|
||||||
return registrationTime;
|
return registrationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationTime(Instant value) {
|
public void setRegistrationTime(LocalTime value) {
|
||||||
this.registrationTime = value;
|
this.registrationTime = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,11 +94,11 @@ public class InDocumentJournal extends SpcexObjectBase {
|
||||||
this.courierType = value;
|
this.courierType = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEmailDate() {
|
public LocalDate getEmailDate() {
|
||||||
return emailDate;
|
return emailDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmailDate(Instant value) {
|
public void setEmailDate(LocalDate value) {
|
||||||
this.emailDate = value;
|
this.emailDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,11 +126,11 @@ public class InDocumentJournal extends SpcexObjectBase {
|
||||||
this.comment = value;
|
this.comment = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getReceiptDate() {
|
public LocalDate getReceiptDate() {
|
||||||
return receiptDate;
|
return receiptDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReceiptDate(Instant value) {
|
public void setReceiptDate(LocalDate value) {
|
||||||
this.receiptDate = value;
|
this.receiptDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Журнал исходящих документов
|
* Журнал исходящих документов
|
||||||
|
|
@ -14,33 +15,33 @@ import java.time.Instant;
|
||||||
public class OutDocumentJournal extends SpcexObjectBase {
|
public class OutDocumentJournal extends SpcexObjectBase {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private Instant registrationDate;
|
private LocalDate registrationDate;
|
||||||
private Instant registrationTime;
|
private LocalTime registrationTime;
|
||||||
private Long registrationNumber;
|
private Long registrationNumber;
|
||||||
private String documentName;
|
private String documentName;
|
||||||
private String addressee;
|
private String addressee;
|
||||||
private Long quantity;
|
private Long quantity;
|
||||||
private String clearingCode;
|
private String clearingCode;
|
||||||
private String courierType;
|
private String courierType;
|
||||||
private Instant emailDate;
|
private LocalDate emailDate;
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
private String dossierNumber;
|
private String dossierNumber;
|
||||||
private Instant postDate;
|
private LocalDate postDate;
|
||||||
private String resultStatus;
|
private String resultStatus;
|
||||||
|
|
||||||
public Instant getRegistrationDate() {
|
public LocalDate getRegistrationDate() {
|
||||||
return registrationDate;
|
return registrationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationDate(Instant value) {
|
public void setRegistrationDate(LocalDate value) {
|
||||||
this.registrationDate = value;
|
this.registrationDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getRegistrationTime() {
|
public LocalTime getRegistrationTime() {
|
||||||
return registrationTime;
|
return registrationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationTime(Instant value) {
|
public void setRegistrationTime(LocalTime value) {
|
||||||
this.registrationTime = value;
|
this.registrationTime = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,11 +93,11 @@ public class OutDocumentJournal extends SpcexObjectBase {
|
||||||
this.courierType = value;
|
this.courierType = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEmailDate() {
|
public LocalDate getEmailDate() {
|
||||||
return emailDate;
|
return emailDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmailDate(Instant value) {
|
public void setEmailDate(LocalDate value) {
|
||||||
this.emailDate = value;
|
this.emailDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,11 +117,11 @@ public class OutDocumentJournal extends SpcexObjectBase {
|
||||||
this.dossierNumber = value;
|
this.dossierNumber = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getPostDate() {
|
public LocalDate getPostDate() {
|
||||||
return postDate;
|
return postDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostDate(Instant value) {
|
public void setPostDate(LocalDate value) {
|
||||||
this.postDate = value;
|
this.postDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package ru.clearing.classes.statics.data.messages;
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Полные тексты ошибок
|
* Полные тексты ошибок
|
||||||
|
|
@ -16,7 +16,7 @@ public class ErrorText extends BusinessObject {
|
||||||
private String errorCode;
|
private String errorCode;
|
||||||
private String text;
|
private String text;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Instant clearingDate;
|
private LocalDate clearingDate;
|
||||||
|
|
||||||
public String getErrorCode() {
|
public String getErrorCode() {
|
||||||
return errorCode;
|
return errorCode;
|
||||||
|
|
@ -42,11 +42,11 @@ public class ErrorText extends BusinessObject {
|
||||||
this.userId = value;
|
this.userId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getClearingDate() {
|
public LocalDate getClearingDate() {
|
||||||
return clearingDate;
|
return clearingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClearingDate(Instant value) {
|
public void setClearingDate(LocalDate value) {
|
||||||
this.clearingDate = value;
|
this.clearingDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,41 +2,42 @@ package ru.clearing.classes.statics.data.misc;
|
||||||
|
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ключевая ставка ЦБ
|
* Ключевая ставка ЦБ
|
||||||
*
|
* <p>
|
||||||
* DB table: KEY_RATE
|
* DB table: KEY_RATE
|
||||||
**/
|
**/
|
||||||
public class KeyRate extends SpcexObjectBase {
|
public class KeyRate extends SpcexObjectBase {
|
||||||
private Double rate;
|
private BigDecimal rate;
|
||||||
private Instant startDate;
|
private LocalDate startDate;
|
||||||
private Instant endDate;
|
private LocalDate endDate;
|
||||||
private String document;
|
private String document;
|
||||||
private String workflowStatus;
|
private String workflowStatus;
|
||||||
|
|
||||||
public Double getRate() {
|
public BigDecimal getRate() {
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRate(Double rate) {
|
public void setRate(BigDecimal rate) {
|
||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getStartDate() {
|
public LocalDate getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Instant startDate) {
|
public void setStartDate(LocalDate startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEndDate() {
|
public LocalDate getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndDate(Instant endDate) {
|
public void setEndDate(LocalDate endDate) {
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package ru.clearing.classes.statics.data.misc;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Инструменты Денежного рынка
|
* Инструменты Денежного рынка
|
||||||
|
|
@ -13,8 +13,8 @@ import java.time.Instant;
|
||||||
public class MoneyMarketSecurity extends SpcexObjectBase {
|
public class MoneyMarketSecurity extends SpcexObjectBase {
|
||||||
private Long securityId;// (linked to security)
|
private Long securityId;// (linked to security)
|
||||||
private String description;
|
private String description;
|
||||||
private Instant startDate;
|
private LocalDate startDate;
|
||||||
private Instant endDate;
|
private LocalDate endDate;
|
||||||
private BigDecimal nominalValue;
|
private BigDecimal nominalValue;
|
||||||
private Long nominalCurrency; // (linked to currencyCode)
|
private Long nominalCurrency; // (linked to currencyCode)
|
||||||
private String instrumentType; // (linked to instrumentType)
|
private String instrumentType; // (linked to instrumentType)
|
||||||
|
|
@ -37,19 +37,19 @@ public class MoneyMarketSecurity extends SpcexObjectBase {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getStartDate() {
|
public LocalDate getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Instant startDate) {
|
public void setStartDate(LocalDate startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEndDate() {
|
public LocalDate getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndDate(Instant endDate) {
|
public void setEndDate(LocalDate endDate) {
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package ru.clearing.classes.statics.data.profile;
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB: PROFILE_DOCUMENT
|
* DB: PROFILE_DOCUMENT
|
||||||
|
|
@ -13,15 +13,15 @@ public class ProfileDocument extends SpcexObjectBase {
|
||||||
|
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
private String documentType; // ref CHAR(4)
|
private String documentType; // ref CHAR(4)
|
||||||
private Instant issueDate;
|
private LocalDate issueDate;
|
||||||
private String issuePlace;
|
private String issuePlace;
|
||||||
private String issuer;
|
private String issuer;
|
||||||
private String issuerCode;
|
private String issuerCode;
|
||||||
private String name;
|
private String name;
|
||||||
private String number;
|
private String number;
|
||||||
private String place;
|
private String place;
|
||||||
private Instant validFromDate;
|
private LocalDate validFromDate;
|
||||||
private Instant validToDate;
|
private LocalDate validToDate;
|
||||||
private String link;
|
private String link;
|
||||||
|
|
||||||
public Long getCompanyId() {
|
public Long getCompanyId() {
|
||||||
|
|
@ -40,11 +40,11 @@ public class ProfileDocument extends SpcexObjectBase {
|
||||||
this.documentType = documentType;
|
this.documentType = documentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getIssueDate() {
|
public LocalDate getIssueDate() {
|
||||||
return issueDate;
|
return issueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIssueDate(Instant issueDate) {
|
public void setIssueDate(LocalDate issueDate) {
|
||||||
this.issueDate = issueDate;
|
this.issueDate = issueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,19 +96,19 @@ public class ProfileDocument extends SpcexObjectBase {
|
||||||
this.place = place;
|
this.place = place;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getValidFromDate() {
|
public LocalDate getValidFromDate() {
|
||||||
return validFromDate;
|
return validFromDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidFromDate(Instant validFromDate) {
|
public void setValidFromDate(LocalDate validFromDate) {
|
||||||
this.validFromDate = validFromDate;
|
this.validFromDate = validFromDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getValidToDate() {
|
public LocalDate getValidToDate() {
|
||||||
return validToDate;
|
return validToDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidToDate(Instant validToDate) {
|
public void setValidToDate(LocalDate validToDate) {
|
||||||
this.validToDate = validToDate;
|
this.validToDate = validToDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package ru.clearing.classes.statics.data.scheduler;
|
||||||
|
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Расписание планировщика
|
* Расписание планировщика
|
||||||
|
|
@ -15,8 +15,8 @@ public class Scheduler extends BusinessObject {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private String task;
|
private String task;
|
||||||
private Instant taskTime;
|
private LocalTime taskTime;
|
||||||
private Instant clearingDate;
|
private LocalDate clearingDate;
|
||||||
private String market;
|
private String market;
|
||||||
private String taskStatus;
|
private String taskStatus;
|
||||||
private Long securityId;
|
private Long securityId;
|
||||||
|
|
@ -30,19 +30,19 @@ public class Scheduler extends BusinessObject {
|
||||||
this.task = value;
|
this.task = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getTaskTime() {
|
public LocalTime getTaskTime() {
|
||||||
return taskTime;
|
return taskTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskTime(Instant value) {
|
public void setTaskTime(LocalTime value) {
|
||||||
this.taskTime = value;
|
this.taskTime = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getClearingDate() {
|
public LocalDate getClearingDate() {
|
||||||
return clearingDate;
|
return clearingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClearingDate(Instant value) {
|
public void setClearingDate(LocalDate value) {
|
||||||
this.clearingDate = value;
|
this.clearingDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ package ru.clearing.classes.statics.data.scheduler;
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Расписание на текущий день
|
* Расписание на текущий день
|
||||||
|
|
@ -14,8 +15,8 @@ public class SchedulerAllToday extends SpcexObjectBase {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private String task;
|
private String task;
|
||||||
private Instant taskTime;
|
private LocalTime taskTime;
|
||||||
private Instant clearingDate;
|
private LocalDate clearingDate;
|
||||||
private String market;
|
private String market;
|
||||||
private String taskStatus;
|
private String taskStatus;
|
||||||
private Long securityId;
|
private Long securityId;
|
||||||
|
|
@ -30,19 +31,19 @@ public class SchedulerAllToday extends SpcexObjectBase {
|
||||||
this.task = value;
|
this.task = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getTaskTime() {
|
public LocalTime getTaskTime() {
|
||||||
return taskTime;
|
return taskTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskTime(Instant value) {
|
public void setTaskTime(LocalTime value) {
|
||||||
this.taskTime = value;
|
this.taskTime = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getClearingDate() {
|
public LocalDate getClearingDate() {
|
||||||
return clearingDate;
|
return clearingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClearingDate(Instant value) {
|
public void setClearingDate(LocalDate value) {
|
||||||
this.clearingDate = value;
|
this.clearingDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package ru.clearing.classes.statics.data.scheduler;
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Постоянное расписание операционного дня
|
* Постоянное расписание операционного дня
|
||||||
|
|
@ -14,7 +14,7 @@ public class Timetable extends BusinessObject {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private String task;
|
private String task;
|
||||||
private Instant taskTime;
|
private LocalTime taskTime;
|
||||||
private String taskStatus;
|
private String taskStatus;
|
||||||
|
|
||||||
public String getTask() {
|
public String getTask() {
|
||||||
|
|
@ -25,11 +25,11 @@ public class Timetable extends BusinessObject {
|
||||||
this.task = value;
|
this.task = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getTaskTime() {
|
public LocalTime getTaskTime() {
|
||||||
return taskTime;
|
return taskTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskTime(Instant value) {
|
public void setTaskTime(LocalTime value) {
|
||||||
this.taskTime = value;
|
this.taskTime = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package ru.clearing.classes.statics.data.scheduler;
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Торговые и неторговые дни
|
* Торговые и неторговые дни
|
||||||
|
|
@ -13,15 +13,15 @@ import java.time.Instant;
|
||||||
public class TradingCalendar extends BusinessObject {
|
public class TradingCalendar extends BusinessObject {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private Instant clearingDate;
|
private LocalDate clearingDate;
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
private String tradingStatus;
|
private String tradingStatus;
|
||||||
|
|
||||||
public Instant getClearingDate() {
|
public LocalDate getClearingDate() {
|
||||||
return clearingDate;
|
return clearingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClearingDate(Instant value) {
|
public void setClearingDate(LocalDate value) {
|
||||||
this.clearingDate = value;
|
this.clearingDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ДФ-10 Подтверждение о загрузке по поступлению на клиринговый счет
|
* ДФ-10 Подтверждение о загрузке по поступлению на клиринговый счет
|
||||||
*
|
* <p>
|
||||||
* DB table: S_DF10
|
* DB table: S_DF10
|
||||||
*/
|
*/
|
||||||
public class SDf10 extends SpcexObjectBase {
|
public class SDf10 extends SpcexObjectBase {
|
||||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||||
|
|
||||||
private String account;
|
private String account;
|
||||||
private String sum;
|
private BigDecimal sum;
|
||||||
private String market;
|
private String market;
|
||||||
private String type;
|
private String type;
|
||||||
private BigDecimal number;
|
private BigDecimal number;
|
||||||
|
|
@ -33,11 +33,11 @@ public class SDf10 extends SpcexObjectBase {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSum() {
|
public BigDecimal getSum() {
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSum(String sum) {
|
public void setSum(BigDecimal sum) {
|
||||||
this.sum = sum;
|
this.sum = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Денежные средства от расчетной организации
|
* Денежные средства от расчетной организации
|
||||||
|
|
@ -16,16 +16,16 @@ public class Statement extends BusinessObject {
|
||||||
|
|
||||||
private Long addresseeId;
|
private Long addresseeId;
|
||||||
private Long senderId;
|
private Long senderId;
|
||||||
private Instant clearingDate;
|
private LocalDate clearingDate;
|
||||||
private String statementType;
|
private String statementType;
|
||||||
private String comment;
|
private String comment;
|
||||||
private Long accountId;
|
private Long accountId;
|
||||||
private String account;
|
private String account;
|
||||||
private String inOutDirection;
|
private String inOutDirection;
|
||||||
private Instant settlementDate;
|
private LocalDate settlementDate;
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
private String cashMovementCurrencyCode;
|
private String cashMovementCurrencyCode;
|
||||||
private String status;
|
private String operationStatus;
|
||||||
private String errorCode;
|
private String errorCode;
|
||||||
private String errorText;
|
private String errorText;
|
||||||
private Long inSDfId;
|
private Long inSDfId;
|
||||||
|
|
@ -48,11 +48,11 @@ public class Statement extends BusinessObject {
|
||||||
this.senderId = value;
|
this.senderId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getClearingDate() {
|
public LocalDate getClearingDate() {
|
||||||
return clearingDate;
|
return clearingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClearingDate(Instant value) {
|
public void setClearingDate(LocalDate value) {
|
||||||
this.clearingDate = value;
|
this.clearingDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,11 +96,11 @@ public class Statement extends BusinessObject {
|
||||||
this.inOutDirection = value;
|
this.inOutDirection = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getSettlementDate() {
|
public LocalDate getSettlementDate() {
|
||||||
return settlementDate;
|
return settlementDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSettlementDate(Instant value) {
|
public void setSettlementDate(LocalDate value) {
|
||||||
this.settlementDate = value;
|
this.settlementDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,12 +120,12 @@ public class Statement extends BusinessObject {
|
||||||
this.cashMovementCurrencyCode = value;
|
this.cashMovementCurrencyCode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus() {
|
public String getOperationStatus() {
|
||||||
return status;
|
return operationStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String value) {
|
public void setOperationStatus(String value) {
|
||||||
this.status = value;
|
this.operationStatus = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getErrorCode() {
|
public String getErrorCode() {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package ru.clearing.classes.statics.data.user;
|
||||||
|
|
||||||
import ru.clearing.classes.ConstSerializable;
|
import ru.clearing.classes.ConstSerializable;
|
||||||
import ru.clearing.classes.objects.BusinessObject;
|
import ru.clearing.classes.objects.BusinessObject;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Активность пользователей в системе
|
* Активность пользователей в системе
|
||||||
|
|
@ -20,7 +20,7 @@ public class UserConnect extends BusinessObject {
|
||||||
private String serverIP;
|
private String serverIP;
|
||||||
private String clientIP;
|
private String clientIP;
|
||||||
private String connectionState;
|
private String connectionState;
|
||||||
private Instant clearingDate;
|
private LocalDate clearingDate;
|
||||||
private Long errorCode;
|
private Long errorCode;
|
||||||
private String errorText;
|
private String errorText;
|
||||||
|
|
||||||
|
|
@ -72,11 +72,11 @@ public class UserConnect extends BusinessObject {
|
||||||
this.connectionState = value;
|
this.connectionState = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getClearingDate() {
|
public LocalDate getClearingDate() {
|
||||||
return clearingDate;
|
return clearingDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClearingDate(Instant value) {
|
public void setClearingDate(LocalDate value) {
|
||||||
this.clearingDate = value;
|
this.clearingDate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
//package ru.clearing.platform.dictionary;
|
package ru.clearing.platform.dictionary;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * Справочник статусов возваращения процентов
|
* Справочник статусов возваращения процентов
|
||||||
// *
|
* <p>
|
||||||
// * Dictionary DB table: INTEREST_STATUS_DICTIONARY
|
* Dictionary DB table: INTEREST_STATUS_DICTIONARY
|
||||||
// **/
|
**/
|
||||||
//public class InterestStatusDictionary extends AbstractDictionary {
|
public class InterestStatusDictionary extends AbstractDictionary {
|
||||||
// private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID;
|
private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID;
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>imdg</artifactId>
|
<artifactId>imdg</artifactId>
|
||||||
<name>Clearing in memory data grid</name>
|
<name>Clearing in memory data grid</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>SPCEX-1.0.0.0</version>
|
<version>SPCEX-1.0.0.0</version>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>clearing-parent</artifactId>
|
<artifactId>clearing-parent</artifactId>
|
||||||
<groupId>ru.spcex.clearing</groupId>
|
<groupId>ru.spcex.clearing</groupId>
|
||||||
<version>SPCEX-1.0.0.0</version>
|
<version>SPCEX-1.0.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
@ -74,8 +74,23 @@
|
||||||
|
|
||||||
<!-- TEST -->
|
<!-- TEST -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>testng</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.skyscreamer</groupId>
|
||||||
|
<artifactId>jsonassert</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
@ -117,6 +132,23 @@
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.21.0</version>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
<artifactId>junit-platform-surefire-provider</artifactId>
|
||||||
|
<version>1.2.0-M1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>5.2.0-M1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -2,13 +2,14 @@ package ru.spcex.clearing.imdg;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class IMDGApplication {
|
public class IMDGApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(IMDGApplication.class);
|
SpringApplicationBuilder builder = new SpringApplicationBuilder(IMDGApplication.class);
|
||||||
builder.run(args);
|
builder.run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,9 @@ import static ru.spcex.clearing.imdg.base.ObjectBaseMapStore.MAX_IN_CLAUSE_SIZE;
|
||||||
* Store для словарей стандартных - из ID, CODE, NAME.
|
* Store для словарей стандартных - из ID, CODE, NAME.
|
||||||
*/
|
*/
|
||||||
public abstract class DictionaryMapStore<T extends Dictionary> implements MapLoader<Long, T> {
|
public abstract class DictionaryMapStore<T extends Dictionary> implements MapLoader<Long, T> {
|
||||||
private static Logger log = LoggerFactory.getLogger(DictionaryMapStore.class);
|
private static final Logger log = LoggerFactory.getLogger(DictionaryMapStore.class);
|
||||||
|
|
||||||
protected NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
|
||||||
|
|
||||||
protected final JdbcTemplate jdbcTemplate;
|
protected final JdbcTemplate jdbcTemplate;
|
||||||
|
protected NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||||
|
|
||||||
protected DictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
protected DictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
this.jdbcTemplate = jdbcTemplate;
|
this.jdbcTemplate = jdbcTemplate;
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,11 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.Date;
|
||||||
import java.sql.SQLException;
|
import java.sql.*;
|
||||||
import java.sql.Time;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public abstract class ObjectBaseMapStore<T extends SpcexObjectBase> extends SimpleObjectMapStore<T> {
|
public abstract class ObjectBaseMapStore<T extends SpcexObjectBase> extends SimpleObjectMapStore<T> {
|
||||||
|
|
@ -88,7 +85,7 @@ public abstract class ObjectBaseMapStore<T extends SpcexObjectBase> extends Simp
|
||||||
|
|
||||||
protected LocalDate getLocalDateFromSqlDate(ResultSet rs, String column) throws SQLException {
|
protected LocalDate getLocalDateFromSqlDate(ResultSet rs, String column) throws SQLException {
|
||||||
Date date = rs.getDate(column);
|
Date date = rs.getDate(column);
|
||||||
return date != null ? Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate() : null;
|
return date != null ? date.toLocalDate() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LocalTime getLocalTimeFromSqlTime(ResultSet rs, String column) throws SQLException {
|
protected LocalTime getLocalTimeFromSqlTime(ResultSet rs, String column) throws SQLException {
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,10 @@ import java.util.stream.Collectors;
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public abstract class SimpleObjectMapStore<T extends SpcexObjectBase> implements MapStore<Long, T> {
|
public abstract class SimpleObjectMapStore<T extends SpcexObjectBase> implements MapStore<Long, T> {
|
||||||
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
|
||||||
|
|
||||||
private final static int BATCH_SIZE = 1000;
|
private final static int BATCH_SIZE = 1000;
|
||||||
protected SimpleDateFormat DB_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd");
|
protected final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||||
protected final JdbcTemplate jdbcTemplate;
|
protected final JdbcTemplate jdbcTemplate;
|
||||||
|
protected SimpleDateFormat DB_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
protected SimpleObjectMapStore(JdbcTemplate jdbcTemplate) {
|
protected SimpleObjectMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
this.jdbcTemplate = jdbcTemplate;
|
this.jdbcTemplate = jdbcTemplate;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<Account
|
||||||
AccountBalance object = updateLog.getObject();
|
AccountBalance object = updateLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
updateLog.getId(),
|
updateLog.getId(),
|
||||||
updateLog.getEventTime(),
|
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
|
||||||
updateLog.getUserId(),
|
updateLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,17 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID",
|
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||||
"ACCOUNT_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "STATUS", "PROCESSING_SIGN"
|
"ACCOUNT_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "ACCOUNT_STATUS", "PROCESSING_SIGN"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] objectToField(AccountHistory updateLog) {
|
public Object[] objectToField(AccountHistory updateLog) {
|
||||||
Account object=updateLog.getObject();
|
Account object = updateLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
updateLog.getId(),
|
updateLog.getId(),
|
||||||
updateLog.getEventTime(),
|
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
|
||||||
updateLog.getUserId(),
|
updateLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
@ -46,7 +46,7 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
|
||||||
object.getAccount(),
|
object.getAccount(),
|
||||||
object.getAccountType(),
|
object.getAccountType(),
|
||||||
object.getRelationId(),
|
object.getRelationId(),
|
||||||
object.getStatus(),
|
object.getAccountStatus(),
|
||||||
object.getProcessingSign()
|
object.getProcessingSign()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import ru.clearing.classes.statics.data.account.AccountRouting;
|
||||||
import ru.clearing.classes.statics.data.account.AccountRoutingHistory;
|
import ru.clearing.classes.statics.data.account.AccountRoutingHistory;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||||
|
import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<AccountRoutingHistory> {
|
public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<AccountRoutingHistory> {
|
||||||
|
|
@ -26,17 +27,17 @@ public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<Account
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID",
|
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||||
"ACCOUNT_ROUTING_ID", "DESTINATION_ID", "RELATION_ID", "SOURCE_ID"
|
"ACCOUNT_ROUTING_ID", "DESTINATION_ID", "RELATION_ID", "SOURCE_ID"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] objectToField(AccountRoutingHistory updateLog) {
|
public Object[] objectToField(AccountRoutingHistory updateLog) {
|
||||||
AccountRouting object=updateLog.getObject();
|
AccountRouting object = updateLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
updateLog.getId(),
|
updateLog.getId(),
|
||||||
updateLog.getEventTime(),
|
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
|
||||||
updateLog.getUserId(),
|
updateLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import ru.clearing.classes.statics.data.account.BankAccount;
|
||||||
import ru.clearing.classes.statics.data.account.BankAccountHistory;
|
import ru.clearing.classes.statics.data.account.BankAccountHistory;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||||
|
import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccountHistory> {
|
public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccountHistory> {
|
||||||
|
|
@ -36,7 +37,7 @@ public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccoun
|
||||||
BankAccount object = historyLog.getObject();
|
BankAccount object = historyLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
historyLog.getId(),
|
historyLog.getId(),
|
||||||
historyLog.getEventTime(),
|
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
|
||||||
historyLog.getUserId(),
|
historyLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package ru.spcex.clearing.imdg.businessevent;
|
||||||
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.classes.statics.data.company.CompanyHistory;
|
import ru.clearing.classes.statics.data.company.CompanyHistory;
|
||||||
import ru.clearing.classes.statics.data.profile.CompanyInfo;
|
import ru.clearing.classes.statics.data.profile.CompanyInfo;
|
||||||
|
|
@ -13,9 +14,12 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
//@Component
|
@Component
|
||||||
public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory> {
|
public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory> {
|
||||||
|
|
||||||
|
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
||||||
|
protected final String insertCompanyInfoStatement = makeInsertSql("COMPANY_INFO_HISTORY", getFieldsForCompanyInfo(), "id");
|
||||||
|
|
||||||
public CompanyHistoryMapStore(JdbcTemplate jdbcTemplate) {
|
public CompanyHistoryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
@ -42,9 +46,6 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
|
||||||
protected final String insertCompanyInfoStatement = makeInsertSql("COMPANY_INFO", getFieldsForCompanyInfo(), "id");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void store(Map<Long, CompanyHistory> map) {
|
public void store(Map<Long, CompanyHistory> map) {
|
||||||
List<Object[]> batchArgs = new ArrayList<>();
|
List<Object[]> batchArgs = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||||
import ru.clearing.classes.statics.data.account.InformationAccountHistory;
|
import ru.clearing.classes.statics.data.account.InformationAccountHistory;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||||
|
import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class InformationAccountHistoryMapStore extends TemplateEventMapStore<InformationAccountHistory> {
|
public class InformationAccountHistoryMapStore extends TemplateEventMapStore<InformationAccountHistory> {
|
||||||
|
|
@ -26,17 +27,17 @@ public class InformationAccountHistoryMapStore extends TemplateEventMapStore<Inf
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID",
|
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||||
"INFORMATION_ACCOUNT_ID", "ACCOUNT_ID", "CLEARING_ACCOUNT_ID"
|
"INFORMATION_ACCOUNT_ID", "ACCOUNT_ID", "CLEARING_ACCOUNT_ID"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] objectToField(InformationAccountHistory historyLog) {
|
public Object[] objectToField(InformationAccountHistory historyLog) {
|
||||||
InformationAccount object=historyLog.getObject();
|
InformationAccount object = historyLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
historyLog.getId(),
|
historyLog.getId(),
|
||||||
historyLog.getEventTime(),
|
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
|
||||||
historyLog.getUserId(),
|
historyLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -28,17 +28,17 @@ public class RelationHistoryMapStore extends TemplateEventMapStore<RelationHisto
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID",
|
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||||
"RELATION_ID", "CREATED_AT", "UPDATED_AT", "CONSUMER_ID", "SUPPLIER_ID", "SERVICE_STATUS", "SERVICE", "SERVICE_PRODUCT", "COMMENT"
|
"RELATION_ID", "CREATED_AT", "UPDATED_AT", "CONSUMER_ID", "SUPPLIER_ID", "SERVICE_STATUS", "SERVICE", "SERVICE_PRODUCT", "COMMENT"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] objectToField(RelationHistory updateLog) {
|
public Object[] objectToField(RelationHistory updateLog) {
|
||||||
Relation object=updateLog.getObject();
|
Relation object = updateLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
updateLog.getId(),
|
updateLog.getId(),
|
||||||
updateLog.getEventTime(),
|
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
|
||||||
updateLog.getUserId(),
|
updateLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,17 @@ public class SecurityHistoryMapStore extends TemplateEventMapStore<SecurityHisto
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID",
|
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||||
"SECURITY_ID", "CREATED_AT", "UPDATED_AT", "INSTRUMENT_TYPE", "ISSUER_ID", "SHORT_NAME", "FULL_NAME", "SHORT_NAME_ENG", "FULL_NAME_ENG", "SECURITY_SYMBOL", "WORKFLOW_STATUS"
|
"SECURITY_ID", "CREATED_AT", "UPDATED_AT", "INSTRUMENT_TYPE", "ISSUER_ID", "SHORT_NAME", "FULL_NAME", "SHORT_NAME_ENG", "FULL_NAME_ENG", "SECURITY_SYMBOL", "WORKFLOW_STATUS"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] objectToField(SecurityHistory updateLog) {
|
public Object[] objectToField(SecurityHistory updateLog) {
|
||||||
Security object=updateLog.getObject();
|
Security object = updateLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
updateLog.getId(),
|
updateLog.getId(),
|
||||||
updateLog.getEventTime(),
|
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
|
||||||
updateLog.getUserId(),
|
updateLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public class UserConnectHistoryMapStore extends TemplateEventMapStore<UserConnec
|
||||||
UserConnect object = historyLog.getObject();
|
UserConnect object = historyLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
historyLog.getId(),
|
historyLog.getId(),
|
||||||
historyLog.getEventTime(),
|
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
|
||||||
historyLog.getUserId(),
|
historyLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
@ -49,7 +49,7 @@ public class UserConnectHistoryMapStore extends TemplateEventMapStore<UserConnec
|
||||||
object.getServerIP(),
|
object.getServerIP(),
|
||||||
object.getClientIP(),
|
object.getClientIP(),
|
||||||
object.getConnectionState(),
|
object.getConnectionState(),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate()),
|
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||||
object.getErrorCode(),
|
object.getErrorCode(),
|
||||||
object.getErrorText()
|
object.getErrorText()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,17 @@ public class UserHistoryMapStore extends TemplateEventMapStore<UserHistory> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"ID","EVENT_TIME", "EVENT_USER_ID",
|
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||||
"USER_ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER"
|
"USER_CLS_ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] objectToField(UserHistory historyLog) {
|
public Object[] objectToField(UserHistory historyLog) {
|
||||||
User object=historyLog.getObject();
|
User object = historyLog.getObject();
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
historyLog.getId(),
|
historyLog.getId(),
|
||||||
historyLog.getEventTime(),
|
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
|
||||||
historyLog.getUserId(),
|
historyLog.getUserId(),
|
||||||
|
|
||||||
object.getId(),
|
object.getId(),
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class AccountBalanceMapStore extends TemplateMapStore<AccountBalance> {
|
||||||
object.setStartBalanceAmount(resultSet.getObject("START_BALANCE_AMOUNT", BigDecimal.class));
|
object.setStartBalanceAmount(resultSet.getObject("START_BALANCE_AMOUNT", BigDecimal.class));
|
||||||
object.setCloseBalanceAmount(resultSet.getObject("CLOSE_BALANCE_AMOUNT", BigDecimal.class));
|
object.setCloseBalanceAmount(resultSet.getObject("CLOSE_BALANCE_AMOUNT", BigDecimal.class));
|
||||||
object.setTradeBalanceAmount(resultSet.getObject("TRADE_BALANCE_AMOUNT", BigDecimal.class));
|
object.setTradeBalanceAmount(resultSet.getObject("TRADE_BALANCE_AMOUNT", BigDecimal.class));
|
||||||
object.setFreeBalanceAmount(resultSet.getObject("FREE_BALANCE_AMOU", BigDecimal.class));
|
object.setFreeBalanceAmount(resultSet.getObject("FREE_BALANCE_AMOUNT", BigDecimal.class));
|
||||||
object.setChangeBalanceAmount(resultSet.getObject("CHANGE_BALANCE_AMOUNT", BigDecimal.class));
|
object.setChangeBalanceAmount(resultSet.getObject("CHANGE_BALANCE_AMOUNT", BigDecimal.class));
|
||||||
object.setCreditAmount(resultSet.getObject("CREDIT_AMOUNT", BigDecimal.class));
|
object.setCreditAmount(resultSet.getObject("CREDIT_AMOUNT", BigDecimal.class));
|
||||||
object.setDebitAmount(resultSet.getObject("DEBIT_AMOUNT", BigDecimal.class));
|
object.setDebitAmount(resultSet.getObject("DEBIT_AMOUNT", BigDecimal.class));
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class AccountMapStore extends TemplateMapStore<Account> {
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "STATUS", "PROCESSING_SIGN"
|
"ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "ACCOUNT_STATUS", "PROCESSING_SIGN"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class AccountMapStore extends TemplateMapStore<Account> {
|
||||||
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
||||||
object.setAccountType(resultSet.getObject("ACCOUNT_TYPE", String.class));
|
object.setAccountType(resultSet.getObject("ACCOUNT_TYPE", String.class));
|
||||||
object.setRelationId(resultSet.getObject("RELATION_ID", Long.class));
|
object.setRelationId(resultSet.getObject("RELATION_ID", Long.class));
|
||||||
object.setStatus(resultSet.getObject("STATUS", String.class));
|
object.setAccountStatus(resultSet.getObject("ACCOUNT_STATUS", String.class));
|
||||||
object.setProcessingSign(resultSet.getObject("PROCESSING_SIGN", String.class));
|
object.setProcessingSign(resultSet.getObject("PROCESSING_SIGN", String.class));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ public class AccountMapStore extends TemplateMapStore<Account> {
|
||||||
object.getAccount(),
|
object.getAccount(),
|
||||||
object.getAccountType(),
|
object.getAccountType(),
|
||||||
object.getRelationId(),
|
object.getRelationId(),
|
||||||
object.getStatus(),
|
object.getAccountStatus(),
|
||||||
object.getProcessingSign()
|
object.getProcessingSign()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class ErrorTextMapStore extends TemplateMapStore<ErrorText> {
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"ID", "CREATED_AT", "UPDATED_AT", "ERROR_CODE", "TEXT", "USER_ID", "CLEARING_DATE"
|
"ID", "CREATED_AT", "UPDATED_AT", "ERROR_CODE", "TEXT", "USER_ID", "CLEARING_DATE"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class ErrorTextMapStore extends TemplateMapStore<ErrorText> {
|
||||||
object.setErrorCode(resultSet.getObject("ERROR_CODE", String.class));
|
object.setErrorCode(resultSet.getObject("ERROR_CODE", String.class));
|
||||||
object.setText(resultSet.getObject("TEXT", String.class));
|
object.setText(resultSet.getObject("TEXT", String.class));
|
||||||
object.setUserId(resultSet.getObject("USER_ID", Long.class));
|
object.setUserId(resultSet.getObject("USER_ID", Long.class));
|
||||||
object.setClearingDate(getInstantFromTimestamp(resultSet, "CLEARING_DATE"));
|
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class ErrorTextMapStore extends TemplateMapStore<ErrorText> {
|
||||||
object.getErrorCode(),
|
object.getErrorCode(),
|
||||||
object.getText(),
|
object.getText(),
|
||||||
object.getUserId(),
|
object.getUserId(),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate())
|
TimeUtil.toDateFromLocalDate(object.getClearingDate())
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ public class RelationMapStore extends TemplateMapStore<Relation> {
|
||||||
object.setConsumerId(resultSet.getObject("CONSUMER_ID", Long.class));
|
object.setConsumerId(resultSet.getObject("CONSUMER_ID", Long.class));
|
||||||
object.setSupplierId(resultSet.getObject("SUPPLIER_ID", Long.class));
|
object.setSupplierId(resultSet.getObject("SUPPLIER_ID", Long.class));
|
||||||
object.setServiceStatus(resultSet.getObject("SERVICE_STATUS", String.class));
|
object.setServiceStatus(resultSet.getObject("SERVICE_STATUS", String.class));
|
||||||
object.setService(resultSet.getObject("SERVICE", Long.class));
|
object.setService(resultSet.getObject("SERVICE", String.class));
|
||||||
object.setServiceProduct(resultSet.getObject("SERVICE_PRODUCT", Long.class));
|
object.setServiceProduct(resultSet.getObject("SERVICE_PRODUCT", String.class));
|
||||||
object.setComment(resultSet.getObject("COMMENT", String.class));
|
object.setComment(resultSet.getObject("COMMENT", String.class));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ public class SchedulerMapStore extends TemplateMapStore<Scheduler> {
|
||||||
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
||||||
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
||||||
object.setTask(resultSet.getObject("TASK", String.class));
|
object.setTask(resultSet.getObject("TASK", String.class));
|
||||||
object.setTaskTime(getInstantFromTimestamp(resultSet, "TASK_TIME"));
|
object.setTaskTime(getLocalTimeFromSqlTime(resultSet, "TASK_TIME"));
|
||||||
object.setClearingDate(getInstantFromTimestamp(resultSet, "CLEARING_DATE"));
|
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||||
object.setMarket(resultSet.getObject("MARKET", String.class));
|
object.setMarket(resultSet.getObject("MARKET", String.class));
|
||||||
object.setTaskStatus(resultSet.getObject("TASK_STATUS", String.class));
|
object.setTaskStatus(resultSet.getObject("TASK_STATUS", String.class));
|
||||||
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
||||||
|
|
@ -56,8 +56,8 @@ public class SchedulerMapStore extends TemplateMapStore<Scheduler> {
|
||||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||||
object.getTask(),
|
object.getTask(),
|
||||||
TimeUtil.toDateFromInstant(object.getTaskTime()),
|
TimeUtil.toDateFromLocalTime(object.getTaskTime()),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate()),
|
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||||
object.getMarket(),
|
object.getMarket(),
|
||||||
object.getTaskStatus(),
|
object.getTaskStatus(),
|
||||||
object.getSecurityId()
|
object.getSecurityId()
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class StatementMapStore extends TemplateMapStore<Statement> {
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"ID", "ADDRESSEE_ID", "SENDER_ID", "CREATED_AT", "UPDATED_AT", "CLEARING_DATE", "STATEMENT_TYPE_ID", "COMMENT", "ACCOUNT_ID", "ACCOUNT", "IN_OUT_DIRECTION", "SETTLEMENT_DATE", "AMOUNT", "CASH_MOVEMENT_CURRENCY_CODE", "STATUS", "ERROR_CODE", "ERROR_TEXT", "IN_S_DF_ID", "OUT_S_DF_ID", "IN_OUT_S_DF_TYPE"
|
"ID", "ADDRESSEE_ID", "SENDER_ID", "CREATED_AT", "UPDATED_AT", "CLEARING_DATE", "STATEMENT_TYPE", "COMMENT", "ACCOUNT_ID", "ACCOUNT", "IN_OUT_DIRECTION", "SETTLEMENT_DATE", "AMOUNT", "CASH_MOVEMENT_CURRENCY_CODE", "OPERATION_STATUS", "ERROR_CODE", "ERROR_TEXT", "IN_S_DF_ID", "OUT_S_DF_ID", "IN_OUT_S_DF_TYPE"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,16 +43,16 @@ public class StatementMapStore extends TemplateMapStore<Statement> {
|
||||||
object.setSenderId(resultSet.getObject("SENDER_ID", Long.class));
|
object.setSenderId(resultSet.getObject("SENDER_ID", Long.class));
|
||||||
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
||||||
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
||||||
object.setClearingDate(getInstantFromTimestamp(resultSet, "CLEARING_DATE"));
|
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||||
object.setStatementType(resultSet.getObject("STATEMENT_TYPE_ID", String.class));
|
object.setStatementType(resultSet.getObject("STATEMENT_TYPE", String.class));
|
||||||
object.setComment(resultSet.getObject("COMMENT", String.class));
|
object.setComment(resultSet.getObject("COMMENT", String.class));
|
||||||
object.setAccountId(resultSet.getObject("ACCOUNT_ID", Long.class));
|
object.setAccountId(resultSet.getObject("ACCOUNT_ID", Long.class));
|
||||||
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
||||||
object.setInOutDirection(resultSet.getObject("IN_OUT_DIRECTION", String.class));
|
object.setInOutDirection(resultSet.getObject("IN_OUT_DIRECTION", String.class));
|
||||||
object.setSettlementDate(getInstantFromTimestamp(resultSet, "SETTLEMENT_DATE"));
|
object.setSettlementDate(getLocalDateFromSqlDate(resultSet, "SETTLEMENT_DATE"));
|
||||||
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
|
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
|
||||||
object.setCashMovementCurrencyCode(resultSet.getObject("CASH_MOVEMENT_CURRENCY_CODE", String.class));
|
object.setCashMovementCurrencyCode(resultSet.getObject("CASH_MOVEMENT_CURRENCY_CODE", String.class));
|
||||||
object.setStatus(resultSet.getObject("STATUS", String.class));
|
object.setOperationStatus(resultSet.getObject("OPERATION_STATUS", String.class));
|
||||||
object.setErrorCode(resultSet.getObject("ERROR_CODE", String.class));
|
object.setErrorCode(resultSet.getObject("ERROR_CODE", String.class));
|
||||||
object.setErrorText(resultSet.getObject("ERROR_TEXT", String.class));
|
object.setErrorText(resultSet.getObject("ERROR_TEXT", String.class));
|
||||||
object.setInSDfId(resultSet.getObject("IN_S_DF_ID", Long.class));
|
object.setInSDfId(resultSet.getObject("IN_S_DF_ID", Long.class));
|
||||||
|
|
@ -69,16 +69,16 @@ public class StatementMapStore extends TemplateMapStore<Statement> {
|
||||||
object.getSenderId(),
|
object.getSenderId(),
|
||||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate()),
|
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||||
object.getStatementType(),
|
object.getStatementType(),
|
||||||
object.getComment(),
|
object.getComment(),
|
||||||
object.getAccountId(),
|
object.getAccountId(),
|
||||||
object.getAccount(),
|
object.getAccount(),
|
||||||
object.getInOutDirection(),
|
object.getInOutDirection(),
|
||||||
TimeUtil.toDateFromInstant(object.getSettlementDate()),
|
TimeUtil.toDateFromLocalDate(object.getSettlementDate()),
|
||||||
object.getAmount(),
|
object.getAmount(),
|
||||||
object.getCashMovementCurrencyCode(),
|
object.getCashMovementCurrencyCode(),
|
||||||
object.getStatus(),
|
object.getOperationStatus(),
|
||||||
object.getErrorCode(),
|
object.getErrorCode(),
|
||||||
object.getErrorText(),
|
object.getErrorText(),
|
||||||
object.getInSDfId(),
|
object.getInSDfId(),
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class TimetableMapStore extends TemplateMapStore<Timetable> {
|
||||||
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
||||||
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
||||||
object.setTask(resultSet.getObject("TASK", String.class));
|
object.setTask(resultSet.getObject("TASK", String.class));
|
||||||
object.setTaskTime(getInstantFromTimestamp(resultSet, "TASK_TIME"));
|
object.setTaskTime(getLocalTimeFromSqlTime(resultSet, "TASK_TIME"));
|
||||||
object.setTaskStatus(resultSet.getObject("TASK_STATUS", String.class));
|
object.setTaskStatus(resultSet.getObject("TASK_STATUS", String.class));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +53,7 @@ public class TimetableMapStore extends TemplateMapStore<Timetable> {
|
||||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||||
object.getTask(),
|
object.getTask(),
|
||||||
TimeUtil.toDateFromInstant(object.getTaskTime()),
|
TimeUtil.toDateFromLocalTime(object.getTaskTime()),
|
||||||
object.getTaskStatus()
|
object.getTaskStatus()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class TradingCalendarMapStore extends TemplateMapStore<TradingCalendar> {
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"ID", "CREATED_AT", "UPDATED_AT", "CLEARING_DATE", "COMPANY_ID", "TRADING_STATUS"
|
"ID", "CREATED_AT", "UPDATED_AT", "CLEARING_DATE", "COMPANY_ID", "TRADING_STATUS"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class TradingCalendarMapStore extends TemplateMapStore<TradingCalendar> {
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
||||||
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
||||||
object.setClearingDate(getInstantFromTimestamp(resultSet, "CLEARING_DATE"));
|
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||||
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
|
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
|
||||||
object.setTradingStatus(resultSet.getObject("TRADING_STATUS", String.class));
|
object.setTradingStatus(resultSet.getObject("TRADING_STATUS", String.class));
|
||||||
return object;
|
return object;
|
||||||
|
|
@ -52,7 +52,7 @@ public class TradingCalendarMapStore extends TemplateMapStore<TradingCalendar> {
|
||||||
object.getId(),
|
object.getId(),
|
||||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate()),
|
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||||
object.getCompanyId(),
|
object.getCompanyId(),
|
||||||
object.getTradingStatus()
|
object.getTradingStatus()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class UserConnectMapStore extends TemplateMapStore<UserConnect> {
|
||||||
object.setServerIP(resultSet.getObject("SERVER_I_P", String.class));
|
object.setServerIP(resultSet.getObject("SERVER_I_P", String.class));
|
||||||
object.setClientIP(resultSet.getObject("CLIENT_I_P", String.class));
|
object.setClientIP(resultSet.getObject("CLIENT_I_P", String.class));
|
||||||
object.setConnectionState(resultSet.getObject("CONNECTION_STATE", String.class));
|
object.setConnectionState(resultSet.getObject("CONNECTION_STATE", String.class));
|
||||||
object.setClearingDate(getInstantFromTimestamp(resultSet, "CLEARING_DATE"));
|
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||||
object.setErrorCode(resultSet.getObject("ERROR_CODE", Long.class));
|
object.setErrorCode(resultSet.getObject("ERROR_CODE", Long.class));
|
||||||
object.setErrorText(resultSet.getObject("ERROR_TEXT", String.class));
|
object.setErrorText(resultSet.getObject("ERROR_TEXT", String.class));
|
||||||
return object;
|
return object;
|
||||||
|
|
@ -64,7 +64,7 @@ public class UserConnectMapStore extends TemplateMapStore<UserConnect> {
|
||||||
object.getServerIP(),
|
object.getServerIP(),
|
||||||
object.getClientIP(),
|
object.getClientIP(),
|
||||||
object.getConnectionState(),
|
object.getConnectionState(),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate()),
|
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||||
object.getErrorCode(),
|
object.getErrorCode(),
|
||||||
object.getErrorText()
|
object.getErrorText()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -51,22 +51,11 @@ public class HazelcastConfiguration {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
config.addMapConfig(poolMapConfigs.map_AllowedDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_CompanyRoleDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_CompanySymbolDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_ContactTypeDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_CorporationSoleTypeDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_CountryCodeDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_DocumentTypeDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_LegalKindDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_OrganizationTypeDictionary());
|
|
||||||
config.addMapConfig(poolMapConfigs.map_WorkflowStatusDictionary());
|
|
||||||
|
|
||||||
config.addMapConfig(poolMapConfigs.map_Company()); //todo убедиться, что CompanyMapStore extends BusinessObjectMapStore теперь будет TemplateMapStore.
|
config.addMapConfig(poolMapConfigs.map_Company()); //todo убедиться, что CompanyMapStore extends BusinessObjectMapStore теперь будет TemplateMapStore.
|
||||||
|
config.addMapConfig(poolMapConfigs.map_CompanyHistory());
|
||||||
// Автоподключение мап
|
// Автоподключение мап
|
||||||
List<MapConfig> autoMapCfg = poolMapConfigs.autoconfiguratorOfMapstorages();
|
List<MapConfig> autoMapCfg = poolMapConfigs.autoconfiguratorOfMapstorages();
|
||||||
for (MapConfig cfg: autoMapCfg) {
|
for (MapConfig cfg : autoMapCfg) {
|
||||||
config.addMapConfig(cfg);
|
config.addMapConfig(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,6 @@ import ru.spcex.clearing.imdg.base.AutoconfiguredMap;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
import ru.spcex.clearing.imdg.businessevent.CompanyHistoryMapStore;
|
import ru.spcex.clearing.imdg.businessevent.CompanyHistoryMapStore;
|
||||||
import ru.spcex.clearing.imdg.businessobject.CompanyMapStore;
|
import ru.spcex.clearing.imdg.businessobject.CompanyMapStore;
|
||||||
import ru.spcex.clearing.imdg.dictionary.*;
|
|
||||||
import ru.spcex.clearing.imdg.object.CompanySymbolsMapStore;
|
|
||||||
import ru.spcex.clearing.imdg.object.ContactMapStore;
|
|
||||||
import ru.spcex.clearing.imdg.object.ProfileDocumentMapStore;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -24,12 +20,21 @@ import java.util.List;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class PoolMapConfigs {
|
public class PoolMapConfigs {
|
||||||
private Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
@Autowired
|
||||||
|
private CompanyMapStore companyMapStore;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyHistoryMapStore companyHistoryMapStore;
|
||||||
|
|
||||||
|
// Автоконфигурируемые мапсторы:
|
||||||
|
@Autowired
|
||||||
|
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
|
||||||
|
|
||||||
private MapStoreConfig makeDefaultMapStoreConfig(MapLoader<Long, ?> mapBean) {
|
private MapStoreConfig makeDefaultMapStoreConfig(MapLoader<Long, ?> mapBean) {
|
||||||
return new MapStoreConfig()
|
return new MapStoreConfig()
|
||||||
.setImplementation(mapBean)
|
.setImplementation(mapBean)
|
||||||
;//todo config: .setWriteDelaySeconds(configRoot.getIMDG().getDbSyncSeconds());
|
;//todo config: .setWriteDelaySeconds(configRoot.getIMDG().getDbSyncSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScheduledExecutorConfig makeDefaultScheduledExecutorConfig(String name) {
|
public ScheduledExecutorConfig makeDefaultScheduledExecutorConfig(String name) {
|
||||||
|
|
@ -67,82 +72,13 @@ public class PoolMapConfigs {
|
||||||
return makeMapIndexConfig(attributeName, false);
|
return makeMapIndexConfig(attributeName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired private AllowedDictionaryMapStore allowedDictionaryMapStore;
|
|
||||||
public MapConfig map_AllowedDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_AllowedDictionary, allowedDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private CompanyRoleDictionaryMapStore companyRoleDictionaryMapStore;
|
|
||||||
public MapConfig map_CompanyRoleDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyRoleDictionary, companyRoleDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private CompanySymbolDictionaryMapStore companySymbolDictionaryMapStore;
|
|
||||||
public MapConfig map_CompanySymbolDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanySymbolDictionary, companySymbolDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private ContactTypeDictionaryMapStore contactTypeDictionaryMapStore;
|
|
||||||
public MapConfig map_ContactTypeDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_ContactTypeDictionary, contactTypeDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private CorporationSoleTypeDictionaryMapStore corporationSoleTypeDictionaryMapStore;
|
|
||||||
public MapConfig map_CorporationSoleTypeDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, corporationSoleTypeDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private CountryCodeDictionaryMapStore countryCodeDictionaryMapStore;
|
|
||||||
public MapConfig map_CountryCodeDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CountryCodeDictionary, countryCodeDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private DocumentTypeDictionaryMapStore documentTypeDictionaryMapStore;
|
|
||||||
public MapConfig map_DocumentTypeDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_DocumentTypeDictionary, documentTypeDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private LegalKindDictionaryMapStore legalKindDictionaryMapStore;
|
|
||||||
public MapConfig map_LegalKindDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_LegalKindDictionary, legalKindDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private OrganizationTypeDictionaryMapStore organizationTypeDictionaryMapStore;
|
|
||||||
public MapConfig map_OrganizationTypeDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_OrganizationTypeDictionary, organizationTypeDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
@Autowired private WorkflowStatusDictionaryMapStore workflowStatusDictionaryMapStore;
|
|
||||||
public MapConfig map_WorkflowStatusDictionary() {
|
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_WorkflowStatusDictionary, workflowStatusDictionaryMapStore)
|
|
||||||
.setNearCacheConfig(makeDefaultNearCacheConfig())
|
|
||||||
.addMapIndexConfig(makeMapIndexConfig("code"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CompanyMapStore companyMapStore;
|
|
||||||
|
|
||||||
public MapConfig map_Company() {
|
public MapConfig map_Company() {
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore);
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapConfig map_CompanyHistory() {
|
||||||
// Автоконфигурируемые мапсторы:
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyHistory, companyHistoryMapStore);
|
||||||
@Autowired
|
}
|
||||||
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
|
|
||||||
|
|
||||||
// @Qualifier("AutoconfiguredMapStore")
|
// @Qualifier("AutoconfiguredMapStore")
|
||||||
public List<MapConfig> autoconfiguratorOfMapstorages() {
|
public List<MapConfig> autoconfiguratorOfMapstorages() {
|
||||||
|
|
@ -173,7 +109,7 @@ public class PoolMapConfigs {
|
||||||
}
|
}
|
||||||
out.add(mapCfg);
|
out.add(mapCfg);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException("Can not configure MapStore " + mapStore.getMapName() + "(" + mapStore.toString() + "): " + e, e);
|
throw new RuntimeException("Can not configure MapStore " + mapStore.getMapName() + "(" + mapStore + "): " + e, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("Configured {} mapStore's", out.size());
|
log.debug("Configured {} mapStore's", out.size());
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.AllowedDictionary;
|
import ru.clearing.platform.dictionary.AllowedDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AllowedDictionaryMapStore extends DictionaryMapStore<AllowedDictionary> {
|
public class AllowedDictionaryMapStore extends DictionaryTMapStore<AllowedDictionary> {
|
||||||
|
|
||||||
public AllowedDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public AllowedDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_AllowedDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "ALLOWED_DICTIONARY";
|
return "ALLOWED_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.CompanyRoleDictionary;
|
import ru.clearing.platform.dictionary.CompanyRoleDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CompanyRoleDictionaryMapStore extends DictionaryMapStore<CompanyRoleDictionary> {
|
public class CompanyRoleDictionaryMapStore extends DictionaryTMapStore<CompanyRoleDictionary> {
|
||||||
|
|
||||||
public CompanyRoleDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public CompanyRoleDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_CompanyRoleDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "COMPANY_ROLE_DICTIONARY";
|
return "COMPANY_ROLE_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,24 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.CompanySymbolDictionary;
|
import ru.clearing.platform.dictionary.CompanySymbolDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CompanySymbolDictionaryMapStore extends DictionaryMapStore<CompanySymbolDictionary> {
|
public class CompanySymbolDictionaryMapStore extends DictionaryTMapStore<CompanySymbolDictionary> {
|
||||||
|
|
||||||
public CompanySymbolDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public CompanySymbolDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_CompanySymbolDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "COMPANY_SYMBOL_DICTIONARY";
|
return "COMPANY_SYMBOL_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.ContactTypeDictionary;
|
import ru.clearing.platform.dictionary.ContactTypeDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ContactTypeDictionaryMapStore extends DictionaryMapStore<ContactTypeDictionary> {
|
public class ContactTypeDictionaryMapStore extends DictionaryTMapStore<ContactTypeDictionary> {
|
||||||
|
|
||||||
public ContactTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public ContactTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_ContactTypeDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "CONTACT_TYPE_DICTIONARY";
|
return "CONTACT_TYPE_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.CorporationSoleTypeDictionary;
|
import ru.clearing.platform.dictionary.CorporationSoleTypeDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CorporationSoleTypeDictionaryMapStore extends DictionaryMapStore<CorporationSoleTypeDictionary> {
|
public class CorporationSoleTypeDictionaryMapStore extends DictionaryTMapStore<CorporationSoleTypeDictionary> {
|
||||||
|
|
||||||
public CorporationSoleTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public CorporationSoleTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_CorporationSoleTypeDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "CORPORATION_SOLE_TYPE_DICTIONARY";
|
return "CORPORATION_SOLE_TYPE_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,22 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.CountryCodeDictionary;
|
import ru.clearing.platform.dictionary.CountryCodeDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CountryCodeDictionaryMapStore extends DictionaryMapStore<CountryCodeDictionary> {
|
public class CountryCodeDictionaryMapStore extends DictionaryTMapStore<CountryCodeDictionary> {
|
||||||
|
|
||||||
public CountryCodeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public CountryCodeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_CountryCodeDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "COUNTRY_CODE_DICTIONARY";
|
return "COUNTRY_CODE_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,22 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.DocumentTypeDictionary;
|
import ru.clearing.platform.dictionary.DocumentTypeDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class DocumentTypeDictionaryMapStore extends DictionaryMapStore<DocumentTypeDictionary> {
|
public class DocumentTypeDictionaryMapStore extends DictionaryTMapStore<DocumentTypeDictionary> {
|
||||||
|
|
||||||
public DocumentTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public DocumentTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_DocumentTypeDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "DOCUMENT_TYPE_DICTIONARY";
|
return "DOCUMENT_TYPE_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
//package ru.spcex.clearing.imdg.dictionary;
|
package ru.spcex.clearing.imdg.dictionary;
|
||||||
//
|
|
||||||
//import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
//import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
//import ru.clearing.platform.dictionary.InterestStatusDictionary;
|
import ru.clearing.platform.dictionary.InterestStatusDictionary;
|
||||||
//import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
//import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
//
|
|
||||||
//@Component
|
@Component
|
||||||
//public class InterestStatusDictionaryMapStore extends DictionaryTMapStore<InterestStatusDictionary> {
|
public class InterestStatusDictionaryMapStore extends DictionaryTMapStore<InterestStatusDictionary> {
|
||||||
//
|
|
||||||
// public InterestStatusDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public InterestStatusDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
// super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public String getMapName() {
|
public String getMapName() {
|
||||||
// return IMDGDistributedNames.Map_InterestStatusDictionary;
|
return IMDGDistributedNames.Map_InterestStatusDictionary;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public String getTableName() {
|
public String getTableName() {
|
||||||
// return "INTEREST_STATUS_DICTIONARY";
|
return "INTEREST_STATUS_DICTIONARY";
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public InterestStatusDictionary getDictionaryObject() {
|
public InterestStatusDictionary getDictionaryObject() {
|
||||||
// return new InterestStatusDictionary();
|
return new InterestStatusDictionary();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.LegalKindDictionary;
|
import ru.clearing.platform.dictionary.LegalKindDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class LegalKindDictionaryMapStore extends DictionaryMapStore<LegalKindDictionary> {
|
public class LegalKindDictionaryMapStore extends DictionaryTMapStore<LegalKindDictionary> {
|
||||||
|
|
||||||
public LegalKindDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public LegalKindDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_LegalKindDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "LEGAL_KIND_DICTIONARY";
|
return "LEGAL_KIND_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.OrganizationTypeDictionary;
|
import ru.clearing.platform.dictionary.OrganizationTypeDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class OrganizationTypeDictionaryMapStore extends DictionaryMapStore<OrganizationTypeDictionary> {
|
public class OrganizationTypeDictionaryMapStore extends DictionaryTMapStore<OrganizationTypeDictionary> {
|
||||||
|
|
||||||
public OrganizationTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public OrganizationTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_OrganizationTypeDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "ORGANIZATION_TYPE_DICTIONARY";
|
return "ORGANIZATION_TYPE_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,21 @@ package ru.spcex.clearing.imdg.dictionary;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.platform.dictionary.WorkflowStatusDictionary;
|
import ru.clearing.platform.dictionary.WorkflowStatusDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class WorkflowStatusDictionaryMapStore extends DictionaryMapStore<WorkflowStatusDictionary> {
|
public class WorkflowStatusDictionaryMapStore extends DictionaryTMapStore<WorkflowStatusDictionary> {
|
||||||
|
|
||||||
public WorkflowStatusDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
public WorkflowStatusDictionaryMapStore(JdbcTemplate jdbcTemplate) {
|
||||||
super(jdbcTemplate);
|
super(jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMapName() {
|
||||||
|
return IMDGDistributedNames.Map_WorkflowStatusDictionary;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return "WORKFLOW_STATUS_DICTIONARY";
|
return "WORKFLOW_STATUS_DICTIONARY";
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ package ru.spcex.clearing.imdg.object;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.classes.statics.data.company.CompanyRoleSet;
|
import ru.clearing.classes.statics.data.company.CompanyRoleSet;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
@ -34,15 +34,15 @@ public class CompanyRoleSetMapStore extends TemplateMapStore<CompanyRoleSet> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{"id", "roleid", "companyid"};
|
return new String[]{"ID", "ROLE_ID", "COMPANY_ID"};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CompanyRoleSet objectReader(ResultSet resultSet) throws SQLException {
|
protected CompanyRoleSet objectReader(ResultSet resultSet) throws SQLException {
|
||||||
CompanyRoleSet companyRoleSet = new CompanyRoleSet();
|
CompanyRoleSet companyRoleSet = new CompanyRoleSet();
|
||||||
companyRoleSet.setId(resultSet.getObject("id", Long.class));
|
companyRoleSet.setId(resultSet.getObject("ID", Long.class));
|
||||||
companyRoleSet.setRoleId(resultSet.getObject("roleid", Long.class));
|
companyRoleSet.setRoleId(resultSet.getObject("ROLE_ID", Long.class));
|
||||||
companyRoleSet.setCompanyId(resultSet.getObject("companyid", Long.class));
|
companyRoleSet.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
|
||||||
return companyRoleSet;
|
return companyRoleSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ public class CompanySymbolsMapStore extends TemplateMapStore<CompanySymbols> {
|
||||||
protected CompanySymbols objectReader(ResultSet resultSet) throws SQLException {
|
protected CompanySymbols objectReader(ResultSet resultSet) throws SQLException {
|
||||||
CompanySymbols object = new CompanySymbols();
|
CompanySymbols object = new CompanySymbols();
|
||||||
object.setId(resultSet.getObject("id", Long.class));
|
object.setId(resultSet.getObject("id", Long.class));
|
||||||
object.setCompanyId(resultSet.getObject("companyid", Long.class));
|
object.setCompanyId(resultSet.getObject("company_id", Long.class));
|
||||||
object.setCompanySymbol(resultSet.getObject("companysymbol", String.class));
|
object.setCompanySymbol(resultSet.getObject("company_symbol", String.class));
|
||||||
object.setCompanySymbolValue(resultSet.getObject("companysymbolvalue", String.class));
|
object.setCompanySymbolValue(resultSet.getObject("company_symbol_value", String.class));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,20 +39,20 @@ public class InDocumentJournalMapStore extends TemplateMapStore<InDocumentJourna
|
||||||
public InDocumentJournal objectReader(ResultSet resultSet) throws SQLException {
|
public InDocumentJournal objectReader(ResultSet resultSet) throws SQLException {
|
||||||
InDocumentJournal object = new InDocumentJournal();
|
InDocumentJournal object = new InDocumentJournal();
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setRegistrationDate(getInstantFromTimestamp(resultSet, "REGISTRATION_DATE"));
|
object.setRegistrationDate(getLocalDateFromSqlDate(resultSet, "REGISTRATION_DATE"));
|
||||||
object.setRegistrationTime(getInstantFromTimestamp(resultSet, "REGISTRATION_TIME"));
|
object.setRegistrationTime(getLocalTimeFromSqlTime(resultSet, "REGISTRATION_TIME"));
|
||||||
object.setRegistrationNumber(resultSet.getObject("REGISTRATION_NUMBER", Long.class));
|
object.setRegistrationNumber(resultSet.getObject("REGISTRATION_NUMBER", Long.class));
|
||||||
object.setDocumentName(resultSet.getObject("DOCUMENT_NAME", String.class));
|
object.setDocumentName(resultSet.getObject("DOCUMENT_NAME", String.class));
|
||||||
object.setSender(resultSet.getObject("SENDER", String.class));
|
object.setSender(resultSet.getObject("SENDER", String.class));
|
||||||
object.setQuantity(resultSet.getObject("QUANTITY", Long.class));
|
object.setQuantity(resultSet.getObject("QUANTITY", Long.class));
|
||||||
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
|
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
|
||||||
object.setCourierType(resultSet.getObject("COURIER_TYPE", String.class));
|
object.setCourierType(resultSet.getObject("COURIER_TYPE", String.class));
|
||||||
object.setEmailDate(getInstantFromTimestamp(resultSet, "EMAIL_DATE"));
|
object.setEmailDate(getLocalDateFromSqlDate(resultSet, "EMAIL_DATE"));
|
||||||
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
|
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
|
||||||
object.setDossierNumber(resultSet.getObject("DOSSIER_NUMBER", String.class));
|
object.setDossierNumber(resultSet.getObject("DOSSIER_NUMBER", String.class));
|
||||||
object.setResultStatus(resultSet.getObject("RESULT_STATUS", String.class));
|
object.setResultStatus(resultSet.getObject("RESULT_STATUS", String.class));
|
||||||
object.setComment(resultSet.getObject("COMMENT", String.class));
|
object.setComment(resultSet.getObject("COMMENT", String.class));
|
||||||
object.setReceiptDate(getInstantFromTimestamp(resultSet, "RECEIPT_DATE"));
|
object.setReceiptDate(getLocalDateFromSqlDate(resultSet, "RECEIPT_DATE"));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,19 +60,19 @@ public class InDocumentJournalMapStore extends TemplateMapStore<InDocumentJourna
|
||||||
public Object[] objectToField(InDocumentJournal object) {
|
public Object[] objectToField(InDocumentJournal object) {
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
object.getId(),
|
object.getId(),
|
||||||
TimeUtil.toDateFromInstant(object.getRegistrationDate()),
|
TimeUtil.toDateFromLocalDate(object.getRegistrationDate()),
|
||||||
TimeUtil.toDateFromInstant(object.getRegistrationTime()),
|
TimeUtil.toDateFromLocalTime(object.getRegistrationTime()),
|
||||||
object.getRegistrationNumber(),
|
object.getRegistrationNumber(),
|
||||||
object.getDocumentName(),
|
object.getDocumentName(),
|
||||||
object.getSender(),
|
object.getSender(),
|
||||||
object.getQuantity(),
|
object.getQuantity(),
|
||||||
object.getClearingCode(),
|
object.getClearingCode(),
|
||||||
object.getCourierType(),
|
object.getCourierType(),
|
||||||
TimeUtil.toDateFromInstant(object.getEmailDate()),
|
TimeUtil.toDateFromLocalDate(object.getEmailDate()),
|
||||||
object.getAmount(),
|
object.getAmount(),
|
||||||
object.getDossierNumber(),
|
object.getDossierNumber(),
|
||||||
object.getComment(),
|
object.getComment(),
|
||||||
TimeUtil.toDateFromInstant(object.getReceiptDate()),
|
TimeUtil.toDateFromLocalDate(object.getReceiptDate()),
|
||||||
object.getResultStatus()
|
object.getResultStatus()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||||
import ru.spcex.platform.utils.time.TimeUtil;
|
import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
|
@ -41,9 +42,9 @@ public class KeyRateMapStore extends TemplateMapStore<KeyRate> {
|
||||||
protected KeyRate objectReader(ResultSet resultSet) throws SQLException {
|
protected KeyRate objectReader(ResultSet resultSet) throws SQLException {
|
||||||
KeyRate keyRate = new KeyRate();
|
KeyRate keyRate = new KeyRate();
|
||||||
keyRate.setId(resultSet.getObject("ID", Long.class));
|
keyRate.setId(resultSet.getObject("ID", Long.class));
|
||||||
keyRate.setRate(resultSet.getObject("RATE", Double.class));
|
keyRate.setRate(resultSet.getObject("RATE", BigDecimal.class));
|
||||||
keyRate.setStartDate(getInstantFromTimestamp(resultSet,"START_DATE"));
|
keyRate.setStartDate(getLocalDateFromSqlDate(resultSet, "START_DATE"));
|
||||||
keyRate.setEndDate(getInstantFromTimestamp(resultSet, "END_DATE"));
|
keyRate.setEndDate(getLocalDateFromSqlDate(resultSet, "END_DATE"));
|
||||||
keyRate.setDocument(resultSet.getObject("DOCUMENT", String.class));
|
keyRate.setDocument(resultSet.getObject("DOCUMENT", String.class));
|
||||||
keyRate.setWorkflowStatus(resultSet.getObject("WORKFLOW_STATUS", String.class));
|
keyRate.setWorkflowStatus(resultSet.getObject("WORKFLOW_STATUS", String.class));
|
||||||
return keyRate;
|
return keyRate;
|
||||||
|
|
@ -54,8 +55,8 @@ public class KeyRateMapStore extends TemplateMapStore<KeyRate> {
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
partnerList.getId(),
|
partnerList.getId(),
|
||||||
partnerList.getRate(),
|
partnerList.getRate(),
|
||||||
TimeUtil.toDateFromInstant(partnerList.getStartDate()),
|
TimeUtil.toDateFromLocalDate(partnerList.getStartDate()),
|
||||||
TimeUtil.toDateFromInstant(partnerList.getEndDate()),
|
TimeUtil.toDateFromLocalDate(partnerList.getEndDate()),
|
||||||
partnerList.getDocument(),
|
partnerList.getDocument(),
|
||||||
partnerList.getWorkflowStatus()
|
partnerList.getWorkflowStatus()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ public class MoneyMarketSecurityMapStore extends TemplateMapStore<MoneyMarketSec
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
||||||
object.setDescription(resultSet.getObject("DESCRIPTION", String.class));
|
object.setDescription(resultSet.getObject("DESCRIPTION", String.class));
|
||||||
object.setStartDate(getInstantFromTimestamp(resultSet, "START_DATE"));
|
object.setStartDate(getLocalDateFromSqlDate(resultSet, "START_DATE"));
|
||||||
object.setEndDate(getInstantFromTimestamp(resultSet, "END_DATE"));
|
object.setEndDate(getLocalDateFromSqlDate(resultSet, "END_DATE"));
|
||||||
object.setNominalValue(resultSet.getObject("NOMINAL_VALUE", BigDecimal.class));
|
object.setNominalValue(resultSet.getObject("NOMINAL_VALUE", BigDecimal.class));
|
||||||
object.setNominalCurrency(resultSet.getObject("NOMINAL_CURRENCY", Long.class));
|
object.setNominalCurrency(resultSet.getObject("NOMINAL_CURRENCY", Long.class));
|
||||||
object.setInstrumentType(resultSet.getObject("INSTRUMENT_TYPE", String.class));
|
object.setInstrumentType(resultSet.getObject("INSTRUMENT_TYPE", String.class));
|
||||||
|
|
@ -60,8 +60,8 @@ public class MoneyMarketSecurityMapStore extends TemplateMapStore<MoneyMarketSec
|
||||||
moneyMarketSecurity.getId(),
|
moneyMarketSecurity.getId(),
|
||||||
moneyMarketSecurity.getSecurityId(),
|
moneyMarketSecurity.getSecurityId(),
|
||||||
moneyMarketSecurity.getDescription(),
|
moneyMarketSecurity.getDescription(),
|
||||||
TimeUtil.toDateFromInstant(moneyMarketSecurity.getStartDate()),
|
TimeUtil.toDateFromLocalDate(moneyMarketSecurity.getStartDate()),
|
||||||
TimeUtil.toDateFromInstant(moneyMarketSecurity.getEndDate()),
|
TimeUtil.toDateFromLocalDate(moneyMarketSecurity.getEndDate()),
|
||||||
moneyMarketSecurity.getNominalValue(),
|
moneyMarketSecurity.getNominalValue(),
|
||||||
moneyMarketSecurity.getNominalCurrency(),
|
moneyMarketSecurity.getNominalCurrency(),
|
||||||
moneyMarketSecurity.getInstrumentType(),
|
moneyMarketSecurity.getInstrumentType(),
|
||||||
|
|
|
||||||
|
|
@ -39,19 +39,19 @@ public class OutDocumentJournalMapStore extends TemplateMapStore<OutDocumentJour
|
||||||
public OutDocumentJournal objectReader(ResultSet resultSet) throws SQLException {
|
public OutDocumentJournal objectReader(ResultSet resultSet) throws SQLException {
|
||||||
OutDocumentJournal object = new OutDocumentJournal();
|
OutDocumentJournal object = new OutDocumentJournal();
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setRegistrationDate(getInstantFromTimestamp(resultSet, "REGISTRATION_DATE"));
|
object.setRegistrationDate(getLocalDateFromSqlDate(resultSet, "REGISTRATION_DATE"));
|
||||||
object.setRegistrationTime(getInstantFromTimestamp(resultSet, "REGISTRATION_TIME"));
|
object.setRegistrationTime(getLocalTimeFromSqlTime(resultSet, "REGISTRATION_TIME"));
|
||||||
object.setRegistrationNumber(resultSet.getObject("REGISTRATION_NUMBER", Long.class));
|
object.setRegistrationNumber(resultSet.getObject("REGISTRATION_NUMBER", Long.class));
|
||||||
object.setDocumentName(resultSet.getObject("DOCUMENT_NAME", String.class));
|
object.setDocumentName(resultSet.getObject("DOCUMENT_NAME", String.class));
|
||||||
object.setAddressee(resultSet.getObject("ADDRESSEE", String.class));
|
object.setAddressee(resultSet.getObject("ADDRESSEE", String.class));
|
||||||
object.setQuantity(resultSet.getObject("QUANTITY", Long.class));
|
object.setQuantity(resultSet.getObject("QUANTITY", Long.class));
|
||||||
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
|
object.setClearingCode(resultSet.getObject("CLEARING_CODE", String.class));
|
||||||
object.setCourierType(resultSet.getObject("COURIER_TYPE", String.class));
|
object.setCourierType(resultSet.getObject("COURIER_TYPE", String.class));
|
||||||
object.setEmailDate(getInstantFromTimestamp(resultSet, "EMAIL_DATE"));
|
object.setEmailDate(getLocalDateFromSqlDate(resultSet, "EMAIL_DATE"));
|
||||||
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
|
object.setAmount(resultSet.getObject("AMOUNT", BigDecimal.class));
|
||||||
object.setDossierNumber(resultSet.getObject("DOSSIER_NUMBER", String.class));
|
object.setDossierNumber(resultSet.getObject("DOSSIER_NUMBER", String.class));
|
||||||
object.setResultStatus(resultSet.getObject("RESULT_STATUS", String.class));
|
object.setResultStatus(resultSet.getObject("RESULT_STATUS", String.class));
|
||||||
object.setPostDate(getInstantFromTimestamp(resultSet, "POST_DATE"));
|
object.setPostDate(getLocalDateFromSqlDate(resultSet, "POST_DATE"));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,18 +59,18 @@ public class OutDocumentJournalMapStore extends TemplateMapStore<OutDocumentJour
|
||||||
public Object[] objectToField(OutDocumentJournal object) {
|
public Object[] objectToField(OutDocumentJournal object) {
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
object.getId(),
|
object.getId(),
|
||||||
TimeUtil.toDateFromInstant(object.getRegistrationDate()),
|
TimeUtil.toDateFromLocalDate(object.getRegistrationDate()),
|
||||||
TimeUtil.toDateFromInstant(object.getRegistrationTime()),
|
TimeUtil.toDateFromLocalTime(object.getRegistrationTime()),
|
||||||
object.getRegistrationNumber(),
|
object.getRegistrationNumber(),
|
||||||
object.getDocumentName(),
|
object.getDocumentName(),
|
||||||
object.getAddressee(),
|
object.getAddressee(),
|
||||||
object.getQuantity(),
|
object.getQuantity(),
|
||||||
object.getClearingCode(),
|
object.getClearingCode(),
|
||||||
object.getCourierType(),
|
object.getCourierType(),
|
||||||
TimeUtil.toDateFromInstant(object.getEmailDate()),
|
TimeUtil.toDateFromLocalDate(object.getEmailDate()),
|
||||||
object.getAmount(),
|
object.getAmount(),
|
||||||
object.getDossierNumber(),
|
object.getDossierNumber(),
|
||||||
TimeUtil.toDateFromInstant(object.getPostDate()),
|
TimeUtil.toDateFromLocalDate(object.getPostDate()),
|
||||||
object.getResultStatus()
|
object.getResultStatus()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,15 @@ public class ProfileDocumentMapStore extends TemplateMapStore<ProfileDocument> {
|
||||||
object.setId(resultSet.getObject("id", Long.class));
|
object.setId(resultSet.getObject("id", Long.class));
|
||||||
object.setCompanyId(resultSet.getObject("company_id", Long.class));
|
object.setCompanyId(resultSet.getObject("company_id", Long.class));
|
||||||
object.setDocumentType(resultSet.getObject("document_type", String.class));
|
object.setDocumentType(resultSet.getObject("document_type", String.class));
|
||||||
object.setIssueDate(getInstantFromTimestamp(resultSet, "issue_date"));
|
object.setIssueDate(getLocalDateFromSqlDate(resultSet, "issue_date"));
|
||||||
object.setIssuePlace(resultSet.getObject("issue_place", String.class));
|
object.setIssuePlace(resultSet.getObject("issue_place", String.class));
|
||||||
object.setIssuer(resultSet.getObject("issuer", String.class));
|
object.setIssuer(resultSet.getObject("issuer", String.class));
|
||||||
object.setIssuerCode(resultSet.getObject("issuer_code", String.class));
|
object.setIssuerCode(resultSet.getObject("issuer_code", String.class));
|
||||||
object.setName(resultSet.getObject("name", String.class));
|
object.setName(resultSet.getObject("name", String.class));
|
||||||
object.setNumber(resultSet.getObject("number", String.class));
|
object.setNumber(resultSet.getObject("number", String.class));
|
||||||
object.setPlace(resultSet.getObject("place", String.class));
|
object.setPlace(resultSet.getObject("place", String.class));
|
||||||
object.setValidFromDate(getInstantFromTimestamp(resultSet, "valid_from_date"));
|
object.setValidFromDate(getLocalDateFromSqlDate(resultSet, "valid_from_date"));
|
||||||
object.setValidToDate(getInstantFromTimestamp(resultSet, "valid_to_date"));
|
object.setValidToDate(getLocalDateFromSqlDate(resultSet, "valid_to_date"));
|
||||||
object.setLink(resultSet.getObject("LINK", String.class));
|
object.setLink(resultSet.getObject("LINK", String.class));
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
@ -60,15 +60,15 @@ public class ProfileDocumentMapStore extends TemplateMapStore<ProfileDocument> {
|
||||||
resultSet.getId(),
|
resultSet.getId(),
|
||||||
resultSet.getCompanyId(),
|
resultSet.getCompanyId(),
|
||||||
resultSet.getDocumentType(),
|
resultSet.getDocumentType(),
|
||||||
TimeUtil.toDateFromInstant(resultSet.getIssueDate()),
|
TimeUtil.toDateFromLocalDate(resultSet.getIssueDate()),
|
||||||
resultSet.getIssuePlace(),
|
resultSet.getIssuePlace(),
|
||||||
resultSet.getIssuer(),
|
resultSet.getIssuer(),
|
||||||
resultSet.getIssuerCode(),
|
resultSet.getIssuerCode(),
|
||||||
resultSet.getName(),
|
resultSet.getName(),
|
||||||
resultSet.getNumber(),
|
resultSet.getNumber(),
|
||||||
resultSet.getPlace(),
|
resultSet.getPlace(),
|
||||||
TimeUtil.toDateFromInstant(resultSet.getValidFromDate()),
|
TimeUtil.toDateFromLocalDate(resultSet.getValidFromDate()),
|
||||||
TimeUtil.toDateFromInstant(resultSet.getValidToDate()),
|
TimeUtil.toDateFromLocalDate(resultSet.getValidToDate()),
|
||||||
resultSet.getLink()
|
resultSet.getLink()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf04;
|
import ru.clearing.classes.statics.data.sdf.SDf04;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||||
|
import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
@ -145,7 +146,7 @@ public class SDf04MapStore extends TemplateMapStore<SDf04> {
|
||||||
object.getDoc_result(),
|
object.getDoc_result(),
|
||||||
object.getImp_result(),
|
object.getImp_result(),
|
||||||
object.getFile_name(),
|
object.getFile_name(),
|
||||||
object.getGenerationTime(),
|
TimeUtil.toDateFromInstant(object.getGenerationTime()),
|
||||||
object.getGenerationId()
|
object.getGenerationId()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import org.springframework.stereotype.Component;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf09;
|
import ru.clearing.classes.statics.data.sdf.SDf09;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||||
|
import ru.spcex.platform.utils.time.TimeUtil;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
|
@ -41,6 +42,7 @@ public class SDf09MapStore extends TemplateMapStore<SDf09> {
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setAccount(resultSet.getString("ACCOUNT"));
|
object.setAccount(resultSet.getString("ACCOUNT"));
|
||||||
object.setSum(resultSet.getObject("SUM", BigDecimal.class));
|
object.setSum(resultSet.getObject("SUM", BigDecimal.class));
|
||||||
|
object.setMarket(resultSet.getString("MARKET"));
|
||||||
object.setType(resultSet.getString("TYPE"));
|
object.setType(resultSet.getString("TYPE"));
|
||||||
object.setNumber(resultSet.getObject("NUMBER", BigDecimal.class));
|
object.setNumber(resultSet.getObject("NUMBER", BigDecimal.class));
|
||||||
object.setInn(resultSet.getObject("_I_N_N", BigDecimal.class));
|
object.setInn(resultSet.getObject("_I_N_N", BigDecimal.class));
|
||||||
|
|
@ -56,11 +58,12 @@ public class SDf09MapStore extends TemplateMapStore<SDf09> {
|
||||||
object.getId(),
|
object.getId(),
|
||||||
object.getAccount(),
|
object.getAccount(),
|
||||||
object.getSum(),
|
object.getSum(),
|
||||||
|
object.getMarket(),
|
||||||
object.getType(),
|
object.getType(),
|
||||||
object.getNumber(),
|
object.getNumber(),
|
||||||
object.getInn(),
|
object.getInn(),
|
||||||
object.getFileName(),
|
object.getFileName(),
|
||||||
object.getGenerationTime(),
|
TimeUtil.toDateFromInstant(object.getGenerationTime()),
|
||||||
object.getGenerationId()
|
object.getGenerationId()
|
||||||
};
|
};
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ public class SDf10MapStore extends TemplateMapStore<SDf10> {
|
||||||
SDf10 object = new SDf10();
|
SDf10 object = new SDf10();
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
||||||
|
object.setSum(resultSet.getObject("SUM", BigDecimal.class));
|
||||||
object.setMarket(resultSet.getObject("MARKET", String.class));
|
object.setMarket(resultSet.getObject("MARKET", String.class));
|
||||||
object.setType(resultSet.getObject("TYPE", String.class));
|
object.setType(resultSet.getObject("TYPE", String.class));
|
||||||
object.setNumber(resultSet.getObject("NUMBER", BigDecimal.class));
|
object.setNumber(resultSet.getObject("NUMBER", BigDecimal.class));
|
||||||
|
|
@ -57,6 +58,7 @@ public class SDf10MapStore extends TemplateMapStore<SDf10> {
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
object.getId(),
|
object.getId(),
|
||||||
object.getAccount(),
|
object.getAccount(),
|
||||||
|
object.getSum(),
|
||||||
object.getMarket(),
|
object.getMarket(),
|
||||||
object.getType(),
|
object.getType(),
|
||||||
object.getNumber(),
|
object.getNumber(),
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class SchedulerAllTodayMapStore extends TemplateMapStore<SchedulerAllToda
|
||||||
@Override
|
@Override
|
||||||
public String[] getFields() {
|
public String[] getFields() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
"ID", "TASK", "TASK_TIME", "CLEARING_DATE", "MARKET", "TASK_STATUS", "SECURITY_ID", "SOURCE", "ORIG_ID"
|
"ID", "TASK", "TASK_TIME", "CLEARING_DATE", "MARKET", "TASK_STATUS", "SECURITY_ID", "SOURCE", "ORIG_ID"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,8 +39,8 @@ public class SchedulerAllTodayMapStore extends TemplateMapStore<SchedulerAllToda
|
||||||
SchedulerAllToday object = new SchedulerAllToday();
|
SchedulerAllToday object = new SchedulerAllToday();
|
||||||
object.setId(resultSet.getObject("ID", Long.class));
|
object.setId(resultSet.getObject("ID", Long.class));
|
||||||
object.setTask(resultSet.getObject("TASK", String.class));
|
object.setTask(resultSet.getObject("TASK", String.class));
|
||||||
object.setTaskTime(getInstantFromTimestamp(resultSet, "TASK_TIME"));
|
object.setTaskTime(getLocalTimeFromSqlTime(resultSet, "TASK_TIME"));
|
||||||
object.setClearingDate(getInstantFromTimestamp(resultSet, "CLEARING_DATE"));
|
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||||
object.setMarket(resultSet.getObject("MARKET", String.class));
|
object.setMarket(resultSet.getObject("MARKET", String.class));
|
||||||
object.setTaskStatus(resultSet.getObject("TASK_STATUS", String.class));
|
object.setTaskStatus(resultSet.getObject("TASK_STATUS", String.class));
|
||||||
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
||||||
|
|
@ -54,8 +54,8 @@ public class SchedulerAllTodayMapStore extends TemplateMapStore<SchedulerAllToda
|
||||||
Object[] args = new Object[]{
|
Object[] args = new Object[]{
|
||||||
object.getId(),
|
object.getId(),
|
||||||
object.getTask(),
|
object.getTask(),
|
||||||
TimeUtil.toDateFromInstant(object.getTaskTime()),
|
TimeUtil.toDateFromLocalTime(object.getTaskTime()),
|
||||||
TimeUtil.toDateFromInstant(object.getClearingDate()),
|
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||||
object.getMarket(),
|
object.getMarket(),
|
||||||
object.getTaskStatus(),
|
object.getTaskStatus(),
|
||||||
object.getSecurityId(),
|
object.getSecurityId(),
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,17 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.clearing.classes.statics.data.account.*;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.classes.statics.data.company.CompanyHistory;
|
import ru.clearing.classes.statics.data.company.CompanyHistory;
|
||||||
|
import ru.clearing.classes.statics.data.company.relation.Relation;
|
||||||
|
import ru.clearing.classes.statics.data.company.relation.RelationHistory;
|
||||||
|
import ru.clearing.classes.statics.data.security.Security;
|
||||||
|
import ru.clearing.classes.statics.data.security.SecurityHistory;
|
||||||
|
import ru.clearing.classes.statics.data.user.User;
|
||||||
|
import ru.clearing.classes.statics.data.user.UserConnect;
|
||||||
|
import ru.clearing.classes.statics.data.user.UserConnectHistory;
|
||||||
|
import ru.clearing.classes.statics.data.user.UserHistory;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -22,18 +31,72 @@ public class UpdateMapService extends AbstractUpdateMapService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addingListenersToCards() {
|
public void addingListenersToCards() {
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountBalance).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Account).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountRouting).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_BankAccount).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Company).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Company).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_InformationAccount).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Relation).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Security).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserConnect).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_User).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void entryModified(EntryEvent<Long, Object> event, String eventType) {
|
protected void entryModified(EntryEvent<Long, Object> event, String eventType) {
|
||||||
log.debug("{} {}", event, eventType);
|
log.debug("{} {}", event, eventType);
|
||||||
Object value = (EVENT_DELETE.equals(eventType) ? event.getOldValue() : event.getValue());
|
Object value = (EVENT_DELETE.equals(eventType) ? event.getOldValue() : event.getValue());
|
||||||
if (value instanceof Company) {
|
if (value instanceof AccountBalance) {
|
||||||
|
AccountBalanceHistory accountBalanceHistory = new AccountBalanceHistory();
|
||||||
|
createBusinessEvent(accountBalanceHistory, eventType);
|
||||||
|
accountBalanceHistory.setObject((AccountBalance) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountBalanceHistory).put(accountBalanceHistory.getId(), accountBalanceHistory);
|
||||||
|
} else if (value instanceof Account) {
|
||||||
|
AccountHistory accountHistory = new AccountHistory();
|
||||||
|
createBusinessEvent(accountHistory, eventType);
|
||||||
|
accountHistory.setObject((Account) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountHistory).put(accountHistory.getId(), accountHistory);
|
||||||
|
} else if (value instanceof AccountRouting) {
|
||||||
|
AccountRoutingHistory accountRoutingHistory = new AccountRoutingHistory();
|
||||||
|
createBusinessEvent(accountRoutingHistory, eventType);
|
||||||
|
accountRoutingHistory.setObject((AccountRouting) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountRoutingHistory).put(accountRoutingHistory.getId(), accountRoutingHistory);
|
||||||
|
} else if (value instanceof BankAccount) {
|
||||||
|
BankAccountHistory bankAccountHistory = new BankAccountHistory();
|
||||||
|
createBusinessEvent(bankAccountHistory, eventType);
|
||||||
|
bankAccountHistory.setObject((BankAccount) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_BankAccountHistory).put(bankAccountHistory.getId(), bankAccountHistory);
|
||||||
|
} else if (value instanceof Company) {
|
||||||
CompanyHistory companyHistory = new CompanyHistory();
|
CompanyHistory companyHistory = new CompanyHistory();
|
||||||
createBusinessEvent(companyHistory, eventType);
|
createBusinessEvent(companyHistory, eventType);
|
||||||
companyHistory.setObject((Company) value);
|
companyHistory.setObject((Company) value);
|
||||||
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_CompanyHistory).put(companyHistory.getId(), companyHistory);
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_CompanyHistory).put(companyHistory.getId(), companyHistory);
|
||||||
|
} else if (value instanceof InformationAccount) {
|
||||||
|
InformationAccountHistory informationAccountHistory = new InformationAccountHistory();
|
||||||
|
createBusinessEvent(informationAccountHistory, eventType);
|
||||||
|
informationAccountHistory.setObject((InformationAccount) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_InformationAccountHistory).put(informationAccountHistory.getId(), informationAccountHistory);
|
||||||
|
} else if (value instanceof Relation) {
|
||||||
|
RelationHistory relationHistory = new RelationHistory();
|
||||||
|
createBusinessEvent(relationHistory, eventType);
|
||||||
|
relationHistory.setObject((Relation) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_RelationHistory).put(relationHistory.getId(), relationHistory);
|
||||||
|
} else if (value instanceof Security) {
|
||||||
|
SecurityHistory securityHistory = new SecurityHistory();
|
||||||
|
createBusinessEvent(securityHistory, eventType);
|
||||||
|
securityHistory.setObject((Security) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_SecurityHistory).put(securityHistory.getId(), securityHistory);
|
||||||
|
} else if (value instanceof UserConnect) {
|
||||||
|
UserConnectHistory userConnectHistory = new UserConnectHistory();
|
||||||
|
createBusinessEvent(userConnectHistory, eventType);
|
||||||
|
userConnectHistory.setObject((UserConnect) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserConnectHistory).put(userConnectHistory.getId(), userConnectHistory);
|
||||||
|
} else if (value instanceof User) {
|
||||||
|
UserHistory userHistory = new UserHistory();
|
||||||
|
createBusinessEvent(userHistory, eventType);
|
||||||
|
userHistory.setObject((User) value);
|
||||||
|
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserHistory).put(userHistory.getId(), userHistory);
|
||||||
} else {
|
} else {
|
||||||
log.error("unexpected event {}", event);
|
log.error("unexpected event {}", event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ imdg.hazelcast.listenPort=5701
|
||||||
imdg.hazelcast.login=dev
|
imdg.hazelcast.login=dev
|
||||||
imdg.hazelcast.password=dev-pass
|
imdg.hazelcast.password=dev-pass
|
||||||
imdg.hazelcast.cluster-members[0]=127.0.0.1
|
imdg.hazelcast.cluster-members[0]=127.0.0.1
|
||||||
|
|
||||||
imdg.database.login=clearing
|
imdg.database.login=clearing
|
||||||
imdg.database.password=Aa111111
|
imdg.database.password=Aa111111
|
||||||
imdg.database.url=jdbc:postgresql://10.200.200.133:5432/postgres
|
imdg.database.url=jdbc:postgresql://10.200.200.133:5432/postgres
|
||||||
|
|
@ -0,0 +1,322 @@
|
||||||
|
package ru.spcex.clearing.imdg;
|
||||||
|
|
||||||
|
import com.hazelcast.config.MapStoreConfig;
|
||||||
|
import com.hazelcast.core.HazelcastInstance;
|
||||||
|
import com.hazelcast.core.IMap;
|
||||||
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Assumptions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.support.DataAccessUtils;
|
||||||
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.jdbc.core.SqlTypeValue;
|
||||||
|
import org.springframework.jdbc.core.StatementCreatorUtils;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.TestPropertySource;
|
||||||
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
|
import ru.clearing.classes.statics.data.company.CompanyHistory;
|
||||||
|
import ru.clearing.classes.statics.data.profile.CompanyInfo;
|
||||||
|
import ru.clearing.platform.dictionary.AbstractDictionary;
|
||||||
|
import ru.clearing.platform.dictionary.CompanySymbolDictionary;
|
||||||
|
import ru.spcex.clearing.imdg.base.*;
|
||||||
|
import ru.spcex.clearing.imdg.config.DbTestConnectionConfig;
|
||||||
|
import ru.spcex.clearing.imdg.config.TestConfiguration;
|
||||||
|
import ru.spcex.clearing.imdg.structure.BusinessObjectAndBusinessEventForCheckMapStore;
|
||||||
|
import ru.spcex.clearing.imdg.structure.DictionaryObjectForCheckMapStore;
|
||||||
|
import ru.spcex.clearing.imdg.utils.BusinessEventRowMapper;
|
||||||
|
import ru.spcex.clearing.imdg.utils.DbDataUtils;
|
||||||
|
import ru.spcex.clearing.imdg.utils.SpcexObjectBaseRowMapper;
|
||||||
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
import ru.spcex.platform.utils.text.TextUtil;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static ru.spcex.clearing.imdg.structure.RunnableMapNamesForTesting.businessObjectAndBusinessEventForCheckMapStores;
|
||||||
|
import static ru.spcex.clearing.imdg.structure.RunnableMapNamesForTesting.dictionaryObjectForCheckMapStores;
|
||||||
|
import static ru.spcex.clearing.imdg.utils.DbDataUtils.generatingRandomString;
|
||||||
|
|
||||||
|
@ContextConfiguration(classes = {
|
||||||
|
TestConfiguration.class,
|
||||||
|
DbTestConnectionConfig.class})
|
||||||
|
@ExtendWith(SpringExtension.class)
|
||||||
|
@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/imdg/src/main/resources")
|
||||||
|
public class AllMapStoreTest {
|
||||||
|
private static final Long ID = 1000000L;
|
||||||
|
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||||
|
@Autowired
|
||||||
|
TestConfiguration testConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initTestObjects() {
|
||||||
|
try {
|
||||||
|
for (BusinessObjectAndBusinessEventForCheckMapStore<SpcexObjectBase> objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
|
SpcexObjectBase object = objectForCheck.getClazz().getDeclaredConstructor().newInstance();
|
||||||
|
DbDataUtils.fillObjectDefaultValues(object, object.getClass());
|
||||||
|
if (objectForCheck.getClazz().equals(CompanyHistory.class)) {
|
||||||
|
CompanyHistory companyHistory = (CompanyHistory) object;
|
||||||
|
CompanyInfo companyInfo = companyHistory.getObject().getProfile();
|
||||||
|
companyInfo.setCompanyId(companyHistory.getObject().getId());
|
||||||
|
companyInfo.setId(1000000L);
|
||||||
|
objectForCheck.setPredictableObj(companyHistory);
|
||||||
|
} else if (objectForCheck.getClazz().equals(Company.class)) {
|
||||||
|
Company company = (Company) object;
|
||||||
|
CompanyInfo companyInfo = company.getProfile();
|
||||||
|
companyInfo.setCompanyId(1000000L);
|
||||||
|
companyInfo.setId(1000000L);
|
||||||
|
objectForCheck.setPredictableObj(company);
|
||||||
|
} else if (objectForCheck.getMapName().startsWith("Map_SDf")) {
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setMarket", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setFile_type", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setSeg_type", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setPriority", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setPr", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setType", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setOp_order", 1);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setSp_code", 2);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setDoc_result", 2);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setAcc_type", 2);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setOp_type", 2);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setDoc_result", 2);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setResult", 3);
|
||||||
|
trySettingString(object, objectForCheck.getClazz(), "setImp_result", 3);
|
||||||
|
objectForCheck.setPredictableObj(object);
|
||||||
|
} else {
|
||||||
|
objectForCheck.setPredictableObj(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (DictionaryObjectForCheckMapStore<AbstractDictionary> objectForCheck : dictionaryObjectForCheckMapStores) {
|
||||||
|
AbstractDictionary object = objectForCheck.getClazz().getDeclaredConstructor().newInstance();
|
||||||
|
DbDataUtils.fillObjectDefaultValues(object, object.getClass());
|
||||||
|
objectForCheck.setPredictableObj(object);
|
||||||
|
}
|
||||||
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
} catch (InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void checkAllMapStoreCreatedTest() throws SQLException {
|
||||||
|
Assumptions.assumeTrue(false, "todo удалить если будет не нужна, пока не работает из-за не все mapStore готовы");
|
||||||
|
//Поиск таблиц которым нужно добавить mapStore и вывод результата в консоль
|
||||||
|
List<String> nameTables = new ArrayList<>();
|
||||||
|
Connection jdbcConnection = DriverManager.getConnection("jdbc:postgresql://10.200.200.133:5432/postgres", "clearing", "Aa111111");
|
||||||
|
DatabaseMetaData md = jdbcConnection.getMetaData();
|
||||||
|
ResultSet rs = md.getTables(null, "clearing_tester", "%", new String[]{"TABLE"});
|
||||||
|
while (rs.next()) {
|
||||||
|
String tableName = rs.getString("TABLE_NAME");
|
||||||
|
//сущности для company_info и company_info_history включены соответсвенно в company и company_history
|
||||||
|
if (tableName.equals("company_info") || tableName.equals("company_info_history")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
nameTables.add(tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
HazelcastInstance hazelcastInstance = testConfig.getHazelcastInstance();
|
||||||
|
hazelcastInstance.getMap("");
|
||||||
|
for (String mapName : hazelcastInstance.getConfig().getMapConfigs().keySet()) {
|
||||||
|
Object mapStore = getMapStore(mapName);
|
||||||
|
String tableName;
|
||||||
|
if (mapStore instanceof TemplateMapStore) {
|
||||||
|
tableName = ((TemplateMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof DictionaryMapStore) {
|
||||||
|
tableName = ((DictionaryMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof TemplateEventMapStore) {
|
||||||
|
tableName = ((TemplateEventMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof BusinessObjectMapStore) {
|
||||||
|
tableName = ((BusinessObjectMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof BusinessEventMapStore) {
|
||||||
|
tableName = ((BusinessEventMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapName.equals("default")) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
System.out.println(mapStore == null ? "Не получилось сопоставить mapStore: is null" : "Не получилось сопоставить: " + mapStore.getClass() + " с таблицей");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
nameTables.remove(tableName.toLowerCase());
|
||||||
|
}
|
||||||
|
System.out.println("** Результат поиска таблиц которым нужно добавить mapStore **");
|
||||||
|
nameTables.forEach(System.out::println);
|
||||||
|
System.out.println("*************************************************************");
|
||||||
|
Assertions.assertEquals(0, nameTables.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void checkSavingForAllMapStoreTest() {
|
||||||
|
saveBusinessObjectAndBusinessEventToMaps();
|
||||||
|
saveDictionaryObjectToMaps();
|
||||||
|
testConfig.shutDownHazelcast();
|
||||||
|
testConfig.reinitHazlecastInstance();
|
||||||
|
|
||||||
|
for (BusinessObjectAndBusinessEventForCheckMapStore objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
|
String mapName = objectForCheck.getMapName();
|
||||||
|
SpcexObjectBase actual;
|
||||||
|
if (getMapStore(mapName) instanceof TemplateEventMapStore) {
|
||||||
|
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
|
||||||
|
List<SpcexObjectBase> obj = jdbcTemplate.query(sql, new BusinessEventRowMapper<>(objectForCheck.getClazz()));
|
||||||
|
actual = DataAccessUtils.singleResult(obj);
|
||||||
|
} else if (getMapStore(mapName) instanceof BusinessEventMapStore) {
|
||||||
|
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
|
||||||
|
List<CompanyHistory> objCompanyHistory = jdbcTemplate.query(sql, new BusinessEventRowMapper<>(objectForCheck.getClazz()));
|
||||||
|
CompanyHistory companyHistory = DataAccessUtils.singleResult(objCompanyHistory);
|
||||||
|
String sqlI = String.format("SELECT * FROM %s WHERE id = %d", "COMPANY_INFO_HISTORY", ID);
|
||||||
|
List<CompanyInfo> objCompanyInfo = jdbcTemplate.query(sqlI, new SpcexObjectBaseRowMapper<>(CompanyInfo.class));
|
||||||
|
CompanyInfo companyInfo = DataAccessUtils.singleResult(objCompanyInfo);
|
||||||
|
companyHistory.getObject().setProfile(companyInfo);
|
||||||
|
actual = companyHistory;
|
||||||
|
} else {
|
||||||
|
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(mapName);
|
||||||
|
actual = map.get(ID);
|
||||||
|
}
|
||||||
|
objectForCheck.getMATCHER().assertMatch(actual, objectForCheck.getPredictableObj());
|
||||||
|
}
|
||||||
|
for (DictionaryObjectForCheckMapStore objectForCheck : dictionaryObjectForCheckMapStores) {
|
||||||
|
String mapName = objectForCheck.getMapName();
|
||||||
|
AbstractDictionary actual;
|
||||||
|
IMap<Long, AbstractDictionary> map = testConfig.getHazelcastInstance().getMap(mapName);
|
||||||
|
actual = map.get(ID);
|
||||||
|
objectForCheck.getMATCHER().assertMatch(actual, objectForCheck.getPredictableObj());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//todo удалить если будет не нужна, пока не работает из-за "deleteIsSupported() return false" в SimpleObjectMapStore.
|
||||||
|
@Test
|
||||||
|
public void checkDeletingForAllMapStoreTest() {
|
||||||
|
Assumptions.assumeTrue(false, "todo удалить если будет не нужна, пока не работает из-за \"deleteIsSupported() return false\" в SimpleObjectMapStore.");
|
||||||
|
saveBusinessObjectAndBusinessEventToMaps();
|
||||||
|
|
||||||
|
for (BusinessObjectAndBusinessEventForCheckMapStore objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
|
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(objectForCheck.getMapName());
|
||||||
|
map.remove(ID);
|
||||||
|
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
|
||||||
|
List<SpcexObjectBase> obj = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(objectForCheck.getClazz()));
|
||||||
|
|
||||||
|
Assertions.assertNull(map.get(ID));
|
||||||
|
Assertions.assertEquals(0, obj.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTableNameFromMapStore(String mapName) {
|
||||||
|
MapStoreConfig mapStoreConfig = testConfig.getHazelcastInstance().getConfig().getMapConfig(mapName).getMapStoreConfig();
|
||||||
|
Object mapStore = mapStoreConfig.getImplementation();
|
||||||
|
String tableName = null;
|
||||||
|
if (mapStore instanceof TemplateMapStore) {
|
||||||
|
tableName = ((TemplateMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof DictionaryMapStore) {
|
||||||
|
tableName = ((DictionaryMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof TemplateEventMapStore) {
|
||||||
|
tableName = ((TemplateEventMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof BusinessObjectMapStore) {
|
||||||
|
tableName = ((BusinessObjectMapStore<?>) mapStore).getTableName();
|
||||||
|
} else if (mapStore instanceof BusinessEventMapStore) {
|
||||||
|
tableName = ((BusinessEventMapStore<?>) mapStore).getTableName();
|
||||||
|
}
|
||||||
|
return tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object getMapStore(String mapName) {
|
||||||
|
MapStoreConfig mapStoreConfig = testConfig.getHazelcastInstance().getConfig().getMapConfig(mapName).getMapStoreConfig();
|
||||||
|
return mapStoreConfig.getImplementation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveBusinessObjectAndBusinessEventToMaps() {
|
||||||
|
for (BusinessObjectAndBusinessEventForCheckMapStore objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
|
String mapName = objectForCheck.getMapName();
|
||||||
|
SpcexObjectBase spcexObjectBase = objectForCheck.getPredictableObj();
|
||||||
|
spcexObjectBase.setId(ID);
|
||||||
|
log.info("Запись в мап {} объекта {}", mapName, spcexObjectBase);
|
||||||
|
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(mapName);
|
||||||
|
map.put(spcexObjectBase.getId(), spcexObjectBase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveDictionaryObjectToMaps() {
|
||||||
|
for (DictionaryObjectForCheckMapStore objectForCheck : dictionaryObjectForCheckMapStores) {
|
||||||
|
String mapName = objectForCheck.getMapName();
|
||||||
|
AbstractDictionary dictionaryObj = objectForCheck.getPredictableObj();
|
||||||
|
dictionaryObj.setId(ID);
|
||||||
|
log.info("Запись в мап {} объекта {}", mapName, dictionaryObj);
|
||||||
|
Object mapStore = getMapStore(mapName);
|
||||||
|
String[] fields;
|
||||||
|
Object[] args;
|
||||||
|
if (mapName.equals(IMDGDistributedNames.Map_CompanySymbolDictionary)) {
|
||||||
|
CompanySymbolDictionary companySymbolDictionary = (CompanySymbolDictionary) dictionaryObj;
|
||||||
|
fields = new String[]{"ID", "CODE", "NAME", "SHORTNAME"};
|
||||||
|
args = new Object[]{companySymbolDictionary.getId(), companySymbolDictionary.getCode(), companySymbolDictionary.getName(), companySymbolDictionary.getShortname()};
|
||||||
|
} else {
|
||||||
|
fields = new String[]{"ID", "CODE", "NAME"};
|
||||||
|
args = new Object[]{dictionaryObj.getId(), dictionaryObj.getCode(), dictionaryObj.getName()};
|
||||||
|
}
|
||||||
|
makeInsertSql(((DictionaryTMapStore<?>) mapStore).getTableName(), fields, args, "id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void trySettingString(SpcexObjectBase object, Class clazz, String methodName, int lenght) {
|
||||||
|
try {
|
||||||
|
Method method = clazz.getDeclaredMethod(methodName, String.class);
|
||||||
|
method.invoke(object, generatingRandomString(lenght));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void makeInsertSql(String tableName, String[] fields, Object[] args, String matchingKey) {
|
||||||
|
String INSERT_TEMPLATE = "INSERT INTO ${tableName} (${columnsEnumeration}) VALUES (${valuesEnumeration}) ON CONFLICT (${matchingKey}) DO UPDATE SET ${excludedColumns}";
|
||||||
|
|
||||||
|
String columnsEnumeration = Arrays.stream(fields).map(f -> "" + f.toUpperCase() + "").collect(Collectors.joining(", "));
|
||||||
|
String valuesEnumeration = String.join(", ", Collections.nCopies(fields.length, "?"));
|
||||||
|
String excludedColumns = Arrays.stream(fields).filter(f -> !matchingKey.equalsIgnoreCase(f)).
|
||||||
|
map(f -> "" + f.toUpperCase() + "=EXCLUDED." + f.toUpperCase() + "").collect(Collectors.joining(", "));
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("tableName", tableName);
|
||||||
|
params.put("columnsEnumeration", columnsEnumeration);
|
||||||
|
params.put("valuesEnumeration", valuesEnumeration);
|
||||||
|
params.put("matchingKey", matchingKey.toUpperCase());
|
||||||
|
params.put("excludedColumns", excludedColumns);
|
||||||
|
|
||||||
|
String insertStatement = TextUtil.format(INSERT_TEMPLATE, params);
|
||||||
|
|
||||||
|
List<Object[]> batchArgs = new ArrayList<>();
|
||||||
|
if (args.length != args.length) {
|
||||||
|
throw new IllegalArgumentException("objectToField return " + args.length + " arguments, but expected " + args.length);
|
||||||
|
}
|
||||||
|
batchArgs.add(args);
|
||||||
|
batchInsertUpdate(insertStatement, batchArgs, tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void batchInsertUpdate(@NonNull String insertStatement, @NonNull List<Object[]> args, String tableName) {
|
||||||
|
try {
|
||||||
|
int[][] ret = jdbcTemplate.batchUpdate(insertStatement, args, 1000, (ps, params) -> {
|
||||||
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
Object value = params[i];
|
||||||
|
try {
|
||||||
|
StatementCreatorUtils.setParameterValue(ps, i + 1, SqlTypeValue.TYPE_UNKNOWN, value);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new SQLException("batchInsertUpdate, at prepare argument " + i + " value = " + value + "; SQL=" + insertStatement, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int batchSize = ret.length > 0 ? ret[0].length : ret.length;
|
||||||
|
log.debug("{} {} rows stored", tableName, batchSize);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SQL error at batch UPDATE OR INSERT INTO {}\n{}", tableName, ExceptionUtils.getStackTrace(e));
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package ru.spcex.clearing.imdg.config;
|
||||||
|
|
||||||
|
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.jdbc.datasource.init.DatabasePopulator;
|
||||||
|
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||||
|
import ru.spcex.clearing.imdg.error.ModuleInitializeException;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
|
@Configuration
|
||||||
|
public class DbTestConnectionConfig {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
private DatabasePopulator createDatabasePopulator() {
|
||||||
|
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
|
||||||
|
databasePopulator.setContinueOnError(true);
|
||||||
|
databasePopulator.addScript(new ClassPathResource("/ddl.sql"));
|
||||||
|
return databasePopulator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DataSource dataSource() {
|
||||||
|
DataSource result;
|
||||||
|
String login = "clearing";
|
||||||
|
String password = "Aa111111";
|
||||||
|
String logTimeoutPart = "";
|
||||||
|
String dbPath = "jdbc:postgresql://10.200.200.133:5432/postgres?currentSchema=clearing_tester";
|
||||||
|
int timeoutSec = 30;
|
||||||
|
|
||||||
|
ComboPooledDataSource cpds = new ComboPooledDataSource();
|
||||||
|
try {
|
||||||
|
cpds.setDriverClass("org.postgresql.Driver");
|
||||||
|
} catch (Exception ue) {
|
||||||
|
throw new RuntimeException(ue);
|
||||||
|
}
|
||||||
|
cpds.setJdbcUrl(dbPath);
|
||||||
|
cpds.setUser(login);
|
||||||
|
cpds.setPassword(password);
|
||||||
|
cpds.setInitialPoolSize(10);
|
||||||
|
cpds.setMinPoolSize(01);
|
||||||
|
cpds.setMaxPoolSize(30);
|
||||||
|
int numHelperThreads = Runtime.getRuntime().availableProcessors() * 2;
|
||||||
|
cpds.setNumHelperThreads(numHelperThreads);
|
||||||
|
cpds.setCheckoutTimeout(timeoutSec * 1000);
|
||||||
|
logTimeoutPart = String.format(" (timeout=%ds)", timeoutSec);
|
||||||
|
// DatabasePopulatorUtils.execute(createDatabasePopulator(), cpds);
|
||||||
|
result = cpds;
|
||||||
|
|
||||||
|
String OPERATION_DATABASE_CONNECTION_CHECK = String.format("Database [%s] connection check", dbPath);
|
||||||
|
try {
|
||||||
|
Connection conn = result.getConnection();
|
||||||
|
conn.close();
|
||||||
|
log.info("{}: success", OPERATION_DATABASE_CONNECTION_CHECK);
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
String msg = String.format("%s%s: failed: %s -> %s",
|
||||||
|
OPERATION_DATABASE_CONNECTION_CHECK, logTimeoutPart, e.getClass().getSimpleName(), e.getMessage());
|
||||||
|
log.error(msg);
|
||||||
|
throw new ModuleInitializeException(msg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||||
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
|
return jdbcTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package ru.spcex.clearing.imdg.config;
|
||||||
|
|
||||||
|
import com.hazelcast.config.Config;
|
||||||
|
import com.hazelcast.core.Hazelcast;
|
||||||
|
import com.hazelcast.core.HazelcastInstance;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Import({HazelcastConfiguration.class, PoolMapConfigs.class})
|
||||||
|
@ComponentScan(basePackages = {"ru.spcex.clearing.imdg"})
|
||||||
|
public class TestConfiguration {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||||
|
@Autowired
|
||||||
|
private HazelcastInstance hazelcastInstance;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Config hazelcastConfig;
|
||||||
|
|
||||||
|
public void shutDownHazelcast() {
|
||||||
|
if (hazelcastInstance != null) {
|
||||||
|
hazelcastInstance.getLifecycleService().shutdown();
|
||||||
|
|
||||||
|
while (hazelcastInstance.getLifecycleService().isRunning()) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
log.info("Waiting to complete hazelCast");
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.warn("Test at ShutDownHazelcast(): thread interrupted {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hazelcastInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reinitHazlecastInstance() {
|
||||||
|
hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(hazelcastConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Config getHazelcastConfig() {
|
||||||
|
return hazelcastConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HazelcastInstance getHazelcastInstance() {
|
||||||
|
return hazelcastInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package ru.spcex.clearing.imdg.structure;
|
||||||
|
|
||||||
|
|
||||||
|
import ru.spcex.clearing.imdg.utils.MatcherFactory.Matcher;
|
||||||
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||||
|
|
||||||
|
public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
|
||||||
|
|
||||||
|
public final Matcher<T> MATCHER = usingIgnoringFieldsComparator();
|
||||||
|
private final String mapName;
|
||||||
|
private final Class<T> clazz;
|
||||||
|
private SettingOperation settingOperation;
|
||||||
|
|
||||||
|
private SpcexObjectBase predictableObj;
|
||||||
|
|
||||||
|
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz) {
|
||||||
|
this.mapName = mapName;
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, SettingOperation settingOperation) {
|
||||||
|
this.mapName = mapName;
|
||||||
|
this.clazz = clazz;
|
||||||
|
this.settingOperation = settingOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMapName() {
|
||||||
|
return mapName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<T> getClazz() {
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matcher<T> getMATCHER() {
|
||||||
|
return MATCHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpcexObjectBase getPredictableObj() {
|
||||||
|
return predictableObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPredictableObj(SpcexObjectBase predictableObj) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||||
|
if (settingOperation != null) {
|
||||||
|
Method method = clazz.getDeclaredMethod(settingOperation.getMethodName(), settingOperation.getParameterTypes());
|
||||||
|
method.invoke(predictableObj, settingOperation.getParams());
|
||||||
|
}
|
||||||
|
this.predictableObj = predictableObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SettingOperation {
|
||||||
|
private final String methodName;
|
||||||
|
private final Class[] parameterTypes;
|
||||||
|
private final Object[] params;
|
||||||
|
|
||||||
|
//сеттер для полей значения которых обрезаются при вставке в БД
|
||||||
|
public SettingOperation(String methodName, Class[] parameterTypes, Object[] params) {
|
||||||
|
this.methodName = methodName;
|
||||||
|
this.parameterTypes = parameterTypes;
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethodName() {
|
||||||
|
return methodName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class[] getParameterTypes() {
|
||||||
|
return parameterTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getParams() {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package ru.spcex.clearing.imdg.structure;
|
||||||
|
|
||||||
|
|
||||||
|
import ru.clearing.platform.dictionary.AbstractDictionary;
|
||||||
|
import ru.spcex.clearing.imdg.utils.MatcherFactory.Matcher;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||||
|
|
||||||
|
public class DictionaryObjectForCheckMapStore<T> {
|
||||||
|
|
||||||
|
public final Matcher<T> MATCHER = usingIgnoringFieldsComparator();
|
||||||
|
private final String mapName;
|
||||||
|
private final Class<T> clazz;
|
||||||
|
|
||||||
|
private AbstractDictionary predictableObj;
|
||||||
|
|
||||||
|
public DictionaryObjectForCheckMapStore(String mapName, Class<T> clazz) {
|
||||||
|
this.mapName = mapName;
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMapName() {
|
||||||
|
return mapName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<T> getClazz() {
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matcher<T> getMATCHER() {
|
||||||
|
return MATCHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractDictionary getPredictableObj() {
|
||||||
|
return predictableObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPredictableObj(AbstractDictionary predictableObj) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||||
|
this.predictableObj = predictableObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
package ru.spcex.clearing.imdg.structure;
|
||||||
|
|
||||||
|
import ru.clearing.classes.statics.data.account.*;
|
||||||
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
|
import ru.clearing.classes.statics.data.company.CompanyHistory;
|
||||||
|
import ru.clearing.classes.statics.data.company.CompanyRoleSet;
|
||||||
|
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||||
|
import ru.clearing.classes.statics.data.company.relation.Relation;
|
||||||
|
import ru.clearing.classes.statics.data.company.relation.RelationHistory;
|
||||||
|
import ru.clearing.classes.statics.data.generated.ClearingMemberCategory;
|
||||||
|
import ru.clearing.classes.statics.data.journal.InDocumentJournal;
|
||||||
|
import ru.clearing.classes.statics.data.journal.OutDocumentJournal;
|
||||||
|
import ru.clearing.classes.statics.data.messages.ErrorText;
|
||||||
|
import ru.clearing.classes.statics.data.misc.KeyRate;
|
||||||
|
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurity;
|
||||||
|
import ru.clearing.classes.statics.data.profile.Contact;
|
||||||
|
import ru.clearing.classes.statics.data.profile.ProfileDocument;
|
||||||
|
import ru.clearing.classes.statics.data.scheduler.*;
|
||||||
|
import ru.clearing.classes.statics.data.sdf.*;
|
||||||
|
import ru.clearing.classes.statics.data.security.Security;
|
||||||
|
import ru.clearing.classes.statics.data.security.SecurityHistory;
|
||||||
|
import ru.clearing.classes.statics.data.statement.Statement;
|
||||||
|
import ru.clearing.classes.statics.data.user.*;
|
||||||
|
import ru.clearing.platform.dictionary.*;
|
||||||
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
import ru.spcex.clearing.imdg.structure.BusinessObjectAndBusinessEventForCheckMapStore.SettingOperation;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RunnableMapNamesForTesting {
|
||||||
|
public static List<BusinessObjectAndBusinessEventForCheckMapStore> businessObjectAndBusinessEventForCheckMapStores;
|
||||||
|
public static List<DictionaryObjectForCheckMapStore> dictionaryObjectForCheckMapStores;
|
||||||
|
|
||||||
|
static {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void init() {
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores = new LinkedList<>();
|
||||||
|
dictionaryObjectForCheckMapStores = new LinkedList<>();
|
||||||
|
|
||||||
|
//business event
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalanceHistory, AccountBalanceHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountHistory, AccountHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRoutingHistory, AccountRoutingHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_BankAccountHistory, BankAccountHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccountHistory, InformationAccountHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_RelationHistory, RelationHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SecurityHistory, SecurityHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnectHistory, UserConnectHistory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserHistory, UserHistory.class));
|
||||||
|
|
||||||
|
//business object
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Account, Account.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ErrorText, ErrorText.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Relation, Relation.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Scheduler, Scheduler.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Security, Security.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Statement, Statement.class,
|
||||||
|
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_TaskRunner, TaskRunner.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Timetable, Timetable.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_TradingCalendar, TradingCalendar.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnect, UserConnect.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_User, User.class));
|
||||||
|
|
||||||
|
//dictionary
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountStatusDictionary, AccountStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountTypeDictionary, AccountTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AllowedDictionary, AllowedDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_BalanceAccountTypeDictionary, BalanceAccountTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ChargeDirectionDictionary, ChargeDirectionDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ClearingStatusDictionary, ClearingStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CompanyRoleDictionary, CompanyRoleDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CompanySymbolDictionary, CompanySymbolDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ConnectionStateDictionary, ConnectionStateDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ContactTypeDictionary, ContactTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, CorporationSoleTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CountryCodeDictionary, CountryCodeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CourierTypeDictionary, CourierTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CurrencyCodeDictionary, CurrencyCodeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_DocumentTypeDictionary, DocumentTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ErrorCodeDictionary, ErrorCodeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_InOutDirectionDictionary, InOutDirectionDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_InstrumentTypeDictionary, InstrumentTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_InterestStatusDictionary, InterestStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_LegalKindDictionary, LegalKindDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ManagementJournalPurposeDictionary, ManagementJournalPurposeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ManagementJournalStatusDictionary, ManagementJournalStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ManagementJournalTypeDictionary, ManagementJournalTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_MoneyFlowSideDictionary, MoneyFlowSideDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_OperationStatusDictionary, OperationStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_OperationTypeDictionary, OperationTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_OrganizationTypeDictionary, OrganizationTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ResultStatusDictionary, ResultStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_SectorDictionary, SectorDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ServiceDictionary, ServiceDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ServiceProductDictionary, ServiceProductDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_SourceDictionary, SourceDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_StatementTypeDictionary, StatementTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TaskDictionary, TaskDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TaskStatusDictionary, TaskStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TermTypeDictionary, TermTypeDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TradingStatusDictionary, TradingStatusDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_UserRoleDictionary, UserRoleDictionary.class));
|
||||||
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_WorkflowStatusDictionary, WorkflowStatusDictionary.class));
|
||||||
|
|
||||||
|
//object
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRouting, AccountRouting.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_BankAccount, BankAccount.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ClearingMemberCategory, ClearingMemberCategory.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyRoleSet, CompanyRoleSet.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Contact, Contact.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InDocumentJournal, InDocumentJournal.class,
|
||||||
|
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccount, InformationAccount.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_KeyRate, KeyRate.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_MoneyMarketSecurity, MoneyMarketSecurity.class,
|
||||||
|
new SettingOperation("setNominalValue", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_OutDocumentJournal, OutDocumentJournal.class,
|
||||||
|
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ProfileDocument, ProfileDocument.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SchedulerAllToday, SchedulerAllToday.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf01, SDf01.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf02, SDf02.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf03, SDf03.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf04, SDf04.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf05, SDf05.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf08, SDf08.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf09, SDf09.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf10, SDf10.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf11, SDf11.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf12, SDf12.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf13, SDf13.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf16, SDf16.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf17, SDf17.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SDf18, SDf18.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserRoleSession, UserRoleSession.class));
|
||||||
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserSettings, UserSettings.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
package ru.spcex.clearing.imdg.utils;
|
||||||
|
|
||||||
|
import org.springframework.jdbc.core.RowMapper;
|
||||||
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public abstract class AbstractHistoryRowMapper<T extends SpcexObjectBase> implements RowMapper<T> {
|
||||||
|
@Override
|
||||||
|
abstract public T mapRow(ResultSet rs, int rowNum) throws SQLException;
|
||||||
|
|
||||||
|
|
||||||
|
protected void setValueFildForObjectIfFildExists(SpcexObjectBase object, Class<?> clazz, String fildName, Object value) {
|
||||||
|
try {
|
||||||
|
Field field = clazz.getDeclaredField(fildName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
Class<?> typeField = field.getType();
|
||||||
|
if (typeField.equals(LocalDate.class)) {
|
||||||
|
Date date = (Date) value;
|
||||||
|
field.set(object, value != null ? Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate() : null);
|
||||||
|
} else if (typeField.equals(LocalTime.class)) {
|
||||||
|
Time time = (Time) value;
|
||||||
|
field.set(object, value != null ? time.toLocalTime() : null);
|
||||||
|
} else if (typeField.getName().equals(Instant.class.getName())) {
|
||||||
|
field.set(object, value != null ? ((Timestamp) value).toInstant() : null);
|
||||||
|
} else {
|
||||||
|
field.set(object, value);
|
||||||
|
}
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
if (!clazz.getSuperclass().getName().equals(Object.class.getName())) {
|
||||||
|
setValueFildForObjectIfFildExists(object, clazz.getSuperclass(), fildName, value);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getFildName(String str, String objIdColumn) {
|
||||||
|
if (str.equals(objIdColumn)) {
|
||||||
|
return "objId";
|
||||||
|
} else if (str.equals("created_at")) {
|
||||||
|
return "created";
|
||||||
|
} else if (str.equals("updated_at")) {
|
||||||
|
return "updated";
|
||||||
|
}
|
||||||
|
return snakeCaseToCamelCase(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String snakeCaseToCamelCase(String str) {
|
||||||
|
StringBuilder builder = new StringBuilder(str);
|
||||||
|
for (int i = 0; i < builder.length(); i++) {
|
||||||
|
|
||||||
|
// Check char is underscore
|
||||||
|
if (builder.charAt(i) == '_') {
|
||||||
|
builder.deleteCharAt(i);
|
||||||
|
builder.replace(
|
||||||
|
i, i + 1,
|
||||||
|
String.valueOf(
|
||||||
|
Character.toUpperCase(
|
||||||
|
builder.charAt(i))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package ru.spcex.clearing.imdg.utils;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.NotWritablePropertyException;
|
||||||
|
import org.springframework.beans.TypeMismatchException;
|
||||||
|
import org.springframework.jdbc.support.JdbcUtils;
|
||||||
|
import ru.clearing.classes.objects.BusinessEvent;
|
||||||
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class BusinessEventRowMapper<T extends BusinessEvent> extends AbstractHistoryRowMapper<T> {
|
||||||
|
|
||||||
|
private final Class<T> mappedClass;
|
||||||
|
|
||||||
|
public BusinessEventRowMapper(Class<T> mappedClass) {
|
||||||
|
this.mappedClass = mappedClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||||
|
T historyObject = BeanUtils.instantiateClass(this.mappedClass);
|
||||||
|
SpcexObjectBase objectFild = null;
|
||||||
|
try {
|
||||||
|
objectFild = (SpcexObjectBase) BeanUtils.instantiateClass(historyObject.getClass().getDeclaredField("object").getType());
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
ResultSetMetaData meta_data = rs.getMetaData();
|
||||||
|
String objIdColumn = rs.getMetaData().getTableName(1).replace("_history", "_id");
|
||||||
|
|
||||||
|
int columnCount = meta_data.getColumnCount();
|
||||||
|
|
||||||
|
for (int index = 1; index <= columnCount; index++) {
|
||||||
|
String column = JdbcUtils.lookupColumnName(meta_data, index);
|
||||||
|
String fildName = getFildName(column, objIdColumn);
|
||||||
|
try {
|
||||||
|
Object value = JdbcUtils.getResultSetValue(rs, index, Class.forName(meta_data.getColumnClassName(index)));
|
||||||
|
if (fildName.equals("id")) {
|
||||||
|
historyObject.setId((Long) value);
|
||||||
|
continue;
|
||||||
|
} else if (fildName.equals("eventUserId")) {
|
||||||
|
historyObject.setUserId((Long) value);
|
||||||
|
continue;
|
||||||
|
} else if (fildName.equals("userId")) {
|
||||||
|
setValueFildForObjectIfFildExists(objectFild, objectFild.getClass(), fildName, value);
|
||||||
|
continue;
|
||||||
|
} else if (fildName.equals("objId")) {
|
||||||
|
objectFild.setId((Long) value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
setValueFildForObjectIfFildExists(historyObject, historyObject.getClass(), fildName, value);
|
||||||
|
setValueFildForObjectIfFildExists(objectFild, objectFild.getClass(), fildName, value);
|
||||||
|
} catch (TypeMismatchException | NotWritablePropertyException e) {
|
||||||
|
// Ignore
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
historyObject.setObject(objectFild);
|
||||||
|
return historyObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,251 @@
|
||||||
|
package ru.spcex.clearing.imdg.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Утилитарный класс для работы с embedded базой.
|
||||||
|
* Так же используется для заполнения значений классов для подготовки вставки в базу
|
||||||
|
*/
|
||||||
|
public final class DbDataUtils {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
/**
|
||||||
|
* Паттерн который проверяет что исполняемый скрипт пересоздает таблицу (recreate table * (*))
|
||||||
|
*/
|
||||||
|
private final static Pattern PATTERN_CREATE_TABLE = Pattern.compile(
|
||||||
|
"(?m)(?i)^\\s*?(?:re)*(create\\s*?table\\s*?[^\\s$]+?\\s*?\\([\\S\\s]+?(?:\\);|^\\)\\s*?$))");
|
||||||
|
private final static Pattern PATTERN_ALTER_TABLE = Pattern.compile(
|
||||||
|
"(?m)(?i)^\\s*?(alter\\s*?table\\s*?[^\\s$]+?\\s*?add\\s*?constraint\\s*?[^\\s$]+?\\s*?primary\\s*?key\\s*?\\([\\S\\s]+?(?:\\);|^\\)\\s*?$))");
|
||||||
|
private final static Pattern PATTERN_UPDATE_OR_INSERT_TABLE = Pattern.compile(
|
||||||
|
"(?i)update\\s+\\w+\\s+set\\s+\\w+|update\\s+or\\s+insert\\s+into\\s+\\w+.*?values|insert\\s+into\\s+\\w+.*?values");
|
||||||
|
private final static Pattern PATTERN_UPDATE_OR_INSERT_VERSIONDB = Pattern.compile(
|
||||||
|
"(?m)(?i)^\\s*?(update or insert into VERSIONEDID\\s*?[\\w\\s\\(\\,)]+\\s*values\\s*?[\\w\\s\\.'\\(\\,)]+matching\\s*?[\\w\\s,\\(\\)]+\\s*;)");
|
||||||
|
private final static Pattern PATTERN_CHANGE_CREATE_TO_RECREATE = Pattern.compile(
|
||||||
|
"(?i)^\\s*?create");
|
||||||
|
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("ddMMyyyy");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Создавать объект этого типа нельзя
|
||||||
|
*/
|
||||||
|
private DbDataUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Создает пустую базу по DDL скрипту (только таблицы), так же проверяет скрипты DDL на валидность.
|
||||||
|
*/
|
||||||
|
public static void executeAllDDL(List<String> DDLs, JdbcTemplate jdbcTemplate) {
|
||||||
|
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
log.info("Создание всех таблиц по DDL.sql");
|
||||||
|
int executed = 0;
|
||||||
|
for (String dll : DDLs) {
|
||||||
|
executed += executeOneDDL(dll, jdbcTemplate);
|
||||||
|
}
|
||||||
|
log.info("Закончено создание таблиц... выполненых запросов {}", executed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int executeOneDDL(String ddl, JdbcTemplate jdbcTemplate) {
|
||||||
|
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
Matcher m = PATTERN_CREATE_TABLE.matcher(ddl);
|
||||||
|
// Matcher alterMatcher = PATTERN_ALTER_TABLE.matcher(ddl);
|
||||||
|
List<String> sqls = new ArrayList<>();
|
||||||
|
// List<String> alterSqls = new ArrayList<>();
|
||||||
|
while (m.find()) {
|
||||||
|
String oneDDL = m.group(1);
|
||||||
|
Matcher mr = PATTERN_CHANGE_CREATE_TO_RECREATE.matcher(oneDDL);
|
||||||
|
oneDDL = mr.replaceAll("RECREATE");
|
||||||
|
sqls.add(oneDDL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// while (alterMatcher.find()) {
|
||||||
|
// String oneDDL = alterMatcher.group(1);
|
||||||
|
// alterSqls.add(oneDDL);
|
||||||
|
// }
|
||||||
|
log.info("Exec batch");
|
||||||
|
int[] result = jdbcTemplate.batchUpdate(sqls.toArray(new String[0]));
|
||||||
|
// int alterResult[] = jdbcTemplate.batchUpdate(alterSqls.toArray(new String[0]));
|
||||||
|
log.info("Batch sql done");
|
||||||
|
|
||||||
|
// Для проставления версии БД
|
||||||
|
int insertCount = 0;
|
||||||
|
Matcher versionM = PATTERN_UPDATE_OR_INSERT_VERSIONDB.matcher(ddl);
|
||||||
|
while (versionM.find()) {
|
||||||
|
String oneSQL = versionM.group(1);
|
||||||
|
jdbcTemplate.execute(oneSQL);
|
||||||
|
log.trace("Executed version SQL: {}", oneSQL);
|
||||||
|
insertCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.length + insertCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fillMandatorySqlData(Map<String, String> mandatorySql, JdbcTemplate jdbcTemplate) {
|
||||||
|
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
log.info("Заполнение базы общими значениями");
|
||||||
|
fillSqlData(mandatorySql, jdbcTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fillAdditionalSqlData(Map<String, String> additionalSql, JdbcTemplate jdbcTemplate) {
|
||||||
|
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
log.info("Заполнение базы дополнительными значениями");
|
||||||
|
fillSqlData(additionalSql, jdbcTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fillSqlData(Map<String, String> sqlMap, JdbcTemplate jdbcTemplate) {
|
||||||
|
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
for (Map.Entry<String, String> sqlEntry : sqlMap.entrySet()) {
|
||||||
|
String sql = sqlEntry.getValue();
|
||||||
|
String[] lines = sql.split("\n");
|
||||||
|
List<String> sqls = new ArrayList<>();
|
||||||
|
for (String line : lines) {
|
||||||
|
if (StringUtils.isEmpty(line) || StringUtils.isWhitespace(line))
|
||||||
|
continue;
|
||||||
|
String execLine = line.trim();
|
||||||
|
if (!execLine.endsWith(";"))
|
||||||
|
execLine += ";";
|
||||||
|
Matcher updateOrInsertMatcher = PATTERN_UPDATE_OR_INSERT_TABLE.matcher(execLine);
|
||||||
|
if (updateOrInsertMatcher.find()) {
|
||||||
|
execLine = execLine.replaceAll("(?i)update\\s+or\\s+insert\\s*", "insert ");
|
||||||
|
log.info("Скрипт {}", execLine);
|
||||||
|
sqls.add(execLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("Exec batch");
|
||||||
|
int[] result = jdbcTemplate.batchUpdate(sqls.toArray(new String[0]));
|
||||||
|
log.info("Batch sql done");
|
||||||
|
}
|
||||||
|
log.info("Заполнение базы значениями завершено");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fillObjectDefaultValues(Object object) {
|
||||||
|
fillObjectDefaultValues(object, object.getClass());
|
||||||
|
for (Field field : object.getClass().getDeclaredFields()) {
|
||||||
|
if (!Modifier.isFinal(field.getModifiers())) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
setFieldDefaultValue(field, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fillObjectDefaultValues(Object object, Class<?> clazz) {
|
||||||
|
if (!clazz.getSuperclass().getName().equals(Object.class.getName())) {
|
||||||
|
fillObjectDefaultValues(object, clazz.getSuperclass());
|
||||||
|
}
|
||||||
|
for (Field field : clazz.getDeclaredFields()) {
|
||||||
|
if (!Modifier.isFinal(field.getModifiers()) && !Modifier.isStatic(field.getModifiers())) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
setFieldDefaultValue(field, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void getObjectsFieldValues(Object object, Map<Field, Object> values, boolean deepScan) throws IllegalAccessException {
|
||||||
|
if (!object.getClass().getSuperclass().getName().equals(Object.class.getName())) {
|
||||||
|
log.trace("Scan values of {}", object.getClass().getName());
|
||||||
|
getObjectsFieldValues(object.getClass().getSuperclass(), values, deepScan);
|
||||||
|
for (Field field : object.getClass().getDeclaredFields()) {
|
||||||
|
if (!Modifier.isFinal(field.getModifiers())) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object value = field.get(object);
|
||||||
|
values.put(field, value);
|
||||||
|
if (deepScan && isBusinessObject(value)) { // пройти внутрь наших классов
|
||||||
|
getObjectsFieldValues(value, values, deepScan); // go to deeper
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Это наш класс и не примитив
|
||||||
|
*
|
||||||
|
* @param value объект, возможно otc-объект.
|
||||||
|
* @return нужно ли применять deepScan
|
||||||
|
*/
|
||||||
|
private static boolean isBusinessObject(Object value) {
|
||||||
|
String classesClassPathPrefix = "ru.clearing.classes.objects";
|
||||||
|
return value != null && value.getClass().getName().startsWith(classesClassPathPrefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setFieldDefaultValue(Field field, Object object) {
|
||||||
|
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
|
Class<?> typeField = field.getType();
|
||||||
|
try {
|
||||||
|
if (typeField.getName().equals(String.class.getName())) {
|
||||||
|
field.set(object, generatingRandomString(4));
|
||||||
|
} else if (typeField.equals(Integer.TYPE) || typeField.equals(Integer.class)) {
|
||||||
|
field.set(object, generatingRandomInteger());
|
||||||
|
} else if (typeField.getName().equals(BigDecimal.class.getName())) {
|
||||||
|
field.set(object, new BigDecimal(String.format("%d3.220000000000000000", generatingRandomInteger())));
|
||||||
|
} else if (typeField.equals(Long.TYPE) || typeField.equals(Long.class)) {
|
||||||
|
field.set(object, generatingRandomLong());
|
||||||
|
} else if (typeField.equals(LocalDate.class)) {
|
||||||
|
field.set(object, LocalDate.of(2022, generatingRandomInteger(), generatingRandomInteger()));
|
||||||
|
} else if (typeField.equals(LocalTime.class)) {
|
||||||
|
field.set(object, LocalTime.of(generatingRandomInteger(), generatingRandomInteger()));
|
||||||
|
} else if (typeField.getName().equals(Date.class.getName())) {
|
||||||
|
field.set(object, new Date());
|
||||||
|
} else if (typeField.getName().equals(Boolean.class.getName())) {
|
||||||
|
field.set(object, true);
|
||||||
|
} else if (typeField.getName().equals(UUID.class.getName())) {
|
||||||
|
field.set(object, UUID.randomUUID());
|
||||||
|
} else if (typeField.getName().equals(Instant.class.getName())) {
|
||||||
|
field.set(object, Instant.parse(String.format("2022-10-0%dT15:39:18.659Z", generatingRandomInteger())));
|
||||||
|
// } else if (typeField.getSimpleName().equals(CompanyInfo.class.getSimpleName())) {
|
||||||
|
// CompanyInfo companyInfo = new CompanyInfo();
|
||||||
|
// fillObjectDefaultValues(companyInfo, CompanyInfo.class);
|
||||||
|
// field.set(object, companyInfo);
|
||||||
|
// } else if (typeField.getSuperclass().getName().equals(SpcexObjectBase.class.getName())) {
|
||||||
|
// Object objectField = typeField.getDeclaredConstructor().newInstance();
|
||||||
|
// DbDataUtils.fillObjectDefaultValues(objectField, objectField.getClass());
|
||||||
|
// field.set(object, objectField);
|
||||||
|
} else {
|
||||||
|
Object objectField = typeField.getDeclaredConstructor().newInstance();
|
||||||
|
fillObjectDefaultValues(objectField, objectField.getClass());
|
||||||
|
field.set(object, objectField);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
log.info(e.getMessage());
|
||||||
|
} catch (InvocationTargetException | InstantiationException | NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generatingRandomString(int targetStringLength) {
|
||||||
|
int leftLimit = 97; // letter 'a'
|
||||||
|
int rightLimit = 122; // letter 'z'
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
return random.ints(leftLimit, rightLimit + 1)
|
||||||
|
.limit(targetStringLength)
|
||||||
|
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long generatingRandomLong() {
|
||||||
|
long leftLimit = 1L;
|
||||||
|
long rightLimit = 1000000L;
|
||||||
|
return leftLimit + (long) (Math.random() * (rightLimit - leftLimit));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int generatingRandomInteger() {
|
||||||
|
int leftLimit = 1;
|
||||||
|
int rightLimit = 9;
|
||||||
|
return leftLimit + (int) (new Random().nextFloat() * (rightLimit - leftLimit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package ru.spcex.clearing.imdg.utils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory for creating test matchers.
|
||||||
|
* <p>
|
||||||
|
* Comparing actual and expected objects via AssertJ
|
||||||
|
*/
|
||||||
|
public class MatcherFactory {
|
||||||
|
|
||||||
|
public static <T> Matcher<T> usingIgnoringFieldsComparator(String... fieldsToIgnore) {
|
||||||
|
return new Matcher<>(fieldsToIgnore);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Matcher<T> {
|
||||||
|
private final String[] fieldsToIgnore;
|
||||||
|
|
||||||
|
private Matcher(String... fieldsToIgnore) {
|
||||||
|
this.fieldsToIgnore = fieldsToIgnore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertMatch(T actual, T expected) {
|
||||||
|
assertThat(actual).usingRecursiveComparison().ignoringFields(fieldsToIgnore).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public final void assertMatch(Iterable<T> actual, T... expected) {
|
||||||
|
assertMatch(actual, Arrays.asList(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertMatch(Iterable<T> actual, Iterable<T> expected) {
|
||||||
|
assertThat(actual).usingRecursiveFieldByFieldElementComparatorIgnoringFields(fieldsToIgnore).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package ru.spcex.clearing.imdg.utils;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.NotWritablePropertyException;
|
||||||
|
import org.springframework.beans.TypeMismatchException;
|
||||||
|
import org.springframework.jdbc.support.JdbcUtils;
|
||||||
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class SpcexObjectBaseRowMapper<T extends SpcexObjectBase> extends AbstractHistoryRowMapper<T> {
|
||||||
|
|
||||||
|
private final Class<T> mappedClass;
|
||||||
|
|
||||||
|
public SpcexObjectBaseRowMapper(Class<T> mappedClass) {
|
||||||
|
this.mappedClass = mappedClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||||
|
T object = BeanUtils.instantiateClass(this.mappedClass);
|
||||||
|
ResultSetMetaData meta_data = rs.getMetaData();
|
||||||
|
String objIdColumn = rs.getMetaData().getTableName(1).replace("_history", "_id");
|
||||||
|
|
||||||
|
int columnCount = meta_data.getColumnCount();
|
||||||
|
|
||||||
|
for (int index = 1; index <= columnCount; index++) {
|
||||||
|
String column = JdbcUtils.lookupColumnName(meta_data, index);
|
||||||
|
String fildName = getFildName(column, objIdColumn);
|
||||||
|
try {
|
||||||
|
Object value = JdbcUtils.getResultSetValue(rs, index, Class.forName(meta_data.getColumnClassName(index)));
|
||||||
|
if (fildName.equals("objId")) {
|
||||||
|
object.setId((Long) value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
setValueFildForObjectIfFildExists(object, object.getClass(), fildName, value);
|
||||||
|
} catch (TypeMismatchException | NotWritablePropertyException e) {
|
||||||
|
// Ignore
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
}
|
||||||
4877
clearing-parent/imdg/src/test/resources/ddl.sql
Normal file
4877
clearing-parent/imdg/src/test/resources/ddl.sql
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -20,9 +20,9 @@ import ru.spcex.platform.enumeration.Status;
|
||||||
import ru.spcex.platform.enumeration.UserRole;
|
import ru.spcex.platform.enumeration.UserRole;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.utils.time.TimeUtil;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -34,11 +34,13 @@ import java.util.stream.Stream;
|
||||||
@Service
|
@Service
|
||||||
public class UserService extends QueueConsumer implements InitializingBean {
|
public class UserService extends QueueConsumer implements InitializingBean {
|
||||||
private final static Map<String, UserRole> roleMapping = new HashMap<>();
|
private final static Map<String, UserRole> roleMapping = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
roleMapping.put("CS_MKR_ADMIN", UserRole.Admin);
|
roleMapping.put("CS_MKR_ADMIN", UserRole.Admin);
|
||||||
roleMapping.put("CS_MKR_SUPERVISER", UserRole.Superviser);
|
roleMapping.put("CS_MKR_SUPERVISER", UserRole.Superviser);
|
||||||
roleMapping.put("CS_MKR_SECURITY", UserRole.Security);
|
roleMapping.put("CS_MKR_SECURITY", UserRole.Security);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final Imdg<User> userMap;
|
private final Imdg<User> userMap;
|
||||||
private final Imdg<UserRoleSession> userRoleSessionImdg;
|
private final Imdg<UserRoleSession> userRoleSessionImdg;
|
||||||
|
|
@ -52,6 +54,47 @@ public class UserService extends QueueConsumer implements InitializingBean {
|
||||||
this.userConnectImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_UserConnect, UserConnect.class);
|
this.userConnectImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_UserConnect, UserConnect.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Collection<RoleAction> defineAllRoleChanges(Collection<UserRoleSession> presentRoles, Collection<String> authRoles) {
|
||||||
|
Collection<String> finalAuthRoles = authRoles.stream().flatMap((Function<String, Stream<String>>) keycloakRole -> {
|
||||||
|
UserRole userRole = roleMapping.get(keycloakRole);
|
||||||
|
if (userRole == null) return Stream.empty();
|
||||||
|
return Stream.of(userRole.getKey());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return Stream.concat(
|
||||||
|
presentRoles
|
||||||
|
.stream()
|
||||||
|
.filter(presentRole -> !(Status.Active.equalsByKey(presentRole.getStatus()) && contain(presentRole, finalAuthRoles)))
|
||||||
|
.filter(presentRole -> !(Status.Blocked.equalsByKey(presentRole.getStatus()) && !contain(presentRole, finalAuthRoles)))
|
||||||
|
.map(role -> {
|
||||||
|
RoleAction roleAction = new RoleAction();
|
||||||
|
roleAction.roleToChange = role;
|
||||||
|
if (Status.Active.equalsByKey(role.getStatus())) {
|
||||||
|
roleAction.newStatus = Status.Blocked;
|
||||||
|
} else {
|
||||||
|
roleAction.newStatus = Status.Active;
|
||||||
|
}
|
||||||
|
return roleAction;
|
||||||
|
}),
|
||||||
|
finalAuthRoles
|
||||||
|
.stream()
|
||||||
|
.filter(authRole -> !contain(authRole, presentRoles))
|
||||||
|
.map(authRole -> {
|
||||||
|
RoleAction action = new RoleAction();
|
||||||
|
action.newStatus = Status.Active;
|
||||||
|
action.roleName = authRole;
|
||||||
|
return action;
|
||||||
|
})
|
||||||
|
).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean contain(UserRoleSession role, Collection<String> authRoles) {
|
||||||
|
return authRoles.stream().anyMatch(authRole -> authRole.equalsIgnoreCase(role.getUserRole()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean contain(String authRole, Collection<UserRoleSession> presentRoles) {
|
||||||
|
return presentRoles.stream().anyMatch(role -> role.getUserRole().equalsIgnoreCase(authRole));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
callback(UserAuthRequest.class)
|
callback(UserAuthRequest.class)
|
||||||
|
|
@ -87,7 +130,7 @@ public class UserService extends QueueConsumer implements InitializingBean {
|
||||||
userConnect.setDisconnectionTime(logoutInfo.getTime());
|
userConnect.setDisconnectionTime(logoutInfo.getTime());
|
||||||
userConnect.setUpdated(logoutInfo.getTime());
|
userConnect.setUpdated(logoutInfo.getTime());
|
||||||
userConnect.setConnectionState(ConnectionState.Disconnected.getKey());
|
userConnect.setConnectionState(ConnectionState.Disconnected.getKey());
|
||||||
userConnect.setClearingDate(TimeUtil.today());
|
userConnect.setClearingDate(LocalDate.now());
|
||||||
userConnectImdg.update(userConnect);
|
userConnectImdg.update(userConnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,7 +190,7 @@ public class UserService extends QueueConsumer implements InitializingBean {
|
||||||
userConnect.setServerIP(serverIp);
|
userConnect.setServerIP(serverIp);
|
||||||
userConnect.setClientIP(clientIp);
|
userConnect.setClientIP(clientIp);
|
||||||
userConnect.setConnectionState(ConnectionState.Connected.getKey());
|
userConnect.setConnectionState(ConnectionState.Connected.getKey());
|
||||||
userConnect.setClearingDate(TimeUtil.today());
|
userConnect.setClearingDate(LocalDate.now());
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
userConnectImdg.insert(userConnect);
|
userConnectImdg.insert(userConnect);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -155,52 +198,12 @@ public class UserService extends QueueConsumer implements InitializingBean {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Collection<RoleAction> defineAllRoleChanges(Collection<UserRoleSession> presentRoles, Collection<String> authRoles) {
|
|
||||||
Collection<String> finalAuthRoles = authRoles.stream().flatMap((Function<String, Stream<String>>) keycloakRole -> {
|
|
||||||
UserRole userRole = roleMapping.get(keycloakRole);
|
|
||||||
if (userRole == null) return Stream.empty();
|
|
||||||
return Stream.of(userRole.getKey());
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
return Stream.concat(
|
|
||||||
presentRoles
|
|
||||||
.stream()
|
|
||||||
.filter(presentRole -> !(Status.Active.equalsByKey(presentRole.getStatus()) && contain(presentRole, finalAuthRoles)))
|
|
||||||
.filter(presentRole -> !(Status.Blocked.equalsByKey(presentRole.getStatus()) && !contain(presentRole, finalAuthRoles)))
|
|
||||||
.map(role -> {
|
|
||||||
RoleAction roleAction = new RoleAction();
|
|
||||||
roleAction.roleToChange = role;
|
|
||||||
if (Status.Active.equalsByKey(role.getStatus())) {
|
|
||||||
roleAction.newStatus = Status.Blocked;
|
|
||||||
} else {
|
|
||||||
roleAction.newStatus = Status.Active;
|
|
||||||
}
|
|
||||||
return roleAction;
|
|
||||||
}),
|
|
||||||
finalAuthRoles
|
|
||||||
.stream()
|
|
||||||
.filter(authRole -> !contain(authRole, presentRoles))
|
|
||||||
.map(authRole -> {
|
|
||||||
RoleAction action = new RoleAction();
|
|
||||||
action.newStatus = Status.Active;
|
|
||||||
action.roleName = authRole;
|
|
||||||
return action;
|
|
||||||
})
|
|
||||||
).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean contain(UserRoleSession role, Collection<String> authRoles) {
|
|
||||||
return authRoles.stream().anyMatch(authRole -> authRole.equalsIgnoreCase(role.getUserRole()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean contain(String authRole, Collection<UserRoleSession> presentRoles) {
|
|
||||||
return presentRoles.stream().anyMatch(role -> role.getUserRole().equalsIgnoreCase(authRole));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class RoleAction {
|
public static class RoleAction {
|
||||||
String roleName;
|
String roleName;
|
||||||
//------поля при обновления-----
|
//------поля при обновления-----
|
||||||
Status newStatus;
|
Status newStatus;
|
||||||
UserRoleSession roleToChange;
|
UserRoleSession roleToChange;
|
||||||
|
|
||||||
boolean create() {
|
boolean create() {
|
||||||
return roleToChange == null;
|
return roleToChange == null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,9 @@ public final class IMDGDistributedNames {
|
||||||
public static final String Map_SDf09 = "Map_SDf09";
|
public static final String Map_SDf09 = "Map_SDf09";
|
||||||
public static final String Map_SDf12 = "Map_SDf12";
|
public static final String Map_SDf12 = "Map_SDf12";
|
||||||
public static final String Map_SDf18 = "Map_SDf18";
|
public static final String Map_SDf18 = "Map_SDf18";
|
||||||
// public static final String Map_InterestStatusDictionary = "Map_InterestStatusDictionary"; future
|
public static final String Map_InterestStatusDictionary = "Map_InterestStatusDictionary";
|
||||||
public static final String Map_AllowedDictionary = "Map_AllowedDictionary";
|
public static final String Map_AllowedDictionary = "Map_AllowedDictionary";
|
||||||
// public static final String Map_ClearingMemberCategoryDictionary = "Map_ClearingMemberCategoryDictionary"; future
|
public static final String Map_ClearingMemberCategoryDictionary = "Map_ClearingMemberCategoryDictionary";
|
||||||
public static final String Map_CompanyRoleDictionary = "Map_CompanyRoleDictionary";
|
public static final String Map_CompanyRoleDictionary = "Map_CompanyRoleDictionary";
|
||||||
public static final String Map_CompanySymbolDictionary = "Map_CompanySymbolDictionary";
|
public static final String Map_CompanySymbolDictionary = "Map_CompanySymbolDictionary";
|
||||||
public static final String Map_ContactTypeDictionary = "Map_ContactTypeDictionary";
|
public static final String Map_ContactTypeDictionary = "Map_ContactTypeDictionary";
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,17 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class MoneyMarketSecurityNewRequest {
|
public class MoneyMarketSecurityNewRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
public Instant startDate;
|
public LocalDate startDate;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
public Instant endDate;
|
public LocalDate endDate;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double nominalValue;
|
public Double nominalValue;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
|
@ -30,19 +30,19 @@ public class MoneyMarketSecurityNewRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double lotSize;
|
public Double lotSize;
|
||||||
|
|
||||||
public Instant getStartDate() {
|
public LocalDate getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Instant startDate) {
|
public void setStartDate(LocalDate startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEndDate() {
|
public LocalDate getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndDate(Instant endDate) {
|
public void setEndDate(LocalDate endDate) {
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class MoneyMarketSecurityUpdateRequest {
|
public class MoneyMarketSecurityUpdateRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
|
@ -16,7 +16,7 @@ public class MoneyMarketSecurityUpdateRequest {
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Instant endDate;
|
public LocalDate endDate;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double nominalValue;
|
public Double nominalValue;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
|
@ -36,11 +36,11 @@ public class MoneyMarketSecurityUpdateRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEndDate() {
|
public LocalDate getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndDate(Instant endDate) {
|
public void setEndDate(LocalDate endDate) {
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,43 +6,44 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class KeyRateNewRequest {
|
public class KeyRateNewRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double keyRate;
|
public BigDecimal keyRate;
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Instant startDate;
|
public LocalDate startDate;
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Instant endDate;
|
public LocalDate endDate;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public String document;
|
public String document;
|
||||||
|
|
||||||
public Double getKeyRate() {
|
public BigDecimal getKeyRate() {
|
||||||
return keyRate;
|
return keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyRate(Double keyRate) {
|
public void setKeyRate(BigDecimal keyRate) {
|
||||||
this.keyRate = keyRate;
|
this.keyRate = keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getStartDate() {
|
public LocalDate getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Instant startDate) {
|
public void setStartDate(LocalDate startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEndDate() {
|
public LocalDate getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndDate(Instant endDate) {
|
public void setEndDate(LocalDate endDate) {
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,22 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class KeyRateUpdateRequest {
|
public class KeyRateUpdateRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Long id;
|
public Long id;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Double keyRate;
|
public BigDecimal keyRate;
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Instant startDate;
|
public LocalDate startDate;
|
||||||
@JsonSerialize(using = InstantSerializer.class)
|
@JsonSerialize(using = InstantSerializer.class)
|
||||||
@JsonDeserialize(using = InstantDeserializer.class)
|
@JsonDeserialize(using = InstantDeserializer.class)
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Instant endDate;
|
public LocalDate endDate;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public String document;
|
public String document;
|
||||||
|
|
||||||
|
|
@ -32,27 +33,27 @@ public class KeyRateUpdateRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getKeyRate() {
|
public BigDecimal getKeyRate() {
|
||||||
return keyRate;
|
return keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyRate(Double keyRate) {
|
public void setKeyRate(BigDecimal keyRate) {
|
||||||
this.keyRate = keyRate;
|
this.keyRate = keyRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getStartDate() {
|
public LocalDate getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Instant startDate) {
|
public void setStartDate(LocalDate startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instant getEndDate() {
|
public LocalDate getEndDate() {
|
||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndDate(Instant endDate) {
|
public void setEndDate(LocalDate endDate) {
|
||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue