From cf6f80a0cfa9f86cace6951663269a465da74371 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Wed, 28 Dec 2022 12:57:22 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=97=D0=B0=D0=BA=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BB=D0=B8=D1=88?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8F(setShortName,=20s?= =?UTF-8?q?etFullName,=20setTradingCode,=20setClearingCode,=20setRegistrat?= =?UTF-8?q?ionCode)=20=D0=B2=20CompanyHistoryMapStore=20=D0=B8=20CompanyMa?= =?UTF-8?q?pStore.=20=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../businessevent/CompanyHistoryMapStore.java | 16 ++++++------ .../imdg/businessobject/CompanyMapStore.java | 26 +++++++++---------- ...bjectAndBusinessEventForCheckMapStore.java | 10 ++++++- .../structure/RunnableMapNamesForTesting.java | 8 ++++-- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/CompanyHistoryMapStore.java b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/CompanyHistoryMapStore.java index 5c0e5a212..0ba4f25b9 100644 --- a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/CompanyHistoryMapStore.java +++ b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/CompanyHistoryMapStore.java @@ -41,8 +41,8 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore { 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 { 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 { 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; } diff --git a/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/BusinessObjectAndBusinessEventForCheckMapStore.java b/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/BusinessObjectAndBusinessEventForCheckMapStore.java index ed1548ae4..59bb6b6b6 100644 --- a/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/BusinessObjectAndBusinessEventForCheckMapStore.java +++ b/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/BusinessObjectAndBusinessEventForCheckMapStore.java @@ -11,7 +11,7 @@ import static ru.spcex.clearing.imdg.utils.MatcherFactory.usingIgnoringFieldsCom public class BusinessObjectAndBusinessEventForCheckMapStore { - public final Matcher MATCHER = usingIgnoringFieldsComparator(); + public final Matcher MATCHER; private final String mapName; private final Class clazz; private SettingOperation settingOperation; @@ -21,12 +21,20 @@ public class BusinessObjectAndBusinessEventForCheckMapStore { public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class clazz) { this.mapName = mapName; this.clazz = clazz; + this.MATCHER = usingIgnoringFieldsComparator(); } public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class clazz, SettingOperation settingOperation) { this.mapName = mapName; this.clazz = clazz; this.settingOperation = settingOperation; + this.MATCHER = usingIgnoringFieldsComparator(); + } + + public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class clazz, Matcher MATCHER) { + this.mapName = mapName; + this.clazz = clazz; + this.MATCHER = MATCHER; } public String getMapName() { diff --git a/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java b/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java index 3cb9e7407..b40d6f16f 100644 --- a/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java +++ b/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java @@ -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 businessObjectAndBusinessEventForCheckMapStores; public static List 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, From 301d06a4c426da8a516fd091741a14288cbebdf7 Mon Sep 17 00:00:00 2001 From: AKurakin Date: Wed, 28 Dec 2022 14:51:12 +0300 Subject: [PATCH 2/2] =?UTF-8?q?imdg=20http://jira.mfd.msk:8088/browse/CLS-?= =?UTF-8?q?198=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20eventType=20?= =?UTF-8?q?=D0=B2=20=5FHISTORY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clearing/classes/objects/BusinessEvent.java | 10 ++++++++++ .../AccountBalanceHistoryMapStore.java | 3 ++- .../businessevent/AccountHistoryMapStore.java | 3 ++- .../AccountRoutingHistoryMapStore.java | 3 ++- .../businessevent/BankAccountHistoryMapStore.java | 3 ++- .../businessevent/CompanyHistoryMapStore.java | 6 ++++-- .../InformationAccountHistoryMapStore.java | 3 ++- .../businessevent/RelationHistoryMapStore.java | 3 ++- .../businessevent/SecurityHistoryMapStore.java | 3 ++- .../businessevent/UserConnectHistoryMapStore.java | 3 ++- .../imdg/businessevent/UserHistoryMapStore.java | 3 ++- .../imdg/services/AbstractUpdateMapService.java | 15 +++++++++++---- 12 files changed, 43 insertions(+), 15 deletions(-) diff --git a/clearing-parent/classes/src/main/java/ru/clearing/classes/objects/BusinessEvent.java b/clearing-parent/classes/src/main/java/ru/clearing/classes/objects/BusinessEvent.java index c077ebe2a..64a7508b4 100644 --- a/clearing-parent/classes/src/main/java/ru/clearing/classes/objects/BusinessEvent.java +++ b/clearing-parent/classes/src/main/java/ru/clearing/classes/objects/BusinessEvent.java @@ -11,6 +11,7 @@ public abstract class BusinessEvent(Arrays.asList( rootUpdate.getId(), TimeUtil.toDateFromInstant(rootUpdate.getEventTime()), + rootUpdate.getEventType(), rootUpdate.getUserId(), companyInfo.getId(), // company_info_id diff --git a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/InformationAccountHistoryMapStore.java b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/InformationAccountHistoryMapStore.java index 2cc1fb804..9805a3d2a 100644 --- a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/InformationAccountHistoryMapStore.java +++ b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/businessevent/InformationAccountHistoryMapStore.java @@ -27,7 +27,7 @@ public class InformationAccountHistoryMapStore extends TemplateEventMapStore { @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 { Object[] args = new Object[]{ historyLog.getId(), TimeUtil.toDateFromInstant(historyLog.getEventTime()), + historyLog.getEventType(), historyLog.getUserId(), object.getId(), diff --git a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/services/AbstractUpdateMapService.java b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/services/AbstractUpdateMapService.java index f90e5ee06..e447f052c 100644 --- a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/services/AbstractUpdateMapService.java +++ b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/services/AbstractUpdateMapService.java @@ -15,9 +15,12 @@ import java.time.Instant; public abstract class AbstractUpdateMapService implements InitializingBean, EntryAddedListener, EntryUpdatedListener, EntryRemovedListener { - 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); } }