fix property drivers_licence
This commit is contained in:
parent
3a41351297
commit
9f22b17418
6 changed files with 1248 additions and 1341 deletions
|
|
@ -60,16 +60,6 @@
|
|||
<to>driver_licence_group_by_recruit_id</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_group_by_recruit_id</from>
|
||||
<to>driver_licence_java_expression</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_java_expression</from>
|
||||
<to>update_drivers_licence_flags</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>drivers_licence_output</from>
|
||||
<to>Identify last row in a stream </to>
|
||||
|
|
@ -85,6 +75,11 @@
|
|||
<to>driver_licence_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_group_by_recruit_id</from>
|
||||
<to>update_drivers_licence_flags</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Abort</name>
|
||||
|
|
@ -106,115 +101,6 @@
|
|||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_license_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>816</xloc>
|
||||
<yloc>208</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_lisence_job_create</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Detect empty stream</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
|
|
@ -286,39 +172,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<yloc>352</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_java_expression</name>
|
||||
<type>Janino</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<formula>
|
||||
<field_name>has_driver_license</field_name>
|
||||
<formula_string>has_driver_license_raw == 1</formula_string>
|
||||
<value_type>Boolean</value_type>
|
||||
<value_length>-1</value_length>
|
||||
<value_precision>-1</value_precision>
|
||||
<replace_field/>
|
||||
</formula>
|
||||
<formula>
|
||||
<field_name>has_tractor_license</field_name>
|
||||
<formula_string>has_tractor_license_raw == 1</formula_string>
|
||||
<value_type>Boolean</value_type>
|
||||
<value_length>-1</value_length>
|
||||
<value_precision>-1</value_precision>
|
||||
<replace_field/>
|
||||
</formula>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>848</xloc>
|
||||
<yloc>752</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_group_by_recruit_id</name>
|
||||
<type>GroupBy</type>
|
||||
|
|
@ -335,14 +188,16 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<directory>${java.io.tmpdir}</directory>
|
||||
<fields>
|
||||
<field>
|
||||
<aggregate>has_driver_license_raw</aggregate>
|
||||
<aggregate>has_driver_license</aggregate>
|
||||
<subject>is_has_driver_license</subject>
|
||||
<type>MAX</type>
|
||||
<valuefield/>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_tractor_license_raw</aggregate>
|
||||
<aggregate>has_tractor_license</aggregate>
|
||||
<subject>is_has_tractor_license</subject>
|
||||
<type>MAX</type>
|
||||
<valuefield/>
|
||||
</field>
|
||||
</fields>
|
||||
<give_back_row>N</give_back_row>
|
||||
|
|
@ -352,6 +207,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</field>
|
||||
</group>
|
||||
<ignore_aggregate>N</ignore_aggregate>
|
||||
<linenr_fieldname/>
|
||||
<prefix>grp</prefix>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
|
|
@ -359,6 +215,103 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<yloc>752</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>816</xloc>
|
||||
<yloc>208</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_license_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_lisence_job_create</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>drivers_licence_input</name>
|
||||
<type>TableInput</type>
|
||||
|
|
|
|||
|
|
@ -30,21 +30,11 @@
|
|||
<to>Table input 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream 2</from>
|
||||
<to>driver_licence_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_insert_or_update</from>
|
||||
<to>driver_lisence_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input 2</from>
|
||||
<to>Detect empty stream 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>update_driver_licence_flag</from>
|
||||
<to>driver_lisence_failure_job</to>
|
||||
|
|
@ -55,21 +45,11 @@
|
|||
<to>driver_licence_need_update_filter</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_group_by_recruit_id</from>
|
||||
<to>driver_licence_java_expression</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input 2</from>
|
||||
<to>driver_licence_group_by_recruit_id</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_java_expression</from>
|
||||
<to>update_driver_licence_flag</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input 2</from>
|
||||
<to>driver_licence_need_delete_filter</to>
|
||||
|
|
@ -80,6 +60,21 @@
|
|||
<to>driver_licence_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream 2 2</from>
|
||||
<to>Filter rows 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_group_by_recruit_id</from>
|
||||
<to>update_driver_licence_flag</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows 2</from>
|
||||
<to>driver_licence_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_need_delete_filter</from>
|
||||
<to>delete_act_tractor</to>
|
||||
|
|
@ -87,32 +82,27 @@
|
|||
</hop>
|
||||
<hop>
|
||||
<from>delete_act_tractor</from>
|
||||
<to>driver_lisence_failure_job</to>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows 2</from>
|
||||
<to>Unique rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Unique rows</from>
|
||||
<to>driver_licence_success_job</to>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Identify last row in a stream 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_insert_or_update</from>
|
||||
<to>Detect empty stream 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream 2</from>
|
||||
<to>Identify last row in a stream 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>delete_act_tractor</from>
|
||||
<to>Identify last row in a stream 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream 2 2</from>
|
||||
<to>Filter rows 2</to>
|
||||
<to>driver_lisence_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
|
|
@ -137,8 +127,8 @@
|
|||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_license_job_create</name>
|
||||
<type>ExecSql</type>
|
||||
<name>Detect empty stream</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -147,29 +137,10 @@
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET
|
||||
status = 'DELTA_PROCESSING',
|
||||
execution_datetime = DEFAULT,
|
||||
error_description = NULL
|
||||
where job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>432</xloc>
|
||||
<yloc>1264</yloc>
|
||||
<xloc>1408</xloc>
|
||||
<yloc>1136</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -185,8 +156,8 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>976</yloc>
|
||||
<xloc>1568</xloc>
|
||||
<yloc>1232</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -218,11 +189,11 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Unique rows</send_true_to>
|
||||
<send_true_to>driver_licence_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1744</xloc>
|
||||
<yloc>1184</yloc>
|
||||
<xloc>1760</xloc>
|
||||
<yloc>1136</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -239,8 +210,8 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1552</xloc>
|
||||
<yloc>1184</yloc>
|
||||
<xloc>1568</xloc>
|
||||
<yloc>1136</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -256,7 +227,6 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit/>
|
||||
<sql>WITH
|
||||
base AS (
|
||||
SELECT
|
||||
|
|
@ -278,24 +248,25 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
THEN to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->>'dataSved', 'YYYY-MM-DD')
|
||||
END as pred_update_date
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
|
||||
WHERE (jsonb_typeof(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->'svedKat') = 'array'
|
||||
OR ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM' IS NOT NULL
|
||||
OR ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM' IS NOT NULL)
|
||||
),
|
||||
all_data AS (
|
||||
-- Водительские права (обычные)
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->> 'id') as source_id,
|
||||
(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->> 'id') as source_id,
|
||||
ri.driver_update_date AS source_update_date,
|
||||
ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->>'kodStatus' AS status,
|
||||
ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->>'serNomDok' AS licence_series,
|
||||
NULL AS licence_number,
|
||||
array_to_string(array(
|
||||
SELECT kat->>'naimKatTS'
|
||||
FROM jsonb_array_elements(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->'svedKat') AS kat
|
||||
WHERE jsonb_typeof(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->'svedKat') = 'array'), ',') AS categories,
|
||||
SELECT kat->>'naimKatTS'
|
||||
FROM jsonb_array_elements(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->'svedKat') AS kat
|
||||
WHERE jsonb_typeof(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->'svedKat') = 'array'), ',') AS categories,
|
||||
to_date(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->>'dataVydDok', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(ri.info->'svedFL'->'svedVoditUdost'->'voditUdost'->>'srokDeistvDok', 'YYYY-MM-DD') AS close_date,
|
||||
NULL AS replacement_date,
|
||||
|
|
@ -308,6 +279,7 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
|
||||
UNION ALL
|
||||
|
||||
-- Актуальные трактористские права (aktUTM)
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->> 'id') as source_id,
|
||||
|
|
@ -316,18 +288,20 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->>'serUTM' AS licence_series,
|
||||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->>'nomUTM' AS licence_number,
|
||||
(SELECT array_to_string(ARRAY(SELECT jsonb_array_elements_text(
|
||||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->'extend'->'kodKatUTM')), ',')) AS categories,
|
||||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->'extend'->'kodKatUTM')), ',')) AS categories,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->>'dataVydUTM', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->>'dataOkonchUTM', 'YYYY-MM-DD') AS close_date,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->>'dataZameny', 'YYYY-MM-DD') AS replacement_date,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'aktUTM'->>'dataVozvr', 'YYYY-MM-DD') AS return_date,
|
||||
true AS tractor_driver,
|
||||
ri.akt_update_date > '${MAX_SOURCE_UPDATE_DATE}'::date as need_update,
|
||||
NOT ri.has_akt_utm_info as need_to_delete
|
||||
false as need_to_delete -- актуальные права не помечаем на удаление
|
||||
FROM base ri
|
||||
WHERE ri.has_akt_utm_info
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- Предыдущие трактористские права (predUTM)
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->> 'id') as source_id,
|
||||
|
|
@ -336,7 +310,7 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->>'serUTM' AS licence_series,
|
||||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->>'nomUTM' AS licence_number,
|
||||
(SELECT array_to_string(ARRAY(SELECT jsonb_array_elements_text(
|
||||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->'extend'->'kodKatUTM')), ',')) AS categories,
|
||||
ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->'extend'->'kodKatUTM')), ',')) AS categories,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->>'dataVydUTM', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->>'dataOkonchUTM', 'YYYY-MM-DD') AS close_date,
|
||||
to_date(ri.info->'svedFL'->'svedUdostTraktMash'->'udostTraktMash'->'predUTM'->>'dataZameny', 'YYYY-MM-DD') AS replacement_date,
|
||||
|
|
@ -346,17 +320,37 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
false as need_to_delete
|
||||
FROM base ri
|
||||
WHERE ri.has_pred_utm_info
|
||||
|
||||
UNION ALL
|
||||
-- Актуальные трактористские права на удаление
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
NULL as source_id,
|
||||
NULL AS source_update_date,
|
||||
'1' AS status,
|
||||
NULL AS licence_series,
|
||||
NULL AS licence_number,
|
||||
NULL AS categories,
|
||||
NULL AS start_date,
|
||||
NULL AS close_date,
|
||||
NULL AS replacement_date,
|
||||
NULL AS return_date,
|
||||
true AS tractor_driver,
|
||||
false as need_update,
|
||||
true as need_to_delete
|
||||
FROM base ri
|
||||
WHERE ri.has_pred_utm_info AND NOT ri.has_akt_utm_info and ri.pred_update_date > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
)
|
||||
SELECT
|
||||
*,
|
||||
CASE
|
||||
WHEN tractor_driver = false AND status = '1' THEN 1
|
||||
ELSE 0
|
||||
END AS is_has_driver_license,
|
||||
WHEN tractor_driver = false AND status = '1' THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS has_driver_license,
|
||||
CASE
|
||||
WHEN tractor_driver = true AND status = '1' AND NOT need_to_delete THEN 1
|
||||
ELSE 0
|
||||
END AS is_has_tractor_license
|
||||
WHEN tractor_driver = true AND status = '1' AND NOT need_to_delete THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS has_tractor_license
|
||||
FROM all_data
|
||||
ORDER BY recruit_id</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
|
|
@ -366,27 +360,6 @@ ORDER BY recruit_id</sql>
|
|||
<yloc>1264</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Unique rows</name>
|
||||
<type>Unique</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<count_rows>N</count_rows>
|
||||
<fields>
|
||||
</fields>
|
||||
<reject_duplicate_row>N</reject_duplicate_row>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1744</xloc>
|
||||
<yloc>1072</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>delete_act_tractor</name>
|
||||
<type>Delete</type>
|
||||
|
|
@ -421,8 +394,8 @@ ORDER BY recruit_id</sql>
|
|||
</lookup>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1232</xloc>
|
||||
<yloc>1184</yloc>
|
||||
<xloc>1248</xloc>
|
||||
<yloc>1136</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -441,13 +414,13 @@ ORDER BY recruit_id</sql>
|
|||
<directory>${java.io.tmpdir}</directory>
|
||||
<fields>
|
||||
<field>
|
||||
<aggregate>has_driver_license_raw</aggregate>
|
||||
<subject>is_has_driver_license</subject>
|
||||
<aggregate>has_driver_license</aggregate>
|
||||
<subject>has_driver_license</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_tractor_license_raw</aggregate>
|
||||
<subject>is_has_tractor_license</subject>
|
||||
<aggregate>has_tractor_license</aggregate>
|
||||
<subject>has_tractor_license</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
</fields>
|
||||
|
|
@ -465,42 +438,6 @@ ORDER BY recruit_id</sql>
|
|||
<yloc>1520</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_lisence_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'DELTA_ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1552</xloc>
|
||||
<yloc>1328</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
|
|
@ -519,7 +456,6 @@ and recruitment_id = '${IDM_ID}';
|
|||
<condition>=</condition>
|
||||
<field>source_id</field>
|
||||
<name>source_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>drivers_licence</table>
|
||||
|
|
@ -591,39 +527,6 @@ and recruitment_id = '${IDM_ID}';
|
|||
<yloc>1328</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_java_expression</name>
|
||||
<type>Janino</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<formula>
|
||||
<field_name>has_driver_license</field_name>
|
||||
<formula_string>has_driver_license_raw == 1</formula_string>
|
||||
<value_type>Boolean</value_type>
|
||||
<value_length>-1</value_length>
|
||||
<value_precision>-1</value_precision>
|
||||
<replace_field/>
|
||||
</formula>
|
||||
<formula>
|
||||
<field_name>has_tractor_license</field_name>
|
||||
<formula_string>has_tractor_license_raw == 1</formula_string>
|
||||
<value_type>Boolean</value_type>
|
||||
<value_length>-1</value_length>
|
||||
<value_precision>-1</value_precision>
|
||||
<replace_field/>
|
||||
</formula>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1056</xloc>
|
||||
<yloc>1520</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_need_delete_filter</name>
|
||||
<type>FilterRows</type>
|
||||
|
|
@ -653,11 +556,12 @@ and recruitment_id = '${IDM_ID}';
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_false_to>Sample rows</send_false_to>
|
||||
<send_true_to>delete_act_tractor</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>992</xloc>
|
||||
<yloc>1184</yloc>
|
||||
<xloc>1008</xloc>
|
||||
<yloc>1136</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -689,6 +593,7 @@ and recruitment_id = '${IDM_ID}';
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_false_to>Sample rows</send_false_to>
|
||||
<send_true_to>driver_licence_insert_or_update</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
|
|
@ -710,11 +615,8 @@ and recruitment_id = '${IDM_ID}';
|
|||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -725,13 +627,80 @@ WHERE job_name = '${JOB_NAME}'
|
|||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1744</xloc>
|
||||
<xloc>1760</xloc>
|
||||
<yloc>976</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_license_job_create</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET
|
||||
status = 'DELTA_PROCESSING',
|
||||
execution_datetime = DEFAULT,
|
||||
error_description = NULL
|
||||
where job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>432</xloc>
|
||||
<yloc>1264</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_lisence_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'DELTA_ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1552</xloc>
|
||||
<yloc>1328</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>update_driver_licence_flag</name>
|
||||
<type>Update</type>
|
||||
|
|
@ -746,13 +715,11 @@ and recruitment_id = '${IDM_ID}';
|
|||
<commit>10000</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<error_ignored>Y</error_ignored>
|
||||
<ignore_flag_field/>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruit_id</field>
|
||||
<name>recruit_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>citizen</table>
|
||||
|
|
|
|||
|
|
@ -46,16 +46,6 @@
|
|||
<to>Filter rows 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_java_expression</from>
|
||||
<to>update_drivers_licence_flags</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_group_by_recruit_id</from>
|
||||
<to>driver_licence_java_expression</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>drivers_licence_input</from>
|
||||
<to>Detect empty stream 2</to>
|
||||
|
|
@ -86,6 +76,11 @@
|
|||
<to>driver_license_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>driver_licence_group_by_recruit_id</from>
|
||||
<to>update_drivers_licence_flags</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Abort 2</name>
|
||||
|
|
@ -283,14 +278,16 @@
|
|||
<directory>${java.io.tmpdir}</directory>
|
||||
<fields>
|
||||
<field>
|
||||
<aggregate>has_driver_license_raw</aggregate>
|
||||
<aggregate>has_driver_license</aggregate>
|
||||
<subject>is_has_driver_license</subject>
|
||||
<type>MAX</type>
|
||||
<valuefield/>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_tractor_license_raw</aggregate>
|
||||
<aggregate>has_tractor_license</aggregate>
|
||||
<subject>is_has_tractor_license</subject>
|
||||
<type>MAX</type>
|
||||
<valuefield/>
|
||||
</field>
|
||||
</fields>
|
||||
<give_back_row>N</give_back_row>
|
||||
|
|
@ -300,6 +297,7 @@
|
|||
</field>
|
||||
</group>
|
||||
<ignore_aggregate>N</ignore_aggregate>
|
||||
<linenr_fieldname/>
|
||||
<prefix>grp</prefix>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
|
|
@ -307,39 +305,6 @@
|
|||
<yloc>1024</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_java_expression</name>
|
||||
<type>Janino</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<formula>
|
||||
<field_name>has_driver_license</field_name>
|
||||
<formula_string>has_driver_license_raw == 1</formula_string>
|
||||
<value_type>Boolean</value_type>
|
||||
<value_length>-1</value_length>
|
||||
<value_precision>-1</value_precision>
|
||||
<replace_field/>
|
||||
</formula>
|
||||
<formula>
|
||||
<field_name>has_tractor_license</field_name>
|
||||
<formula_string>has_tractor_license_raw == 1</formula_string>
|
||||
<value_type>Boolean</value_type>
|
||||
<value_length>-1</value_length>
|
||||
<value_precision>-1</value_precision>
|
||||
<replace_field/>
|
||||
</formula>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>928</xloc>
|
||||
<yloc>1024</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>driver_licence_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
|
|
@ -422,11 +387,8 @@ and recruitment_id = '${IDM_ID}';
|
|||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<delete_field/>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<insert_field/>
|
||||
<quoteString>N</quoteString>
|
||||
<read_field/>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
|
|
@ -451,7 +413,6 @@ DO UPDATE SET
|
|||
status = 'PROCESSING',
|
||||
execution_datetime = DEFAULT,
|
||||
error_description = NULL;</sql>
|
||||
<update_field/>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>368</xloc>
|
||||
|
|
@ -471,7 +432,6 @@ DO UPDATE SET
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit/>
|
||||
<sql>WITH
|
||||
base AS (
|
||||
SELECT
|
||||
|
|
@ -582,13 +542,11 @@ ORDER BY recruit_id </sql>
|
|||
<commit>10000</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<error_ignored>Y</error_ignored>
|
||||
<ignore_flag_field/>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruit_id</field>
|
||||
<name>recruit_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>citizen</table>
|
||||
|
|
|
|||
|
|
@ -21,62 +21,62 @@
|
|||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<from>property_create_job</from>
|
||||
<to>property_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>property_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Change job status on error</from>
|
||||
<from>property_failure_job</from>
|
||||
<to>Abort</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output</from>
|
||||
<to>Change job status on error</to>
|
||||
<from>property_output</from>
|
||||
<to>property_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Update</from>
|
||||
<to>Change job status on error</to>
|
||||
<from>property_update_flags</from>
|
||||
<to>property_failure_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<from>property_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_input</from>
|
||||
<to>property_output</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_input</from>
|
||||
<to>property_group_by</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_group_by</from>
|
||||
<to>property_update_flags</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>property_success_job</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_output</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Table output</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>sort_by_recruit_id</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>sort_by_recruit_id</from>
|
||||
<to>Update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table output</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
|
|
@ -97,105 +97,8 @@
|
|||
<row_threshold>0</row_threshold>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<yloc>528</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on error</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1120</xloc>
|
||||
<yloc>528</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Change job status on success</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<yloc>160</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Create job execution record</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>320</yloc>
|
||||
<xloc>1392</xloc>
|
||||
<yloc>864</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -212,7 +115,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<yloc>160</yloc>
|
||||
<yloc>0</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -244,10 +147,10 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_true_to>Change job status on success</send_true_to>
|
||||
<send_true_to>property_success_job</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1376</xloc>
|
||||
<xloc>1408</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
|
|
@ -255,7 +158,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<name>Identify last row in a stream</name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
|
|
@ -265,13 +168,13 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<xloc>1248</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<type>TableInput</type>
|
||||
<name>property_create_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -280,168 +183,271 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as(
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>INSERT INTO etl.job_execution (id, job_name, status, execution_datetime, error_description, recruitment_id)
|
||||
VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>288</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_failure_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
<argument>
|
||||
<name>error_description</name>
|
||||
</argument>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>Y</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'ERROR',
|
||||
error_description = ?,
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1056</xloc>
|
||||
<yloc>864</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_group_by</name>
|
||||
<type>GroupBy</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<add_linenr>N</add_linenr>
|
||||
<all_rows>N</all_rows>
|
||||
<directory>${java.io.tmpdir}</directory>
|
||||
<fields>
|
||||
<field>
|
||||
<aggregate>has_property</aggregate>
|
||||
<subject>has_property</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_ground_transport</aggregate>
|
||||
<subject>has_ground_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_air_transport</aggregate>
|
||||
<subject>has_air_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_water_transport</aggregate>
|
||||
<subject>has_water_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_possibility_reg_residence</aggregate>
|
||||
<subject>has_possibility_reg_residence</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
</fields>
|
||||
<give_back_row>N</give_back_row>
|
||||
<group>
|
||||
<field>
|
||||
<name>recruit_id</name>
|
||||
</field>
|
||||
</group>
|
||||
<ignore_aggregate>N</ignore_aggregate>
|
||||
<prefix>grp</prefix>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<yloc>576</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH base AS (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
ri.info,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedON' -> 'on') = 'array' AS has_realty,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') = 'array' AS has_ground,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') = 'array' AS has_air,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') = 'array' AS has_water
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
WHERE
|
||||
'${IDM_ID}' != '' AND
|
||||
COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND
|
||||
(jsonb_typeof(info -> 'svedFL' -> 'svedON' -> 'on') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') = 'array')
|
||||
),
|
||||
prop AS (
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'realty' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedON'->'on') = 'array'
|
||||
THEN base.info->'svedFL'->'svedON'->'on'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedON'->'on') = 'array'
|
||||
|
||||
UNION ALL
|
||||
prop AS (
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'realty' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedON' -> 'on') AS property_data ON true
|
||||
WHERE base.has_realty
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'ground_transportation' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedNazTS'->'nazTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedNazTS'->'nazTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedNazTS'->'nazTS') = 'array'
|
||||
UNION ALL
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'ground_transportation' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') AS property_data ON true
|
||||
WHERE base.has_ground
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'air_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedVozTS'->'vozTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedVozTS'->'vozTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedVozTS'->'vozTS') = 'array'
|
||||
UNION ALL
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'air_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') AS property_data ON true
|
||||
WHERE base.has_air
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'water_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedVodTS'->'vodTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedVodTS'->'vodTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedVodTS'->'vodTS') = 'array'
|
||||
),
|
||||
all_data as(
|
||||
-- Недвижимость
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
property_data->>'naimVidPrav' AS kind_right, -- Исправлено название поля
|
||||
property_data->'adrObSob'->>'adrObSobTekst' AS address,
|
||||
property_data->>'kodVidPrav' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPrav', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPrav', 'YYYY-MM-DD') AS close_date,
|
||||
'realty' AS type_property,
|
||||
true AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'realty'
|
||||
UNION ALL
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'water_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') AS property_data ON true
|
||||
WHERE base.has_water
|
||||
),
|
||||
|
||||
-- Наземный транспорт
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'vidTS' AS property_code,
|
||||
property_data->>'godVyp' AS issue_year,
|
||||
property_data->>'markaTS' AS brand_model,
|
||||
property_data->>'gosRegZn' AS reg_plate,
|
||||
property_data->>'idenNom' AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'ground_transportation' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'ground_transportation'
|
||||
all_data AS (
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
property_data ->> 'naimVidPrav' AS kind_right,
|
||||
property_data -> 'adrObSob' ->> 'adrObSobTekst' AS address,
|
||||
property_data ->> 'kodVidPrav' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data ->> 'dataRegPrav', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data ->> 'dataPrekPrav', 'YYYY-MM-DD') AS close_date,
|
||||
'realty' AS type_property,
|
||||
true AS has_possibility_reg_residence,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'realty'
|
||||
|
||||
UNION ALL
|
||||
UNION ALL
|
||||
|
||||
-- Воздушный транспорт
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'naimVid' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
property_data->>'naznKat' AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'air_vehicles' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'air_vehicles'
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data ->> 'vidTS',
|
||||
property_data ->> 'godVyp',
|
||||
property_data ->> 'markaTS',
|
||||
property_data ->> 'gosRegZn',
|
||||
property_data ->> 'idenNom',
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'ground_transportation',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'ground_transportation'
|
||||
|
||||
UNION ALL
|
||||
UNION ALL
|
||||
|
||||
-- Водный транспорт
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'naimVid' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
property_data->>'naznKat' AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'water_vehicles' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'water_vehicles'
|
||||
)
|
||||
select
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naimVid',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naznKat',
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'air_vehicles',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'air_vehicles'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naimVid',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naznKat',
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'water_vehicles',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'water_vehicles'
|
||||
)
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
source_update_date,
|
||||
kind_right,
|
||||
|
|
@ -455,33 +461,23 @@ select
|
|||
start_date,
|
||||
close_date,
|
||||
type_property,
|
||||
has_possibility_reg_residence,
|
||||
CASE
|
||||
WHEN type_property = 'realty' THEN true
|
||||
ELSE false
|
||||
END AS has_property, -- недвиж//has_property
|
||||
CASE
|
||||
WHEN type_property = 'ground_transportation' THEN true
|
||||
ELSE false
|
||||
END AS has_ground_transport, -- наземный транспорт//has_ground_transport
|
||||
CASE
|
||||
WHEN type_property = 'air_vehicles' THEN true
|
||||
ELSE false
|
||||
END AS has_air_transport, -- воздушный транспорт//has_air_transport
|
||||
CASE
|
||||
WHEN type_property = 'water_vehicles' THEN true
|
||||
ELSE false
|
||||
END AS has_water_transport -- водный транспорт//has_water_transport
|
||||
from all_data</sql>
|
||||
has_possibility_reg_residence AS has_possibility_reg_residence,
|
||||
source_id,
|
||||
type_property = 'realty' AS has_property,
|
||||
type_property = 'ground_transportation' AS has_ground_transport,
|
||||
type_property = 'air_vehicles' AS has_air_transport,
|
||||
type_property = 'water_vehicles' AS has_water_transport
|
||||
FROM all_data
|
||||
ORDER BY recruit_id;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>496</xloc>
|
||||
<xloc>688</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table output</name>
|
||||
<name>property_output</name>
|
||||
<type>TableOutput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -546,6 +542,10 @@ from all_data</sql>
|
|||
<column_name>source_update_date</column_name>
|
||||
<stream_name>source_update_date</stream_name>
|
||||
</field>
|
||||
<field>
|
||||
<column_name>source_id</column_name>
|
||||
<stream_name>source_id</stream_name>
|
||||
</field>
|
||||
</fields>
|
||||
<ignore_errors>N</ignore_errors>
|
||||
<only_when_have_rows>N</only_when_have_rows>
|
||||
|
|
@ -562,12 +562,44 @@ from all_data</sql>
|
|||
<use_batch>Y</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>912</xloc>
|
||||
<xloc>1056</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Update</name>
|
||||
<name>property_success_job</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>Y</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>Y</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>UPDATE etl.job_execution
|
||||
SET status = 'SUCCESS',
|
||||
execution_end_datetime = current_timestamp
|
||||
WHERE job_name = '${JOB_NAME}'
|
||||
and recruitment_id = '${IDM_ID}';
|
||||
|
||||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1408</xloc>
|
||||
<yloc>0</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_update_flags</name>
|
||||
<type>Update</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
|
|
@ -612,49 +644,15 @@ from all_data</sql>
|
|||
<skip_lookup>N</skip_lookup>
|
||||
<use_batch>Y</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>912</xloc>
|
||||
<yloc>528</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>sort_by_recruit_id</name>
|
||||
<type>SortRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<directory>${java.io.tmpdir}</directory>
|
||||
<prefix>srt</prefix>
|
||||
<sort_size>100000</sort_size>
|
||||
<free_memory/>
|
||||
<compress>N</compress>
|
||||
<compress_variable/>
|
||||
<unique_rows>Y</unique_rows>
|
||||
<fields>
|
||||
<field>
|
||||
<name>recruit_id</name>
|
||||
<ascending>Y</ascending>
|
||||
<case_sensitive>N</case_sensitive>
|
||||
<collator_enabled>N</collator_enabled>
|
||||
<collator_strength>0</collator_strength>
|
||||
<presorted>N</presorted>
|
||||
</field>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>688</xloc>
|
||||
<yloc>528</yloc>
|
||||
<yloc>864</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Table output</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>property_output</source_transform>
|
||||
<target_transform>property_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
@ -665,8 +663,8 @@ from all_data</sql>
|
|||
<min_pct_rows/>
|
||||
</error>
|
||||
<error>
|
||||
<source_transform>Update</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<source_transform>property_update_flags</source_transform>
|
||||
<target_transform>property_failure_job</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
<descriptions_valuename>error_description</descriptions_valuename>
|
||||
|
|
|
|||
|
|
@ -22,12 +22,7 @@
|
|||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>property_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
|
|
@ -41,45 +36,50 @@
|
|||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Insert / update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>sort_by_recruit_id</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Update</from>
|
||||
<from>property_update_flags</from>
|
||||
<to>Change job status on error</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>sort_by_recruit_id</from>
|
||||
<to>Update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update</from>
|
||||
<from>property_insert_or_update</from>
|
||||
<to>Change job status on error</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update</from>
|
||||
<from>property_input</from>
|
||||
<to>property_group_by</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_group_by</from>
|
||||
<to>property_update_flags</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_input</from>
|
||||
<to>Filter rows 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows 2</from>
|
||||
<to>property_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_insert_or_update</from>
|
||||
<to>Detect empty stream 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Detect empty stream 2</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Abort</name>
|
||||
|
|
@ -97,8 +97,8 @@
|
|||
<row_threshold>0</row_threshold>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1456</xloc>
|
||||
<yloc>512</yloc>
|
||||
<xloc>1520</xloc>
|
||||
<yloc>768</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -133,8 +133,8 @@ and recruitment_id = '${IDM_ID}';
|
|||
</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1200</xloc>
|
||||
<yloc>512</yloc>
|
||||
<xloc>1088</xloc>
|
||||
<yloc>768</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -166,7 +166,7 @@ and recruitment_id = '${IDM_ID}';
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1520</xloc>
|
||||
<yloc>208</yloc>
|
||||
<yloc>256</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -198,11 +198,11 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>352</xloc>
|
||||
<yloc>352</yloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Detect empty stream</name>
|
||||
<name>Detect empty stream 2</name>
|
||||
<type>DetectEmptyStream</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -214,8 +214,8 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
</partitioning>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>208</yloc>
|
||||
<xloc>1296</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -251,14 +251,51 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1520</xloc>
|
||||
<yloc>352</yloc>
|
||||
<yloc>416</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Filter rows 2</name>
|
||||
<type>FilterRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<compare>
|
||||
<condition>
|
||||
<conditions>
|
||||
</conditions>
|
||||
<function>=</function>
|
||||
<leftvalue>need_update</leftvalue>
|
||||
<negated>N</negated>
|
||||
<operator>-</operator>
|
||||
<value>
|
||||
<isnull>N</isnull>
|
||||
<length>-1</length>
|
||||
<name>constant</name>
|
||||
<precision>-1</precision>
|
||||
<text>Y</text>
|
||||
<type>Boolean</type>
|
||||
</value>
|
||||
</condition>
|
||||
</compare>
|
||||
<send_false_to>Sample rows</send_false_to>
|
||||
<send_true_to>property_insert_or_update</send_true_to>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>864</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Identify last row in a stream</name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
|
|
@ -268,12 +305,313 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>352</yloc>
|
||||
<xloc>1520</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update</name>
|
||||
<name>property_update_flags</name>
|
||||
<type>Update</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>10000</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<error_ignored>Y</error_ignored>
|
||||
<ignore_flag_field/>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruit_id</field>
|
||||
<name>recruit_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>citizen</table>
|
||||
<value>
|
||||
<name>has_property</name>
|
||||
<rename>has_property</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_ground_transport</name>
|
||||
<rename>has_ground_transport</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_air_transport</name>
|
||||
<rename>has_air_transport</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_water_transport</name>
|
||||
<rename>has_water_transport</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_possibility_reg_residence</name>
|
||||
<rename>has_possibility_reg_residence</rename>
|
||||
</value>
|
||||
</lookup>
|
||||
<skip_lookup>N</skip_lookup>
|
||||
<use_batch>Y</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1088</xloc>
|
||||
<yloc>976</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_group_by</name>
|
||||
<type>GroupBy</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<add_linenr>N</add_linenr>
|
||||
<all_rows>N</all_rows>
|
||||
<directory>${java.io.tmpdir}</directory>
|
||||
<fields>
|
||||
<field>
|
||||
<aggregate>has_property</aggregate>
|
||||
<subject>has_property</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_ground_transport</aggregate>
|
||||
<subject>has_ground_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_air_transport</aggregate>
|
||||
<subject>has_air_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_water_transport</aggregate>
|
||||
<subject>has_water_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_possibility_reg_residence</aggregate>
|
||||
<subject>has_possibility_reg_residence</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
</fields>
|
||||
<give_back_row>N</give_back_row>
|
||||
<group>
|
||||
<field>
|
||||
<name>recruit_id</name>
|
||||
</field>
|
||||
</group>
|
||||
<ignore_aggregate>N</ignore_aggregate>
|
||||
<prefix>grp</prefix>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>640</xloc>
|
||||
<yloc>976</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH base AS (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedON' -> 'on') = 'array' AS has_realty,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') = 'array' AS has_ground,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') = 'array' AS has_air,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') = 'array' AS has_water
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
WHERE
|
||||
'${IDM_ID}' != '' AND
|
||||
COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND
|
||||
(jsonb_typeof(info -> 'svedFL' -> 'svedON' -> 'on') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') = 'array')
|
||||
),
|
||||
|
||||
prop AS (
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'realty' AS property_type,
|
||||
property_data.value AS property_data,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date AS need_update
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedON' -> 'on') AS property_data ON true
|
||||
WHERE base.has_realty
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'ground_transportation' AS property_type,
|
||||
property_data.value AS property_data,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date AS need_update
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') AS property_data ON true
|
||||
WHERE base.has_ground
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'air_vehicles' AS property_type,
|
||||
property_data.value AS property_data,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date AS need_update
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') AS property_data ON true
|
||||
WHERE base.has_air
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'water_vehicles' AS property_type,
|
||||
property_data.value AS property_data,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date AS need_update
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') AS property_data ON true
|
||||
WHERE base.has_water
|
||||
),
|
||||
|
||||
all_data AS (
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
property_data ->> 'naimVidPrav' AS kind_right,
|
||||
property_data -> 'adrObSob' ->> 'adrObSobTekst' AS address,
|
||||
property_data ->> 'kodVidPrav' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data ->> 'dataRegPrav', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data ->> 'dataPrekPrav', 'YYYY-MM-DD') AS close_date,
|
||||
'realty' AS type_property,
|
||||
true AS has_possibility_reg_residence,
|
||||
property_data ->> 'id' AS source_id,
|
||||
prop.need_update
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'realty'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data ->> 'vidTS',
|
||||
property_data ->> 'godVyp',
|
||||
property_data ->> 'markaTS',
|
||||
property_data ->> 'gosRegZn',
|
||||
property_data ->> 'idenNom',
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'ground_transportation',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id,
|
||||
prop.need_update
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'ground_transportation'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naimVid',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naznKat',
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'air_vehicles',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id,
|
||||
prop.need_update
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'air_vehicles'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naimVid',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naznKat',
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'water_vehicles',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id,
|
||||
prop.need_update
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'water_vehicles'
|
||||
)
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
source_update_date,
|
||||
kind_right,
|
||||
address,
|
||||
property_code,
|
||||
issue_year::int,
|
||||
brand_model,
|
||||
reg_plate,
|
||||
vin,
|
||||
vehicle_category,
|
||||
start_date,
|
||||
close_date,
|
||||
type_property,
|
||||
has_possibility_reg_residence AS has_possibility_reg_residence,
|
||||
source_id,
|
||||
need_update,
|
||||
type_property = 'realty' AS has_property,
|
||||
type_property = 'ground_transportation' AS has_ground_transport,
|
||||
type_property = 'air_vehicles' AS has_air_transport,
|
||||
type_property = 'water_vehicles' AS has_water_transport
|
||||
FROM all_data
|
||||
ORDER BY recruit_id;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>640</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>property_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -288,18 +626,8 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruit_id</field>
|
||||
<name>recruit_id</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>start_date</field>
|
||||
<name>start_date</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>type_property</field>
|
||||
<name>type_property</name>
|
||||
<field>source_id</field>
|
||||
<name>source_id</name>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>property</table>
|
||||
|
|
@ -368,313 +696,22 @@ and recruitment_id = '${IDM_ID}';</sql>
|
|||
<rename>source_update_date</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>source_id</name>
|
||||
<rename>source_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<update_bypassed>N</update_bypassed>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>960</xloc>
|
||||
<yloc>352</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as(
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != ''
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
),
|
||||
prop AS (
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'realty' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedON'->'on') = 'array'
|
||||
THEN base.info->'svedFL'->'svedON'->'on'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedON'->'on') = 'array'
|
||||
AND to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'ground_transportation' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedNazTS'->'nazTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedNazTS'->'nazTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedNazTS'->'nazTS') = 'array'
|
||||
AND to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'air_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedVozTS'->'vozTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedVozTS'->'vozTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedVozTS'->'vozTS') = 'array'
|
||||
AND to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'water_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedVodTS'->'vodTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedVodTS'->'vodTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedVodTS'->'vodTS') = 'array'
|
||||
AND to_date(property_data->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'::date
|
||||
),
|
||||
all_data as(
|
||||
-- Недвижимость
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
property_data->>'naimVidPrav' AS kind_right,
|
||||
property_data->'adrObSob'->>'adrObSobTekst' AS address,
|
||||
property_data->>'kodVidPrav' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPrav', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPrav', 'YYYY-MM-DD') AS close_date,
|
||||
'realty' AS type_property,
|
||||
true AS has_possibility_reg_residence
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'realty'
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- Наземный транспорт
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'vidTS' AS property_code,
|
||||
property_data->>'godVyp' AS issue_year,
|
||||
property_data->>'markaTS' AS brand_model,
|
||||
property_data->>'gosRegZn' AS reg_plate,
|
||||
property_data->>'idenNom' AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'ground_transportation' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'ground_transportation'
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- Воздушный транспорт
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'naimVid' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
property_data->>'naznKat' AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'air_vehicles' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'air_vehicles'
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- Водный транспорт
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'naimVid' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
property_data->>'naznKat' AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'water_vehicles' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'water_vehicles'
|
||||
)
|
||||
SELECT
|
||||
recruit_id,
|
||||
source_update_date,
|
||||
kind_right,
|
||||
address,
|
||||
property_code,
|
||||
issue_year::int,
|
||||
brand_model,
|
||||
reg_plate,
|
||||
vin,
|
||||
vehicle_category,
|
||||
start_date,
|
||||
close_date,
|
||||
type_property,
|
||||
has_possibility_reg_residence,
|
||||
CASE
|
||||
WHEN type_property = 'realty' THEN true
|
||||
ELSE false
|
||||
END AS has_property,
|
||||
CASE
|
||||
WHEN type_property = 'ground_transportation' THEN true
|
||||
ELSE false
|
||||
END AS has_ground_transport,
|
||||
CASE
|
||||
WHEN type_property = 'air_vehicles' THEN true
|
||||
ELSE false
|
||||
END AS has_air_transport,
|
||||
CASE
|
||||
WHEN type_property = 'water_vehicles' THEN true
|
||||
ELSE false
|
||||
END AS has_water_transport
|
||||
FROM all_data</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>560</xloc>
|
||||
<yloc>352</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Update</name>
|
||||
<type>Update</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>10000</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<error_ignored>Y</error_ignored>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruit_id</field>
|
||||
<name>recruit_id</name>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
<table>citizen</table>
|
||||
<value>
|
||||
<name>has_property</name>
|
||||
<rename>has_property</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_ground_transport</name>
|
||||
<rename>has_ground_transport</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_air_transport</name>
|
||||
<rename>has_air_transport</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_water_transport</name>
|
||||
<rename>has_water_transport</rename>
|
||||
</value>
|
||||
<value>
|
||||
<name>has_possibility_reg_residence</name>
|
||||
<rename>has_possibility_reg_residence</rename>
|
||||
</value>
|
||||
</lookup>
|
||||
<skip_lookup>N</skip_lookup>
|
||||
<use_batch>Y</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>960</xloc>
|
||||
<yloc>512</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>sort_by_recruit_id</name>
|
||||
<type>SortRows</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<directory>${java.io.tmpdir}</directory>
|
||||
<prefix>srt</prefix>
|
||||
<sort_size>100000</sort_size>
|
||||
<free_memory/>
|
||||
<compress>N</compress>
|
||||
<compress_variable/>
|
||||
<unique_rows>Y</unique_rows>
|
||||
<fields>
|
||||
<field>
|
||||
<name>recruit_id</name>
|
||||
<ascending>Y</ascending>
|
||||
<case_sensitive>N</case_sensitive>
|
||||
<collator_enabled>N</collator_enabled>
|
||||
<collator_strength>0</collator_strength>
|
||||
<presorted>N</presorted>
|
||||
</field>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>512</yloc>
|
||||
<xloc>1088</xloc>
|
||||
<yloc>560</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Insert / update</source_transform>
|
||||
<source_transform>property_update_flags</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
|
|
@ -686,7 +723,7 @@ FROM all_data</sql>
|
|||
<min_pct_rows/>
|
||||
</error>
|
||||
<error>
|
||||
<source_transform>Update</source_transform>
|
||||
<source_transform>property_insert_or_update</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
|
|
|
|||
|
|
@ -22,12 +22,7 @@
|
|||
<order>
|
||||
<hop>
|
||||
<from>Create job execution record</from>
|
||||
<to>Table input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<to>property_input</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
|
|
@ -41,42 +36,47 @@
|
|||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update</from>
|
||||
<from>property_insert_or_update</from>
|
||||
<to>Change job status on error</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Insert / update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>sort_by_recruit_id</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>sort_by_recruit_id</from>
|
||||
<to>Update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Update</from>
|
||||
<to>Change job status on error</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update</from>
|
||||
<from>property_input</from>
|
||||
<to>property_insert_or_update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_input</from>
|
||||
<to>Detect empty stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_input</from>
|
||||
<to>property_group_by</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_group_by</from>
|
||||
<to>Update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Filter rows</from>
|
||||
<to>Change job status on success</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>property_insert_or_update</from>
|
||||
<to>Identify last row in a stream</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Identify last row in a stream</from>
|
||||
<to>Filter rows</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1744</xloc>
|
||||
<yloc>688</yloc>
|
||||
<yloc>832</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -134,7 +134,7 @@ and recruitment_id = '${IDM_ID}';
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1328</xloc>
|
||||
<yloc>688</yloc>
|
||||
<yloc>832</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -166,7 +166,7 @@ and recruitment_id = '${IDM_ID}';
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1744</xloc>
|
||||
<yloc>352</yloc>
|
||||
<yloc>256</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -230,7 +230,7 @@ DO UPDATE SET
|
|||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>352</yloc>
|
||||
<yloc>256</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -273,7 +273,7 @@ DO UPDATE SET
|
|||
<name>Identify last row in a stream</name>
|
||||
<type>DetectLastRow</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
|
|
@ -283,12 +283,12 @@ DO UPDATE SET
|
|||
<resultfieldname>last_row</resultfieldname>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<xloc>1552</xloc>
|
||||
<yloc>496</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update</name>
|
||||
<name>property_insert_or_update</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
|
|
@ -309,14 +309,8 @@ DO UPDATE SET
|
|||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>start_date</field>
|
||||
<name>start_date</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>type_property</field>
|
||||
<name>type_property</name>
|
||||
<field>source_id</field>
|
||||
<name>source_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>ervu_dashboard</schema>
|
||||
|
|
@ -386,19 +380,24 @@ DO UPDATE SET
|
|||
<rename>source_update_date</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>source_id</name>
|
||||
<rename>source_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<update_bypassed>Y</update_bypassed>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<xloc>1328</xloc>
|
||||
<yloc>496</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input</name>
|
||||
<name>property_input</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
|
|
@ -407,166 +406,150 @@ DO UPDATE SET
|
|||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<sql>WITH
|
||||
base as(
|
||||
<limit/>
|
||||
<sql>WITH base AS (
|
||||
SELECT
|
||||
ri.recruit_id,
|
||||
ri.info
|
||||
ri.info,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedON' -> 'on') = 'array' AS has_realty,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') = 'array' AS has_ground,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') = 'array' AS has_air,
|
||||
jsonb_typeof(ri.info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') = 'array' AS has_water
|
||||
FROM ervu_dashboard.recruits_info ri
|
||||
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
|
||||
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
|
||||
WHERE
|
||||
'${IDM_ID}' != '' AND
|
||||
COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND
|
||||
(jsonb_typeof(info -> 'svedFL' -> 'svedON' -> 'on') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') = 'array' OR
|
||||
jsonb_typeof(info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') = 'array')
|
||||
),
|
||||
prop AS (
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'realty' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedON'->'on') = 'array'
|
||||
THEN base.info->'svedFL'->'svedON'->'on'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedON'->'on') = 'array'
|
||||
|
||||
UNION ALL
|
||||
prop AS (
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'realty' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedON' -> 'on') AS property_data ON true
|
||||
WHERE base.has_realty
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'ground_transportation' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedNazTS'->'nazTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedNazTS'->'nazTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedNazTS'->'nazTS') = 'array'
|
||||
UNION ALL
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'ground_transportation' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedNazTS' -> 'nazTS') AS property_data ON true
|
||||
WHERE base.has_ground
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'air_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedVozTS'->'vozTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedVozTS'->'vozTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedVozTS'->'vozTS') = 'array'
|
||||
UNION ALL
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'air_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedVozTS' -> 'vozTS') AS property_data ON true
|
||||
WHERE base.has_air
|
||||
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'water_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
LEFT JOIN LATERAL jsonb_array_elements(
|
||||
CASE
|
||||
WHEN jsonb_typeof(base.info->'svedFL'->'svedVodTS'->'vodTS') = 'array'
|
||||
THEN base.info->'svedFL'->'svedVodTS'->'vodTS'
|
||||
ELSE '[]'::jsonb
|
||||
END
|
||||
) AS property_data ON true
|
||||
WHERE jsonb_typeof(base.info->'svedFL'->'svedVodTS'->'vodTS') = 'array'
|
||||
),
|
||||
all_data as(
|
||||
-- Недвижимость
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
property_data->>'naimVidPrav' AS kind_right, -- Исправлено название поля
|
||||
property_data->'adrObSob'->>'adrObSobTekst' AS address,
|
||||
property_data->>'kodVidPrav' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPrav', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPrav', 'YYYY-MM-DD') AS close_date,
|
||||
'realty' AS type_property,
|
||||
true AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'realty'
|
||||
UNION ALL
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
'water_vehicles' AS property_type,
|
||||
property_data.value AS property_data
|
||||
FROM base
|
||||
JOIN LATERAL jsonb_array_elements(base.info -> 'svedFL' -> 'svedVodTS' -> 'vodTS') AS property_data ON true
|
||||
WHERE base.has_water
|
||||
),
|
||||
|
||||
-- Наземный транспорт
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'vidTS' AS property_code,
|
||||
property_data->>'godVyp' AS issue_year,
|
||||
property_data->>'markaTS' AS brand_model,
|
||||
property_data->>'gosRegZn' AS reg_plate,
|
||||
property_data->>'idenNom' AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'ground_transportation' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'ground_transportation'
|
||||
all_data AS (
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
property_data ->> 'naimVidPrav' AS kind_right,
|
||||
property_data -> 'adrObSob' ->> 'adrObSobTekst' AS address,
|
||||
property_data ->> 'kodVidPrav' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data ->> 'dataRegPrav', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data ->> 'dataPrekPrav', 'YYYY-MM-DD') AS close_date,
|
||||
'realty' AS type_property,
|
||||
true AS has_possibility_reg_residence,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'realty'
|
||||
|
||||
UNION ALL
|
||||
UNION ALL
|
||||
|
||||
-- Воздушный транспорт
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'naimVid' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
property_data->>'naznKat' AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'air_vehicles' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'air_vehicles'
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data ->> 'vidTS',
|
||||
property_data ->> 'godVyp',
|
||||
property_data ->> 'markaTS',
|
||||
property_data ->> 'gosRegZn',
|
||||
property_data ->> 'idenNom',
|
||||
NULL AS vehicle_category,
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'ground_transportation',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'ground_transportation'
|
||||
|
||||
UNION ALL
|
||||
UNION ALL
|
||||
|
||||
-- Водный транспорт
|
||||
SELECT
|
||||
base.recruit_id,
|
||||
to_date(property_data->>'dataSved', 'YYYY-MM-DD') AS source_update_date,
|
||||
NULL AS kind_right,
|
||||
NULL AS address,
|
||||
property_data->>'naimVid' AS property_code,
|
||||
NULL AS issue_year,
|
||||
NULL AS brand_model,
|
||||
NULL AS reg_plate,
|
||||
NULL AS vin,
|
||||
property_data->>'naznKat' AS vehicle_category,
|
||||
to_date(property_data->>'dataRegPr', 'YYYY-MM-DD') AS start_date,
|
||||
to_date(property_data->>'dataPrekPr', 'YYYY-MM-DD') AS close_date,
|
||||
'water_vehicles' AS type_property,
|
||||
false AS has_possibility_reg_residence
|
||||
FROM base
|
||||
JOIN prop ON base.recruit_id = prop.recruit_id
|
||||
WHERE prop.property_type = 'water_vehicles'
|
||||
)
|
||||
select
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naimVid',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naznKat',
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'air_vehicles',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'air_vehicles'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
prop.recruit_id,
|
||||
to_date(property_data ->> 'dataSved', 'YYYY-MM-DD'),
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naimVid',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
property_data ->> 'naznKat',
|
||||
to_date(property_data ->> 'dataRegPr', 'YYYY-MM-DD'),
|
||||
to_date(property_data ->> 'dataPrekPr', 'YYYY-MM-DD'),
|
||||
'water_vehicles',
|
||||
false,
|
||||
property_data ->> 'id' AS source_id
|
||||
FROM prop
|
||||
WHERE prop.property_type = 'water_vehicles'
|
||||
)
|
||||
|
||||
SELECT
|
||||
recruit_id,
|
||||
source_update_date,
|
||||
kind_right,
|
||||
|
|
@ -580,28 +563,18 @@ select
|
|||
start_date,
|
||||
close_date,
|
||||
type_property,
|
||||
has_possibility_reg_residence,
|
||||
CASE
|
||||
WHEN type_property = 'realty' THEN true
|
||||
ELSE false
|
||||
END AS has_property, -- недвиж//has_property
|
||||
CASE
|
||||
WHEN type_property = 'ground_transportation' THEN true
|
||||
ELSE false
|
||||
END AS has_ground_transport, -- наземный транспорт//has_ground_transport
|
||||
CASE
|
||||
WHEN type_property = 'air_vehicles' THEN true
|
||||
ELSE false
|
||||
END AS has_air_transport, -- воздушный транспорт//has_air_transport
|
||||
CASE
|
||||
WHEN type_property = 'water_vehicles' THEN true
|
||||
ELSE false
|
||||
END AS has_water_transport -- водный транспорт//has_water_transport
|
||||
from all_data</sql>
|
||||
has_possibility_reg_residence AS has_possibility_reg_residence,
|
||||
source_id,
|
||||
type_property = 'realty' AS has_property,
|
||||
type_property = 'ground_transportation' AS has_ground_transport,
|
||||
type_property = 'air_vehicles' AS has_air_transport,
|
||||
type_property = 'water_vehicles' AS has_water_transport
|
||||
FROM all_data
|
||||
ORDER BY recruit_id;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>496</xloc>
|
||||
<xloc>768</xloc>
|
||||
<yloc>496</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
|
|
@ -652,13 +625,13 @@ from all_data</sql>
|
|||
<use_batch>Y</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>992</xloc>
|
||||
<yloc>688</yloc>
|
||||
<xloc>768</xloc>
|
||||
<yloc>832</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>sort_by_recruit_id</name>
|
||||
<type>SortRows</type>
|
||||
<name>property_group_by</name>
|
||||
<type>GroupBy</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
|
|
@ -667,32 +640,53 @@ from all_data</sql>
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<add_linenr>N</add_linenr>
|
||||
<all_rows>N</all_rows>
|
||||
<directory>${java.io.tmpdir}</directory>
|
||||
<prefix>srt</prefix>
|
||||
<sort_size>100000</sort_size>
|
||||
<free_memory/>
|
||||
<compress>N</compress>
|
||||
<compress_variable/>
|
||||
<unique_rows>Y</unique_rows>
|
||||
<fields>
|
||||
<field>
|
||||
<name>recruit_id</name>
|
||||
<ascending>Y</ascending>
|
||||
<case_sensitive>N</case_sensitive>
|
||||
<collator_enabled>N</collator_enabled>
|
||||
<collator_strength>0</collator_strength>
|
||||
<presorted>N</presorted>
|
||||
<aggregate>has_property</aggregate>
|
||||
<subject>has_property</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_ground_transport</aggregate>
|
||||
<subject>has_ground_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_air_transport</aggregate>
|
||||
<subject>has_air_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_water_transport</aggregate>
|
||||
<subject>has_water_transport</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
<field>
|
||||
<aggregate>has_possibility_reg_residence</aggregate>
|
||||
<subject>has_possibility_reg_residence</subject>
|
||||
<type>MAX</type>
|
||||
</field>
|
||||
</fields>
|
||||
<give_back_row>N</give_back_row>
|
||||
<group>
|
||||
<field>
|
||||
<name>recruit_id</name>
|
||||
</field>
|
||||
</group>
|
||||
<ignore_aggregate>N</ignore_aggregate>
|
||||
<prefix>grp</prefix>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>768</xloc>
|
||||
<yloc>688</yloc>
|
||||
<yloc>704</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
<error>
|
||||
<source_transform>Insert / update</source_transform>
|
||||
<source_transform>property_insert_or_update</source_transform>
|
||||
<target_transform>Change job status on error</target_transform>
|
||||
<is_enabled>Y</is_enabled>
|
||||
<nr_valuename/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue