Added tests for dictionary MapStore(without CompanyHistoryMapStore)
This commit is contained in:
parent
165f1df99b
commit
86cc64d4a5
24 changed files with 323 additions and 260 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,26 @@ 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.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ключевая ставка ЦБ
|
* Ключевая ставка ЦБ
|
||||||
*
|
* <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 Instant startDate;
|
||||||
private Instant endDate;
|
private Instant 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ import java.util.List;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class HazelcastConfiguration {
|
public class HazelcastConfiguration {
|
||||||
|
|
||||||
private ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
|
|
||||||
private final PoolMapConfigs poolMapConfigs;
|
private final PoolMapConfigs poolMapConfigs;
|
||||||
private final HazelcastServerElement hzSettings;
|
private final HazelcastServerElement hzSettings;
|
||||||
|
private final ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public HazelcastConfiguration(PoolMapConfigs poolMapConfigs, ImdgSettings imdgSettings) {
|
public HazelcastConfiguration(PoolMapConfigs poolMapConfigs, ImdgSettings imdgSettings) {
|
||||||
|
|
@ -49,17 +49,6 @@ 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_CompanyRoleSet()); todo протестировать автоконфигуратор конфигурации мапсторов
|
// config.addMapConfig(poolMapConfigs.map_CompanyRoleSet()); todo протестировать автоконфигуратор конфигурации мапсторов
|
||||||
config.addMapConfig(poolMapConfigs.map_CompanySymbols());
|
config.addMapConfig(poolMapConfigs.map_CompanySymbols());
|
||||||
config.addMapConfig(poolMapConfigs.map_ProfileDocument());
|
config.addMapConfig(poolMapConfigs.map_ProfileDocument());
|
||||||
|
|
@ -69,7 +58,7 @@ public class HazelcastConfiguration {
|
||||||
|
|
||||||
// Автоподключение мап
|
// Автоподключение мап
|
||||||
List<MapConfig> autoMapCfg = poolMapConfigs.autoconfiguratorOfMapstorages();
|
List<MapConfig> autoMapCfg = poolMapConfigs.autoconfiguratorOfMapstorages();
|
||||||
for (MapConfig cfg: autoMapCfg) {
|
for (MapConfig cfg : autoMapCfg) {
|
||||||
config.addMapConfig(cfg);
|
config.addMapConfig(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,14 @@ 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.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.base.AutoconfiguredMap;
|
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.CompanySymbolsMapStore;
|
||||||
import ru.spcex.clearing.imdg.object.ContactMapStore;
|
import ru.spcex.clearing.imdg.object.ContactMapStore;
|
||||||
import ru.spcex.clearing.imdg.object.ProfileDocumentMapStore;
|
import ru.spcex.clearing.imdg.object.ProfileDocumentMapStore;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -24,9 +23,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());
|
||||||
|
|
||||||
private ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
|
private final ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
|
||||||
|
@Autowired
|
||||||
|
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
|
||||||
|
@Autowired
|
||||||
|
private CompanySymbolsMapStore companySymbolsMapStore;
|
||||||
|
@Autowired
|
||||||
|
private ProfileDocumentMapStore profileDocumentMapStore;
|
||||||
|
@Autowired
|
||||||
|
private ContactMapStore contactMapStore;
|
||||||
|
@Autowired
|
||||||
|
private CompanyMapStore companyMapStore;
|
||||||
|
// @Autowired
|
||||||
|
private CompanyHistoryMapStore companyHistoryMapStore;
|
||||||
|
|
||||||
public PoolMapConfigs() {
|
public PoolMapConfigs() {
|
||||||
}
|
}
|
||||||
|
|
@ -34,7 +45,7 @@ public class PoolMapConfigs {
|
||||||
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) {
|
||||||
|
|
@ -72,71 +83,6 @@ 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 todo эксперимент с мапстором, см. ниже autoconfiguratorOfMapstorage.
|
// @Autowired todo эксперимент с мапстором, см. ниже autoconfiguratorOfMapstorage.
|
||||||
// private CompanyRoleSetMapStore companyRoleSetMapStore;
|
// private CompanyRoleSetMapStore companyRoleSetMapStore;
|
||||||
//
|
//
|
||||||
|
|
@ -145,9 +91,6 @@ public class PoolMapConfigs {
|
||||||
// .addMapIndexConfig(makeMapIndexConfig("companyId"));
|
// .addMapIndexConfig(makeMapIndexConfig("companyId"));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
|
|
||||||
|
|
||||||
// @Qualifier("AutoconfiguredMapStore")
|
// @Qualifier("AutoconfiguredMapStore")
|
||||||
public List<MapConfig> autoconfiguratorOfMapstorages() {
|
public List<MapConfig> autoconfiguratorOfMapstorages() {
|
||||||
List<MapConfig> out = new ArrayList<>();
|
List<MapConfig> out = new ArrayList<>();
|
||||||
|
|
@ -177,52 +120,34 @@ 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());
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CompanySymbolsMapStore companySymbolsMapStore;
|
|
||||||
|
|
||||||
public MapConfig map_CompanySymbols() {
|
public MapConfig map_CompanySymbols() {
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanySymbols, companySymbolsMapStore)
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanySymbols, companySymbolsMapStore)
|
||||||
.addMapIndexConfig(makeMapIndexConfig("companyId"))
|
.addMapIndexConfig(makeMapIndexConfig("companyId"))
|
||||||
.addMapIndexConfig(makeMapIndexConfig("companySymbol"));
|
.addMapIndexConfig(makeMapIndexConfig("companySymbol"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ProfileDocumentMapStore profileDocumentMapStore;
|
|
||||||
|
|
||||||
public MapConfig map_ProfileDocument() {
|
public MapConfig map_ProfileDocument() {
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_ProfileDocument, profileDocumentMapStore)
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_ProfileDocument, profileDocumentMapStore)
|
||||||
.addMapIndexConfig(makeMapIndexConfig("companyId"));
|
.addMapIndexConfig(makeMapIndexConfig("companyId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ContactMapStore contactMapStore;
|
|
||||||
|
|
||||||
public MapConfig map_Contact() {
|
public MapConfig map_Contact() {
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_Contact, contactMapStore)
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_Contact, contactMapStore)
|
||||||
.addMapIndexConfig(makeMapIndexConfig("companyId"));
|
.addMapIndexConfig(makeMapIndexConfig("companyId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CompanyMapStore companyMapStore;
|
|
||||||
|
|
||||||
public MapConfig map_Company() {
|
public MapConfig map_Company() {
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore)
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore)
|
||||||
.addMapIndexConfig(makeMapIndexConfig("Id"));
|
.addMapIndexConfig(makeMapIndexConfig("Id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
private CompanyHistoryMapStore companyHistoryMapStore;
|
|
||||||
|
|
||||||
public MapConfig map_CompanyUpdate() {
|
public MapConfig map_CompanyUpdate() {
|
||||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyHistory, companyHistoryMapStore);
|
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyHistory, companyHistoryMapStore);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
|
||||||
|
|
@ -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,8 +42,8 @@ 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(getInstantFromTimestamp(resultSet, "START_DATE"));
|
||||||
keyRate.setEndDate(getInstantFromTimestamp(resultSet, "END_DATE"));
|
keyRate.setEndDate(getInstantFromTimestamp(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));
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package ru.spcex.clearing.imdg;
|
||||||
import com.hazelcast.config.MapStoreConfig;
|
import com.hazelcast.config.MapStoreConfig;
|
||||||
import com.hazelcast.core.HazelcastInstance;
|
import com.hazelcast.core.HazelcastInstance;
|
||||||
import com.hazelcast.core.IMap;
|
import com.hazelcast.core.IMap;
|
||||||
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Assumptions;
|
import org.junit.jupiter.api.Assumptions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
@ -13,27 +14,32 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.support.DataAccessUtils;
|
import org.springframework.dao.support.DataAccessUtils;
|
||||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
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.ContextConfiguration;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.test.context.TestPropertySource;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import ru.spcex.clearing.imdg.base.BusinessObjectMapStore;
|
import ru.clearing.platform.dictionary.AbstractDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
import ru.clearing.platform.dictionary.CompanySymbolDictionary;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
import ru.spcex.clearing.imdg.base.*;
|
||||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
|
||||||
import ru.spcex.clearing.imdg.config.DbTestConnectionConfig;
|
import ru.spcex.clearing.imdg.config.DbTestConnectionConfig;
|
||||||
import ru.spcex.clearing.imdg.config.TestConfiguration;
|
import ru.spcex.clearing.imdg.config.TestConfiguration;
|
||||||
import ru.spcex.clearing.imdg.structure.ObjectForCheckMapStore;
|
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.BusinessEventRowMapper;
|
||||||
import ru.spcex.clearing.imdg.utils.DbDataUtils;
|
import ru.spcex.clearing.imdg.utils.DbDataUtils;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
|
import ru.spcex.platform.utils.text.TextUtil;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.objectForCheckMapStores;
|
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.businessObjectAndBusinessEventForCheckMapStores;
|
||||||
|
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.dictionaryObjectForCheckMapStores;
|
||||||
|
|
||||||
@ContextConfiguration(classes = {
|
@ContextConfiguration(classes = {
|
||||||
TestConfiguration.class,
|
TestConfiguration.class,
|
||||||
|
|
@ -52,11 +58,16 @@ public class AllMapStoreTest {
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initTestObjects() {
|
public void initTestObjects() {
|
||||||
try {
|
try {
|
||||||
for (ObjectForCheckMapStore<SpcexObjectBase> objectForCheck : objectForCheckMapStores) {
|
for (BusinessObjectAndBusinessEventForCheckMapStore<SpcexObjectBase> objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
SpcexObjectBase object = objectForCheck.getClazz().getDeclaredConstructor().newInstance();
|
SpcexObjectBase object = objectForCheck.getClazz().getDeclaredConstructor().newInstance();
|
||||||
DbDataUtils.fillObjectDefaultValues(object, object.getClass());
|
DbDataUtils.fillObjectDefaultValues(object, object.getClass());
|
||||||
objectForCheck.setPredictableObj(object);
|
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) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
} catch (InvocationTargetException | NoSuchMethodException e) {
|
} catch (InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
|
@ -109,11 +120,12 @@ public class AllMapStoreTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkSavingForAllMapStoreTest() {
|
public void checkSavingForAllMapStoreTest() {
|
||||||
saveObjectToMaps();
|
saveBusinessObjectAndBusinessEventToMaps();
|
||||||
|
saveDictionaryObjectToMaps();
|
||||||
testConfig.shutDownHazelcast();
|
testConfig.shutDownHazelcast();
|
||||||
testConfig.reinitHazlecastInstance();
|
testConfig.reinitHazlecastInstance();
|
||||||
|
|
||||||
for (ObjectForCheckMapStore objectForCheck : objectForCheckMapStores) {
|
for (BusinessObjectAndBusinessEventForCheckMapStore objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
String mapName = objectForCheck.getMapName();
|
String mapName = objectForCheck.getMapName();
|
||||||
SpcexObjectBase actual;
|
SpcexObjectBase actual;
|
||||||
if (getMapStore(mapName) instanceof TemplateEventMapStore) {
|
if (getMapStore(mapName) instanceof TemplateEventMapStore) {
|
||||||
|
|
@ -126,15 +138,22 @@ public class AllMapStoreTest {
|
||||||
}
|
}
|
||||||
objectForCheck.getMATCHER().assertMatch(actual, objectForCheck.getPredictableObj());
|
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.
|
//todo удалить если будет не нужна, пока не работает из-за "deleteIsSupported() return false" в SimpleObjectMapStore.
|
||||||
@Test
|
@Test
|
||||||
public void checkDeletingForAllMapStoreTest() {
|
public void checkDeletingForAllMapStoreTest() {
|
||||||
Assumptions.assumeTrue(false, "todo удалить если будет не нужна, пока не работает из-за \"deleteIsSupported() return false\" в SimpleObjectMapStore.");
|
Assumptions.assumeTrue(false, "todo удалить если будет не нужна, пока не работает из-за \"deleteIsSupported() return false\" в SimpleObjectMapStore.");
|
||||||
saveObjectToMaps();
|
saveBusinessObjectAndBusinessEventToMaps();
|
||||||
|
|
||||||
for (ObjectForCheckMapStore objectForCheck : objectForCheckMapStores) {
|
for (BusinessObjectAndBusinessEventForCheckMapStore objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(objectForCheck.getMapName());
|
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(objectForCheck.getMapName());
|
||||||
map.remove(ID);
|
map.remove(ID);
|
||||||
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
|
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
|
||||||
|
|
@ -166,14 +185,81 @@ public class AllMapStoreTest {
|
||||||
return mapStoreConfig.getImplementation();
|
return mapStoreConfig.getImplementation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveObjectToMaps() {
|
private void saveBusinessObjectAndBusinessEventToMaps() {
|
||||||
for (ObjectForCheckMapStore objectForCheck : objectForCheckMapStores) {
|
for (BusinessObjectAndBusinessEventForCheckMapStore objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
|
||||||
String mapName = objectForCheck.getMapName();
|
String mapName = objectForCheck.getMapName();
|
||||||
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(mapName);
|
|
||||||
SpcexObjectBase spcexObjectBase = objectForCheck.getPredictableObj();
|
SpcexObjectBase spcexObjectBase = objectForCheck.getPredictableObj();
|
||||||
spcexObjectBase.setId(ID);
|
spcexObjectBase.setId(ID);
|
||||||
log.info("Запись в мап {} объекта {}", mapName, spcexObjectBase);
|
log.info("Запись в мап {} объекта {}", mapName, spcexObjectBase);
|
||||||
|
Object mapStore = getMapStore(mapName);
|
||||||
|
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(mapName);
|
||||||
map.put(spcexObjectBase.getId(), spcexObjectBase);
|
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 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.datasource.init.DatabasePopulator;
|
import org.springframework.jdbc.datasource.init.DatabasePopulator;
|
||||||
import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
|
||||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||||
import ru.spcex.clearing.imdg.error.ModuleInitializeException;
|
import ru.spcex.clearing.imdg.error.ModuleInitializeException;
|
||||||
|
|
||||||
|
|
@ -53,7 +52,7 @@ public class DbTestConnectionConfig {
|
||||||
cpds.setNumHelperThreads(configRoot.getDatabase().getNumHelperThreads());
|
cpds.setNumHelperThreads(configRoot.getDatabase().getNumHelperThreads());
|
||||||
cpds.setCheckoutTimeout(timeoutSec * 1000/*todo common 1000==ConstsCommon.SECOND*/);
|
cpds.setCheckoutTimeout(timeoutSec * 1000/*todo common 1000==ConstsCommon.SECOND*/);
|
||||||
logTimeoutPart = String.format(" (timeout=%ds)", timeoutSec);
|
logTimeoutPart = String.format(" (timeout=%ds)", timeoutSec);
|
||||||
DatabasePopulatorUtils.execute(createDatabasePopulator(), cpds);
|
// DatabasePopulatorUtils.execute(createDatabasePopulator(), cpds);
|
||||||
result = cpds;
|
result = cpds;
|
||||||
|
|
||||||
String OPERATION_DATABASE_CONNECTION_CHECK = String.format("Database [%s] connection check", dbPath);
|
String OPERATION_DATABASE_CONNECTION_CHECK = String.format("Database [%s] connection check", dbPath);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import java.lang.reflect.Method;
|
||||||
|
|
||||||
import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||||
|
|
||||||
public class ObjectForCheckMapStore<T> {
|
public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
|
||||||
|
|
||||||
public final Matcher<T> MATCHER = usingIgnoringFieldsComparator();
|
public final Matcher<T> MATCHER = usingIgnoringFieldsComparator();
|
||||||
private final String mapName;
|
private final String mapName;
|
||||||
|
|
@ -18,12 +18,12 @@ public class ObjectForCheckMapStore<T> {
|
||||||
|
|
||||||
private SpcexObjectBase predictableObj;
|
private SpcexObjectBase predictableObj;
|
||||||
|
|
||||||
public ObjectForCheckMapStore(String mapName, Class<T> clazz) {
|
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz) {
|
||||||
this.mapName = mapName;
|
this.mapName = mapName;
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectForCheckMapStore(String mapName, Class<T> clazz, SettingOperation settingOperation) {
|
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, SettingOperation settingOperation) {
|
||||||
this.mapName = mapName;
|
this.mapName = mapName;
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
this.settingOperation = settingOperation;
|
this.settingOperation = settingOperation;
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,70 +16,69 @@ import ru.clearing.classes.statics.data.user.User;
|
||||||
import ru.clearing.classes.statics.data.user.UserConnect;
|
import ru.clearing.classes.statics.data.user.UserConnect;
|
||||||
import ru.clearing.classes.statics.data.user.UserConnectHistory;
|
import ru.clearing.classes.statics.data.user.UserConnectHistory;
|
||||||
import ru.clearing.classes.statics.data.user.UserHistory;
|
import ru.clearing.classes.statics.data.user.UserHistory;
|
||||||
|
import ru.clearing.platform.dictionary.*;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.imdg.structure.ObjectForCheckMapStore.SettingOperation;
|
import ru.spcex.clearing.imdg.structure.BusinessObjectAndBusinessEventForCheckMapStore.SettingOperation;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class GeneratorMapNamesForHazelcast {
|
public class GeneratorMapNamesForHazelcast {
|
||||||
public static Map<Class, String> mapStoreNameByClass;
|
public static List<BusinessObjectAndBusinessEventForCheckMapStore> businessObjectAndBusinessEventForCheckMapStores;
|
||||||
public static List<ObjectForCheckMapStore> objectForCheckMapStores;
|
public static List<DictionaryObjectForCheckMapStore> dictionaryObjectForCheckMapStores;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
init();
|
init();
|
||||||
mapStoreNameByClass = createMapStoreNameByClass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void init() {
|
private static void init() {
|
||||||
objectForCheckMapStores = new LinkedList<>();
|
businessObjectAndBusinessEventForCheckMapStores = new LinkedList<>();
|
||||||
|
dictionaryObjectForCheckMapStores = new LinkedList<>();
|
||||||
|
|
||||||
//business event
|
//business event
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalanceHistory, AccountBalanceHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalanceHistory, AccountBalanceHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountHistory, AccountHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountHistory, AccountHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountRoutingHistory, AccountRoutingHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRoutingHistory, AccountRoutingHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_BankAccountHistory, BankAccountHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_BankAccountHistory, BankAccountHistory.class));
|
||||||
// objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
|
// objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccountHistory, InformationAccountHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccountHistory, InformationAccountHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_RelationHistory, RelationHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_RelationHistory, RelationHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_SecurityHistory, SecurityHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SecurityHistory, SecurityHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_UserConnectHistory, UserConnectHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnectHistory, UserConnectHistory.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_UserHistory, UserHistory.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserHistory, UserHistory.class));
|
||||||
|
|
||||||
//business object
|
//business object
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Account, Account.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Account, Account.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_ErrorText, ErrorText.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ErrorText, ErrorText.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Relation, Relation.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Relation, Relation.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Scheduler, Scheduler.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Scheduler, Scheduler.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Security, Security.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Security, Security.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Statement, Statement.class,
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Statement, Statement.class,
|
||||||
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
|
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_TaskRunner, TaskRunner.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_TaskRunner, TaskRunner.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_Timetable, Timetable.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Timetable, Timetable.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_TradingCalendar, TradingCalendar.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_TradingCalendar, TradingCalendar.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_UserConnect, UserConnect.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnect, UserConnect.class));
|
||||||
objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_User, User.class));
|
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_User, User.class));
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<String, Class> createClassByMapStoreName() {
|
//dictionary
|
||||||
return Collections.unmodifiableMap(
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountStatusDictionary, AccountStatusDictionary.class));
|
||||||
new HashMap<String, Class>() {{
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountTypeDictionary, AccountTypeDictionary.class));
|
||||||
objectForCheckMapStores.forEach(objectForCheckMapStore -> {
|
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AllowedDictionary, AllowedDictionary.class));
|
||||||
put(objectForCheckMapStore.getMapName(), objectForCheckMapStore.getClazz());
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Class, String> createMapStoreNameByClass() {
|
|
||||||
return Collections.unmodifiableMap(
|
|
||||||
new HashMap<Class, String>() {{
|
|
||||||
objectForCheckMapStores.forEach(objectForCheckMapStore -> {
|
|
||||||
put(objectForCheckMapStore.getClazz(), objectForCheckMapStore.getMapName());
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package ru.spcex.clearing.imdg.utils;
|
package ru.spcex.clearing.imdg.utils;
|
||||||
|
|
||||||
|
|
||||||
import com.hazelcast.config.Config;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -11,7 +10,6 @@ import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
@ -20,16 +18,11 @@ import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.createClassByMapStoreName;
|
|
||||||
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.createMapStoreNameByClass;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Утилитарный класс для работы с embedded базой.
|
* Утилитарный класс для работы с embedded базой.
|
||||||
* Так же используется для заполнения значений классов для подготовки вставки в базу
|
* Так же используется для заполнения значений классов для подготовки вставки в базу
|
||||||
*/
|
*/
|
||||||
public final class DbDataUtils {
|
public final class DbDataUtils {
|
||||||
public final static Map<String, Class> classByMapStoreName = createClassByMapStoreName();
|
|
||||||
public final static Map<Class, String> mapStoreNameByClass = createMapStoreNameByClass();
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
private static final Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
||||||
/**
|
/**
|
||||||
* Паттерн который проверяет что исполняемый скрипт пересоздает таблицу (recreate table * (*))
|
* Паттерн который проверяет что исполняемый скрипт пересоздает таблицу (recreate table * (*))
|
||||||
|
|
@ -232,40 +225,4 @@ public final class DbDataUtils {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFieldDefaultValue(Field field, Object object, String value) {
|
|
||||||
Logger log = LoggerFactory.getLogger(DbDataUtils.class);
|
|
||||||
if (value == null || value.equals("null"))
|
|
||||||
return;
|
|
||||||
Class<?> typeField = field.getType();
|
|
||||||
try {
|
|
||||||
if (typeField.getName().equals(String.class.getName())) {
|
|
||||||
field.set(object, value);
|
|
||||||
} else if (typeField.equals(Integer.TYPE) || typeField.equals(Integer.class)) {
|
|
||||||
field.set(object, Integer.valueOf(value));
|
|
||||||
} else if (typeField.getName().equals(BigDecimal.class.getName())) {
|
|
||||||
field.set(object, new BigDecimal(value));
|
|
||||||
} else if (typeField.equals(Long.TYPE) || typeField.equals(Long.class)) {
|
|
||||||
field.set(object, Long.valueOf(value));
|
|
||||||
} else if (typeField.getName().equals(Date.class.getName())) {
|
|
||||||
field.set(object, SIMPLE_DATE_FORMAT.parse(value));
|
|
||||||
} else if (typeField.getName().equals(Boolean.class.getName())) {
|
|
||||||
field.set(object, Boolean.valueOf(value));
|
|
||||||
}
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
log.info(e.getMessage());
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Class<?>> setImplementsClasses(Config hazelcastConfig) {
|
|
||||||
List<Class<?>> mapStoreClasses = new ArrayList<>();
|
|
||||||
for (String mapName : hazelcastConfig.getMapConfigs().keySet()) {
|
|
||||||
Class<?> clazz = classByMapStoreName.get(mapName);
|
|
||||||
if (clazz != null)
|
|
||||||
mapStoreClasses.add(clazz);
|
|
||||||
}
|
|
||||||
return mapStoreClasses;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue