Поправил комментарии, чуть пофиксил сторадж для update команд.

This commit is contained in:
AKurakin 2022-08-09 11:39:52 +03:00
parent e37357ebc1
commit f802c3f69d
7 changed files with 14 additions and 16 deletions

View file

@ -245,7 +245,6 @@
<accountType type="12" name="Идентификатор типа счета" shortname="Тип" searchable="true" sortable="true" visible="true" link="accountType"/> <accountType type="12" name="Идентификатор типа счета" shortname="Тип" searchable="true" sortable="true" visible="true" link="accountType"/>
<relationId field="relation.id" type="1" name="Идентификатор договорных отношений" shortname="Договор" searchable="true" sortable="true" visible="true" link="relation"/> <relationId field="relation.id" type="1" name="Идентификатор договорных отношений" shortname="Договор" searchable="true" sortable="true" visible="true" link="relation"/>
<status type="12" name="Идентификатор статуса" shortname="Статус" searchable="true" sortable="true" visible="true" link="workflowStatus"/> <status type="12" name="Идентификатор статуса" shortname="Статус" searchable="true" sortable="true" visible="true" link="workflowStatus"/>
<!-- todo <workflowStatusId type="1" name="Активный статус" shortname="Статус обработки" searchable="true" sortable="true" link="workflowStatus"/> -->
</account> </account>
<relation name="Договорные отношения" class="com.spicex.Static.company.Relation.Service" logUpdates = "true"> <relation name="Договорные отношения" class="com.spicex.Static.company.Relation.Service" logUpdates = "true">
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/> <id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>

View file

@ -9,8 +9,8 @@ import ru.spcex.platform.classes.base.SpcexObjectBase;
public class CompanyInfo extends SpcexObjectBase { public class CompanyInfo extends SpcexObjectBase {
private static final long serialVersionUID = ConstSerializable.serialVersionUID; private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long companyId; // Company.CompanyInfo.companyId = CompanyInfo.id todo company_id=id - эти поля можно не добавлять в объект, их администрирует мапстор. И в базе получается они задублируются-лишнее поле company_id. private Long companyId; // Company.CompanyInfo.companyId = CompanyInfo.id
private String clearingMemberCategory; // ref CHAR(4), todo такие ссылки на словари - не понял нужны как строки или нужны как ID? Зависит от политики обновления словарей. private String clearingMemberCategory; // ref CHAR(4),
private String corporationSoleType; // ref CHAR(4), private String corporationSoleType; // ref CHAR(4),
private String countryCode; //ref CHAR(4), private String countryCode; //ref CHAR(4),
private String description; private String description;

View file

@ -1,16 +1,16 @@
TODO ÏÅÐÅÏÈÑÀÒÜ ÐÈÄÌÈ ïîä íîâóþ áàçó TODO ÏÅÐÅÏÈÑÀÒÜ ÐÈÄÌÈ ïîä íîâóþ áàçó
1. Remove database 1. Remove database
rm -fr /opt/otc/db/otc.fdb rm -fr /opt/clearing/db/clearing.db
2. Create database file 2. Create database file
/opt/firebird/bin/isql -user SYSDBA -password SYSDBA /opt/postgresql(firebird?)/bin/isql -user SYSDBA -password SYSDBA
"CREATE DATABASE '/opt/otc/db/otc.fdb' USER "SYSDBA" PASSWORD 'SYSDBA' ROLE 'RDB$ADMIN' PAGE_SIZE = 16384 DEFAULT CHARACTER SET UTF8 COLLATION UNICODE_CI_AI;" "CREATE DATABASE '/opt/clearing/db/clearing.db' USER "SYSDBA" PASSWORD 'SYSDBA' ROLE 'RDB$ADMIN' PAGE_SIZE = 16384 DEFAULT CHARACTER SET UTF8 COLLATION UNICODE_CI_AI;"
"exit;" "exit;"
3. Create database tables 3. Create database tables
/opt/firebird/bin/isql -user SYSDBA -password SYSDBA -charset WIN1251 /opt/otc/db/otc.fdb /opt/firebird/bin/isql -user SYSDBA -password SYSDBA -charset WIN1251 /opt/clearing/db/clearing.db
"input DDL.sql;" "input DDL.sql;"
"exit;" "exit;"
4. Input initial data and dictionary values 4. Input initial data and dictionary values
cat DATA.sql | /opt/firebird/bin/isql -user SYSDBA -password SYSDBA /opt/otc/db/otc.fdb cat DATA.sql | /opt/firebird/bin/isql -user SYSDBA -password SYSDBA /opt/clearing/db/clearing.db

View file

@ -24,7 +24,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.getHazelcast().getDbSyncSeconds()); ;//todo config: .setWriteDelaySeconds(configRoot.getIMDG().getDbSyncSeconds());
} }
public ScheduledExecutorConfig makeDefaultScheduledExecutorConfig(String name) { public ScheduledExecutorConfig makeDefaultScheduledExecutorConfig(String name) {
@ -40,7 +40,7 @@ public class PoolMapConfigs {
.setName(mapName) .setName(mapName)
.setInMemoryFormat(InMemoryFormat.OBJECT) .setInMemoryFormat(InMemoryFormat.OBJECT)
.setMapStoreConfig(makeDefaultMapStoreConfig(mapBean)) .setMapStoreConfig(makeDefaultMapStoreConfig(mapBean))
//fixme config: .setBackupCount(configRoot.getHazelcast().getBackupCount()) //fixme config: .setBackupCount(configRoot.getIMDG().getBackupCount())
; ;
} }

View file

@ -5,6 +5,6 @@ import javax.sql.DataSource;
public class DbDefaultConfig { public class DbDefaultConfig {
public static DataSource getEmbeddedDatabase(String embeddedFilePath) { public static DataSource getEmbeddedDatabase(String embeddedFilePath) {
throw new UnsupportedOperationException("Are PostgreSQL not supported embedded DB?");//todo PsotgreSQL throw new UnsupportedOperationException("Are PostgreSQL not supported embedded DB?");//todo PsotgreSQL для юнит тестов
} }
} }

View file

@ -42,10 +42,9 @@ public class DbUtilsHelper {
" (" + Arrays.stream(fields).map(f -> "\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", ")) + ") values (" + " (" + Arrays.stream(fields).map(f -> "\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", ")) + ") values (" +
// Arrays.stream(fields).map(f -> "\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", ", ":", "")); // Arrays.stream(fields).map(f -> "\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", ", ":", ""));
String.join(", ", Collections.nCopies(fields.length, "?")) + String.join(", ", Collections.nCopies(fields.length, "?")) +
") WHERE "; ") ON CONFLICT ";
if (matchingKey != null) // PostgreSQL conflict_target fixme проверить мэтчинг updateOrInsert += "(" + matchingKey.toUpperCase()+")";
updateOrInsert += " " + matchingKey.toUpperCase(); updateOrInsert += " DO UPDATE SET " + Arrays.stream(fields).filter(f->!matchingKey.equalsIgnoreCase(f)).map(f -> "\"" + f.toUpperCase() + "\"=EXCLUDED.\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", "));
updateOrInsert += " CONFLICT DO UPDATE";
return updateOrInsert; return updateOrInsert;
} }

View file

@ -14,7 +14,7 @@ import java.util.Date;
/** /**
* Для работы с java.util.Date * Для работы с java.util.Date
* И конвертация в новый формат * И конвертация в новый формат
* todo копипаст юниттеста нужен. * todo добавить юниттест.
* todo зарефакторить * todo зарефакторить
*/ */
public class TimeUtil { public class TimeUtil {