Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
ialbert 2022-12-28 18:06:08 +03:00
commit ad410be755
15 changed files with 79 additions and 39 deletions

View file

@ -11,6 +11,7 @@ public abstract class BusinessEvent<T extends SpcexObjectBase /*BusinessObject*/
private Instant eventTime;
private Long userId;
private String eventType; // varchar(4)
public Instant getEventTime() {
return eventTime;
@ -20,6 +21,14 @@ public abstract class BusinessEvent<T extends SpcexObjectBase /*BusinessObject*/
this.eventTime = eventTime;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public Long getUserId() {
return userId;
}
@ -36,6 +45,7 @@ public abstract class BusinessEvent<T extends SpcexObjectBase /*BusinessObject*/
public String toString() {
return getClass().getSimpleName() + "{" +
"eventTime=" + eventTime +
"eventType=" + eventType +
", userId=" + userId +
", object=" + getObject() +
'}';

View file

@ -27,7 +27,7 @@ public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<Account
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"ACCOUNT_BALANCE_ID", "COMPANY_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT_ID", "ACCOUNT_TYPE",
"ACCOUNT", "OPEN_BALANCE_AMOUNT", "START_BALANCE_AMOUNT", "CLOSE_BALANCE_AMOUNT",
"TRADE_BALANCE_AMOUNT", "FREE_BALANCE_AMOUNT", "CHANGE_BALANCE_AMOUNT",
@ -42,6 +42,7 @@ public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<Account
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"ACCOUNT_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT", "ACCOUNT_TYPE", "RELATION_ID", "ACCOUNT_STATUS", "PROCESSING_SIGN", "COMPANY_ID"
};
}
@ -38,6 +38,7 @@ public class AccountHistoryMapStore extends TemplateEventMapStore<AccountHistory
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<Account
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"ACCOUNT_ROUTING_ID", "DESTINATION_ID", "RELATION_ID", "SOURCE_ID"
};
}
@ -38,6 +38,7 @@ public class AccountRoutingHistoryMapStore extends TemplateEventMapStore<Account
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccoun
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"BANK_ACCOUNT_ID", "ACCOUNT_ID", "BANK_IDENTIFICATION_CODE", "BANK_NAME", "CORRESPONDENT_ACCOUNT", "CORRESPONDENT_ACCOUNT_NAME", "CURRENCY", "DESTINATION", "IBAN", "INTERNATIONAL_TRANSFER_SIGN", "SWIFT_CODE", "TAXPAYER_IDENTIFICATION_NUMBER", "TAX_REGISTRATION_REASON_CODE", "ACCOUNT", "COMPANY_ID"
};
}
@ -38,6 +38,7 @@ public class BankAccountHistoryMapStore extends TemplateEventMapStore<BankAccoun
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),

View file

@ -32,17 +32,17 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
@Override
public String[] getFields() {
return new String[]{
"id", "event_time", "event_user_id",
"id", "event_time", "event_type", "event_user_id",
"company_id", "created_at", "updated_at", "trading_code", "clearing_code", "registration_code", "workflow_status", "short_name", "full_name"
};
}
public String[] getFieldsForCompanyInfo() {
return new String[]{
"id", "event_time", "event_user_id",
"id", "event_time", "event_type", "event_user_id",
"company_info_id", "company_id", "corporation_sole_type", "country_code", "description",
"professional_sign", "legal_kind", "organization_type", "residence", "short_name", "full_name",
"short_name_eng", "full_name_eng", "trading_code", "clearing_code", "registration_code"
"professional_sign", "legal_kind", "organization_type", "residence", "short_name_eng", "full_name_eng"
// ,"short_name", "full_name", "trading_code", "clearing_code", "registration_code"
};
}
@ -58,6 +58,7 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
Object[] args = new Object[]{
companyHistory.getId(),
TimeUtil.toDateFromInstant(companyHistory.getEventTime()),
companyHistory.getEventType(),
companyHistory.getUserId(),
company.getId(), // company_id
@ -94,6 +95,7 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
return new ArrayList<>(Arrays.asList(
rootUpdate.getId(),
TimeUtil.toDateFromInstant(rootUpdate.getEventTime()),
rootUpdate.getEventType(),
rootUpdate.getUserId(),
companyInfo.getId(), // company_info_id
@ -105,13 +107,13 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
companyInfo.getLegalKind(),
companyInfo.getOrganizationType(),
companyInfo.getResidence(),
companyInfo.getShortName(),
companyInfo.getFullName(),
companyInfo.getShortNameEng(),
companyInfo.getFullNameEng(),
companyInfo.getTradingCode(),
companyInfo.getClearingCode(),
companyInfo.getRegistrationCode()
companyInfo.getFullNameEng()
// companyInfo.getShortName(),
// companyInfo.getFullName(),
// companyInfo.getTradingCode(),
// companyInfo.getClearingCode(),
// companyInfo.getRegistrationCode()
));
}
}

View file

@ -27,7 +27,7 @@ public class InformationAccountHistoryMapStore extends TemplateEventMapStore<Inf
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"INFORMATION_ACCOUNT_ID", "ACCOUNT_ID", "CLEARING_ACCOUNT_ID", "COMPANY_ID"
};
}
@ -38,6 +38,7 @@ public class InformationAccountHistoryMapStore extends TemplateEventMapStore<Inf
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),

View file

@ -28,7 +28,7 @@ public class RelationHistoryMapStore extends TemplateEventMapStore<RelationHisto
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"RELATION_ID", "CREATED_AT", "UPDATED_AT", "CONSUMER_ID", "SUPPLIER_ID", "SERVICE_STATUS", "SERVICE", "SERVICE_PRODUCT", "COMMENT"
};
}
@ -39,6 +39,7 @@ public class RelationHistoryMapStore extends TemplateEventMapStore<RelationHisto
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class SecurityHistoryMapStore extends TemplateEventMapStore<SecurityHisto
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"SECURITY_ID", "CREATED_AT", "UPDATED_AT", "INSTRUMENT_TYPE", "ISSUER_ID", "SHORT_NAME", "FULL_NAME", "SHORT_NAME_ENG", "FULL_NAME_ENG", "SECURITY_SYMBOL", "WORKFLOW_STATUS"
};
}
@ -38,6 +38,7 @@ public class SecurityHistoryMapStore extends TemplateEventMapStore<SecurityHisto
Object[] args = new Object[]{
updateLog.getId(),
TimeUtil.toDateFromInstant(updateLog.getEventTime()),
updateLog.getEventType(),
updateLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class UserConnectHistoryMapStore extends TemplateEventMapStore<UserConnec
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"USER_CONNECT_ID", "CREATED_AT", "UPDATED_AT", "USER_ID", "CONNECTION_TIME", "DISCONNECTION_TIME", "SERVER_IP", "CLIENT_IP", "CONNECTION_STATE", "CLEARING_DATE", "ERROR_CODE", "ERROR_TEXT"
};
}
@ -38,6 +38,7 @@ public class UserConnectHistoryMapStore extends TemplateEventMapStore<UserConnec
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),

View file

@ -27,7 +27,7 @@ public class UserHistoryMapStore extends TemplateEventMapStore<UserHistory> {
@Override
public String[] getFields() {
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
return new String[]{"ID", "EVENT_TIME", "EVENT_TYPE", "EVENT_USER_ID",
"USER_CLS_ID", "CREATED_AT", "UPDATED_AT", "IDENTIFIER"
};
}
@ -38,6 +38,7 @@ public class UserHistoryMapStore extends TemplateEventMapStore<UserHistory> {
Object[] args = new Object[]{
historyLog.getId(),
TimeUtil.toDateFromInstant(historyLog.getEventTime()),
historyLog.getEventType(),
historyLog.getUserId(),
object.getId(),

View file

@ -37,8 +37,8 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
return new String[]{
"id", "company_id", "corporation_sole_type", "country_code", "description",
"professional_sign", "legal_kind", "organization_type", "residence",
"short_name_eng", "full_name_eng", "short_name", "full_name", "trading_code",
"clearing_code", "registration_code"
"short_name_eng", "full_name_eng"
// , "short_name", "full_name", "trading_code","clearing_code", "registration_code"
};
}
@ -114,11 +114,11 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
companyInfo.setResidence(rs.getString("RESIDENCE"));
companyInfo.setShortNameEng(rs.getString("SHORT_NAME_ENG"));
companyInfo.setFullNameEng(rs.getString("FULL_NAME_ENG"));
companyInfo.setShortName(rs.getString("SHORT_NAME"));
companyInfo.setFullName(rs.getString("FULL_NAME"));
companyInfo.setTradingCode(rs.getString("TRADING_CODE"));
companyInfo.setClearingCode(rs.getString("CLEARING_CODE"));
companyInfo.setRegistrationCode(rs.getString("REGISTRATION_CODE"));
// companyInfo.setShortName(rs.getString("SHORT_NAME"));
// companyInfo.setFullName(rs.getString("FULL_NAME"));
// companyInfo.setTradingCode(rs.getString("TRADING_CODE"));
// companyInfo.setClearingCode(rs.getString("CLEARING_CODE"));
// companyInfo.setRegistrationCode(rs.getString("REGISTRATION_CODE"));
return companyInfo;
}
);
@ -150,12 +150,12 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
companyInfo.getOrganizationType(),
companyInfo.getResidence(),
companyInfo.getShortNameEng(),
companyInfo.getFullNameEng(),
companyInfo.getShortName(),
companyInfo.getFullName(),
companyInfo.getTradingCode(),
companyInfo.getClearingCode(),
companyInfo.getRegistrationCode()
companyInfo.getFullNameEng()
// companyInfo.getShortName(),
// companyInfo.getFullName(),
// companyInfo.getTradingCode(),
// companyInfo.getClearingCode(),
// companyInfo.getRegistrationCode()
));
return companyInfoArgs;
}

View file

@ -15,9 +15,12 @@ import java.time.Instant;
public abstract class AbstractUpdateMapService implements InitializingBean,
EntryAddedListener<Long, Object>, EntryUpdatedListener<Long, Object>, EntryRemovedListener<Long, Object> {
protected final String EVENT_CREATE = "CREATE";
protected final String EVENT_UPDATE = "UPDATE";
protected final String EVENT_DELETE = "DELETE";
/**
* EVENT_TYPE_DICTIONARY
*/
protected final String EVENT_CREATE = "CRET";
protected final String EVENT_UPDATE = "UPDT";
protected final String EVENT_DELETE = "DELT";
protected final HazelcastInstance hazelcastServerInstance;
private final Logger log = LoggerFactory.getLogger(this.getClass());
@ -53,7 +56,11 @@ public abstract class AbstractUpdateMapService implements InitializingBean,
protected void createBusinessEvent(BusinessEvent businessEvent, String eventType) {
businessEvent.setId(hazelcastServerInstance.getIdGenerator(IMDGDistributedNames.MAP_SEQUENCE_NAME).newId());
businessEvent.setEventTime(Instant.now());
businessEvent.setUserId(0L); // todo откуда брать пользователя, причину изменений?
if (eventType != null && eventType.length() > 4) { // never
eventType = eventType.substring(0, 4);
}
businessEvent.setEventType(eventType);
businessEvent.setUserId(0L);
log.debug("business event created {} {}", businessEvent.getClass().getName(), businessEvent);
}
}

View file

@ -11,7 +11,7 @@ import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsCom
public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
public final Matcher<T> MATCHER = usingIgnoringFieldsComparator();
public final Matcher<T> MATCHER;
private final String mapName;
private final Class<T> clazz;
private SettingOperation settingOperation;
@ -21,12 +21,20 @@ public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz) {
this.mapName = mapName;
this.clazz = clazz;
this.MATCHER = usingIgnoringFieldsComparator();
}
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, SettingOperation settingOperation) {
this.mapName = mapName;
this.clazz = clazz;
this.settingOperation = settingOperation;
this.MATCHER = usingIgnoringFieldsComparator();
}
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, Matcher<T> MATCHER) {
this.mapName = mapName;
this.clazz = clazz;
this.MATCHER = MATCHER;
}
public String getMapName() {

View file

@ -30,6 +30,8 @@ import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsComparator;
public class RunnableMapNamesForTesting {
public static List<BusinessObjectAndBusinessEventForCheckMapStore> businessObjectAndBusinessEventForCheckMapStores;
public static List<DictionaryObjectForCheckMapStore> dictionaryObjectForCheckMapStores;
@ -47,7 +49,8 @@ public class RunnableMapNamesForTesting {
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountHistory, AccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRoutingHistory, AccountRoutingHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_BankAccountHistory, BankAccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class,
usingIgnoringFieldsComparator("object.profile.clearingCode", "object.profile.fullName", "object.profile.registrationCode", "object.profile.shortName", "object.profile.tradingCode")));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccountHistory, InformationAccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_RelationHistory, RelationHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SecurityHistory, SecurityHistory.class));
@ -58,7 +61,8 @@ public class RunnableMapNamesForTesting {
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Account, Account.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ClearingCalendar, ClearingCalendar.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Company, Company.class,
usingIgnoringFieldsComparator("profile.clearingCode", "profile.fullName", "profile.registrationCode", "profile.shortName", "profile.tradingCode")));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ErrorText, ErrorText.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Launcher, Launcher.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Listing, Listing.class,