Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5013fb2c17
176 changed files with 38899 additions and 78 deletions
54
.gitlab-ci.yml
Normal file
54
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
image:
|
||||
name: ${DOCKER_PROXY}/docker:latest
|
||||
pull_policy: if-not-present
|
||||
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
DOCKER_PROXY: "mirror.gcr.io"
|
||||
ACCESS_TOKEN: "glpat-t_i_xh-qo58ud2hT5vxj"
|
||||
|
||||
stages:
|
||||
- preflight
|
||||
- build
|
||||
- test
|
||||
- collect_results
|
||||
|
||||
preflight:
|
||||
image: ${DOCKER_PROXY}/bitnami/git:latest
|
||||
stage: preflight
|
||||
script:
|
||||
- pwd
|
||||
- git clone -b successful_set "http://gitlab-ci-token:$ACCESS_TOKEN@git.mfd.msk/mfd/clearing_test.git"
|
||||
artifacts:
|
||||
name: "$CI_COMMIT_REF_NAME"
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- clearing_test
|
||||
|
||||
build:
|
||||
image: ${DOCKER_PROXY}/maven:latest
|
||||
stage: build
|
||||
script:
|
||||
- mvn clean package -DskipTests -Pdistributive
|
||||
artifacts:
|
||||
name: "$CI_COMMIT_REF_NAME"
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- /builds/mfd/clearing/z-distr/target/clearing
|
||||
|
||||
test:
|
||||
stage: test
|
||||
variables:
|
||||
CLEARING_TEST_DIR: "/builds/mfd/clearing/clearing_test"
|
||||
CLR_TEST_DIR: "/builds/mfd/clearing/clr_test"
|
||||
RESULT_FILES_DIR: "/builds/mfd/clearing/clr_test/result-files"
|
||||
script:
|
||||
- echo "Installing maven and python" && apk update && apk add maven python3
|
||||
- echo "Copying jar files to clearing-all/bin" && cp -r /builds/mfd/clearing/z-distr/target/clearing/bin ./clr_test/clearing-all/bin
|
||||
- echo "Copying DDL.sql to db directory" && cp /builds/mfd/clearing/z-distr/target/clearing/db/DDL.sql ./db
|
||||
- python3 clr_test/run_test_docker_containers.py
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
when: always
|
||||
paths:
|
||||
- $CI_PROJECT_DIR/clr_test/mnt
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
|
@ -233,6 +233,19 @@
|
|||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
<!-- <transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>data_register_code.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/data.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>data_register_code.sql</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet> -->
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<meta version="3.12.2.93">
|
||||
<meta version="3.12.8.94">
|
||||
<enums>
|
||||
<allowed id="1" code="ALWD" name="Разрешено"/>
|
||||
<allowed id="2" code="DEND" name="Запрещено"/>
|
||||
|
|
@ -258,15 +258,16 @@
|
|||
<sessionStatus id="3" code="CLOS" name="Клиринг завершен"/>
|
||||
<sessionStatus id="4" code="CLR0" name="Идет клиринг: Загрузка остатков и сверка"/>
|
||||
<sessionStatus id="5" code="CL01" name="Идет клиринг: Выбор и подготовка сделок"/>
|
||||
<sessionStatus id="6" code="CL02" name="Идет клиринг: Расчет обязательств и требований"/>
|
||||
<sessionStatus id="6" code="CL02" name="Идет клиринг: Формирование обязательств и требований"/>
|
||||
<sessionStatus id="7" code="CL03" name="Идет клиринг: Допуск обязательств и требований"/>
|
||||
<sessionStatus id="8" code="CL04" name="Идет клиринг: Включение в клиринговый пул"/>
|
||||
<sessionStatus id="9" code="CL05" name="Идет клиринг: Контроль и исключение обязательств"/>
|
||||
<sessionStatus id="9" code="CL05" name="Идет клиринг: Расчеты"/>
|
||||
<sessionStatus id="10" code="CL06" name="Идет клиринг: Создание обязательств и требований для расчета"/>
|
||||
<sessionStatus id="11" code="CL07" name="Идет клиринг: Расчеты"/>
|
||||
<sessionStatus id="11" code="CL07" name="Идет клиринг: Формирование поручений в ПРЦ и РДЦ"/>
|
||||
<sessionStatus id="12" code="CL08" name="Идет клиринг: Обработка результатов по расчетам"/>
|
||||
<sessionStatus id="13" code="CL09" name="Идет клиринг: Сверка на базе расчетов"/>
|
||||
<sessionStatus id="14" code="CL10" name="Идет клиринг: Формирование отчетов и реестров"/>
|
||||
<sessionStatus id="15" code="С0_1" name="Идет клиринг: Установка начального баланса в сессии"/>
|
||||
|
||||
<sessionType id="1" code="FINL" name="Итоговая клиринговая сессия"/>
|
||||
<sessionType id="2" code="MEDM" name="Промежуточная клиринговая сессия"/>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
<parent>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cleaning-builders</artifactId>
|
||||
<name>cleaning-builders</name>
|
||||
<description>Cleaning builders module</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
<name>clearing-validation</name>
|
||||
<description>Clearing-module, dependency version of platform-utils</description>
|
||||
<packaging>jar</packaging>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
@ -35,13 +35,13 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>dictionary</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
<artifactId>db-scripts</artifactId>
|
||||
<name>db-scripts</name>
|
||||
<description>db-scripts for PostgreSQL</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-- DB version: 3.12
|
||||
-- DATA version: 3.12.2.93
|
||||
-- DB version: 3.12.8.99
|
||||
-- DATA version: 3.12.8.94
|
||||
|
||||
|
||||
/* Dictionaries */
|
||||
|
|
@ -516,17 +516,17 @@ INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (4, 'CLR0', 'Иде
|
|||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (5, 'CL01', 'Идет клиринг: Выбор и подготовка сделок') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (6, 'CL02', 'Идет клиринг: Расчет обязательств и требований') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (6, 'CL02', 'Идет клиринг: Формирование обязательств и требований') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (7, 'CL03', 'Идет клиринг: Допуск обязательств и требований') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (8, 'CL04', 'Идет клиринг: Включение в клиринговый пул') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (9, 'CL05', 'Идет клиринг: Контроль и исключение обязательств') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (9, 'CL05', 'Идет клиринг: Расчеты') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (10, 'CL06', 'Идет клиринг: Создание обязательств и требований для расчета') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (11, 'CL07', 'Идет клиринг: Расчеты') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (11, 'CL07', 'Идет клиринг: Формирование поручений в ПРЦ и РДЦ') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (12, 'CL08', 'Идет клиринг: Обработка результатов по расчетам') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
|
|
@ -534,6 +534,8 @@ INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (13, 'CL09', 'Ид
|
|||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (14, 'CL10', 'Идет клиринг: Формирование отчетов и реестров') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_STATUS_DICTIONARY(ID, CODE, NAME) values (15, 'С0_1', 'Идет клиринг: Установка начального баланса в сессии') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_TYPE_DICTIONARY(ID, CODE, NAME) values (1, 'FINL', 'Итоговая клиринговая сессия') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO SESSION_TYPE_DICTIONARY(ID, CODE, NAME) values (2, 'MEDM', 'Промежуточная клиринговая сессия') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
<artifactId>dbf-exporter</artifactId>
|
||||
<name>dbf-exporter</name>
|
||||
<description>DBF exporter for DBF files</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
<artifactId>dbf-importer</artifactId>
|
||||
<name>dbf-importer</name>
|
||||
<description>DBF loader for DBF files</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
<name>Clearing dictionary</name>
|
||||
<description>Clearing dictionary</description>
|
||||
<packaging>jar</packaging>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
<parent>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<artifactId>extdb-importer</artifactId>
|
||||
<name>extdb-importer</name>
|
||||
<description>Extdb importer module. Аналог trade-importer.</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>imdg-hist</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
|
@ -36,13 +36,13 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>dictionary</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>cleaning-builders</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
<artifactId>imdg</artifactId>
|
||||
<name>Clearing in memory data grid</name>
|
||||
<packaging>jar</packaging>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
@ -32,13 +32,13 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>dictionary</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>cleaning-builders</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@ public class RegistryHistoryMapStore extends TemplateEventMapStore<RegistryHisto
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Long> loadAllKeys() {
|
||||
return defaultLoadAllKeysOnTodayByField("EVENT_TIME", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegistryHistory load(Long id) {
|
||||
if (!isLoadable(id)) return null;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>lim-exporter</artifactId>
|
||||
<name>Lim exporter</name>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
<name>_parent_clearing</name>
|
||||
<description>Clearing parent module</description>
|
||||
<packaging>pom</packaging>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
|
@ -43,6 +43,8 @@
|
|||
<module>swt-importer</module>
|
||||
<module>gateway-api</module>
|
||||
<module>imdg-hist</module>
|
||||
<module>xml-importer</module>
|
||||
<module>xml-exporter</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
<artifactId>reports-service</artifactId>
|
||||
<name>reports-service</name>
|
||||
<description>Service for creating reports</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<!-- Spring boot -->
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>cleaning-builders</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public class CurrencyPairSecurityService extends QueueConsumer implements Initia
|
|||
currencyPairSecurity.setFullName(req.getFullName());
|
||||
// currencyPairSecurity.setShortNameEng(req.getShortNameEng());
|
||||
// currencyPairSecurity.setFullNameEng(req.getFullNameEng());
|
||||
if (req.getWorkflowStatus() == null) {
|
||||
if (req.getWorkflowStatus() != null) {
|
||||
currencyPairSecurity.setWorkflowStatus(req.getWorkflowStatus());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
<name>security-util clearing</name>
|
||||
<description>Clearing misc util for verify user roles</description>
|
||||
<packaging>jar</packaging>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
@ -35,13 +35,13 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>dictionary</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>swt-exporter</artifactId>
|
||||
<name>Swt exporter</name>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
<parent>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<artifactId>test-clearing</artifactId>
|
||||
<name>Test-clearing</name>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
<parent>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<artifactId>trade-importer</artifactId>
|
||||
<name>trade-importer</name>
|
||||
<description>Trade importer module</description>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.100</version>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
2
clearing-parent/xml-exporter/.gitignore
vendored
Normal file
2
clearing-parent/xml-exporter/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
log/
|
||||
17
clearing-parent/xml-exporter/.idea/dataSources.xml
generated
Normal file
17
clearing-parent/xml-exporter/.idea/dataSources.xml
generated
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="clearing@localhost" uuid="8f6a6996-0d81-423c-b506-8dd4667b4c00">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://localhost:5433/clearing</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
119
clearing-parent/xml-exporter/pom.xml
Normal file
119
clearing-parent/xml-exporter/pom.xml
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xml-exporter</artifactId>
|
||||
<name>xml-exporter</name>
|
||||
<description>XML exporter for XML files</description>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-sftp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XML files -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Own dependencies -->
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-imdg-api-hazelcast-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- special logging -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>7.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- TEST -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>test-clearing</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package ru.spcex.clearing.xml.exporter;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
||||
@SpringBootApplication
|
||||
public class XMLExporterApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(XMLExporterApplication.class);
|
||||
builder.run(args);
|
||||
} catch (Throwable e) {
|
||||
LoggerFactory.getLogger(XMLExporterApplication.class).error("XML-Loader start failed: {} -> {}", e.getClass().getSimpleName(), e.getMessage());
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@Configuration
|
||||
public class ImdgConfig {
|
||||
@Bean("taskExecutorHazelcastClientInitializer")
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
}
|
||||
|
||||
@Bean("taskExecutorIdGeneratorAwaiter")
|
||||
public ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter() {
|
||||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Bean("imdgProvider")
|
||||
public ImdgProvider imdgProvider(@Qualifier("taskExecutorHazelcastClientInitializer") ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer,
|
||||
@Qualifier("taskExecutorIdGeneratorAwaiter") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
ExportXMLServiceSettings settings) {
|
||||
HazelcastClientParams params = new HazelcastClientParams();
|
||||
params.setClusterMembers(settings.getHazelcast().getClusterMembers());
|
||||
params.setLogin(settings.getHazelcast().getLogin());
|
||||
params.setPassword(settings.getHazelcast().getPassword());
|
||||
return new HazelcastService(taskExecutorHazelcastClientInitializer, taskExecutorIdGeneratorAwaiter, params);
|
||||
}
|
||||
|
||||
@Bean("executor")
|
||||
public ThreadPoolTaskExecutor executor(ExportXMLServiceSettings settings) {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setMaxPoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setCorePoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setThreadNamePrefix("xml-exporter-");
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(300);
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) {
|
||||
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
|
||||
if (maxPoolSz > 2) {
|
||||
pool.setKeepAliveSeconds(60);
|
||||
pool.setAllowCoreThreadTimeOut(true);
|
||||
}
|
||||
pool.setCorePoolSize(maxPoolSz);
|
||||
pool.setWaitForTasksToCompleteOnShutdown(waitForCompletion);
|
||||
return pool;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
|
||||
@Configuration
|
||||
public class KafkaConfig {
|
||||
@Autowired
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Bean
|
||||
public Consumer<String, Object> createConsumer(ExportXMLServiceSettings settings) {
|
||||
return KafkaConsumerFactory.consumer(settings.getKafkaConsumer());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public Producer<String, Object> createProducer(ExportXMLServiceSettings settings) {
|
||||
if (settings.getKafkaProducer() != null) {
|
||||
return KafkaProducerFactory.producer(settings.getKafkaProducer());
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Configuration
|
||||
public class KafkaSenderConfig {
|
||||
Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final ImdgProvider imdgProvider;
|
||||
|
||||
@Autowired
|
||||
public KafkaSenderConfig(ImdgProvider imdgProvider) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProducerFactory<String, Object> pf(ExportXMLServiceSettings settings) {
|
||||
if (settings.getKafkaProducer() == null) {
|
||||
return null;
|
||||
}
|
||||
KafkaProducerSettings kafkaSettings = settings.getKafkaProducer();
|
||||
return KafkaProducerFactory.producerFactory(kafkaSettings);
|
||||
}
|
||||
|
||||
@Bean("kafkaTemplate")
|
||||
public KafkaTemplate<String, Object> kafkaTemplate(ProducerFactory<String, Object> pf) {
|
||||
if (pf == null) {
|
||||
return null;
|
||||
}
|
||||
return new KafkaTemplate<>(pf);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Supplier<KafkaSender> kafkaSenderSupplier(KafkaTemplate<String, Object> kafkaTemplate,
|
||||
ImdgProvider imdgProvider) {
|
||||
ImdgId imdgIdGenerator = imdgProvider.getImdgIdGenerator();
|
||||
return () -> KafkaSender
|
||||
.setup()
|
||||
.setKafkaTemplate(kafkaTemplate)
|
||||
.idGenerator(imdgIdGenerator::nextId)
|
||||
.imdgProvider(s -> {
|
||||
Imdg<RequestInfo> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class);
|
||||
return imdg::insert;
|
||||
})
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import static org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Command.LS;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.annotation.Gateway;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway;
|
||||
import org.springframework.integration.file.remote.session.CachingSessionFactory;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean;
|
||||
import org.springframework.integration.sftp.gateway.SftpOutboundGateway;
|
||||
import org.springframework.integration.sftp.outbound.SftpMessageHandler;
|
||||
import org.springframework.integration.sftp.session.DefaultSftpSessionFactory;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
import org.springframework.messaging.handler.annotation.Payload;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
|
||||
@Profile("!test")
|
||||
@Configuration
|
||||
public class SFTPConfig {
|
||||
protected Logger log = LoggerFactory.getLogger(getClass());
|
||||
protected static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser();
|
||||
|
||||
@Bean
|
||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ExportXMLServiceSettings settings) {
|
||||
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
||||
factory.setHost(settings.getStore().getServerIp());
|
||||
factory.setPort(settings.getStore().getServerPort());
|
||||
factory.setUser(settings.getStore().getUser());
|
||||
factory.setPassword(settings.getStore().getPassword());
|
||||
factory.setAllowUnknownKeys(true);
|
||||
return new CachingSessionFactory<>(factory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "toSftpChannel")
|
||||
public MessageHandler handler(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
SftpMessageHandler handler = new SftpMessageHandler(sessionFactory);
|
||||
handler.setRemoteDirectoryExpression(EXPRESSION_PARSER.parseExpression("headers['path']"));
|
||||
handler.setAutoCreateDirectory(true);
|
||||
handler.setFileNameGenerator(message -> {
|
||||
if (message.getPayload() instanceof File) {
|
||||
return ((File) message.getPayload()).getName();
|
||||
} else {
|
||||
throw new IllegalArgumentException("File must expected as payload.");
|
||||
}
|
||||
});
|
||||
return handler;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/53655208/profile-doesnt-work-with-messaging-gateway
|
||||
@Bean("xmlGateway")
|
||||
public AnnotationGatewayProxyFactoryBean xmlGateway() {
|
||||
return new AnnotationGatewayProxyFactoryBean(XmlGateway.class);
|
||||
}
|
||||
|
||||
public interface XmlGateway {
|
||||
@Gateway(requestChannel = "toSftpChannel")
|
||||
void sendToSftp(@Payload File file, @Header("path") String path);
|
||||
|
||||
@Gateway(requestChannel = "listSftpChannel")
|
||||
List<SftpFileInfo> listFiles(@Payload String dir);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageChannel listSftpChannel(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
DirectChannel dc = new DirectChannel();
|
||||
dc.subscribe(handlerList(sessionFactory));
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageChannel toSftpChannel(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
DirectChannel dc = new DirectChannel();
|
||||
dc.subscribe(handler(sessionFactory));
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "listSftpChannel")
|
||||
public MessageHandler handlerList(SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
||||
SftpOutboundGateway sftpOutboundGateway = new SftpOutboundGateway(sessionFactory, LS.getCommand(), "payload");
|
||||
sftpOutboundGateway.setOption(AbstractRemoteFileOutboundGateway.Option.RECURSIVE);
|
||||
return sftpOutboundGateway;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
|
||||
@Profile("test")
|
||||
@Configuration
|
||||
public class SFTPMockConfig {
|
||||
@Bean("xmlGateway")
|
||||
public SFTPConfig.XmlGateway dbfGateway(){
|
||||
return new XGateway();
|
||||
}
|
||||
|
||||
public static class XGateway implements SFTPConfig.XmlGateway{
|
||||
|
||||
@Override
|
||||
public void sendToSftp(File file, String path) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SftpFileInfo> listFiles(String dir) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package ru.spcex.clearing.xml.exporter.config;
|
||||
|
||||
import com.ctc.wstx.stax.WstxInputFactory;
|
||||
import com.ctc.wstx.stax.WstxOutputFactory;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF02ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF03ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF05ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF07ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF51ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF53ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF54ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF56ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public class XMLExporterConfig {
|
||||
@Bean("mapOfTable")
|
||||
public Map<Table, ObjectTag<? extends SpcexObjectBase>> getMapOfTables() {
|
||||
Map<Table, ObjectTag<? extends SpcexObjectBase>> map = new HashMap<>();
|
||||
map.put(Table.S_DF02, new DF02ObjectTag());
|
||||
map.put(Table.S_DF03, new DF03ObjectTag());
|
||||
map.put(Table.S_DF05, new DF05ObjectTag());
|
||||
map.put(Table.S_DF07, new DF07ObjectTag());
|
||||
map.put(Table.S_DF51, new DF51ObjectTag());
|
||||
map.put(Table.S_DF53, new DF53ObjectTag());
|
||||
map.put(Table.S_DF54, new DF54ObjectTag());
|
||||
map.put(Table.S_DF56, new DF56ObjectTag());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Bean("xmlMapper")
|
||||
public XmlMapper xmlMapper() {
|
||||
XMLInputFactory inputFactory = new WstxInputFactory();
|
||||
XMLOutputFactory outputFactory = new WstxOutputFactory();
|
||||
|
||||
XmlFactory xmlFactory = XmlFactory.builder()
|
||||
.xmlInputFactory(inputFactory)
|
||||
.xmlOutputFactory(outputFactory)
|
||||
.build();
|
||||
|
||||
XmlMapper xmlMapper = new XmlMapper(xmlFactory);
|
||||
xmlMapper.registerModule(new JavaTimeModule());
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
return xmlMapper;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
public class Common {
|
||||
private String encoding;
|
||||
private int insertBatchSize;
|
||||
private int threadsCount;
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public int getInsertBatchSize() {
|
||||
return insertBatchSize;
|
||||
}
|
||||
|
||||
public void setInsertBatchSize(int insertBatchSize) {
|
||||
this.insertBatchSize = insertBatchSize;
|
||||
}
|
||||
|
||||
public int getThreadsCount() {
|
||||
return threadsCount;
|
||||
}
|
||||
|
||||
public void setThreadsCount(int threadsCount) {
|
||||
this.threadsCount = threadsCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
public class Cron {
|
||||
private String checkSrcDirCron;
|
||||
|
||||
public String getCheckSrcDirCron() {
|
||||
return checkSrcDirCron;
|
||||
}
|
||||
|
||||
public void setCheckSrcDirCron(String checkSrcDirCron) {
|
||||
this.checkSrcDirCron = checkSrcDirCron;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaConsumerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||
|
||||
@Component
|
||||
@PropertySource("file:${spring.config.location}/application.properties")
|
||||
@ConfigurationProperties("export-xml-service")
|
||||
public class ExportXMLServiceSettings {
|
||||
private HazelcastClientParams hazelcast;
|
||||
private KafkaConsumerSettings kafkaConsumer;
|
||||
private KafkaProducerSettings kafkaProducer;
|
||||
private Common common;
|
||||
private Store store;
|
||||
private Cron cron;
|
||||
|
||||
public HazelcastClientParams getHazelcast() {
|
||||
return hazelcast;
|
||||
}
|
||||
|
||||
public void setHazelcast(HazelcastClientParams hazelcast) {
|
||||
this.hazelcast = hazelcast;
|
||||
}
|
||||
|
||||
public KafkaConsumerSettings getKafkaConsumer() {
|
||||
return kafkaConsumer;
|
||||
}
|
||||
|
||||
public void setKafkaConsumer(KafkaConsumerSettings kafkaConsumer) {
|
||||
this.kafkaConsumer = kafkaConsumer;
|
||||
}
|
||||
|
||||
public Common getCommon() {
|
||||
return common;
|
||||
}
|
||||
|
||||
public void setCommon(Common common) {
|
||||
this.common = common;
|
||||
}
|
||||
|
||||
public Store getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
public void setStore(Store store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public Cron getCron() {
|
||||
return cron;
|
||||
}
|
||||
|
||||
public void setCron(Cron cron) {
|
||||
this.cron = cron;
|
||||
}
|
||||
|
||||
public KafkaProducerSettings getKafkaProducer() {
|
||||
return kafkaProducer;
|
||||
}
|
||||
|
||||
public void setKafkaProducer(KafkaProducerSettings kafkaProducer) {
|
||||
this.kafkaProducer = kafkaProducer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package ru.spcex.clearing.xml.exporter.config.settings;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Store {
|
||||
private String outDir;
|
||||
private String localTempDir;
|
||||
private String user;
|
||||
private String password;
|
||||
private String serverIp;
|
||||
private int serverPort;
|
||||
private Map<String, String> outPayValDir;
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
|
||||
public void setServerIp(String serverIp) {
|
||||
this.serverIp = serverIp;
|
||||
}
|
||||
|
||||
public int getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
|
||||
public void setServerPort(int serverPort) {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
public String getOutDir() {
|
||||
return outDir;
|
||||
}
|
||||
|
||||
public void setOutDir(String outDir) {
|
||||
this.outDir = outDir;
|
||||
}
|
||||
|
||||
public String getLocalTempDir() {
|
||||
return localTempDir;
|
||||
}
|
||||
|
||||
public void setLocalTempDir(String localTempDir) {
|
||||
this.localTempDir = localTempDir;
|
||||
}
|
||||
|
||||
public Map<String, String> getOutPayValDir() {
|
||||
return outPayValDir;
|
||||
}
|
||||
|
||||
public void setOutPayValDir(Map<String, String> outPayValDir) {
|
||||
this.outPayValDir = outPayValDir;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
|
||||
public class ResultContainer {
|
||||
private String sourceName; // имя инициатора (файла)
|
||||
private UUID uuid;
|
||||
private Table tableForExport;
|
||||
private File fileForExport;
|
||||
private Long groupId;
|
||||
private StageResult lastStageResult;
|
||||
private LocalDateTime registrationDateTime;
|
||||
private String memberCode;
|
||||
private DocumentTag documentTag;
|
||||
|
||||
public ResultContainer(Table tableForExport) {
|
||||
this.tableForExport = tableForExport;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Table getTableForExport() {
|
||||
return tableForExport;
|
||||
}
|
||||
|
||||
public void setTableForExport(Table tableForExport) {
|
||||
this.tableForExport = tableForExport;
|
||||
}
|
||||
|
||||
public File getFileForExport() {
|
||||
return fileForExport;
|
||||
}
|
||||
|
||||
public void setFileForExport(File fileForExport) {
|
||||
this.fileForExport = fileForExport;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public StageResult getLastStageResult() {
|
||||
return lastStageResult;
|
||||
}
|
||||
|
||||
public void setLastStageResult(StageResult lastStageResult) {
|
||||
this.lastStageResult = lastStageResult;
|
||||
}
|
||||
|
||||
public LocalDateTime getRegistrationDateTime() {
|
||||
return registrationDateTime;
|
||||
}
|
||||
|
||||
public void setRegistrationDateTime(LocalDateTime registrationDateTime) {
|
||||
this.registrationDateTime = registrationDateTime;
|
||||
}
|
||||
|
||||
public String getMemberCode() {
|
||||
return memberCode;
|
||||
}
|
||||
|
||||
public void setMemberCode(String memberCode) {
|
||||
this.memberCode = memberCode;
|
||||
}
|
||||
|
||||
public DocumentTag getDocumentTag() {
|
||||
return documentTag;
|
||||
}
|
||||
|
||||
public void setDocumentTag(DocumentTag documentTag) {
|
||||
this.documentTag = documentTag;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.enums;
|
||||
|
||||
import static ru.spcex.clearing.xml.exporter.logic.stages.PrepareXMLFile.SECTION;
|
||||
import static ru.spcex.clearing.xml.exporter.logic.stages.PrepareXMLFile.outDir;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
|
||||
public enum FilenameTemplate {
|
||||
df_section_dateTime {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return appendSection(resultContainer)
|
||||
.append(dateTime(resultContainer))
|
||||
.append(".XML").toString();
|
||||
}
|
||||
},
|
||||
df_section_dateTime_counter {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return appendSection(resultContainer)
|
||||
.append(dateTime(resultContainer))
|
||||
.append(counter(resultContainer, files))
|
||||
.append(".XML").toString();
|
||||
}
|
||||
},
|
||||
df_section_sameName {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
if (resultContainer.getSourceName() == null) {
|
||||
LoggerFactory.getLogger(getClass()).warn("{} groupId={}, SourceName no set. Do default name as df_section_dateTime_counter.", resultContainer.getTableForExport(), resultContainer.getGroupId());
|
||||
return df_section_dateTime_counter.getFileName(resultContainer, files);
|
||||
}
|
||||
String name = resultContainer.getSourceName();
|
||||
int i = name.indexOf("_");
|
||||
if (i < 0) throw new IllegalArgumentException("Unexpected source name (symbol _ not found): " + name);
|
||||
return outDir + File.separator +
|
||||
resultContainer.getTableForExport().getFilePrefix().toUpperCase(Locale.ROOT) +
|
||||
name.substring(i);
|
||||
}
|
||||
},
|
||||
df_section_dateTime_counter_mamberCode {
|
||||
@Override
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return appendSection(resultContainer)
|
||||
.append(dateTime(resultContainer))
|
||||
.append(counter(resultContainer, files))
|
||||
.append(memberCode(resultContainer))
|
||||
.append(".XML").toString();
|
||||
}
|
||||
};
|
||||
|
||||
protected StringBuilder appendSection(ResultContainer resultContainer) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append(outDir);
|
||||
result.append(File.separator);
|
||||
result.append(resultContainer.getTableForExport().getFilePrefix().toUpperCase(Locale.ROOT));
|
||||
result.append('_');
|
||||
result.append(SECTION);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StringBuilder dateTime(ResultContainer resultContainer) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('_');
|
||||
result.append("PRC");
|
||||
result.append(tsFormatter.format(resultContainer.getRegistrationDateTime()));
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StringBuilder counter(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('_');
|
||||
result.append(countSameFilesInDir(resultContainer.getTableForExport().getFilePrefix(), files) + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected StringBuilder memberCode(ResultContainer resultContainer) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append('_');
|
||||
result.append(resultContainer.getMemberCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Integer countSameFilesInDir(String prefixOfTable, List<SftpFileInfo> files) {
|
||||
final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
int res = 0;
|
||||
String timestampNow = utilFormatter.format(LocalDateTime.now());
|
||||
for (SftpFileInfo file : files) {
|
||||
if (file.isDirectory()) continue;
|
||||
String name = file.getFilename();
|
||||
String[] splitName = name.split("_");
|
||||
if (splitName.length < 3) {
|
||||
log.info("Filename did not contains 3 or 4+ separator \"_\": " + name);
|
||||
continue;
|
||||
}
|
||||
String prefix = splitName[0];
|
||||
String timestamp = splitName[2];
|
||||
|
||||
if (prefix.equalsIgnoreCase(prefixOfTable) && timestamp.contains(timestampNow)) {
|
||||
if (splitName.length < 4) {
|
||||
log.warn("Filename did not contains 4+ separator \"_\": " + name);
|
||||
continue;
|
||||
}
|
||||
String counter = splitName[3];
|
||||
int positionOfDot = counter.indexOf('.');
|
||||
if (positionOfDot != -1) {
|
||||
counter = counter.substring(0, positionOfDot);
|
||||
}
|
||||
res = Integer.max(res, Integer.parseInt(counter));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private static final DateTimeFormatter tsFormatter = DateTimeFormatter.ofPattern("yyMMddHHmm");
|
||||
private static final DateTimeFormatter utilFormatter = DateTimeFormatter.ofPattern("yyMMdd");
|
||||
|
||||
public String getFileName(ResultContainer resultContainer, List<SftpFileInfo> files) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.enums;
|
||||
|
||||
public enum StageResult {
|
||||
OK,
|
||||
ERROR,
|
||||
COMPLETE
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.enums;
|
||||
|
||||
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf05;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf07;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf51;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf54;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf56;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
public enum Table {
|
||||
S_DF02("DF-02", IMDGDistributedNames.Map_SDf02, SDf02.class),
|
||||
S_DF03("DF-03", IMDGDistributedNames.Map_SDf03, SDf03.class),
|
||||
S_DF05("DF-05", IMDGDistributedNames.Map_SDf05, SDf05.class),
|
||||
S_DF07("DF-07", IMDGDistributedNames.Map_SDf07, SDf07.class),
|
||||
S_DF51("DF-51", IMDGDistributedNames.Map_SDf51, SDf51.class),
|
||||
S_DF53("DF-53", IMDGDistributedNames.Map_SDf53, SDf53.class),
|
||||
S_DF54("DF-54", IMDGDistributedNames.Map_SDf54, SDf54.class),
|
||||
S_DF56("DF-56", IMDGDistributedNames.Map_SDf56, SDf56.class);
|
||||
|
||||
/**
|
||||
* Префикс имени файла для экспорта
|
||||
*/
|
||||
private final String filePrefix;
|
||||
|
||||
/**
|
||||
* Имя мапы hazelcast
|
||||
*/
|
||||
private final String hazelcastMapName;
|
||||
|
||||
/**
|
||||
* Класс объекта
|
||||
*/
|
||||
private final Class<? extends SpcexObjectBase> entityClass;
|
||||
|
||||
|
||||
Table(String filePrefix, String hazelcastMapName, Class<? extends SpcexObjectBase> entityClass) {
|
||||
this.filePrefix = filePrefix;
|
||||
this.hazelcastMapName = hazelcastMapName;
|
||||
this.entityClass = entityClass;
|
||||
}
|
||||
|
||||
public String getHazelcastMapName() {
|
||||
return hazelcastMapName;
|
||||
}
|
||||
|
||||
public String getFilePrefix() {
|
||||
return filePrefix;
|
||||
}
|
||||
|
||||
public Class<? extends SpcexObjectBase> getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
@JacksonXmlRootElement(localName = "DOCUMENT")
|
||||
public class DocumentTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEID")
|
||||
private String messageId;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETYPE")
|
||||
private String messageType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGENAME")
|
||||
private String messageName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEDATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate messageDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETIME")
|
||||
@JsonFormat(pattern = "HH:mm:ss")
|
||||
private LocalTime messageTime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SENDER")
|
||||
private String sender;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RECEIVER")
|
||||
private String receiver;
|
||||
|
||||
@JacksonXmlProperty(localName = "PARENTDOC")
|
||||
private ParentDocTag parentDoc;
|
||||
|
||||
@JacksonXmlElementWrapper(localName = "OBJECTS")
|
||||
@JacksonXmlProperty(localName = "OBJECT")
|
||||
private List<ObjectTag<? extends SpcexObjectBase>> objects;
|
||||
|
||||
public DocumentTag() {
|
||||
}
|
||||
|
||||
public String getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(String messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public String getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
public String getMessageName() {
|
||||
return messageName;
|
||||
}
|
||||
|
||||
public void setMessageName(String messageName) {
|
||||
this.messageName = messageName;
|
||||
}
|
||||
|
||||
public LocalDate getMessageDate() {
|
||||
return messageDate;
|
||||
}
|
||||
|
||||
public void setMessageDate(LocalDate messageDate) {
|
||||
this.messageDate = messageDate;
|
||||
}
|
||||
|
||||
public LocalTime getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(LocalTime messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getReceiver() {
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(String receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
public ParentDocTag getParentDoc() {
|
||||
return parentDoc;
|
||||
}
|
||||
|
||||
public void setParentDoc(ParentDocTag parentDoc) {
|
||||
this.parentDoc = parentDoc;
|
||||
}
|
||||
|
||||
public List<ObjectTag<? extends SpcexObjectBase>> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public void setObjects(List<ObjectTag<? extends SpcexObjectBase>> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DocumentTag that = (DocumentTag) o;
|
||||
return Objects.equals(messageId, that.messageId) && Objects.equals(messageType, that.messageType) && Objects.equals(messageName, that.messageName) && Objects.equals(messageDate, that.messageDate) && Objects.equals(messageTime, that.messageTime) && Objects.equals(sender, that.sender) && Objects.equals(receiver, that.receiver) && Objects.equals(parentDoc, that.parentDoc) && Objects.equals(objects, that.objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(messageId, messageType, messageName, messageDate, messageTime, sender, receiver, parentDoc, objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DocumentTag{" +
|
||||
"messageId='" + messageId + '\'' +
|
||||
", messageType='" + messageType + '\'' +
|
||||
", messageName='" + messageName + '\'' +
|
||||
", messageDate='" + messageDate + '\'' +
|
||||
", messageTime='" + messageTime + '\'' +
|
||||
", sender='" + sender + '\'' +
|
||||
", receiver='" + receiver + '\'' +
|
||||
", parentDoc=" + parentDoc +
|
||||
", objects=" + objects +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ParentDocTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PARENTID")
|
||||
private String parentId;
|
||||
|
||||
public ParentDocTag() {
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ParentDocTag that = (ParentDocTag) o;
|
||||
return Objects.equals(parentId, that.parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParentDocTag{" +
|
||||
"parentId='" + parentId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||
|
||||
public class DF02ObjectTag extends ObjectTag<SDf02> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "CURR_CODE")
|
||||
private String currCode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "REMAINDER")
|
||||
private String remainder;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_CODE")
|
||||
private String accCode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DAT")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dat;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MARKET")
|
||||
private String market;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME")
|
||||
private String accName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE")
|
||||
private String accType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUMENGAGE")
|
||||
private String sumengage;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUMUNBLOK")
|
||||
private String sumunblock;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "FILE_TYPE")
|
||||
private String fileType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RESULT")
|
||||
private String result;
|
||||
|
||||
public DF02ObjectTag() {
|
||||
super(SDf02.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf02 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.currCode = entity.getCurr_code();
|
||||
this.account = entity.getAccount();
|
||||
this.remainder = entity.getRemainder();
|
||||
this.deal = entity.getDeal();
|
||||
this.accCode = entity.getAcc_code();
|
||||
this.dat = LocalDate.parse(entity.getDat(), dtf);
|
||||
this.market = entity.getMarket();
|
||||
this.accName = entity.getAcc_name();
|
||||
this.accType = entity.getAcc_type();
|
||||
this.sumengage = entity.getSumengage();
|
||||
this.sumunblock = entity.getSumunblock();
|
||||
this.fileType = entity.getFile_type();
|
||||
this.result = entity.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.currCode;
|
||||
}
|
||||
|
||||
public String getCurrCode() {
|
||||
return currCode;
|
||||
}
|
||||
|
||||
public void setCurrCode(String currCode) {
|
||||
this.currCode = currCode;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getRemainder() {
|
||||
return remainder;
|
||||
}
|
||||
|
||||
public void setRemainder(String remainder) {
|
||||
this.remainder = remainder;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public String getAccCode() {
|
||||
return accCode;
|
||||
}
|
||||
|
||||
public void setAccCode(String accCode) {
|
||||
this.accCode = accCode;
|
||||
}
|
||||
|
||||
public LocalDate getDat() {
|
||||
return dat;
|
||||
}
|
||||
|
||||
public void setDat(LocalDate dat) {
|
||||
this.dat = dat;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public String getAccName() {
|
||||
return accName;
|
||||
}
|
||||
|
||||
public void setAccName(String accName) {
|
||||
this.accName = accName;
|
||||
}
|
||||
|
||||
public String getAccType() {
|
||||
return accType;
|
||||
}
|
||||
|
||||
public void setAccType(String accType) {
|
||||
this.accType = accType;
|
||||
}
|
||||
|
||||
public String getSumengage() {
|
||||
return sumengage;
|
||||
}
|
||||
|
||||
public void setSumengage(String sumengage) {
|
||||
this.sumengage = sumengage;
|
||||
}
|
||||
|
||||
public String getSumunblock() {
|
||||
return sumunblock;
|
||||
}
|
||||
|
||||
public void setSumunblock(String sumunblock) {
|
||||
this.sumunblock = sumunblock;
|
||||
}
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF02ObjectTag that = (DF02ObjectTag) o;
|
||||
return Objects.equals(currCode, that.currCode) && Objects.equals(account, that.account) && Objects.equals(remainder, that.remainder) && Objects.equals(deal, that.deal) && Objects.equals(accCode, that.accCode) && Objects.equals(dat, that.dat) && Objects.equals(market, that.market) && Objects.equals(accName, that.accName) && Objects.equals(accType, that.accType) && Objects.equals(sumengage, that.sumengage) && Objects.equals(sumunblock, that.sumunblock) && Objects.equals(fileType, that.fileType) && Objects.equals(result, that.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(currCode, account, remainder, deal, accCode, dat, market, accName, accType, sumengage, sumunblock, fileType, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF02ObjectTag{" +
|
||||
"currCode='" + currCode + '\'' +
|
||||
", account='" + account + '\'' +
|
||||
", remainder='" + remainder + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", accCode='" + accCode + '\'' +
|
||||
", dat=" + dat +
|
||||
", market='" + market + '\'' +
|
||||
", accName='" + accName + '\'' +
|
||||
", accType='" + accType + '\'' +
|
||||
", sumengage='" + sumengage + '\'' +
|
||||
", sumunblock='" + sumunblock + '\'' +
|
||||
", fileType='" + fileType + '\'' +
|
||||
", result='" + result + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
|
||||
public class DF03ObjectTag extends ObjectTag<SDf03> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE")
|
||||
private String segType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE")
|
||||
private String docType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF")
|
||||
private String docnmRef;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV")
|
||||
private String docnmprev;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
@JsonIgnore
|
||||
private String sbanknam2;
|
||||
@JsonIgnore
|
||||
private String sbanknam3;
|
||||
@JsonIgnore
|
||||
private String sbanknam4;
|
||||
@JsonIgnore
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
@JsonIgnore
|
||||
private String rbanknam2;
|
||||
@JsonIgnore
|
||||
private String rbanknam3;
|
||||
@JsonIgnore
|
||||
private String rbanknam4;
|
||||
@JsonIgnore
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1")
|
||||
private String specif1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "IMP_RESULT")
|
||||
private String impResult;
|
||||
|
||||
|
||||
public DF03ObjectTag() {
|
||||
super(SDf03.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf03 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.segType = entity.getSeg_type();
|
||||
this.docType = entity.getDoc_type();
|
||||
this.docnmRef = entity.getDocnm_ref();
|
||||
this.docnmprev = entity.getDocnmprev();
|
||||
this.cAccDeb = entity.getC_acc_deb();
|
||||
this.sbanknam1 = entity.getSbanknam1();
|
||||
this.sbanknam2 = entity.getSbanknam2();
|
||||
this.sbanknam3 = entity.getSbanknam3();
|
||||
this.sbanknam4 = entity.getSbanknam4();
|
||||
this.sbanknam5 = entity.getSbanknam5();
|
||||
this.cAccCred = entity.getC_acc_cred();
|
||||
this.rbanknam1 = entity.getRbanknam1();
|
||||
this.rbanknam2 = entity.getRbanknam2();
|
||||
this.rbanknam3 = entity.getRbanknam3();
|
||||
this.rbanknam4 = entity.getRbanknam4();
|
||||
this.rbanknam5 = entity.getRbanknam5();
|
||||
this.payDate = LocalDate.parse(entity.getPay_date(), dtf);
|
||||
this.payVal = entity.getPay_val();
|
||||
this.sumDeb = entity.getSum_deb();
|
||||
this.specif1 = entity.getSpecif_1();
|
||||
this.impResult = entity.getImp_result();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.payVal;
|
||||
}
|
||||
|
||||
public String getSegType() {
|
||||
return segType;
|
||||
}
|
||||
|
||||
public void setSegType(String segType) {
|
||||
this.segType = segType;
|
||||
}
|
||||
|
||||
public String getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(String docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocnmRef() {
|
||||
return docnmRef;
|
||||
}
|
||||
|
||||
public void setDocnmRef(String docnmRef) {
|
||||
this.docnmRef = docnmRef;
|
||||
}
|
||||
|
||||
public String getDocnmprev() {
|
||||
return docnmprev;
|
||||
}
|
||||
|
||||
public void setDocnmprev(String docnmprev) {
|
||||
this.docnmprev = docnmprev;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSpecif1() {
|
||||
return specif1;
|
||||
}
|
||||
|
||||
public void setSpecif1(String specif1) {
|
||||
this.specif1 = specif1;
|
||||
}
|
||||
|
||||
public String getImpResult() {
|
||||
return impResult;
|
||||
}
|
||||
|
||||
public void setImpResult(String impResult) {
|
||||
this.impResult = impResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF03ObjectTag that = (DF03ObjectTag) o;
|
||||
return Objects.equals(segType, that.segType) && Objects.equals(docType, that.docType) && Objects.equals(docnmRef, that.docnmRef) && Objects.equals(docnmprev, that.docnmprev) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(payDate, that.payDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(specif1, that.specif1) && Objects.equals(impResult, that.impResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(segType, docType, docnmRef, docnmprev, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, payDate, payVal, sumDeb, specif1, impResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF03ObjectTag{" +
|
||||
"segType='" + segType + '\'' +
|
||||
", docType='" + docType + '\'' +
|
||||
", docnmRef='" + docnmRef + '\'' +
|
||||
", docnmprev='" + docnmprev + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", specif1='" + specif1 + '\'' +
|
||||
", impResult='" + impResult + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf05;
|
||||
|
||||
public class DF05ObjectTag extends ObjectTag<SDf05> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TP")
|
||||
private BigDecimal tp;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DT")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dt;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TM")
|
||||
@JsonFormat(pattern = "hh:mm:ss")
|
||||
private LocalTime tm;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PR")
|
||||
private String pr;
|
||||
|
||||
public DF05ObjectTag() {
|
||||
super(SDf05.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf05 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
this.tp = entity.getTp();
|
||||
this.dt = entity.getDt();
|
||||
this.tm = LocalTime.parse(entity.getTm(), dtf);
|
||||
this.pr = entity.getPr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public BigDecimal getTp() {
|
||||
return tp;
|
||||
}
|
||||
|
||||
public void setTp(BigDecimal tp) {
|
||||
this.tp = tp;
|
||||
}
|
||||
|
||||
public LocalDate getDt() {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(LocalDate dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public LocalTime getTm() {
|
||||
return tm;
|
||||
}
|
||||
|
||||
public void setTm(LocalTime tm) {
|
||||
this.tm = tm;
|
||||
}
|
||||
|
||||
public String getPr() {
|
||||
return pr;
|
||||
}
|
||||
|
||||
public void setPr(String pr) {
|
||||
this.pr = pr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF05ObjectTag that = (DF05ObjectTag) o;
|
||||
return Objects.equals(tp, that.tp) && Objects.equals(dt, that.dt) && Objects.equals(tm, that.tm) && Objects.equals(pr, that.pr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(tp, dt, tm, pr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF05ObjectTag{" +
|
||||
"tp=" + tp +
|
||||
", dt=" + dt +
|
||||
", tm=" + tm +
|
||||
", pr='" + pr + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf07;
|
||||
|
||||
public class DF07ObjectTag extends ObjectTag<SDf07> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM")
|
||||
private BigDecimal sum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MARKET")
|
||||
private String market;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "TYPE")
|
||||
private String type;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "CLIENTN")
|
||||
private String clientN;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN")
|
||||
private String inn;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "BIC")
|
||||
private String bic;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPEC")
|
||||
private String spec;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private BigDecimal number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RESULT")
|
||||
private BigDecimal result;
|
||||
|
||||
|
||||
public DF07ObjectTag() {
|
||||
super(SDf07.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf07 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.account = entity.getAccount();
|
||||
this.sum = entity.getSum();
|
||||
this.market = entity.getMarket();
|
||||
this.type = entity.getType();
|
||||
this.deal = entity.getDeal();
|
||||
this.clientN = entity.getClientN();
|
||||
this.inn = entity.getInn();
|
||||
this.bic = entity.getBic();
|
||||
this.spec = entity.getSpec();
|
||||
this.number = entity.getNumber();
|
||||
this.result = entity.getResult();
|
||||
this.docNum = entity.getDoc_num();
|
||||
this.docDate = LocalDate.parse(entity.getDoc_date(), dtf);
|
||||
this.payVal = entity.getPay_val();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.payVal;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public BigDecimal getSum() {
|
||||
return sum;
|
||||
}
|
||||
|
||||
public void setSum(BigDecimal sum) {
|
||||
this.sum = sum;
|
||||
}
|
||||
|
||||
public String getMarket() {
|
||||
return market;
|
||||
}
|
||||
|
||||
public void setMarket(String market) {
|
||||
this.market = market;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public String getClientN() {
|
||||
return clientN;
|
||||
}
|
||||
|
||||
public void setClientN(String clientN) {
|
||||
this.clientN = clientN;
|
||||
}
|
||||
|
||||
public String getInn() {
|
||||
return inn;
|
||||
}
|
||||
|
||||
public void setInn(String inn) {
|
||||
this.inn = inn;
|
||||
}
|
||||
|
||||
public String getBic() {
|
||||
return bic;
|
||||
}
|
||||
|
||||
public void setBic(String bic) {
|
||||
this.bic = bic;
|
||||
}
|
||||
|
||||
public String getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public void setSpec(String spec) {
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public BigDecimal getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(BigDecimal number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public BigDecimal getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(BigDecimal result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF07ObjectTag that = (DF07ObjectTag) o;
|
||||
return Objects.equals(account, that.account) && Objects.equals(sum, that.sum) && Objects.equals(market, that.market) && Objects.equals(type, that.type) && Objects.equals(deal, that.deal) && Objects.equals(clientN, that.clientN) && Objects.equals(inn, that.inn) && Objects.equals(bic, that.bic) && Objects.equals(spec, that.spec) && Objects.equals(number, that.number) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(payVal, that.payVal) && Objects.equals(result, that.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(account, sum, market, type, deal, clientN, inn, bic, spec, number, docNum, docDate, payVal, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF07ObjectTag{" +
|
||||
"account='" + account + '\'' +
|
||||
", sum=" + sum +
|
||||
", market='" + market + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", clientN='" + clientN + '\'' +
|
||||
", inn='" + inn + '\'' +
|
||||
", bic='" + bic + '\'' +
|
||||
", spec='" + spec + '\'' +
|
||||
", number=" + number +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Objects;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf51;
|
||||
|
||||
public class DF51ObjectTag extends ObjectTag<SDf51> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private String number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "UNIXTIME")
|
||||
private Long unixtime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DATETIME")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime datetime;
|
||||
|
||||
public DF51ObjectTag() {
|
||||
super(SDf51.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf51 entity) {
|
||||
this.number = entity.getNumber();
|
||||
this.unixtime = Long.valueOf(entity.getDatetime());
|
||||
this.datetime = Instant.ofEpochMilli(this.unixtime).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Long getUnixtime() {
|
||||
return unixtime;
|
||||
}
|
||||
|
||||
public void setUnixtime(Long unixtime) {
|
||||
this.unixtime = unixtime;
|
||||
}
|
||||
|
||||
public LocalDateTime getDatetime() {
|
||||
return datetime;
|
||||
}
|
||||
|
||||
public void setDatetime(LocalDateTime datetime) {
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF51ObjectTag that = (DF51ObjectTag) o;
|
||||
return Objects.equals(number, that.number) && Objects.equals(unixtime, that.unixtime) && Objects.equals(datetime, that.datetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(number, unixtime, datetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF51ObjectTag{" +
|
||||
"number='" + number + '\'' +
|
||||
", unixtime=" + unixtime +
|
||||
", datetime=" + datetime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
|
||||
public class DF53ObjectTag extends ObjectTag<SDf53> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME")
|
||||
private String accName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate date;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "STATUS")
|
||||
private Long status;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE")
|
||||
private String accType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RESULT")
|
||||
private String result;
|
||||
|
||||
|
||||
public DF53ObjectTag() {
|
||||
super(SDf53.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf53 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.account = entity.getAccount();
|
||||
this.accName = entity.getAccName();
|
||||
this.deal = entity.getDeal();
|
||||
this.date = LocalDate.parse(entity.getDate(), dtf);
|
||||
this.status = entity.getStatus();
|
||||
this.accType = entity.getAccType();
|
||||
this.result = entity.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getAccName() {
|
||||
return accName;
|
||||
}
|
||||
|
||||
public void setAccName(String accName) {
|
||||
this.accName = accName;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Long getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Long status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getAccType() {
|
||||
return accType;
|
||||
}
|
||||
|
||||
public void setAccType(String accType) {
|
||||
this.accType = accType;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF53ObjectTag that = (DF53ObjectTag) o;
|
||||
return Objects.equals(account, that.account) && Objects.equals(accName, that.accName) && Objects.equals(deal, that.deal) && Objects.equals(date, that.date) && Objects.equals(status, that.status) && Objects.equals(accType, that.accType) && Objects.equals(result, that.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(account, accName, deal, date, status, accType, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF53ObjectTag{" +
|
||||
"account='" + account + '\'' +
|
||||
", accName='" + accName + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
", date=" + date +
|
||||
", status=" + status +
|
||||
", accType='" + accType + '\'' +
|
||||
", result='" + result + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,619 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf54;
|
||||
|
||||
public class DF54ObjectTag extends ObjectTag<SDf54> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE")
|
||||
private String segType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE")
|
||||
private String docType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF")
|
||||
private String docnmRef;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV")
|
||||
private String docnmprev;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKCODE")
|
||||
private String sbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB")
|
||||
private String cAccDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM")
|
||||
private String sbanknam1;
|
||||
@JsonIgnore
|
||||
private String sbanknam2;
|
||||
@JsonIgnore
|
||||
private String sbanknam3;
|
||||
@JsonIgnore
|
||||
private String sbanknam4;
|
||||
@JsonIgnore
|
||||
private String sbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKCODE")
|
||||
private String rbankcode;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED")
|
||||
private String cAccCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM")
|
||||
private String rbanknam1;
|
||||
@JsonIgnore
|
||||
private String rbanknam2;
|
||||
@JsonIgnore
|
||||
private String rbanknam3;
|
||||
@JsonIgnore
|
||||
private String rbanknam4;
|
||||
@JsonIgnore
|
||||
private String rbanknam5;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_TYPE")
|
||||
private String opType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "OP_ORDER")
|
||||
private String opOrder;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL")
|
||||
private String payVal;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB")
|
||||
private String sumDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SCLIENTN")
|
||||
private String sclientn1;
|
||||
@JsonIgnore
|
||||
private String sclientn2;
|
||||
@JsonIgnore
|
||||
private String sclientn3;
|
||||
@JsonIgnore
|
||||
private String sclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_DEB")
|
||||
private String innDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_DEB")
|
||||
private String kppDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_DEB")
|
||||
private String accDeb;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RCLIENTN")
|
||||
private String rclientn1;
|
||||
@JsonIgnore
|
||||
private String rclientn2;
|
||||
@JsonIgnore
|
||||
private String rclientn3;
|
||||
@JsonIgnore
|
||||
private String rclientn4;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "INN_CRED")
|
||||
private String innCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "KPP_CRED")
|
||||
private String kppCred;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACC_KR_1")
|
||||
private String accKr1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1")
|
||||
private String specif1;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SEND_TYPE")
|
||||
private String sendType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_RESULT")
|
||||
private String docResult;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM")
|
||||
private String docNum;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate docDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "VALUE_DATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate valueDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SWIFT_BEN")
|
||||
private String swiftBen;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SWIFT_INT")
|
||||
private String swiftInt;
|
||||
|
||||
|
||||
public DF54ObjectTag() {
|
||||
super(SDf54.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf54 entity) {
|
||||
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
this.segType = entity.getSeg_type();
|
||||
this.docType = entity.getDoc_type();
|
||||
this.docnmRef = entity.getDocnm_ref();
|
||||
this.docnmprev = entity.getDocnmprev();
|
||||
this.sbankcode = entity.getSbankcode();
|
||||
this.cAccDeb = entity.getC_acc_deb();
|
||||
this.sbanknam1 = entity.getSbanknam1();
|
||||
this.sbanknam2 = entity.getSbanknam2();
|
||||
this.sbanknam3 = entity.getSbanknam3();
|
||||
this.sbanknam4 = entity.getSbanknam4();
|
||||
this.sbanknam5 = entity.getSbanknam5();
|
||||
this.rbankcode = entity.getRbankcode();
|
||||
this.cAccCred = entity.getC_acc_cred();
|
||||
this.rbanknam1 = entity.getRbanknam1();
|
||||
this.rbanknam2 = entity.getRbanknam2();
|
||||
this.rbanknam3 = entity.getRbanknam3();
|
||||
this.rbanknam4 = entity.getRbanknam4();
|
||||
this.rbanknam5 = entity.getRbanknam5();
|
||||
this.opType = entity.getOp_type();
|
||||
this.opOrder = entity.getOp_order();
|
||||
this.payDate = LocalDate.parse(entity.getPay_date(), dtf);
|
||||
this.payVal = entity.getPay_val();
|
||||
this.sumDeb = entity.getSum_deb();
|
||||
this.sclientn1 = entity.getSclientn1();
|
||||
this.sclientn2 = entity.getSclientn2();
|
||||
this.sclientn3 = entity.getSclientn3();
|
||||
this.sclientn4 = entity.getSclientn4();
|
||||
this.innDeb = entity.getInn_deb();
|
||||
this.kppDeb = entity.getKpp_deb();
|
||||
this.accDeb = entity.getAcc_deb();
|
||||
this.rclientn1 = entity.getRclientn1();
|
||||
this.rclientn2 = entity.getRclientn2();
|
||||
this.rclientn3 = entity.getRclientn3();
|
||||
this.rclientn4 = entity.getRclientn4();
|
||||
this.innCred = entity.getInn_cred();
|
||||
this.kppCred = entity.getKpp_cred();
|
||||
this.accKr1 = entity.getAcc_kr_1();
|
||||
this.specif1 = entity.getSpecif_1();
|
||||
this.sendType = entity.getSend_type();
|
||||
this.docResult = entity.getDoc_result();
|
||||
this.docNum = entity.getDoc_num();
|
||||
this.docDate = LocalDate.parse(entity.getDoc_date(), dtf);
|
||||
this.valueDate = LocalDate.parse(entity.getValue_date(), dtf);
|
||||
this.swiftBen = entity.getSwift_ben();
|
||||
this.swiftInt = entity.getSwift_int();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return this.payVal;
|
||||
}
|
||||
|
||||
public String getSegType() {
|
||||
return segType;
|
||||
}
|
||||
|
||||
public void setSegType(String segType) {
|
||||
this.segType = segType;
|
||||
}
|
||||
|
||||
public String getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(String docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocnmRef() {
|
||||
return docnmRef;
|
||||
}
|
||||
|
||||
public void setDocnmRef(String docnmRef) {
|
||||
this.docnmRef = docnmRef;
|
||||
}
|
||||
|
||||
public String getDocnmprev() {
|
||||
return docnmprev;
|
||||
}
|
||||
|
||||
public void setDocnmprev(String docnmprev) {
|
||||
this.docnmprev = docnmprev;
|
||||
}
|
||||
|
||||
public String getSbankcode() {
|
||||
return sbankcode;
|
||||
}
|
||||
|
||||
public void setSbankcode(String sbankcode) {
|
||||
this.sbankcode = sbankcode;
|
||||
}
|
||||
|
||||
public String getcAccDeb() {
|
||||
return cAccDeb;
|
||||
}
|
||||
|
||||
public void setcAccDeb(String cAccDeb) {
|
||||
this.cAccDeb = cAccDeb;
|
||||
}
|
||||
|
||||
public String getSbanknam1() {
|
||||
return sbanknam1;
|
||||
}
|
||||
|
||||
public void setSbanknam1(String sbanknam1) {
|
||||
this.sbanknam1 = sbanknam1;
|
||||
}
|
||||
|
||||
public String getSbanknam2() {
|
||||
return sbanknam2;
|
||||
}
|
||||
|
||||
public void setSbanknam2(String sbanknam2) {
|
||||
this.sbanknam2 = sbanknam2;
|
||||
}
|
||||
|
||||
public String getSbanknam3() {
|
||||
return sbanknam3;
|
||||
}
|
||||
|
||||
public void setSbanknam3(String sbanknam3) {
|
||||
this.sbanknam3 = sbanknam3;
|
||||
}
|
||||
|
||||
public String getSbanknam4() {
|
||||
return sbanknam4;
|
||||
}
|
||||
|
||||
public void setSbanknam4(String sbanknam4) {
|
||||
this.sbanknam4 = sbanknam4;
|
||||
}
|
||||
|
||||
public String getSbanknam5() {
|
||||
return sbanknam5;
|
||||
}
|
||||
|
||||
public void setSbanknam5(String sbanknam5) {
|
||||
this.sbanknam5 = sbanknam5;
|
||||
}
|
||||
|
||||
public String getRbankcode() {
|
||||
return rbankcode;
|
||||
}
|
||||
|
||||
public void setRbankcode(String rbankcode) {
|
||||
this.rbankcode = rbankcode;
|
||||
}
|
||||
|
||||
public String getcAccCred() {
|
||||
return cAccCred;
|
||||
}
|
||||
|
||||
public void setcAccCred(String cAccCred) {
|
||||
this.cAccCred = cAccCred;
|
||||
}
|
||||
|
||||
public String getRbanknam1() {
|
||||
return rbanknam1;
|
||||
}
|
||||
|
||||
public void setRbanknam1(String rbanknam1) {
|
||||
this.rbanknam1 = rbanknam1;
|
||||
}
|
||||
|
||||
public String getRbanknam2() {
|
||||
return rbanknam2;
|
||||
}
|
||||
|
||||
public void setRbanknam2(String rbanknam2) {
|
||||
this.rbanknam2 = rbanknam2;
|
||||
}
|
||||
|
||||
public String getRbanknam3() {
|
||||
return rbanknam3;
|
||||
}
|
||||
|
||||
public void setRbanknam3(String rbanknam3) {
|
||||
this.rbanknam3 = rbanknam3;
|
||||
}
|
||||
|
||||
public String getRbanknam4() {
|
||||
return rbanknam4;
|
||||
}
|
||||
|
||||
public void setRbanknam4(String rbanknam4) {
|
||||
this.rbanknam4 = rbanknam4;
|
||||
}
|
||||
|
||||
public String getRbanknam5() {
|
||||
return rbanknam5;
|
||||
}
|
||||
|
||||
public void setRbanknam5(String rbanknam5) {
|
||||
this.rbanknam5 = rbanknam5;
|
||||
}
|
||||
|
||||
public String getOpType() {
|
||||
return opType;
|
||||
}
|
||||
|
||||
public void setOpType(String opType) {
|
||||
this.opType = opType;
|
||||
}
|
||||
|
||||
public String getOpOrder() {
|
||||
return opOrder;
|
||||
}
|
||||
|
||||
public void setOpOrder(String opOrder) {
|
||||
this.opOrder = opOrder;
|
||||
}
|
||||
|
||||
public LocalDate getPayDate() {
|
||||
return payDate;
|
||||
}
|
||||
|
||||
public void setPayDate(LocalDate payDate) {
|
||||
this.payDate = payDate;
|
||||
}
|
||||
|
||||
public String getPayVal() {
|
||||
return payVal;
|
||||
}
|
||||
|
||||
public void setPayVal(String payVal) {
|
||||
this.payVal = payVal;
|
||||
}
|
||||
|
||||
public String getSumDeb() {
|
||||
return sumDeb;
|
||||
}
|
||||
|
||||
public void setSumDeb(String sumDeb) {
|
||||
this.sumDeb = sumDeb;
|
||||
}
|
||||
|
||||
public String getSclientn1() {
|
||||
return sclientn1;
|
||||
}
|
||||
|
||||
public void setSclientn1(String sclientn1) {
|
||||
this.sclientn1 = sclientn1;
|
||||
}
|
||||
|
||||
public String getSclientn2() {
|
||||
return sclientn2;
|
||||
}
|
||||
|
||||
public void setSclientn2(String sclientn2) {
|
||||
this.sclientn2 = sclientn2;
|
||||
}
|
||||
|
||||
public String getSclientn3() {
|
||||
return sclientn3;
|
||||
}
|
||||
|
||||
public void setSclientn3(String sclientn3) {
|
||||
this.sclientn3 = sclientn3;
|
||||
}
|
||||
|
||||
public String getSclientn4() {
|
||||
return sclientn4;
|
||||
}
|
||||
|
||||
public void setSclientn4(String sclientn4) {
|
||||
this.sclientn4 = sclientn4;
|
||||
}
|
||||
|
||||
public String getInnDeb() {
|
||||
return innDeb;
|
||||
}
|
||||
|
||||
public void setInnDeb(String innDeb) {
|
||||
this.innDeb = innDeb;
|
||||
}
|
||||
|
||||
public String getKppDeb() {
|
||||
return kppDeb;
|
||||
}
|
||||
|
||||
public void setKppDeb(String kppDeb) {
|
||||
this.kppDeb = kppDeb;
|
||||
}
|
||||
|
||||
public String getAccDeb() {
|
||||
return accDeb;
|
||||
}
|
||||
|
||||
public void setAccDeb(String accDeb) {
|
||||
this.accDeb = accDeb;
|
||||
}
|
||||
|
||||
public String getRclientn1() {
|
||||
return rclientn1;
|
||||
}
|
||||
|
||||
public void setRclientn1(String rclientn1) {
|
||||
this.rclientn1 = rclientn1;
|
||||
}
|
||||
|
||||
public String getRclientn2() {
|
||||
return rclientn2;
|
||||
}
|
||||
|
||||
public void setRclientn2(String rclientn2) {
|
||||
this.rclientn2 = rclientn2;
|
||||
}
|
||||
|
||||
public String getRclientn3() {
|
||||
return rclientn3;
|
||||
}
|
||||
|
||||
public void setRclientn3(String rclientn3) {
|
||||
this.rclientn3 = rclientn3;
|
||||
}
|
||||
|
||||
public String getRclientn4() {
|
||||
return rclientn4;
|
||||
}
|
||||
|
||||
public void setRclientn4(String rclientn4) {
|
||||
this.rclientn4 = rclientn4;
|
||||
}
|
||||
|
||||
public String getInnCred() {
|
||||
return innCred;
|
||||
}
|
||||
|
||||
public void setInnCred(String innCred) {
|
||||
this.innCred = innCred;
|
||||
}
|
||||
|
||||
public String getKppCred() {
|
||||
return kppCred;
|
||||
}
|
||||
|
||||
public void setKppCred(String kppCred) {
|
||||
this.kppCred = kppCred;
|
||||
}
|
||||
|
||||
public String getAccKr1() {
|
||||
return accKr1;
|
||||
}
|
||||
|
||||
public void setAccKr1(String accKr1) {
|
||||
this.accKr1 = accKr1;
|
||||
}
|
||||
|
||||
public String getSpecif1() {
|
||||
return specif1;
|
||||
}
|
||||
|
||||
public void setSpecif1(String specif1) {
|
||||
this.specif1 = specif1;
|
||||
}
|
||||
|
||||
public String getSendType() {
|
||||
return sendType;
|
||||
}
|
||||
|
||||
public void setSendType(String sendType) {
|
||||
this.sendType = sendType;
|
||||
}
|
||||
|
||||
public String getDocResult() {
|
||||
return docResult;
|
||||
}
|
||||
|
||||
public void setDocResult(String docResult) {
|
||||
this.docResult = docResult;
|
||||
}
|
||||
|
||||
public String getDocNum() {
|
||||
return docNum;
|
||||
}
|
||||
|
||||
public void setDocNum(String docNum) {
|
||||
this.docNum = docNum;
|
||||
}
|
||||
|
||||
public LocalDate getDocDate() {
|
||||
return docDate;
|
||||
}
|
||||
|
||||
public void setDocDate(LocalDate docDate) {
|
||||
this.docDate = docDate;
|
||||
}
|
||||
|
||||
public LocalDate getValueDate() {
|
||||
return valueDate;
|
||||
}
|
||||
|
||||
public void setValueDate(LocalDate valueDate) {
|
||||
this.valueDate = valueDate;
|
||||
}
|
||||
|
||||
public String getSwiftBen() {
|
||||
return swiftBen;
|
||||
}
|
||||
|
||||
public void setSwiftBen(String swiftBen) {
|
||||
this.swiftBen = swiftBen;
|
||||
}
|
||||
|
||||
public String getSwiftInt() {
|
||||
return swiftInt;
|
||||
}
|
||||
|
||||
public void setSwiftInt(String swiftInt) {
|
||||
this.swiftInt = swiftInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF54ObjectTag that = (DF54ObjectTag) o;
|
||||
return Objects.equals(segType, that.segType) && Objects.equals(docType, that.docType) && Objects.equals(docnmRef, that.docnmRef) && Objects.equals(docnmprev, that.docnmprev) && Objects.equals(sbankcode, that.sbankcode) && Objects.equals(cAccDeb, that.cAccDeb) && Objects.equals(sbanknam1, that.sbanknam1) && Objects.equals(sbanknam2, that.sbanknam2) && Objects.equals(sbanknam3, that.sbanknam3) && Objects.equals(sbanknam4, that.sbanknam4) && Objects.equals(sbanknam5, that.sbanknam5) && Objects.equals(rbankcode, that.rbankcode) && Objects.equals(cAccCred, that.cAccCred) && Objects.equals(rbanknam1, that.rbanknam1) && Objects.equals(rbanknam2, that.rbanknam2) && Objects.equals(rbanknam3, that.rbanknam3) && Objects.equals(rbanknam4, that.rbanknam4) && Objects.equals(rbanknam5, that.rbanknam5) && Objects.equals(opType, that.opType) && Objects.equals(opOrder, that.opOrder) && Objects.equals(payDate, that.payDate) && Objects.equals(payVal, that.payVal) && Objects.equals(sumDeb, that.sumDeb) && Objects.equals(sclientn1, that.sclientn1) && Objects.equals(sclientn2, that.sclientn2) && Objects.equals(sclientn3, that.sclientn3) && Objects.equals(sclientn4, that.sclientn4) && Objects.equals(innDeb, that.innDeb) && Objects.equals(kppDeb, that.kppDeb) && Objects.equals(accDeb, that.accDeb) && Objects.equals(rclientn1, that.rclientn1) && Objects.equals(rclientn2, that.rclientn2) && Objects.equals(rclientn3, that.rclientn3) && Objects.equals(rclientn4, that.rclientn4) && Objects.equals(innCred, that.innCred) && Objects.equals(kppCred, that.kppCred) && Objects.equals(accKr1, that.accKr1) && Objects.equals(specif1, that.specif1) && Objects.equals(sendType, that.sendType) && Objects.equals(docResult, that.docResult) && Objects.equals(docNum, that.docNum) && Objects.equals(docDate, that.docDate) && Objects.equals(valueDate, that.valueDate) && Objects.equals(swiftBen, that.swiftBen) && Objects.equals(swiftInt, that.swiftInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(segType, docType, docnmRef, docnmprev, sbankcode, cAccDeb, sbanknam1, sbanknam2, sbanknam3, sbanknam4, sbanknam5, rbankcode, cAccCred, rbanknam1, rbanknam2, rbanknam3, rbanknam4, rbanknam5, opType, opOrder, payDate, payVal, sumDeb, sclientn1, sclientn2, sclientn3, sclientn4, innDeb, kppDeb, accDeb, rclientn1, rclientn2, rclientn3, rclientn4, innCred, kppCred, accKr1, specif1, sendType, docResult, docNum, docDate, valueDate, swiftBen, swiftInt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF54ObjectTag{" +
|
||||
"segType='" + segType + '\'' +
|
||||
", docType='" + docType + '\'' +
|
||||
", docnmRef='" + docnmRef + '\'' +
|
||||
", docnmprev='" + docnmprev + '\'' +
|
||||
", sbankcode='" + sbankcode + '\'' +
|
||||
", cAccDeb='" + cAccDeb + '\'' +
|
||||
", sbanknam1='" + sbanknam1 + '\'' +
|
||||
", sbanknam2='" + sbanknam2 + '\'' +
|
||||
", sbanknam3='" + sbanknam3 + '\'' +
|
||||
", sbanknam4='" + sbanknam4 + '\'' +
|
||||
", sbanknam5='" + sbanknam5 + '\'' +
|
||||
", rbankcode='" + rbankcode + '\'' +
|
||||
", cAccCred='" + cAccCred + '\'' +
|
||||
", rbanknam1='" + rbanknam1 + '\'' +
|
||||
", rbanknam2='" + rbanknam2 + '\'' +
|
||||
", rbanknam3='" + rbanknam3 + '\'' +
|
||||
", rbanknam4='" + rbanknam4 + '\'' +
|
||||
", rbanknam5='" + rbanknam5 + '\'' +
|
||||
", opType='" + opType + '\'' +
|
||||
", opOrder='" + opOrder + '\'' +
|
||||
", payDate=" + payDate +
|
||||
", payVal='" + payVal + '\'' +
|
||||
", sumDeb='" + sumDeb + '\'' +
|
||||
", sclientn1='" + sclientn1 + '\'' +
|
||||
", sclientn2='" + sclientn2 + '\'' +
|
||||
", sclientn3='" + sclientn3 + '\'' +
|
||||
", sclientn4='" + sclientn4 + '\'' +
|
||||
", innDeb='" + innDeb + '\'' +
|
||||
", kppDeb='" + kppDeb + '\'' +
|
||||
", accDeb='" + accDeb + '\'' +
|
||||
", rclientn1='" + rclientn1 + '\'' +
|
||||
", rclientn2='" + rclientn2 + '\'' +
|
||||
", rclientn3='" + rclientn3 + '\'' +
|
||||
", rclientn4='" + rclientn4 + '\'' +
|
||||
", innCred='" + innCred + '\'' +
|
||||
", kppCred='" + kppCred + '\'' +
|
||||
", accKr1='" + accKr1 + '\'' +
|
||||
", specif1='" + specif1 + '\'' +
|
||||
", sendType='" + sendType + '\'' +
|
||||
", docResult='" + docResult + '\'' +
|
||||
", docNum='" + docNum + '\'' +
|
||||
", docDate=" + docDate +
|
||||
", valueDate=" + valueDate +
|
||||
", swiftBen='" + swiftBen + '\'' +
|
||||
", swiftInt='" + swiftInt + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf56;
|
||||
|
||||
public class DF56ObjectTag extends ObjectTag<SDf56> {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "NUMBER")
|
||||
private String number;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SUNIXTIME")
|
||||
private Long startUnixtime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SDATETIME")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime startDatetime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "EUNIXTIME")
|
||||
private Long endUnixtime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "EDATETIME")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime endDatetime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "DEAL")
|
||||
private String deal;
|
||||
|
||||
|
||||
public DF56ObjectTag() {
|
||||
super(SDf56.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SDf56 entity) {
|
||||
this.number = entity.getNumber();
|
||||
this.startUnixtime = Long.valueOf(entity.getStart_datetime());
|
||||
this.startDatetime = Instant.ofEpochMilli(this.startUnixtime).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
this.endUnixtime = Long.valueOf(entity.getEnd_datetime());
|
||||
this.endDatetime = Instant.ofEpochMilli(this.endUnixtime).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
this.account = entity.getAccount();
|
||||
this.deal = entity.getDeal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return ruCurrency;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Long getStartUnixtime() {
|
||||
return startUnixtime;
|
||||
}
|
||||
|
||||
public void setStartUnixtime(Long startUnixtime) {
|
||||
this.startUnixtime = startUnixtime;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartDatetime() {
|
||||
return startDatetime;
|
||||
}
|
||||
|
||||
public void setStartDatetime(LocalDateTime startDatetime) {
|
||||
this.startDatetime = startDatetime;
|
||||
}
|
||||
|
||||
public Long getEndUnixtime() {
|
||||
return endUnixtime;
|
||||
}
|
||||
|
||||
public void setEndUnixtime(Long endUnixtime) {
|
||||
this.endUnixtime = endUnixtime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndDatetime() {
|
||||
return endDatetime;
|
||||
}
|
||||
|
||||
public void setEndDatetime(LocalDateTime endDatetime) {
|
||||
this.endDatetime = endDatetime;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getDeal() {
|
||||
return deal;
|
||||
}
|
||||
|
||||
public void setDeal(String deal) {
|
||||
this.deal = deal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DF56ObjectTag that = (DF56ObjectTag) o;
|
||||
return Objects.equals(number, that.number) && Objects.equals(startUnixtime, that.startUnixtime) && Objects.equals(startDatetime, that.startDatetime) && Objects.equals(endUnixtime, that.endUnixtime) && Objects.equals(endDatetime, that.endDatetime) && Objects.equals(account, that.account) && Objects.equals(deal, that.deal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(number, startUnixtime, startDatetime, endUnixtime, endDatetime, account, deal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DF56ObjectTag{" +
|
||||
"number='" + number + '\'' +
|
||||
", startUnixtime=" + startUnixtime +
|
||||
", startDatetime=" + startDatetime +
|
||||
", endUnixtime=" + endUnixtime +
|
||||
", endDatetime=" + endDatetime +
|
||||
", account='" + account + '\'' +
|
||||
", deal='" + deal + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.data.tags.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(DF02ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF03ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF05ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF07ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF51ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF53ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF54ObjectTag.class),
|
||||
@JsonSubTypes.Type(DF56ObjectTag.class),
|
||||
})
|
||||
@JsonIgnoreProperties(value = { "clazz", "currency" })
|
||||
public abstract class ObjectTag<T1 extends SpcexObjectBase> {
|
||||
public final static String ruCurrency = CurrencyCode.RUB.getKey();
|
||||
public Class<T1> clazz;
|
||||
|
||||
public ObjectTag (Class<T1> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public abstract void setData(T1 entity);
|
||||
|
||||
public abstract String getCurrency();
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import static ru.spcex.clearing.platform.messaging.domain.Consts.PAIR_SDF;
|
||||
import static ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag.ruCurrency;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.PairSdfRequest;
|
||||
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.exporter.config.SFTPConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.ParentDocTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Component
|
||||
public class ExportFromHazelcast {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final ImdgProvider imdgProvider;
|
||||
private final SFTPConfig.XmlGateway gateway;
|
||||
private final Map<Table, ObjectTag<? extends SpcexObjectBase>> objectTagMap;
|
||||
private final Supplier<KafkaSender> kafkaSender;
|
||||
private final ExportXMLServiceSettings settings;
|
||||
|
||||
public ExportFromHazelcast(ImdgProvider imdgProvider,
|
||||
SFTPConfig.XmlGateway gateway,
|
||||
@Qualifier("mapOfTable") Map<Table, ObjectTag<? extends SpcexObjectBase>> objectTagMap,
|
||||
Supplier<KafkaSender> kafkaSender,
|
||||
ExportXMLServiceSettings settings) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.gateway = gateway;
|
||||
this.objectTagMap = objectTagMap;
|
||||
this.kafkaSender = kafkaSender;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
Table table = Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
File xmlFile = Objects.requireNonNull(resultContainer.getFileForExport());
|
||||
|
||||
DocumentTag documentTag = new DocumentTag();
|
||||
ParentDocTag parentDocTag = new ParentDocTag();
|
||||
parentDocTag.setParentId("");
|
||||
// todo: Добавить данные DocumentTag'а
|
||||
documentTag.setMessageId("");
|
||||
documentTag.setMessageType(table.getFilePrefix().replace("-", ""));
|
||||
documentTag.setMessageName("");
|
||||
documentTag.setMessageDate(LocalDate.now());
|
||||
documentTag.setMessageTime(LocalTime.now());
|
||||
documentTag.setSender("");
|
||||
documentTag.setReceiver("");
|
||||
documentTag.setParentDoc(parentDocTag);
|
||||
|
||||
Imdg<? extends SpcexObjectBase> map = imdgProvider.getImdg(table.getHazelcastMapName(), table.getEntityClass());
|
||||
|
||||
Collection<? extends SpcexObjectBase> tableRows;
|
||||
if (resultContainer.getGroupId() != null) {
|
||||
Map<String, Long> queryParams = Map.of("generationId", resultContainer.getGroupId());
|
||||
tableRows = map.getCollectionObjectsByFieldValues(queryParams);
|
||||
} else {
|
||||
tableRows = map.getAllValues();
|
||||
}
|
||||
if (tableRows.isEmpty()) {
|
||||
log.info("uuid {}. Map {} is empty, generationId {}", resultContainer.getUuid(), resultContainer.getTableForExport().getHazelcastMapName(), resultContainer.getGroupId());
|
||||
return StageResult.COMPLETE;
|
||||
} else {
|
||||
log.debug("uuid {}. Selected {} records from map {}, generationId {}", resultContainer.getUuid(),
|
||||
tableRows.size(), resultContainer.getTableForExport().getHazelcastMapName(), resultContainer.getGroupId());
|
||||
}
|
||||
if (Table.S_DF02 == resultContainer.getTableForExport()) {
|
||||
log.trace("Sort S_DF02 items"); // Сортировка по возрастанию id, чтобы сохранить последовательность строк SDF02, как в SDF01
|
||||
tableRows = new ArrayList<SpcexObjectBase>(tableRows);
|
||||
((ArrayList<SpcexObjectBase>) tableRows).sort(Comparator.comparing(SpcexObjectBase::getId));
|
||||
}
|
||||
|
||||
documentTag.setObjects(addObjectTags(tableRows, table));
|
||||
resultContainer.setDocumentTag(documentTag);
|
||||
|
||||
boolean emptyMap = tableRows.isEmpty();
|
||||
String path;
|
||||
String currency = ruCurrency; //todo: rewrite currency logic
|
||||
if (CurrencyCode.isRub(currency)) {
|
||||
path = settings.getStore().getOutPayValDir().get(ruCurrency);
|
||||
} else {
|
||||
path = settings.getStore().getOutPayValDir().get(currency);
|
||||
}
|
||||
|
||||
if (emptyMap) {
|
||||
log.debug("Delete empty XML temp file \"{}\"", resultContainer.getFileForExport());
|
||||
boolean deleteOk = resultContainer.getFileForExport().delete();
|
||||
if (!deleteOk) {
|
||||
log.warn("Can't delete file {}", resultContainer.getFileForExport().getName());
|
||||
}
|
||||
} else {
|
||||
log.debug("uuid {}, send to SFTP path \"{}\"", resultContainer.getUuid(), path);
|
||||
gateway.sendToSftp(xmlFile, path);
|
||||
if (Table.S_DF02.equals(resultContainer.getTableForExport())) {
|
||||
sendPairSdfRequest(resultContainer);
|
||||
}
|
||||
}
|
||||
|
||||
return StageResult.OK;
|
||||
}
|
||||
|
||||
private <T extends SpcexObjectBase> List<ObjectTag<? extends SpcexObjectBase>> addObjectTags(Collection<T> tableRows, Table table) {
|
||||
List<ObjectTag<? extends SpcexObjectBase>> result = new ArrayList<>();
|
||||
|
||||
for (T row : tableRows) {
|
||||
ObjectTag<T> value = (ObjectTag<T>) objectTagMap.get(table);
|
||||
value.setData(row);
|
||||
result.add(value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void sendPairSdfRequest(ResultContainer resultContainer) {
|
||||
PairSdfRequest request = new PairSdfRequest();
|
||||
request.setGenerationId(resultContainer.getGroupId());
|
||||
request.setFileNameSDf(resultContainer.getFileForExport().getName());
|
||||
request.setTableSDf(resultContainer.getTableForExport().getFilePrefix());
|
||||
Long msgId = kafkaSender.get().sendRequestToQueue(PAIR_SDF, request);
|
||||
log.info("Send PairSdfRequest={} message id={} to kafka \"{}\"", LogFormatter.toString(request), msgId, PAIR_SDF);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import static ru.spcex.clearing.platform.messaging.domain.Consts.EXPORT_COMPLETED;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.system.JournalSdf;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
|
||||
@Component
|
||||
public class Journal implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final Supplier<KafkaSender> kafkaSender;
|
||||
|
||||
@Autowired
|
||||
public Journal(Supplier<KafkaSender> kafkaSender) {
|
||||
this.kafkaSender = kafkaSender;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
if (kafkaSender == null) {
|
||||
log.info("kafka producer settings missing; kafka messages to journal-service are not enabled.");
|
||||
return StageResult.COMPLETE;
|
||||
}
|
||||
JournalSdf journalSdf = new JournalSdf();
|
||||
//todo read file attibutes
|
||||
journalSdf.setRegistrationDate(resultContainer.getRegistrationDateTime().toLocalDate());
|
||||
journalSdf.setRegistrationTime(resultContainer.getRegistrationDateTime().toLocalTime());
|
||||
journalSdf.setRegistrationNumber(resultContainer.getGroupId());
|
||||
journalSdf.setDocumentName(documentNames.get(resultContainer.getTableForExport()));
|
||||
journalSdf.setDossierNumber(dossierNumber.get(resultContainer.getTableForExport()));
|
||||
journalSdf.setResultStatus(StageResult.ERROR.equals(resultContainer.getLastStageResult()) ? "NACK" : "ACK");
|
||||
kafkaSender.get().sendRequestToQueue(EXPORT_COMPLETED, journalSdf);
|
||||
|
||||
//удалим временный файл
|
||||
File xmlFile = resultContainer.getFileForExport();
|
||||
// try {
|
||||
// log.debug("Uuid {}, delete temp file \"{}\"", resultContainer.getUuid(), xmlFile);
|
||||
// Files.deleteIfExists(xmlFile.toPath());
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// Надо сохранять для разбора истории и отладки по логам
|
||||
log.debug("Uuid {}, save temp file \"{}\"", resultContainer.getUuid(), xmlFile);
|
||||
return StageResult.COMPLETE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
}
|
||||
|
||||
private static final Map<Table, String> documentNames = new EnumMap<>(Table.class);
|
||||
static {
|
||||
documentNames.put(Table.S_DF02, "Уведомлений об исполнении операции загрузки денежных средств или уведомление об ошибке");
|
||||
documentNames.put(Table.S_DF03, "Сводное платёжное поручение по итогу проведения расчетов, направляемое в РО");
|
||||
documentNames.put(Table.S_DF05, "Уведомление о завершении расчетов в секции");
|
||||
documentNames.put(Table.S_DF07, "Подтверждение о загрузке Уведомления о возврате ден.ср. по договору депозита");
|
||||
documentNames.put(Table.S_DF51, "Запрос остатков по всем счетам, направляемый в РО");
|
||||
documentNames.put(Table.S_DF53, "");
|
||||
documentNames.put(Table.S_DF54, "Распоряжение на списание денежных средств УК категории В (с клирингового счета)");
|
||||
documentNames.put(Table.S_DF56, "");
|
||||
}
|
||||
|
||||
private static final Map<Table, String> dossierNumber = new EnumMap<>(Table.class);
|
||||
static {
|
||||
dossierNumber.put(Table.S_DF02, "07-50");
|
||||
dossierNumber.put(Table.S_DF03, "07-51");
|
||||
dossierNumber.put(Table.S_DF05, "07-53");
|
||||
dossierNumber.put(Table.S_DF07, "07-58");
|
||||
dossierNumber.put(Table.S_DF51, "07-55");
|
||||
dossierNumber.put(Table.S_DF53, "");
|
||||
dossierNumber.put(Table.S_DF54, "07-48");
|
||||
dossierNumber.put(Table.S_DF56, "");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.integration.sftp.session.SftpFileInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.exporter.config.SFTPConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.FilenameTemplate;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
|
||||
@Component
|
||||
public class PrepareXMLFile implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
public static final String SECTION = "S";
|
||||
private final ExportXMLServiceSettings settings;
|
||||
public static String outDir;
|
||||
private final SFTPConfig.XmlGateway gateway;
|
||||
|
||||
public PrepareXMLFile(ExportXMLServiceSettings settings,
|
||||
SFTPConfig.XmlGateway gateway) {
|
||||
this.settings = settings;
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
if (settings.getStore().getOutPayValDir() == null || settings.getStore().getOutPayValDir().isEmpty()) {
|
||||
log.error("No SFTP scanning directories, need will be adding settings like 'export-xml-service.store.out-pay-val-dir.RUB=/RUB' and restart app");
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
List<SftpFileInfo> files = new ArrayList<>();
|
||||
log.trace("Get files from SFTP paths: {}", settings.getStore().getOutPayValDir().values());
|
||||
// for (String path : settings.getStore().getOutPayValDir().values()) {
|
||||
// files.addAll(gateway.listFiles(path));
|
||||
// }
|
||||
// log.info("There are {} files on the sFTP server in the search directories.", files.size());
|
||||
Table table = resultContainer.getTableForExport();
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
resultContainer.setRegistrationDateTime(currentDateTime);
|
||||
File xmlFile = new File(nameTemplates.get(table).getFileName(resultContainer, files));
|
||||
log.info("XML FILE = {}", xmlFile.toPath());
|
||||
try {
|
||||
Path xmlFilePath = xmlFile.toPath();
|
||||
Files.deleteIfExists(xmlFilePath);
|
||||
Files.createFile(xmlFilePath);
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("uuid %s. Can't create file %s", resultContainer.getUuid(), xmlFile.getName()), e);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
resultContainer.setFileForExport(xmlFile);
|
||||
log.info("uuid {}. Rows from {} with generationId {} will be export to temp file \"{}\"", resultContainer.getUuid(),
|
||||
resultContainer.getTableForExport().getFilePrefix(), resultContainer.getGroupId(), xmlFile);
|
||||
return StageResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
String outDirPath = settings.getStore().getLocalTempDir();
|
||||
File outDirFile = new File(outDirPath);
|
||||
if (outDirFile.exists() && !outDirFile.isDirectory())
|
||||
throw new IOException("Output directory " + outDirPath + " is file.");
|
||||
if (!outDirFile.exists()) Files.createDirectories(outDirFile.toPath());
|
||||
this.outDir = outDirPath;
|
||||
log.info("Output directory: {}", outDirFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
private static final Map<Table, FilenameTemplate> nameTemplates = new EnumMap<>(Table.class);
|
||||
|
||||
static {
|
||||
nameTemplates.put(Table.S_DF02, FilenameTemplate.df_section_sameName);
|
||||
nameTemplates.put(Table.S_DF03, FilenameTemplate.df_section_dateTime_counter);
|
||||
nameTemplates.put(Table.S_DF05, FilenameTemplate.df_section_dateTime);
|
||||
nameTemplates.put(Table.S_DF07, FilenameTemplate.df_section_sameName);
|
||||
nameTemplates.put(Table.S_DF51, FilenameTemplate.df_section_dateTime_counter);
|
||||
nameTemplates.put(Table.S_DF53, FilenameTemplate.df_section_sameName);
|
||||
nameTemplates.put(Table.S_DF54, FilenameTemplate.df_section_dateTime_counter);
|
||||
nameTemplates.put(Table.S_DF56, FilenameTemplate.df_section_dateTime_counter);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
|
||||
@Component
|
||||
public class WriteXMLFile {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final XmlMapper xmlMapper;
|
||||
|
||||
public WriteXMLFile(@Qualifier("xmlMapper") XmlMapper xmlMapper) {
|
||||
this.xmlMapper = xmlMapper;
|
||||
}
|
||||
|
||||
public StageResult process(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Stage: {}", resultContainer.getUuid(), this.getClass().getSimpleName());
|
||||
Table table = Objects.requireNonNull(resultContainer.getTableForExport());
|
||||
File xmlFile = Objects.requireNonNull(resultContainer.getFileForExport());
|
||||
|
||||
DocumentTag documentTag = Objects.requireNonNull(resultContainer.getDocumentTag());
|
||||
|
||||
log.info("DOCUMENT TAG = {}", documentTag);
|
||||
try {
|
||||
xmlMapper.writeValue(xmlFile, documentTag);
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("uuid %s. Can't export table %s (map %s) to file %s. Table was skipped.",
|
||||
resultContainer.getUuid(), table, table.getHazelcastMapName(), xmlFile), e);
|
||||
return StageResult.ERROR;
|
||||
}
|
||||
|
||||
return StageResult.OK;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package ru.spcex.clearing.xml.exporter.services;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.clearing.SdfClearingRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.ExportFromHazelcast;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.Journal;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.PrepareXMLFile;
|
||||
import ru.spcex.clearing.xml.exporter.logic.stages.WriteXMLFile;
|
||||
import ru.spcex.platform.enumeration.Task;
|
||||
|
||||
@Service
|
||||
public class CommandService extends QueueConsumer implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final PrepareXMLFile prepareXMLFile;
|
||||
private final ExportFromHazelcast exportFromHazelcast;
|
||||
private final WriteXMLFile writeXMLFile;
|
||||
private final Journal journal;
|
||||
|
||||
public CommandService(Consumer<String, Object> kafkaQueue,
|
||||
PrepareXMLFile prepareXMLFile,
|
||||
ExportFromHazelcast exportFromHazelcast,
|
||||
WriteXMLFile writeXMLFile,
|
||||
Journal journal) {
|
||||
super(kafkaQueue);
|
||||
this.prepareXMLFile = prepareXMLFile;
|
||||
this.exportFromHazelcast = exportFromHazelcast;
|
||||
this.writeXMLFile = writeXMLFile;
|
||||
this.journal = journal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
callback(ExportToFileRequest.class)
|
||||
.setConsumer(this::process)
|
||||
.forDestination(Consts.EXPORT_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF02, r))
|
||||
.forDestination(Consts.SDF02_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF03, r)) // todo необходимо в отдельную папку: "в отдельную директорию SettlementHouse_Fail (чтобы не отдавать такие файлы в ПРЦ"
|
||||
.forDestination(Consts.SDF03_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF05, r))
|
||||
.forDestination(Consts.SDF05_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF07, r))
|
||||
.forDestination(Consts.SDF07_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF51, r))
|
||||
.forDestination(Consts.SDF51_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF53, r))
|
||||
.forDestination(Consts.SDF53_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF54, r))
|
||||
.forDestination(Consts.SDF54_PROCESS, callbacks::put);
|
||||
callback(SdfClearingRequest.class)
|
||||
.setConsumer(r -> processSpecial(Table.S_DF56, r))
|
||||
.forDestination(Consts.SDF56_PROCESS, callbacks::put);
|
||||
|
||||
callback(LauncherCommandRequest.class)
|
||||
.setConsumer(r -> processByLauncher(Table.S_DF54, r))
|
||||
.forDestination(Task.dbfExport_OUTV.topic(), callbacks::put); // todo: добавить код для экспорта XML
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void process(BaseRequest<ExportToFileRequest> systemRequest) {
|
||||
ExportToFileRequest request = systemRequest.getRequestPayload();
|
||||
Optional<Table> tableForExport = Arrays.stream(Table.values()).
|
||||
filter(table -> table.getFilePrefix().equalsIgnoreCase(request.getNameOfTable())).findFirst();
|
||||
if (tableForExport.isEmpty()) {
|
||||
throw new IllegalStateException(String.format("Unsupported table prefix: %s", request.getNameOfTable()));
|
||||
}
|
||||
ResultContainer resultContainer = new ResultContainer(tableForExport.get());
|
||||
resultContainer.setGroupId(request.getSdfGroupId());
|
||||
resultContainer.setSourceName(request.getFileName());
|
||||
runProcess(resultContainer);
|
||||
}
|
||||
|
||||
private void processSpecial(Table table, BaseRequest<SdfClearingRequest> systemRequest) {
|
||||
SdfClearingRequest request = systemRequest.getRequestPayload();
|
||||
ResultContainer resultContainer = new ResultContainer(table);
|
||||
resultContainer.setGroupId(request.getGroupId());
|
||||
resultContainer.setSourceName(null);
|
||||
runProcess(resultContainer);
|
||||
}
|
||||
|
||||
private void processByLauncher(Table table, BaseRequest<LauncherCommandRequest> systemRequest) {
|
||||
LauncherCommandRequest request = systemRequest.getRequestPayload();
|
||||
log.info("RequestId={}, LauncherCommandRequest task={}. Table {}", systemRequest.getId(), request.getTaskName(), table);
|
||||
ResultContainer resultContainer = new ResultContainer(table);
|
||||
resultContainer.setGroupId(null);
|
||||
resultContainer.setSourceName(null);
|
||||
runProcess(resultContainer);
|
||||
}
|
||||
|
||||
private void runProcess(ResultContainer resultContainer) {
|
||||
log.info("uuid {}. Task started", resultContainer.getUuid());
|
||||
StageResult result;
|
||||
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
result = prepareXMLFile.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
if (result == StageResult.OK) {
|
||||
result = exportFromHazelcast.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
}
|
||||
if (result == StageResult.OK) {
|
||||
result = writeXMLFile.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
}
|
||||
if (result == StageResult.OK) {
|
||||
result = journal.process(resultContainer);
|
||||
resultContainer.setLastStageResult(result);
|
||||
}
|
||||
stopWatch.stop();
|
||||
|
||||
log.info("uuid {}. Task completed, result: {}, time working: {} ms",
|
||||
resultContainer.getUuid(),
|
||||
result,
|
||||
stopWatch.getTotalTimeMillis());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
spring.main.web-application-type=none
|
||||
|
||||
export-xml-service.hazelcast.cluster-members=10.200.200.181:5701
|
||||
export-xml-service.hazelcast.login=dev
|
||||
export-xml-service.hazelcast.password=dev-pass
|
||||
|
||||
export-xml-service.common.encoding=cp866
|
||||
export-xml-service.common.threads-count=10
|
||||
|
||||
export-xml-service.store.local-temp-dir=D:\\docs and T3\\clearing\\xml\\
|
||||
# код валюты должен быть в верхнем регистре, например для рублей - "RUB" (*.RUB=export/rub/).RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.EUR=export/eur/
|
||||
export-xml-service.store.user:tester
|
||||
export-xml-service.store.password=password
|
||||
export-xml-service.store.server-ip=10.230.238.53
|
||||
export-xml-service.store.server-port=2222
|
||||
|
||||
export-xml-service.kafka-consumer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-consumer.group-id=dev-group-balance-service
|
||||
export-xml-service.kafka-consumer.enable-auto-commit=false
|
||||
export-xml-service.kafka-consumer.session-timeout-ms=30000
|
||||
export-xml-service.kafka-consumer.auto-offset-reset=latest
|
||||
export-xml-service.kafka-consumer.linger-ms=1
|
||||
export-xml-service.kafka-consumer.buffer-memory=33554432
|
||||
|
||||
export-xml-service.kafka-producer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-producer.acks=all
|
||||
export-xml-service.kafka-producer.retries=0
|
||||
export-xml-service.kafka-producer.batch-size=16384
|
||||
export-xml-service.kafka-producer.linger-ms=1
|
||||
export-xml-service.kafka-producer.buffer-memory=33554432
|
||||
56
clearing-parent/xml-exporter/src/main/resources/logback.xml
Normal file
56
clearing-parent/xml-exporter/src/main/resources/logback.xml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="LOG_PATH" value="./log" />
|
||||
<property name="FILE_NAME" value="xml-exporter" />
|
||||
<property name="CONSOLE_LOG_PATTERN" value="%date{HH:mm:ss.SSS} [%thread] %-5level %class{0}:%line - %message%n" />
|
||||
<property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %class{0}:%msg%n" />
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!-- |%X{ru.nbch.scoring.web.logging.mdc_key}-->
|
||||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- first FILE TEXT appender -->
|
||||
<appender name="TEXT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${FILE_NAME}-text.log</file>
|
||||
<encoder>
|
||||
<!-- |%X{ru.nbch.scoring.web.logging.mdc_key}-->
|
||||
<Pattern>${FILE_LOG_PATTERN}</Pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/${FILE_NAME}-text.%d{yyyy-MM-dd}.%i.gz
|
||||
</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- second FILE JSON appender -->
|
||||
<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${FILE_NAME}-json.log</file>
|
||||
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/${FILE_NAME}-json.%d{yyyy-MM-dd}.%i.gz
|
||||
</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="TEXT_FILE"/>
|
||||
<appender-ref ref="JSON_FILE" />
|
||||
</root>
|
||||
|
||||
<logger name="ru.spcex" level="debug" additivity="false">
|
||||
<appender-ref ref="TEXT_FILE"/>
|
||||
<appender-ref ref="JSON_FILE" />
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,406 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.apache.kafka.clients.producer.MockProducer;
|
||||
import org.apache.kafka.clients.producer.Producer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf05;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf07;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf51;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf54;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf56;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.test.TestObjectCreator;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.SFTPMockConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.XMLExporterConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF02ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF03ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF05ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF07ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF51ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF53ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF54ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF56ObjectTag;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@SpringBootTest(classes = {
|
||||
ExportFromHazelcast.class,
|
||||
ExportXMLServiceSettings.class,
|
||||
XMLExporterConfig.class,
|
||||
SFTPMockConfig.class,
|
||||
ImdgTestConfig.class,
|
||||
KafkaTestConfig.class,
|
||||
})
|
||||
@TestPropertySource(properties = {"spring.config.location=./src/test/resources/"})
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
@ActiveProfiles("test")
|
||||
class ExportFromHazelcastTest {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
|
||||
@Autowired
|
||||
@Qualifier("hazelcastServiceTest")
|
||||
private HazelcastService hazelcastService;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<ProducerRecord> producerRecord;
|
||||
@SpyBean
|
||||
private MockProducer<String, Object> producer;
|
||||
@Autowired
|
||||
@Qualifier("mockProducer")
|
||||
protected Producer<String, Object> mockProducer;
|
||||
|
||||
@Autowired
|
||||
private ExportFromHazelcast exportFromHazelcast;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
hazelcastService.waitAvailable();
|
||||
|
||||
new TestObjectCreator(hazelcastService).createUserAdmin(1000L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf02ToObjectTag() {
|
||||
SDf02 expectedSDf02 = new SDf02();
|
||||
expectedSDf02.setCurr_code("test1");
|
||||
expectedSDf02.setAccount("test2");
|
||||
expectedSDf02.setRemainder("test3");
|
||||
expectedSDf02.setDeal("test4");
|
||||
expectedSDf02.setAcc_code("test5");
|
||||
expectedSDf02.setDat("14.03.24");
|
||||
expectedSDf02.setMarket("test6");
|
||||
expectedSDf02.setAcc_name("test7");
|
||||
expectedSDf02.setAcc_type("test8");
|
||||
expectedSDf02.setSumengage("test9");
|
||||
expectedSDf02.setSumunblock("test10");
|
||||
expectedSDf02.setFile_type("test11");
|
||||
expectedSDf02.setResult("test12");
|
||||
|
||||
Imdg<SDf02> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf02, SDf02.class);
|
||||
imdg.insert(expectedSDf02);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF02);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-02_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF02ObjectTag actualObjectTag = (DF02ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF02");
|
||||
Assertions.assertThat(actualObjectTag.getCurrCode()).isEqualTo(expectedSDf02.getCurr_code());
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf02.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getRemainder()).isEqualTo(expectedSDf02.getRemainder());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf02.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getAccCode()).isEqualTo(expectedSDf02.getAcc_code());
|
||||
Assertions.assertThat(actualObjectTag.getDat().format(formatter)).isEqualTo(expectedSDf02.getDat());
|
||||
Assertions.assertThat(actualObjectTag.getMarket()).isEqualTo(expectedSDf02.getMarket());
|
||||
Assertions.assertThat(actualObjectTag.getAccName()).isEqualTo(expectedSDf02.getAcc_name());
|
||||
Assertions.assertThat(actualObjectTag.getAccType()).isEqualTo(expectedSDf02.getAcc_type());
|
||||
Assertions.assertThat(actualObjectTag.getSumengage()).isEqualTo(expectedSDf02.getSumengage());
|
||||
Assertions.assertThat(actualObjectTag.getSumunblock()).isEqualTo(expectedSDf02.getSumunblock());
|
||||
Assertions.assertThat(actualObjectTag.getFileType()).isEqualTo(expectedSDf02.getFile_type());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf03ToObjectTag() {
|
||||
SDf03 expectedSDf03 = new SDf03();
|
||||
expectedSDf03.setSeg_type("test1");
|
||||
expectedSDf03.setDoc_type("test2");
|
||||
expectedSDf03.setDocnm_ref("test3");
|
||||
expectedSDf03.setDocnmprev("test4");
|
||||
expectedSDf03.setC_acc_deb("test5");
|
||||
expectedSDf03.setSbanknam1("test6");
|
||||
expectedSDf03.setC_acc_cred("test7");
|
||||
expectedSDf03.setRbanknam1("test8");
|
||||
expectedSDf03.setPay_date("14.03.24");
|
||||
expectedSDf03.setPay_val("test9");
|
||||
expectedSDf03.setSum_deb("test10");
|
||||
expectedSDf03.setSpecif_1("test11");
|
||||
expectedSDf03.setImp_result("test12");
|
||||
|
||||
Imdg<SDf03> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf03, SDf03.class);
|
||||
imdg.insert(expectedSDf03);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF03);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-03_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF03ObjectTag actualObjectTag = (DF03ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF03");
|
||||
Assertions.assertThat(actualObjectTag.getSegType()).isEqualTo(expectedSDf03.getSeg_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocType()).isEqualTo(expectedSDf03.getDoc_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmRef()).isEqualTo(expectedSDf03.getDocnm_ref());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmprev()).isEqualTo(expectedSDf03.getDocnmprev());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedSDf03.getC_acc_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedSDf03.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedSDf03.getC_acc_cred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedSDf03.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate().format(formatter)).isEqualTo(expectedSDf03.getPay_date());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedSDf03.getPay_val());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedSDf03.getSum_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif1()).isEqualTo(expectedSDf03.getSpecif_1());
|
||||
Assertions.assertThat(actualObjectTag.getImpResult()).isEqualTo(expectedSDf03.getImp_result());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf05ToObjectTag() {
|
||||
SDf05 expectedSDf05 = new SDf05();
|
||||
expectedSDf05.setTp(BigDecimal.TEN);
|
||||
expectedSDf05.setDt(LocalDate.parse("2024-03-14"));
|
||||
expectedSDf05.setTm("09:22:12");
|
||||
expectedSDf05.setPr("test2");
|
||||
|
||||
Imdg<SDf05> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf05, SDf05.class);
|
||||
imdg.insert(expectedSDf05);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF05);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-05_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF05ObjectTag actualObjectTag = (DF05ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF05");
|
||||
Assertions.assertThat(actualObjectTag.getTp()).isEqualTo(expectedSDf05.getTp());
|
||||
Assertions.assertThat(actualObjectTag.getDt()).isEqualTo(expectedSDf05.getDt());
|
||||
Assertions.assertThat(actualObjectTag.getTm()).isEqualTo(expectedSDf05.getTm());
|
||||
Assertions.assertThat(actualObjectTag.getPr()).isEqualTo(expectedSDf05.getPr());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf07ToObjectTag() {
|
||||
SDf07 expectedSDf07 = new SDf07();
|
||||
expectedSDf07.setAccount("test1");
|
||||
expectedSDf07.setSum(new BigDecimal(BigInteger.TEN));
|
||||
expectedSDf07.setMarket("test3");
|
||||
expectedSDf07.setType("test4");
|
||||
expectedSDf07.setDeal("test5");
|
||||
expectedSDf07.setClientN("test6");
|
||||
expectedSDf07.setInn("test7");
|
||||
expectedSDf07.setBic("test8");
|
||||
expectedSDf07.setSpec("test9");
|
||||
expectedSDf07.setNumber(new BigDecimal(BigInteger.TWO));
|
||||
expectedSDf07.setDoc_num("test11");
|
||||
expectedSDf07.setDoc_date("14.03.24");
|
||||
expectedSDf07.setPay_val("test12");
|
||||
|
||||
Imdg<SDf07> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf07, SDf07.class);
|
||||
imdg.insert(expectedSDf07);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF07);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-07_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF07ObjectTag actualObjectTag = (DF07ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF07");
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf07.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getSum()).isEqualTo(expectedSDf07.getSum());
|
||||
Assertions.assertThat(actualObjectTag.getMarket()).isEqualTo(expectedSDf07.getMarket());
|
||||
Assertions.assertThat(actualObjectTag.getType()).isEqualTo(expectedSDf07.getType());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf07.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getClientN()).isEqualTo(expectedSDf07.getClientN());
|
||||
Assertions.assertThat(actualObjectTag.getInn()).isEqualTo(expectedSDf07.getInn());
|
||||
Assertions.assertThat(actualObjectTag.getBic()).isEqualTo(expectedSDf07.getBic());
|
||||
Assertions.assertThat(actualObjectTag.getSpec()).isEqualTo(expectedSDf07.getSpec());
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedSDf07.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedSDf07.getDoc_num());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate().format(formatter)).isEqualTo(expectedSDf07.getDoc_date());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedSDf07.getPay_val());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf51ToObjectTag() {
|
||||
SDf51 expectedSDf51 = new SDf51();
|
||||
expectedSDf51.setNumber("1234");
|
||||
expectedSDf51.setDatetime("1718785193000");
|
||||
|
||||
Imdg<SDf51> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf51, SDf51.class);
|
||||
imdg.insert(expectedSDf51);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF51);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-51_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF51ObjectTag actualObjectTag = (DF51ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF51");
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedSDf51.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getUnixtime()).isEqualTo(Long.parseLong(expectedSDf51.getDatetime()));
|
||||
Assertions.assertThat(actualObjectTag.getDatetime()).isEqualTo(Instant.ofEpochMilli(Long.parseLong(expectedSDf51.getDatetime())).atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf53ToObjectTag() {
|
||||
SDf53 expectedSDf53 = new SDf53();
|
||||
expectedSDf53.setAccount("test1");
|
||||
expectedSDf53.setAccName("test2");
|
||||
expectedSDf53.setDeal("test3");
|
||||
expectedSDf53.setDate("14.03.24");
|
||||
expectedSDf53.setStatus(1L);
|
||||
expectedSDf53.setAccType("test4");
|
||||
expectedSDf53.setResult("test5");
|
||||
|
||||
Imdg<SDf53> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
||||
imdg.insert(expectedSDf53);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF53);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-53_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF53ObjectTag actualObjectTag = (DF53ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF53");
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf53.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getAccName()).isEqualTo(expectedSDf53.getAccName());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf53.getDeal());
|
||||
Assertions.assertThat(actualObjectTag.getDate().format(formatter)).isEqualTo(expectedSDf53.getDate());
|
||||
Assertions.assertThat(actualObjectTag.getStatus()).isEqualTo(expectedSDf53.getStatus());
|
||||
Assertions.assertThat(actualObjectTag.getAccType()).isEqualTo(expectedSDf53.getAccType());
|
||||
Assertions.assertThat(actualObjectTag.getResult()).isEqualTo(expectedSDf53.getResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf54ToObjectTag() {
|
||||
SDf54 expectedSDf54 = new SDf54();
|
||||
expectedSDf54.setSeg_type("test1");
|
||||
expectedSDf54.setDoc_type("test2");
|
||||
expectedSDf54.setDocnm_ref("test3");
|
||||
expectedSDf54.setDocnmprev("test4");
|
||||
expectedSDf54.setSbankcode("test5");
|
||||
expectedSDf54.setC_acc_deb("test6");
|
||||
expectedSDf54.setSbanknam1("test7");
|
||||
expectedSDf54.setRbankcode("test8");
|
||||
expectedSDf54.setC_acc_cred("test9");
|
||||
expectedSDf54.setRbanknam1("test10");
|
||||
expectedSDf54.setOp_type("test11");
|
||||
expectedSDf54.setOp_order("test12");
|
||||
expectedSDf54.setPay_date("14.03.24");
|
||||
expectedSDf54.setPay_val("test13");
|
||||
expectedSDf54.setSum_deb("test14");
|
||||
expectedSDf54.setSclientn1("test15");
|
||||
expectedSDf54.setInn_deb("test16");
|
||||
expectedSDf54.setKpp_deb("test17");
|
||||
expectedSDf54.setAcc_deb("test18");
|
||||
expectedSDf54.setRclientn1("test19");
|
||||
expectedSDf54.setInn_cred("test20");
|
||||
expectedSDf54.setKpp_cred("test21");
|
||||
expectedSDf54.setAcc_kr_1("test22");
|
||||
expectedSDf54.setSpecif_1("test23");
|
||||
expectedSDf54.setSend_type("test24");
|
||||
expectedSDf54.setDoc_result("test25");
|
||||
expectedSDf54.setDoc_num("test26");
|
||||
expectedSDf54.setDoc_date("14.03.24");
|
||||
expectedSDf54.setValue_date("14.03.24");
|
||||
expectedSDf54.setSwift_ben("test27");
|
||||
expectedSDf54.setSwift_int("test28");
|
||||
|
||||
Imdg<SDf54> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf54, SDf54.class);
|
||||
imdg.insert(expectedSDf54);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF54);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-54_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF54ObjectTag actualObjectTag = (DF54ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF54");
|
||||
Assertions.assertThat(actualObjectTag.getSegType()).isEqualTo(expectedSDf54.getSeg_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocType()).isEqualTo(expectedSDf54.getDoc_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmRef()).isEqualTo(expectedSDf54.getDocnm_ref());
|
||||
Assertions.assertThat(actualObjectTag.getDocnmprev()).isEqualTo(expectedSDf54.getDocnmprev());
|
||||
Assertions.assertThat(actualObjectTag.getSbankcode()).isEqualTo(expectedSDf54.getSbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccDeb()).isEqualTo(expectedSDf54.getC_acc_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSbanknam1()).isEqualTo(expectedSDf54.getSbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getRbankcode()).isEqualTo(expectedSDf54.getRbankcode());
|
||||
Assertions.assertThat(actualObjectTag.getcAccCred()).isEqualTo(expectedSDf54.getC_acc_cred());
|
||||
Assertions.assertThat(actualObjectTag.getRbanknam1()).isEqualTo(expectedSDf54.getRbanknam1());
|
||||
Assertions.assertThat(actualObjectTag.getOpType()).isEqualTo(expectedSDf54.getOp_type());
|
||||
Assertions.assertThat(actualObjectTag.getOpOrder()).isEqualTo(expectedSDf54.getOp_order());
|
||||
Assertions.assertThat(actualObjectTag.getPayDate().format(formatter)).isEqualTo(expectedSDf54.getPay_date());
|
||||
Assertions.assertThat(actualObjectTag.getPayVal()).isEqualTo(expectedSDf54.getPay_val());
|
||||
Assertions.assertThat(actualObjectTag.getSumDeb()).isEqualTo(expectedSDf54.getSum_deb());
|
||||
Assertions.assertThat(actualObjectTag.getSclientn1()).isEqualTo(expectedSDf54.getSclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnDeb()).isEqualTo(expectedSDf54.getInn_deb());
|
||||
Assertions.assertThat(actualObjectTag.getKppDeb()).isEqualTo(expectedSDf54.getKpp_deb());
|
||||
Assertions.assertThat(actualObjectTag.getAccDeb()).isEqualTo(expectedSDf54.getAcc_deb());
|
||||
Assertions.assertThat(actualObjectTag.getRclientn1()).isEqualTo(expectedSDf54.getRclientn1());
|
||||
Assertions.assertThat(actualObjectTag.getInnCred()).isEqualTo(expectedSDf54.getInn_cred());
|
||||
Assertions.assertThat(actualObjectTag.getKppCred()).isEqualTo(expectedSDf54.getKpp_cred());
|
||||
Assertions.assertThat(actualObjectTag.getAccKr1()).isEqualTo(expectedSDf54.getAcc_kr_1());
|
||||
Assertions.assertThat(actualObjectTag.getSpecif1()).isEqualTo(expectedSDf54.getSpecif_1());
|
||||
Assertions.assertThat(actualObjectTag.getSendType()).isEqualTo(expectedSDf54.getSend_type());
|
||||
Assertions.assertThat(actualObjectTag.getDocResult()).isEqualTo(expectedSDf54.getDoc_result());
|
||||
Assertions.assertThat(actualObjectTag.getDocNum()).isEqualTo(expectedSDf54.getDoc_num());
|
||||
Assertions.assertThat(actualObjectTag.getDocDate().format(formatter)).isEqualTo(expectedSDf54.getDoc_date());
|
||||
Assertions.assertThat(actualObjectTag.getValueDate().format(formatter)).isEqualTo(expectedSDf54.getValue_date());
|
||||
Assertions.assertThat(actualObjectTag.getSwiftBen()).isEqualTo(expectedSDf54.getSwift_ben());
|
||||
Assertions.assertThat(actualObjectTag.getSwiftInt()).isEqualTo(expectedSDf54.getSwift_int());
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldExportSDf56ToObjectTag() {
|
||||
SDf56 expectedSDf56 = new SDf56();
|
||||
expectedSDf56.setNumber("test1");
|
||||
expectedSDf56.setStart_datetime("1718785193000");
|
||||
expectedSDf56.setEnd_datetime("1718875193000");
|
||||
expectedSDf56.setAccount("test4");
|
||||
expectedSDf56.setDeal("test5");
|
||||
|
||||
Imdg<SDf56> imdg = hazelcastService.getImdg(IMDGDistributedNames.Map_SDf56, SDf56.class);
|
||||
imdg.insert(expectedSDf56);
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF56);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-56_S_PRC1604240915_1.xml"));
|
||||
|
||||
StageResult stageResult = exportFromHazelcast.process(actualResultContainer);
|
||||
DF56ObjectTag actualObjectTag = (DF56ObjectTag) actualResultContainer.getDocumentTag().getObjects().get(0);
|
||||
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
Assertions.assertThat(actualResultContainer.getDocumentTag().getMessageType()).isEqualTo("DF56");
|
||||
Assertions.assertThat(actualObjectTag.getNumber()).isEqualTo(expectedSDf56.getNumber());
|
||||
Assertions.assertThat(actualObjectTag.getStartUnixtime()).isEqualTo(Long.valueOf(expectedSDf56.getStart_datetime()));
|
||||
Assertions.assertThat(actualObjectTag.getEndUnixtime()).isEqualTo(Long.valueOf(expectedSDf56.getEnd_datetime()));
|
||||
Assertions.assertThat(actualObjectTag.getStartDatetime()).isEqualTo(Instant.ofEpochMilli(Long.parseLong(expectedSDf56.getStart_datetime())).atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
Assertions.assertThat(actualObjectTag.getEndDatetime()).isEqualTo(Instant.ofEpochMilli(Long.parseLong(expectedSDf56.getEnd_datetime())).atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
Assertions.assertThat(actualObjectTag.getAccount()).isEqualTo(expectedSDf56.getAccount());
|
||||
Assertions.assertThat(actualObjectTag.getDeal()).isEqualTo(expectedSDf56.getDeal());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,433 @@
|
|||
package ru.spcex.clearing.xml.exporter.logic.stages;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.XMLExporterConfig;
|
||||
import ru.spcex.clearing.xml.exporter.config.settings.ExportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.ResultContainer;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.enums.Table;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.DocumentTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.ParentDocTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF02ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF03ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF05ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF07ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF51ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF53ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF54ObjectTag;
|
||||
import ru.spcex.clearing.xml.exporter.logic.data.tags.objects.DF56ObjectTag;
|
||||
|
||||
@SpringBootTest(classes = {
|
||||
WriteXMLFile.class,
|
||||
ExportXMLServiceSettings.class,
|
||||
XMLExporterConfig.class,
|
||||
ImdgTestConfig.class,
|
||||
})
|
||||
@TestPropertySource(properties = {"spring.config.location=./src/test/resources/"})
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
class WriteXMLFileTest {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private WriteXMLFile writeXMLFile;
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
try {
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-02_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-03_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-05_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-07_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-51_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-53_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-54_S_PRC1604240915_1.xml"));
|
||||
Files.deleteIfExists(Path.of("./src/test/resources/xml/DF-56_S_PRC1604240915_1.xml"));
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf02ToXMLFile() {
|
||||
DF02ObjectTag expectedObjectTag = new DF02ObjectTag();
|
||||
expectedObjectTag.setCurrCode("test1");
|
||||
expectedObjectTag.setAccount("test2");
|
||||
expectedObjectTag.setRemainder("test3");
|
||||
expectedObjectTag.setDeal("test4");
|
||||
expectedObjectTag.setAccCode("test5");
|
||||
expectedObjectTag.setDat(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setMarket("test6");
|
||||
expectedObjectTag.setAccName("test7");
|
||||
expectedObjectTag.setAccType("test8");
|
||||
expectedObjectTag.setSumengage("test9");
|
||||
expectedObjectTag.setSumunblock("test10");
|
||||
expectedObjectTag.setFileType("test11");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF02");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF02);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-02_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-02_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf03ToXMLFile() {
|
||||
DF03ObjectTag expectedObjectTag = new DF03ObjectTag();
|
||||
expectedObjectTag.setSegType("test1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setcAccDeb("test5");
|
||||
expectedObjectTag.setSbanknam1("test6");
|
||||
expectedObjectTag.setcAccCred("test7");
|
||||
expectedObjectTag.setRbanknam1("test8");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test9");
|
||||
expectedObjectTag.setSumDeb("test10");
|
||||
expectedObjectTag.setSpecif1("test11");
|
||||
expectedObjectTag.setImpResult("test12");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF03");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF03);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-03_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-03_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf05ToXMLFile() {
|
||||
DF05ObjectTag expectedObjectTag = new DF05ObjectTag();
|
||||
expectedObjectTag.setTp(BigDecimal.TEN);
|
||||
expectedObjectTag.setDt(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setTm(LocalTime.parse("09:22:12"));
|
||||
expectedObjectTag.setPr("test2");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF05");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF05);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-05_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-05_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf07ToXMLFile() {
|
||||
DF07ObjectTag expectedObjectTag = new DF07ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setSum(new BigDecimal(BigInteger.TEN));
|
||||
expectedObjectTag.setMarket("test3");
|
||||
expectedObjectTag.setType("test4");
|
||||
expectedObjectTag.setDeal("test5");
|
||||
expectedObjectTag.setClientN("test6");
|
||||
expectedObjectTag.setInn("test7");
|
||||
expectedObjectTag.setBic("test8");
|
||||
expectedObjectTag.setSpec("test9");
|
||||
expectedObjectTag.setNumber(new BigDecimal(BigInteger.TWO));
|
||||
expectedObjectTag.setDocNum("test11");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test12");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF07");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF07);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-07_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-07_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf51ToXMLFile() {
|
||||
DF51ObjectTag expectedObjectTag = new DF51ObjectTag();
|
||||
expectedObjectTag.setNumber("1234");
|
||||
expectedObjectTag.setDatetime(LocalDateTime.parse("2024-03-14T09:03:11"));
|
||||
expectedObjectTag.setUnixtime(expectedObjectTag.getDatetime().atZone(ZoneId.systemDefault()).toEpochSecond());
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF51");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF51);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-51_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-51_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf53ToXMLFile() {
|
||||
DF53ObjectTag expectedObjectTag = new DF53ObjectTag();
|
||||
expectedObjectTag.setAccount("test1");
|
||||
expectedObjectTag.setAccName("test2");
|
||||
expectedObjectTag.setDeal("test3");
|
||||
expectedObjectTag.setDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setStatus(1L);
|
||||
expectedObjectTag.setAccType("test4");
|
||||
expectedObjectTag.setResult("test5");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF53");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF53);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-53_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-53_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf54ToXMLFile() {
|
||||
DF54ObjectTag expectedObjectTag = new DF54ObjectTag();
|
||||
expectedObjectTag.setSegType("test1");
|
||||
expectedObjectTag.setDocType("test2");
|
||||
expectedObjectTag.setDocnmRef("test3");
|
||||
expectedObjectTag.setDocnmprev("test4");
|
||||
expectedObjectTag.setSbankcode("test5");
|
||||
expectedObjectTag.setcAccDeb("test6");
|
||||
expectedObjectTag.setSbanknam1("test7");
|
||||
expectedObjectTag.setRbankcode("test8");
|
||||
expectedObjectTag.setcAccCred("test9");
|
||||
expectedObjectTag.setRbanknam1("test10");
|
||||
expectedObjectTag.setOpType("test11");
|
||||
expectedObjectTag.setOpOrder("test12");
|
||||
expectedObjectTag.setPayDate(LocalDate.parse("2024-03-14"));
|
||||
expectedObjectTag.setPayVal("test13");
|
||||
expectedObjectTag.setSumDeb("test14");
|
||||
expectedObjectTag.setSclientn1("test15");
|
||||
expectedObjectTag.setInnDeb("test16");
|
||||
expectedObjectTag.setKppDeb("test17");
|
||||
expectedObjectTag.setAccDeb("test18");
|
||||
expectedObjectTag.setRclientn1("test19");
|
||||
expectedObjectTag.setInnCred("test20");
|
||||
expectedObjectTag.setKppCred("test21");
|
||||
expectedObjectTag.setAccKr1("test22");
|
||||
expectedObjectTag.setSpecif1("test23");
|
||||
expectedObjectTag.setSendType("test24");
|
||||
expectedObjectTag.setDocResult("test25");
|
||||
expectedObjectTag.setDocNum("test26");
|
||||
expectedObjectTag.setDocDate(LocalDate.parse("2024-03-15"));
|
||||
expectedObjectTag.setValueDate(LocalDate.parse("2024-03-16"));
|
||||
expectedObjectTag.setSwiftBen("test27");
|
||||
expectedObjectTag.setSwiftInt("test28");
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF54");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF54);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-54_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-54_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void process_shouldWriteSDf56ToXMLFile() {
|
||||
DF56ObjectTag expectedObjectTag = new DF56ObjectTag();
|
||||
expectedObjectTag.setNumber("test1");
|
||||
expectedObjectTag.setStartDatetime(LocalDateTime.parse("2024-03-14T09:03:11"));
|
||||
expectedObjectTag.setEndDatetime(LocalDateTime.parse("2024-04-15T11:03:11"));
|
||||
expectedObjectTag.setAccount("test4");
|
||||
expectedObjectTag.setDeal("test5");
|
||||
expectedObjectTag.setStartUnixtime(expectedObjectTag.getStartDatetime().atZone(ZoneId.systemDefault()).toEpochSecond());
|
||||
expectedObjectTag.setEndUnixtime(expectedObjectTag.getEndDatetime().atZone(ZoneId.systemDefault()).toEpochSecond());
|
||||
|
||||
ParentDocTag expectedParentDocTag = new ParentDocTag();
|
||||
expectedParentDocTag.setParentId("");
|
||||
|
||||
DocumentTag expectedDocumentTag = new DocumentTag();
|
||||
expectedDocumentTag.setMessageId("");
|
||||
expectedDocumentTag.setMessageType("DF56");
|
||||
expectedDocumentTag.setMessageName("");
|
||||
expectedDocumentTag.setMessageDate(LocalDate.parse("2024-03-14"));
|
||||
expectedDocumentTag.setMessageTime(LocalTime.parse("09:15:31"));
|
||||
expectedDocumentTag.setSender("");
|
||||
expectedDocumentTag.setReceiver("");
|
||||
expectedDocumentTag.setParentDoc(expectedParentDocTag);
|
||||
expectedDocumentTag.setObjects(List.of(expectedObjectTag));
|
||||
|
||||
ResultContainer actualResultContainer = new ResultContainer(Table.S_DF56);
|
||||
actualResultContainer.setFileForExport(new File("./src/test/resources/xml/DF-56_S_PRC1604240915_1.xml"));
|
||||
actualResultContainer.setDocumentTag(expectedDocumentTag);
|
||||
|
||||
StageResult stageResult = writeXMLFile.process(actualResultContainer);
|
||||
Assertions.assertThat(stageResult).isEqualTo(StageResult.OK);
|
||||
|
||||
try {
|
||||
Assertions.assertThat(Files.mismatch(actualResultContainer.getFileForExport().toPath(),
|
||||
Path.of("./src/test/resources/xml-original/DF-56_S_PRC1604240915_1.xml")))
|
||||
.isEqualTo(-1L);
|
||||
} catch (IOException e) {
|
||||
fail("File comparison failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
spring.main.web-application-type=none
|
||||
|
||||
export-xml-service.hazelcast.cluster-members=127.0.0.1:5701
|
||||
export-xml-service.hazelcast.login=dev
|
||||
export-xml-service.hazelcast.password=dev-pass
|
||||
|
||||
export-xml-service.common.encoding=cp866
|
||||
export-xml-service.common.threads-count=10
|
||||
|
||||
export-xml-service.store.local-temp-dir=D:\\docs and T3\\clearing\\xml\\
|
||||
# код валюты должен быть в верхнем регистре, например для рублей - "RUB" (*.RUB=export/rub/).RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.RUB=export/rub/
|
||||
export-xml-service.store.out-pay-val-dir.EUR=export/eur/
|
||||
export-xml-service.store.user:tester
|
||||
export-xml-service.store.password=password
|
||||
export-xml-service.store.server-ip=localhost
|
||||
export-xml-service.store.server-port=2222
|
||||
|
||||
export-xml-service.kafka-consumer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-consumer.group-id=dev-group-balance-service
|
||||
export-xml-service.kafka-consumer.enable-auto-commit=false
|
||||
export-xml-service.kafka-consumer.session-timeout-ms=30000
|
||||
export-xml-service.kafka-consumer.auto-offset-reset=latest
|
||||
export-xml-service.kafka-consumer.linger-ms=1
|
||||
export-xml-service.kafka-consumer.buffer-memory=33554432
|
||||
|
||||
export-xml-service.kafka-producer.bootstrap-servers=localhost:9092
|
||||
export-xml-service.kafka-producer.acks=all
|
||||
export-xml-service.kafka-producer.retries=0
|
||||
export-xml-service.kafka-producer.batch-size=16384
|
||||
export-xml-service.kafka-producer.linger-ms=1
|
||||
export-xml-service.kafka-producer.buffer-memory=33554432
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF02" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT CURR_CODE="test1" ACCOUNT="test2" REMAINDER="test3" DEAL="test4" ACC_CODE="test5" DAT="2024-03-14" MARKET="test6" ACC_NAME="test7" ACC_TYPE="test8" SUMENGAGE="test9" SUMUNBLOK="test10" FILE_TYPE="test11"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF03" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT SEG_TYPE="test1" DOC_TYPE="test2" DOCNM_REF="test3" DOCNMPREV="test4" C_ACC_DEB="test5" SBANKNAM="test6" C_ACC_CRED="test7" RBANKNAM="test8" PAY_DATE="2024-03-14" PAY_VAL="test9" SUM_DEB="test10" SPECIF_1="test11" IMP_RESULT="test12"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF05" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT TP="10" DT="2024-03-14" TM="09:22:12" PR="test2"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF07" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT ACCOUNT="test1" SUM="10" MARKET="test3" TYPE="test4" DEAL="test5" CLIENTN="test6" INN="test7" BIC="test8" SPEC="test9" NUMBER="2" DOC_NUM="test11" DOC_DATE="2024-03-14" PAY_VAL="test12"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF51" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT NUMBER="1234" UNIXTIME="1710396191" DATETIME="2024-03-14T09:03:11"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF53" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT ACCOUNT="test1" ACC_NAME="test2" DEAL="test3" DATE="2024-03-14" STATUS="1" ACC_TYPE="test4" RESULT="test5"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF54" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT SEG_TYPE="test1" DOC_TYPE="test2" DOCNM_REF="test3" DOCNMPREV="test4" SBANKCODE="test5" C_ACC_DEB="test6" SBANKNAM="test7" RBANKCODE="test8" C_ACC_CRED="test9" RBANKNAM="test10" OP_TYPE="test11" OP_ORDER="test12" PAY_DATE="2024-03-14" PAY_VAL="test13" SUM_DEB="test14" SCLIENTN="test15" INN_DEB="test16" KPP_DEB="test17" ACC_DEB="test18" RCLIENTN="test19" INN_CRED="test20" KPP_CRED="test21" ACC_KR_1="test22" SPECIF_1="test23" SEND_TYPE="test24" DOC_RESULT="test25" DOC_NUM="test26" DOC_DATE="2024-03-15" VALUE_DATE="2024-03-16" SWIFT_BEN="test27" SWIFT_INT="test28"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<DOCUMENT MESSAGEID="" MESSAGETYPE="DF56" MESSAGENAME="" MESSAGEDATE="2024-03-14" MESSAGETIME="09:15:31" SENDER="" RECEIVER="">
|
||||
<PARENTDOC PARENTID=""/>
|
||||
<OBJECTS>
|
||||
<OBJECT NUMBER="test1" SUNIXTIME="1710396191" SDATETIME="2024-03-14T09:03:11" EUNIXTIME="1713168191" EDATETIME="2024-04-15T11:03:11" ACCOUNT="test4" DEAL="test5"/>
|
||||
</OBJECTS>
|
||||
</DOCUMENT>
|
||||
2
clearing-parent/xml-importer/.gitignore
vendored
Normal file
2
clearing-parent/xml-importer/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
log/
|
||||
124
clearing-parent/xml-importer/.idea/uiDesigner.xml
generated
Normal file
124
clearing-parent/xml-importer/.idea/uiDesigner.xml
generated
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
156
clearing-parent/xml-importer/pom.xml
Normal file
156
clearing-parent/xml-importer/pom.xml
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xml-importer</artifactId>
|
||||
<name>xml-importer</name>
|
||||
<description>XML loader for XML files</description>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>clearing-parent</artifactId>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<version>SPCEX-3.12.101</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-sftp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JDBC -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>c3p0</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- XML files -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-imdg-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-imdg-api-hazelcast-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>classes</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-enum</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- special logging -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>7.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- TEST -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.spcex.clearing</groupId>
|
||||
<artifactId>test-clearing</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>application.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package ru.spcex.clearing.xml.importer;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
||||
@SpringBootApplication
|
||||
public class XMLImporterApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(XMLImporterApplication.class);
|
||||
builder.run(args);
|
||||
} catch (Exception e) {
|
||||
LoggerFactory.getLogger(XMLImporterApplication.class).error("XML-Loader start failed: {} -> {}", e.getClass().getSimpleName(), e.getMessage());
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@Configuration
|
||||
public class ImporterImdgConfig {
|
||||
private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) {
|
||||
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
|
||||
if (maxPoolSz > 2) {
|
||||
pool.setKeepAliveSeconds(60);
|
||||
pool.setAllowCoreThreadTimeOut(true);
|
||||
}
|
||||
pool.setCorePoolSize(maxPoolSz);
|
||||
pool.setWaitForTasksToCompleteOnShutdown(waitForCompletion);
|
||||
return pool;
|
||||
}
|
||||
|
||||
@Bean(name = "taskExecutorHazelcastClientInitializer")
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
}
|
||||
|
||||
@Bean(name = "taskExecutorIdGeneratorAwaiter")
|
||||
public ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter() {
|
||||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public ImdgProvider imdgProvider(
|
||||
@Qualifier("taskExecutorHazelcastClientInitializer") ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer,
|
||||
@Qualifier("taskExecutorIdGeneratorAwaiter") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
ImportXMLServiceSettings settings
|
||||
) {
|
||||
return new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||
taskExecutorIdGeneratorAwaiter,
|
||||
settings.getHazelcast());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import org.apache.kafka.clients.consumer.Consumer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaConsumerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.KafkaProducerFactory;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
@Configuration
|
||||
public class KafkaConfig {
|
||||
@Bean
|
||||
public ProducerFactory<String, Object> pf(ImportXMLServiceSettings settings) {
|
||||
KafkaProducerSettings kafkaSettings = settings.getKafkaProducer();
|
||||
return KafkaProducerFactory.producerFactory(kafkaSettings);
|
||||
}
|
||||
|
||||
@Bean("kafkaTemplate")
|
||||
public KafkaTemplate<String, Object> kafkaTemplate(ProducerFactory<String, Object> pf) {
|
||||
return new KafkaTemplate<>(pf);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Bean
|
||||
public Supplier<KafkaSender> kafkaSender(KafkaTemplate<String, Object> kafkaTemplate,
|
||||
ImdgProvider imdgProvider) {
|
||||
ImdgId imdgIdGenerator = imdgProvider.getImdgIdGenerator();
|
||||
return () -> KafkaSender
|
||||
.setup()
|
||||
.setKafkaTemplate(kafkaTemplate)
|
||||
.idGenerator(imdgIdGenerator::nextId)
|
||||
.imdgProvider(s -> {
|
||||
Imdg<RequestInfo> imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class);
|
||||
return imdg::insert;
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
@Bean
|
||||
public Consumer<String, Object> createConsumer(ImportXMLServiceSettings settings) {
|
||||
return KafkaConsumerFactory.consumer(settings.getKafkaConsumer());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import static org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Command.MGET;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.integration.annotation.Gateway;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway;
|
||||
import org.springframework.integration.file.remote.session.CachingSessionFactory;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean;
|
||||
import org.springframework.integration.sftp.gateway.SftpOutboundGateway;
|
||||
import org.springframework.integration.sftp.session.DefaultSftpSessionFactory;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
|
||||
@Profile("!test")
|
||||
@Configuration
|
||||
public class SFTPConfig {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Bean
|
||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ImportXMLServiceSettings settings) {
|
||||
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
||||
factory.setHost(settings.getStore().getSftpIn().getServerIp());
|
||||
factory.setPort(settings.getStore().getSftpIn().getServerPort());
|
||||
factory.setUser(settings.getStore().getSftpIn().getUser());
|
||||
factory.setPassword(settings.getStore().getSftpIn().getPassword());
|
||||
factory.setAllowUnknownKeys(true);
|
||||
return new CachingSessionFactory<>(factory);
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/53655208/profile-doesnt-work-with-messaging-gateway
|
||||
@Bean("xmlGateway")
|
||||
public AnnotationGatewayProxyFactoryBean xmlGateway() {
|
||||
return new AnnotationGatewayProxyFactoryBean(XmlGateway.class);
|
||||
}
|
||||
|
||||
public interface XmlGateway {
|
||||
@Gateway(requestChannel = "listSftpChannel")
|
||||
List<File> listFiles(String dir);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageChannel listSftpChannel(SessionFactory<ChannelSftp.LsEntry> sessionFactory, ImportXMLServiceSettings settings) {
|
||||
DirectChannel dc = new DirectChannel();
|
||||
dc.subscribe(handlerList(sessionFactory, settings));
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServiceActivator(inputChannel = "listSftpChannel")
|
||||
public MessageHandler handlerList(SessionFactory<ChannelSftp.LsEntry> sessionFactory, ImportXMLServiceSettings settings) {
|
||||
SftpOutboundGateway sftpOutboundGateway = new SftpOutboundGateway(sessionFactory, MGET.getCommand(), null);
|
||||
sftpOutboundGateway.setLocalDirectory(new File(settings.getStore().getSrcDir()));
|
||||
sftpOutboundGateway.setAutoCreateLocalDirectory(true);
|
||||
sftpOutboundGateway.setOption(AbstractRemoteFileOutboundGateway.Option.DELETE);
|
||||
return sftpOutboundGateway;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
@Profile("test")
|
||||
@Configuration
|
||||
public class SFTPMockConfig {
|
||||
@Bean("xmlGateway")
|
||||
public SFTPConfig.XmlGateway xmlGateway(){
|
||||
return new XGateway();
|
||||
}
|
||||
|
||||
public static class XGateway implements SFTPConfig.XmlGateway{
|
||||
|
||||
@Override
|
||||
public List<File> listFiles(String dir) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package ru.spcex.clearing.xml.importer.config;
|
||||
|
||||
import com.ctc.wstx.stax.WstxInputFactory;
|
||||
import com.ctc.wstx.stax.WstxOutputFactory;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf04;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf06;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf52;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf55;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf57;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.xml.importer.config.settings.ImportXMLServiceSettings;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public class XMLImporterConfig {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final ImportXMLServiceSettings settings;
|
||||
private final ApplicationContext context;
|
||||
private final ImdgProvider hazelcastService;
|
||||
|
||||
public XMLImporterConfig(ImportXMLServiceSettings settings,
|
||||
ApplicationContext context,
|
||||
ImdgProvider hazelcastService) {
|
||||
this.settings = settings;
|
||||
this.context = context;
|
||||
this.hazelcastService = hazelcastService;
|
||||
}
|
||||
|
||||
@Bean("executor")
|
||||
public ThreadPoolTaskExecutor executor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
|
||||
executor.setMaxPoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setCorePoolSize(settings.getCommon().getThreadsCount());
|
||||
executor.setThreadNamePrefix("xml-importer-thread-");
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(300);
|
||||
executor.initialize();
|
||||
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("mapOfTable")
|
||||
public Map<ETable, ImdgHazelcast<? extends SpcexObjectBase>> getMapOfTables() {
|
||||
Map<ETable, ImdgHazelcast<? extends SpcexObjectBase>> map = new HashMap<>();
|
||||
map.put(ETable.DF_01, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf01, SDf01.class));
|
||||
map.put(ETable.DF_04, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf04, SDf04.class));
|
||||
map.put(ETable.DF_06, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf06, SDf06.class));
|
||||
map.put(ETable.DF_52, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf52, SDf52.class));
|
||||
map.put(ETable.DF_55, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf55, SDf55.class));
|
||||
map.put(ETable.DF_57, (ImdgHazelcast<? extends SpcexObjectBase>) hazelcastService.getImdg(IMDGDistributedNames.Map_SDf57, SDf57.class));
|
||||
return map;
|
||||
}
|
||||
|
||||
@Bean("xmlMapper")
|
||||
public XmlMapper xmlMapper() {
|
||||
XMLInputFactory inputFactory = new WstxInputFactory();
|
||||
XMLOutputFactory outputFactory = new WstxOutputFactory();
|
||||
|
||||
XmlFactory xmlFactory = XmlFactory.builder()
|
||||
.xmlInputFactory(inputFactory)
|
||||
.xmlOutputFactory(outputFactory)
|
||||
.build();
|
||||
|
||||
XmlMapper xmlMapper = new XmlMapper(xmlFactory);
|
||||
xmlMapper.registerModule(new JavaTimeModule());
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
return xmlMapper;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
public class Common {
|
||||
private String encodingSource;
|
||||
private int insertBatchSize;
|
||||
private int threadsCount;
|
||||
|
||||
public String getEncodingSource() {
|
||||
return encodingSource;
|
||||
}
|
||||
|
||||
public void setEncodingSource(String encodingSource) {
|
||||
this.encodingSource = encodingSource;
|
||||
}
|
||||
|
||||
public int getInsertBatchSize() {
|
||||
return insertBatchSize;
|
||||
}
|
||||
|
||||
public void setInsertBatchSize(int insertBatchSize) {
|
||||
this.insertBatchSize = insertBatchSize;
|
||||
}
|
||||
|
||||
public int getThreadsCount() {
|
||||
return threadsCount;
|
||||
}
|
||||
|
||||
public void setThreadsCount(int threadsCount) {
|
||||
this.threadsCount = threadsCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
public class Cron {
|
||||
private String checkSrcDirCron;
|
||||
|
||||
public String getCheckSrcDirCron() {
|
||||
return checkSrcDirCron;
|
||||
}
|
||||
|
||||
public void setCheckSrcDirCron(String checkSrcDirCron) {
|
||||
this.checkSrcDirCron = checkSrcDirCron;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaConsumerSettings;
|
||||
import ru.spcex.clearing.platform.messaging.config.element.KafkaProducerSettings;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.config.HazelcastClientParams;
|
||||
|
||||
@Component
|
||||
@PropertySource("file:${spring.config.location}/application.properties")
|
||||
@ConfigurationProperties("import-xml-service")
|
||||
public class ImportXMLServiceSettings {
|
||||
private HazelcastClientParams hazelcast;
|
||||
private KafkaProducerSettings kafkaProducer;
|
||||
private KafkaConsumerSettings kafkaConsumer;
|
||||
private Common common;
|
||||
private Store store;
|
||||
private Cron cron;
|
||||
|
||||
public HazelcastClientParams getHazelcast() {
|
||||
return hazelcast;
|
||||
}
|
||||
|
||||
public void setHazelcast(HazelcastClientParams hazelcast) {
|
||||
this.hazelcast = hazelcast;
|
||||
}
|
||||
|
||||
public KafkaProducerSettings getKafkaProducer() {
|
||||
return kafkaProducer;
|
||||
}
|
||||
|
||||
public void setKafkaProducer(KafkaProducerSettings kafkaProducer) {
|
||||
this.kafkaProducer = kafkaProducer;
|
||||
}
|
||||
|
||||
public KafkaConsumerSettings getKafkaConsumer() {
|
||||
return kafkaConsumer;
|
||||
}
|
||||
|
||||
public void setKafkaConsumer(KafkaConsumerSettings kafkaConsumer) {
|
||||
this.kafkaConsumer = kafkaConsumer;
|
||||
}
|
||||
|
||||
public Common getCommon() {
|
||||
return common;
|
||||
}
|
||||
|
||||
public void setCommon(Common common) {
|
||||
this.common = common;
|
||||
}
|
||||
|
||||
public Store getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
public void setStore(Store store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public Cron getCron() {
|
||||
return cron;
|
||||
}
|
||||
|
||||
public void setCron(Cron cron) {
|
||||
this.cron = cron;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package ru.spcex.clearing.xml.importer.config.settings;
|
||||
|
||||
import ru.spcex.platform.utils.config.SftpInboundFolderSetting;
|
||||
|
||||
public class Store {
|
||||
private String srcDir;
|
||||
private String outDir;
|
||||
private String outDirError;
|
||||
private boolean deleteSrcFiles = true;
|
||||
//sftp settings
|
||||
private SftpInboundFolderSetting sftpIn;
|
||||
public String getSrcDir() {
|
||||
return srcDir;
|
||||
}
|
||||
|
||||
public void setSrcDir(String srcDir) {
|
||||
this.srcDir = srcDir;
|
||||
}
|
||||
|
||||
public String getOutDir() {
|
||||
return outDir;
|
||||
}
|
||||
|
||||
public void setOutDir(String outDir) {
|
||||
this.outDir = outDir;
|
||||
}
|
||||
|
||||
public boolean isDeleteSrcFiles() {
|
||||
return deleteSrcFiles;
|
||||
}
|
||||
|
||||
public void setDeleteSrcFiles(boolean deleteSrcFiles) {
|
||||
this.deleteSrcFiles = deleteSrcFiles;
|
||||
}
|
||||
|
||||
public String getOutDirError() {
|
||||
return outDirError;
|
||||
}
|
||||
|
||||
public void setOutDirError(String outDirError) {
|
||||
this.outDirError = outDirError;
|
||||
}
|
||||
|
||||
public SftpInboundFolderSetting getSftpIn() {
|
||||
return sftpIn;
|
||||
}
|
||||
|
||||
public void setSftpIn(SftpInboundFolderSetting sftpIn) {
|
||||
this.sftpIn = sftpIn;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package ru.spcex.clearing.xml.importer.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.spcex.clearing.xml.importer.services.XMLImporterService;
|
||||
|
||||
@RestController("/")
|
||||
public class ImporterController implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final XMLImporterService importerService;
|
||||
|
||||
public ImporterController(@Qualifier("xmlImporterService") XMLImporterService importerService) {
|
||||
this.importerService = importerService;
|
||||
}
|
||||
|
||||
@GetMapping(path = "/xml-import", produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
public String checkFolder() {
|
||||
log.info("Call check method for importer controller");
|
||||
importerService.run();
|
||||
return "xml import completed, see log";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
log.info("controller started");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package ru.spcex.clearing.xml.importer.exceptions;
|
||||
|
||||
public class ConfigException extends RuntimeException {
|
||||
public ConfigException(String msg) { super(msg); }
|
||||
public ConfigException(String msg, Throwable cause) { super(msg, cause); }
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.DocumentTag;
|
||||
|
||||
public class ResultContainer {
|
||||
private UUID uuid;
|
||||
private ETable xmlTable;
|
||||
private File xmlFile;
|
||||
private StageResult lastStageStatus;
|
||||
private DocumentTag documentTag;
|
||||
|
||||
public ResultContainer(ETable xmlTable, File xmlFile) {
|
||||
this.xmlTable = xmlTable;
|
||||
this.xmlFile = xmlFile;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public ETable getXmlTable() {
|
||||
return xmlTable;
|
||||
}
|
||||
|
||||
public void setXmlTable(ETable xmlTable) {
|
||||
this.xmlTable = xmlTable;
|
||||
}
|
||||
|
||||
public File getXmlFile() {
|
||||
return xmlFile;
|
||||
}
|
||||
|
||||
public void setXmlFile(File xmlFile) {
|
||||
this.xmlFile = xmlFile;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public StageResult getLastStageStatus() {
|
||||
return lastStageStatus;
|
||||
}
|
||||
|
||||
public void setLastStageStatus(StageResult lastStageRes) {
|
||||
this.lastStageStatus = lastStageRes;
|
||||
}
|
||||
|
||||
public DocumentTag getDocumentTag() {
|
||||
return documentTag;
|
||||
}
|
||||
|
||||
public void setDocumentTag(DocumentTag documentTag) {
|
||||
this.documentTag = documentTag;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.enums;
|
||||
|
||||
public enum ETable {
|
||||
DF_01("DF-01"),
|
||||
DF_04("DF-04"),
|
||||
DF_06("DF-06"),
|
||||
DF_52("DF-52"),
|
||||
DF_55("DF-55"),
|
||||
DF_57("DF-57");
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
private final String prefix;
|
||||
|
||||
ETable(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public static ETable getTableForFilename(String filename) {
|
||||
for (ETable table : ETable.values()) {
|
||||
if (table.fileForThisTable(filename)) return table;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ETable tableForName(String name) {
|
||||
for (ETable table : values()) {
|
||||
if (name.equalsIgnoreCase(table.name()))
|
||||
return table;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean fileForThisTable(String filename) {
|
||||
return filename != null && filename.startsWith(prefix);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.enums;
|
||||
|
||||
public enum StageResult {
|
||||
OK,
|
||||
ERROR,
|
||||
COMPLETE
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package ru.spcex.clearing.xml.importer.logic.data.tags;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import ru.spcex.clearing.xml.importer.logic.data.tags.objects.ObjectTag;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
@JacksonXmlRootElement(localName = "DOCUMENT")
|
||||
public class DocumentTag {
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEID")
|
||||
private String messageId;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETYPE")
|
||||
private String messageType;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGENAME")
|
||||
private String messageName;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGEDATE")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate messageDate;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "MESSAGETIME")
|
||||
@JsonFormat(pattern = "HH:mm:ss")
|
||||
private LocalTime messageTime;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "SENDER")
|
||||
private String sender;
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "RECEIVER")
|
||||
private String receiver;
|
||||
|
||||
@JacksonXmlProperty(localName = "PARENTDOC")
|
||||
private ParentDocTag parentDoc;
|
||||
|
||||
@JacksonXmlElementWrapper(localName = "OBJECTS")
|
||||
@JacksonXmlProperty(localName = "OBJECT")
|
||||
private List<ObjectTag<? extends SpcexObjectBase>> objects;
|
||||
|
||||
public DocumentTag() {
|
||||
}
|
||||
|
||||
public String getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(String messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public String getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
public String getMessageName() {
|
||||
return messageName;
|
||||
}
|
||||
|
||||
public void setMessageName(String messageName) {
|
||||
this.messageName = messageName;
|
||||
}
|
||||
|
||||
public LocalDate getMessageDate() {
|
||||
return messageDate;
|
||||
}
|
||||
|
||||
public void setMessageDate(LocalDate messageDate) {
|
||||
this.messageDate = messageDate;
|
||||
}
|
||||
|
||||
public LocalTime getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(LocalTime messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getReceiver() {
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(String receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
public ParentDocTag getParentDoc() {
|
||||
return parentDoc;
|
||||
}
|
||||
|
||||
public void setParentDoc(ParentDocTag parentDoc) {
|
||||
this.parentDoc = parentDoc;
|
||||
}
|
||||
|
||||
public List<ObjectTag<? extends SpcexObjectBase>> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public void setObjects(List<ObjectTag<? extends SpcexObjectBase>> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DocumentTag that = (DocumentTag) o;
|
||||
return Objects.equals(messageId, that.messageId) && Objects.equals(messageType, that.messageType) && Objects.equals(messageName, that.messageName) && Objects.equals(messageDate, that.messageDate) && Objects.equals(messageTime, that.messageTime) && Objects.equals(sender, that.sender) && Objects.equals(receiver, that.receiver) && Objects.equals(parentDoc, that.parentDoc) && Objects.equals(objects, that.objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(messageId, messageType, messageName, messageDate, messageTime, sender, receiver, parentDoc, objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DocumentTag{" +
|
||||
"messageId='" + messageId + '\'' +
|
||||
", messageType='" + messageType + '\'' +
|
||||
", messageName='" + messageName + '\'' +
|
||||
", messageDate='" + messageDate + '\'' +
|
||||
", messageTime='" + messageTime + '\'' +
|
||||
", sender='" + sender + '\'' +
|
||||
", receiver='" + receiver + '\'' +
|
||||
", parentDoc=" + parentDoc +
|
||||
", objects=" + objects +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue