http://jira.mfd.msk:8088/browse/CLS-1 DDL памсторы готовы на 90%

This commit is contained in:
akurakin 2022-07-01 21:00:33 +03:00
parent 13d55f1571
commit 0521ad3916
22 changed files with 718 additions and 29 deletions

View file

@ -13,7 +13,6 @@ public class Company extends BusinessObject {
private String clearingCode; private String clearingCode;
private String exchangeCode; private String exchangeCode;
private Long statusId; // WorkflowStatusDictionary private Long statusId; // WorkflowStatusDictionary
// private String fullName;
private CompanyInfo profile; private CompanyInfo profile;
@Override @Override
@ -22,7 +21,6 @@ public class Company extends BusinessObject {
"id=" + id + "id=" + id +
", clearingCode='" + clearingCode + '\'' + ", clearingCode='" + clearingCode + '\'' +
", exchangeCode='" + exchangeCode + '\'' + ", exchangeCode='" + exchangeCode + '\'' +
// ", fullName='" + fullName + '\'' +
", profile=" + profile + ", profile=" + profile +
", statusId=" + statusId + ", statusId=" + statusId +
'}'; '}';
@ -44,14 +42,6 @@ public class Company extends BusinessObject {
this.exchangeCode = exchangeCode; this.exchangeCode = exchangeCode;
} }
// public String getFullName() {
// return fullName;
// }
//
// public void setFullName(String fullName) {
// this.fullName = fullName;
// }
public Long getStatusId() { public Long getStatusId() {
return statusId; return statusId;
} }
@ -59,4 +49,12 @@ public class Company extends BusinessObject {
public void setStatusId(Long statusId) { public void setStatusId(Long statusId) {
this.statusId = statusId; this.statusId = statusId;
} }
public CompanyInfo getProfile() {
return profile;
}
public void setProfile(CompanyInfo profile) {
this.profile = profile;
}
} }

View file

@ -0,0 +1,14 @@
package ru.clearing.classes.StaticData.Company;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.StaticData.Profile.CompanyInfo;
import ru.clearing.classes.objects.BusinessEvent;
import ru.clearing.classes.objects.BusinessObject;
/**
* DB: COMPANY
*/
public class CompanyUpdate extends BusinessEvent<Company> {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
}

View file

@ -10,8 +10,8 @@ public class Contact extends ObjectBase {
private static final long serialVersionUID = ConstSerializable.serialVersionUID; private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long companyId; private Long companyId;
private String contact_type; // ref CHAR(4) private String contactType; // ref CHAR(4)
private String contact_value; private String contactValue;
public Long getCompanyId() { public Long getCompanyId() {
return companyId; return companyId;
@ -21,19 +21,19 @@ public class Contact extends ObjectBase {
this.companyId = companyId; this.companyId = companyId;
} }
public String getContact_type() { public String getContactType() {
return contact_type; return contactType;
} }
public void setContact_type(String contact_type) { public void setContactType(String contactType) {
this.contact_type = contact_type; this.contactType = contactType;
} }
public String getContact_value() { public String getContactValue() {
return contact_value; return contactValue;
} }
public void setContact_value(String contact_value) { public void setContactValue(String contactValue) {
this.contact_value = contact_value; this.contactValue = contactValue;
} }
} }

View file

@ -40,4 +40,13 @@ public abstract class BusinessEvent<T extends BusinessObject> extends ObjectBase
public void setObject(T object) { public void setObject(T object) {
this.object = object; this.object = object;
} }
@Override
public String toString() {
return getClass().getSimpleName() + "{" +
"eventTime=" + eventTime +
", userId=" + userId +
", object=" + object +
'}';
}
} }

View file

@ -1,7 +1,7 @@
package ru.clearing.platform.dictionary; package ru.clearing.platform.dictionary;
/** /**
* Database table: COMPANY_ROLE_DICTIONARY * Database table: COUNTRY_CODE_DICTIONARY
*/ */
public class CountryCodeDictionary extends AbstractDictionary { public class CountryCodeDictionary extends AbstractDictionary {
private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID; private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID;

View file

@ -0,0 +1,66 @@
package ru.spcex.clearing.storage.businessobject;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.StaticData.Company.Company;
import ru.clearing.classes.StaticData.Profile.CompanyInfo;
import ru.spcex.clearing.storage.base.ObjectBaseMapStore;
import ru.spcex.clearing.storage.utils.DbUtilsHelper;
import java.util.*;
@Component
public class CompanyMapStore extends ObjectBaseMapStore<Company> {
public CompanyMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "COMPANY";
}
@Override
public String[] getFields() {
return new String[]{
"id"
};
}
protected final String insertStatement = DbUtilsHelper.createUpdateOrInsert(getTableName(), getFields(), "id");
@Override
public Collection<Company> load(Collection<Long> keys) {
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
(resultSet, i) -> {
Company company = new Company();
company.setId(resultSet.getObject("id", Long.class));
// contact.set(resultSet.getObject("", Long.class));
company.setProfile(new CompanyInfo());
//todo Company loader
return company;
});
}
@Override
public void store(Map<Long, Company> map) {
List<Object[]> batchArgs = new ArrayList<>();
for (Map.Entry<Long, Company> entry : map.entrySet()) {
Company company = entry.getValue();
Object[] args = new Object[]{
company.getId(),
// company.getCompanyId(),
// contact.getContactType(),
// contact.getContactValue()
//todo Company loader
};
batchArgs.add(args);
}
batchInsertUpdate(insertStatement, batchArgs);
}
}

View file

@ -61,8 +61,24 @@ public class HazelcastConfiguration {
) )
); );
config.addMapConfig(poolMapConfigs.map_AllowedDictionary());
config.addMapConfig(poolMapConfigs.map_ClearingMemberCategoryDictionary());
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_WorkflowStatusDictionary());
config.addMapConfig(poolMapConfigs.map_WorkflowStatusDictionary());
config.addMapConfig(poolMapConfigs.map_CompanyRoleSet());
config.addMapConfig(poolMapConfigs.map_CompanySymbols());
config.addMapConfig(poolMapConfigs.map_ProfileDocument());
config.addMapConfig(poolMapConfigs.map_Contact());
config.addMapConfig(poolMapConfigs.map_Company());
//todo config.addMapConfig(poolMapConfigs.map_CompanyUpdate());
return config; return config;
} }

View file

@ -4,8 +4,12 @@ import com.hazelcast.config.*;
import com.hazelcast.core.MapLoader; import com.hazelcast.core.MapLoader;
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.storage.dictionary.WorkflowStatusDictionaryMapStore; import ru.spcex.clearing.storage.businessobject.CompanyMapStore;
import ru.spcex.clearing.storage.dictionary.*;
import ru.spcex.clearing.storage.object.CompanyRoleSetMapStore; import ru.spcex.clearing.storage.object.CompanyRoleSetMapStore;
import ru.spcex.clearing.storage.object.CompanySymbolsMapStore;
import ru.spcex.clearing.storage.object.ContactMapStore;
import ru.spcex.clearing.storage.object.ProfileDocumentMapStore;
import ru.spcex.clearing.storage.utils.IMDGDistributedNames; import ru.spcex.clearing.storage.utils.IMDGDistributedNames;
@Configuration @Configuration
@ -53,22 +57,123 @@ public class PoolMapConfigs {
.setOrdered(ordered); .setOrdered(ordered);
} }
private MapIndexConfig makeMapIndexConfig(String attributeName) {
return makeMapIndexConfig(attributeName, false);
}
@Autowired @Autowired private AllowedDictionaryMapStore allowedDictionaryMapStore;
private WorkflowStatusDictionaryMapStore workflowStatusDictionaryMapStore; public MapConfig map_AllowedDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_AllowedDictionary, allowedDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private ClearingMemberCategoryDictionaryMapStore clearingMemberCategoryDictionaryMapStore;
public MapConfig map_ClearingMemberCategoryDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_ClearingMemberCategoryDictionary, clearingMemberCategoryDictionaryMapStore)
.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() { public MapConfig map_WorkflowStatusDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_WorkflowStatusDictionary, workflowStatusDictionaryMapStore) return makeDefaultMapConfig(IMDGDistributedNames.Map_WorkflowStatusDictionary, workflowStatusDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig()); .setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
} }
@Autowired @Autowired
private CompanyRoleSetMapStore companyRoleSetMapStore; private CompanyRoleSetMapStore companyRoleSetMapStore;
public MapConfig map_CompanyRoleSet() { public MapConfig map_CompanyRoleSet() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyRoleSet, companyRoleSetMapStore); return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyRoleSet, companyRoleSetMapStore)
.addMapIndexConfig(makeMapIndexConfig("companyId"));
}
@Autowired
private CompanySymbolsMapStore companySymbolsMapStore;
public MapConfig map_CompanySymbols() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanySymbols, companySymbolsMapStore)
.addMapIndexConfig(makeMapIndexConfig("companyId"))
.addMapIndexConfig(makeMapIndexConfig("companySymbol"));
}
@Autowired
private ProfileDocumentMapStore profileDocumentMapStore;
public MapConfig map_ProfileDocument() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_ProfileDocument, profileDocumentMapStore)
.addMapIndexConfig(makeMapIndexConfig("companyId"));
}
@Autowired
private ContactMapStore contactMapStore;
public MapConfig map_Contact() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_Contact, contactMapStore)
.addMapIndexConfig(makeMapIndexConfig("companyId"));
}
@Autowired
private CompanyMapStore companyMapStore;
public MapConfig map_Company() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore)
.addMapIndexConfig(makeMapIndexConfig("companyId"));
} }
} }

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.AllowedDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class AllowedDictionaryMapStore extends DictionaryMapStore<AllowedDictionary> {
public AllowedDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "ALLOWED_DICTIONARY";
}
@Override
public AllowedDictionary getDictionaryObject() {
return new AllowedDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.ClearingMemberCategoryDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class ClearingMemberCategoryDictionaryMapStore extends DictionaryMapStore<ClearingMemberCategoryDictionary> {
public ClearingMemberCategoryDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "CLEARING_MEMBER_CATEGORY_DICTIONARY";
}
@Override
public ClearingMemberCategoryDictionary getDictionaryObject() {
return new ClearingMemberCategoryDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.CompanyRoleDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class CompanyRoleDictionaryMapStore extends DictionaryMapStore<CompanyRoleDictionary> {
public CompanyRoleDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "COMPANY_ROLE_DICTIONARY";
}
@Override
public CompanyRoleDictionary getDictionaryObject() {
return new CompanyRoleDictionary();
}
}

View file

@ -0,0 +1,37 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.CompanySymbolDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class CompanySymbolDictionaryMapStore extends DictionaryMapStore<CompanySymbolDictionary> {
public CompanySymbolDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "DD";
}
@Override
public CompanySymbolDictionary getDictionaryObject() {
return new CompanySymbolDictionary();
}
@Override
protected CompanySymbolDictionary mapRow(ResultSet rs, int rowNum) throws SQLException {
CompanySymbolDictionary dictionary = getDictionaryObject();
dictionary.setId(rs.getLong("id"));
dictionary.setCode(rs.getString("code"));
dictionary.setName(rs.getString("name"));
dictionary.setShortname(rs.getString("shortname"));
return dictionary;
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.ContactTypeDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class ContactTypeDictionaryMapStore extends DictionaryMapStore<ContactTypeDictionary> {
public ContactTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "CONTACT_TYPE_DICTIONARY";
}
@Override
public ContactTypeDictionary getDictionaryObject() {
return new ContactTypeDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.CorporationSoleTypeDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class CorporationSoleTypeDictionaryMapStore extends DictionaryMapStore<CorporationSoleTypeDictionary> {
public CorporationSoleTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "CORPORATION_SOLE_TYPE_DICTIONARY";
}
@Override
public CorporationSoleTypeDictionary getDictionaryObject() {
return new CorporationSoleTypeDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.CountryCodeDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class CountryCodeDictionaryMapStore extends DictionaryMapStore<CountryCodeDictionary> {
public CountryCodeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "COUNTRY_CODE_DICTIONARY";
}
@Override
public CountryCodeDictionary getDictionaryObject() {
return new CountryCodeDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.DocumentTypeDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class DocumentTypeDictionaryMapStore extends DictionaryMapStore<DocumentTypeDictionary> {
public DocumentTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "DOCUMENT_TYPE_DICTIONARY";
}
@Override
public DocumentTypeDictionary getDictionaryObject() {
return new DocumentTypeDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.LegalKindDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class LegalKindDictionaryMapStore extends DictionaryMapStore<LegalKindDictionary> {
public LegalKindDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "LEGAL_KIND_DICTIONARY";
}
@Override
public LegalKindDictionary getDictionaryObject() {
return new LegalKindDictionary();
}
}

View file

@ -0,0 +1,24 @@
package ru.spcex.clearing.storage.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.OrganizationTypeDictionary;
import ru.spcex.clearing.storage.base.DictionaryMapStore;
@Component
public class OrganizationTypeDictionaryMapStore extends DictionaryMapStore<OrganizationTypeDictionary> {
public OrganizationTypeDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "ORGANIZATION_TYPE_DICTIONARY";
}
@Override
public OrganizationTypeDictionary getDictionaryObject() {
return new OrganizationTypeDictionary();
}
}

View file

@ -0,0 +1,65 @@
package ru.spcex.clearing.storage.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.StaticData.Company.CompanyRoleSet;
import ru.clearing.classes.StaticData.Company.CompanySymbols;
import ru.spcex.clearing.storage.base.ObjectBaseMapStore;
import ru.spcex.clearing.storage.utils.DbUtilsHelper;
import java.util.*;
@Component
public class CompanySymbolsMapStore extends ObjectBaseMapStore<CompanySymbols> {
public CompanySymbolsMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "COMPANY_SYMBOLS";
}
@Override
public String[] getFields() {
return new String[]{
"id", "company_id", "company_symbol", "company_symbol_value"
};
}
protected final String insertStatement = DbUtilsHelper.createUpdateOrInsert(getTableName(), getFields(), "id");
@Override
public Collection<CompanySymbols> load(Collection<Long> keys) {
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
(resultSet, i) -> {
CompanySymbols companySymbols = new CompanySymbols();
companySymbols.setId(resultSet.getObject("id", Long.class));
companySymbols.setCompanyId(resultSet.getObject("companyid", Long.class));
companySymbols.setCompanySymbol(resultSet.getObject("companysymbol", String.class));
companySymbols.setCompanySymbolValue(resultSet.getObject("companysymbolvalue", String.class));
return companySymbols;
});
}
@Override
public void store(Map<Long, CompanySymbols> map) {
List<Object[]> batchArgs = new ArrayList<>();
for (Map.Entry<Long, CompanySymbols> entry : map.entrySet()) {
CompanySymbols companySymbols = entry.getValue();
Object[] args = new Object[]{
companySymbols.getId(),
companySymbols.getCompanyId(),
companySymbols.getCompanySymbol(),
companySymbols.getCompanySymbolValue()
};
batchArgs.add(args);
}
batchInsertUpdate(insertStatement, batchArgs);
}
}

View file

@ -0,0 +1,64 @@
package ru.spcex.clearing.storage.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.StaticData.Profile.Contact;
import ru.spcex.clearing.storage.base.ObjectBaseMapStore;
import ru.spcex.clearing.storage.utils.DbUtilsHelper;
import java.util.*;
@Component
public class ContactMapStore extends ObjectBaseMapStore<Contact> {
public ContactMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "CONTACT";
}
@Override
public String[] getFields() {
return new String[]{
"id", "company_id", "company_symbol", "company_symbol_value"
};
}
protected final String insertStatement = DbUtilsHelper.createUpdateOrInsert(getTableName(), getFields(), "id");
@Override
public Collection<Contact> load(Collection<Long> keys) {
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
(resultSet, i) -> {
Contact contact = new Contact();
contact.setId(resultSet.getObject("id", Long.class));
contact.setCompanyId(resultSet.getObject("company_id", Long.class));
contact.setContactType(resultSet.getObject("contact_type", String.class));
contact.setContactValue(resultSet.getObject("contact_value", String.class));
return contact;
});
}
@Override
public void store(Map<Long, Contact> map) {
List<Object[]> batchArgs = new ArrayList<>();
for (Map.Entry<Long, Contact> entry : map.entrySet()) {
Contact contact = entry.getValue();
Object[] args = new Object[]{
contact.getId(),
contact.getCompanyId(),
contact.getContactType(),
contact.getContactValue()
};
batchArgs.add(args);
}
batchInsertUpdate(insertStatement, batchArgs);
}
}

View file

@ -0,0 +1,82 @@
package ru.spcex.clearing.storage.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.StaticData.Profile.ProfileDocument;
import ru.spcex.clearing.storage.base.ObjectBaseMapStore;
import ru.spcex.clearing.storage.utils.DbUtilsHelper;
import ru.spcex.clearing.storage.utils.TimeUtil;
import java.util.*;
@Component
public class ProfileDocumentMapStore extends ObjectBaseMapStore<ProfileDocument> {
public ProfileDocumentMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "PROFILE_DOCUMENT";
}
@Override
public String[] getFields() {
return new String[]{
"id", "company_id", "document_type", "issue_date", "issue_place", "issuer", "issuer_code",
"name", "number", "place", "valid_from_date", "valid_to_date"
};
}
protected final String insertStatement = DbUtilsHelper.createUpdateOrInsert(getTableName(), getFields(), "id");
@Override
public Collection<ProfileDocument> load(Collection<Long> keys) {
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
(resultSet, i) -> {
ProfileDocument profileDocument = new ProfileDocument();
profileDocument.setId(resultSet.getObject("id", Long.class));
profileDocument.setCompanyId(resultSet.getObject("company_id", Long.class));
profileDocument.setDocumentType(resultSet.getObject("document_type", String.class));
profileDocument.setIssueDate(getInstantFromTimestamp(resultSet,"issue_date"));
profileDocument.setIssuePlace(resultSet.getObject("issue_place", String.class));
profileDocument.setIssuer(resultSet.getObject("issuer", String.class));
profileDocument.setIssuerCode(resultSet.getObject("issuer_code", String.class));
profileDocument.setName(resultSet.getObject("name", String.class));
profileDocument.setNumber(resultSet.getObject("number", String.class));
profileDocument.setPlace(resultSet.getObject("place", String.class));
profileDocument.setValidFromDate(getInstantFromTimestamp(resultSet,"valid_from_date"));
profileDocument.setValidToDate(getInstantFromTimestamp(resultSet,"valid_to_date"));
return profileDocument;
});
}
@Override
public void store(Map<Long, ProfileDocument> map) {
List<Object[]> batchArgs = new ArrayList<>();
for (Map.Entry<Long, ProfileDocument> entry : map.entrySet()) {
ProfileDocument profileDocument = entry.getValue();
Object[] args = new Object[]{
profileDocument.getId(),
profileDocument.getCompanyId(),
profileDocument.getDocumentType(),
TimeUtil.fromInstant(profileDocument.getIssueDate()),
profileDocument.getIssuePlace(),
profileDocument.getIssuer(),
profileDocument.getIssuerCode(),
profileDocument.getName(),
profileDocument.getNumber(),
profileDocument.getPlace(),
TimeUtil.fromInstant(profileDocument.getValidFromDate()),
TimeUtil.fromInstant(profileDocument.getValidToDate())
};
batchArgs.add(args);
}
batchInsertUpdate(insertStatement, batchArgs);
}
}

View file

@ -5,6 +5,23 @@ public final class IMDGDistributedNames {
private IMDGDistributedNames() { private IMDGDistributedNames() {
} }
public static final String Map_WorkflowStatusDictionary = "Map_WorkflowStatusDictionary"; public static final String Map_Company = "Map_Company";
public static final String Map_CompanyRoleSet = "Map_CompanyRoleSet"; public static final String Map_CompanyRoleSet = "Map_CompanyRoleSet";
public static final String Map_CompanySymbols = "Map_CompanySymbols";
public static final String Map_CompanyInfo = "Map_CompanyInfo";
public static final String Map_Contact = "Map_Contact";
public static final String Map_ProfileDocument = "Map_ProfileDocument";
public static final String Map_AllowedDictionary = "Map_AllowedDictionary";
public static final String Map_ClearingMemberCategoryDictionary = "Map_ClearingMemberCategoryDictionary";
public static final String Map_CompanyRoleDictionary = "Map_CompanyRoleDictionary";
public static final String Map_CompanySymbolDictionary = "Map_CompanySymbolDictionary";
public static final String Map_ContactTypeDictionary = "Map_ContactTypeDictionary";
public static final String Map_CorporationSoleTypeDictionary = "Map_CorporationSoleTypeDictionary";
public static final String Map_CountryCodeDictionary = "Map_CountryCodeDictionary";
public static final String Map_DocumentTypeDictionary = "Map_DocumentTypeDictionary";
public static final String Map_LegalKindDictionary = "Map_LegalKindDictionary";
public static final String Map_OrganizationTypeDictionary = "Map_OrganizationTypeDictionary";
public static final String Map_WorkflowStatusDictionary = "Map_WorkflowStatusDictionary";
} }