This commit is contained in:
adel.ka 2025-10-16 12:53:17 +03:00
parent 5257b2188d
commit e053440f30
32 changed files with 811 additions and 1050 deletions

View file

@ -380,7 +380,6 @@ CROSS JOIN LATERAL (
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND'${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array';</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -476,8 +476,7 @@ CROSS JOIN LATERAL (
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND'${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
AND c.update_date >= '${M_R_UP_DATE}'::timestamp
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp,
AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array';</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -492,7 +492,6 @@ CROSS JOIN LATERAL (
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND'${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array';</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -60,14 +60,28 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
r.idm_id as recruitment_id
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'child_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -95,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -146,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -197,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -248,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -299,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -292,7 +292,6 @@ FROM ervu_dashboard.recruits_info ri
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND'${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
GROUP BY ri.recruit_id;</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -379,8 +379,7 @@ FROM ervu_dashboard.recruits_info ri
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND'${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
AND c.update_date >= '${M_R_UP_DATE}'::timestamp
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
GROUP BY ri.recruit_id;</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -393,7 +393,6 @@ FROM ervu_dashboard.recruits_info ri
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND'${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
GROUP BY ri.recruit_id;</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -59,14 +59,29 @@
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
r.idm_id as recruitment_id
<limit/>
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'citizen_address_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -94,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -145,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -196,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -247,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -298,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -35,36 +35,16 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</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>Table output</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Change job status on error</from>
<to>Abort</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -76,13 +56,28 @@
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Detect empty stream</to>
<from>Detect empty stream</from>
<to>Change job status on success 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Detect empty stream</from>
<to>Change job status on success 2</to>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order>
@ -106,33 +101,6 @@
<yloc>544</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>is_guardian</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>1104</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -244,8 +212,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<attributes/>
<GUI>
<xloc>1536</xloc>
<yloc>160</yloc>
<xloc>1280</xloc>
<yloc>688</yloc>
</GUI>
</transform>
<transform>
@ -284,36 +252,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>720</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -328,7 +266,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>1008</xloc>
<yloc>0</yloc>
</GUI>
</transform>
@ -345,7 +283,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS guardianship_external_id,
@ -363,15 +300,15 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
NULLIF(ch->'dataRozhdDok'->>'mesyacz', '')::int,
NULLIF(ch->'dataRozhdDok'->>'den', '')::int
) AS birth_date,
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils,
true AS is_guardian
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array'
AND '${M_R_CR_DATE}'::timestamp >= c.recruit_create_date;</sql>
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -383,7 +320,7 @@ WHERE
<name>Table output</name>
<type>TableOutput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -489,6 +426,40 @@ WHERE
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>720</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Table output</source_transform>

View file

@ -25,11 +25,6 @@
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Change job status on error</to>
@ -40,11 +35,6 @@
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Change job status on error</to>
@ -55,21 +45,6 @@
<to>Abort</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Detect empty stream</from>
<to>Change job status on success</to>
@ -85,6 +60,26 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -106,33 +101,6 @@
<yloc>480</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>is_guardian</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>1024</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -249,8 +217,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<attributes/>
<GUI>
<xloc>1456</xloc>
<yloc>224</yloc>
<xloc>1216</xloc>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
@ -289,36 +257,6 @@ and recruitment_id = '${IDM_ID}';</sql>
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>704</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -333,7 +271,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>864</xloc>
<xloc>944</xloc>
<yloc>0</yloc>
</GUI>
</transform>
@ -341,7 +279,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -429,7 +367,6 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS guardianship_external_id,
@ -447,7 +384,8 @@ and recruitment_id = '${IDM_ID}';</sql>
NULLIF(ch->'dataRozhdDok'->>'mesyacz', '')::int,
NULLIF(ch->'dataRozhdDok'->>'den', '')::int
) AS birth_date,
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils,
true AS is_guardian
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch
@ -455,8 +393,7 @@ WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array'
AND '${M_R_CR_DATE}'::timestamp >= c.recruit_create_date
AND c.update_date >= '${M_R_UP_DATE}'::timestamp;</sql>
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -504,6 +441,40 @@ WHERE
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>704</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Insert / update</source_transform>

View file

@ -35,31 +35,11 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</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>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Change job status on error</from>
<to>Abort</to>
@ -76,13 +56,28 @@
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Detect empty stream</to>
<from>Detect empty stream</from>
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Detect empty stream</from>
<to>Change job status on success</to>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order>
@ -106,33 +101,6 @@
<yloc>384</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>is_guardian</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>1040</xloc>
<yloc>48</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -265,8 +233,8 @@ DO UPDATE SET
</partitioning>
<attributes/>
<GUI>
<xloc>1488</xloc>
<yloc>192</yloc>
<xloc>1232</xloc>
<yloc>576</yloc>
</GUI>
</transform>
<transform>
@ -305,36 +273,6 @@ DO UPDATE SET
<yloc>48</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>704</xloc>
<yloc>48</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -349,7 +287,7 @@ DO UPDATE SET
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>896</xloc>
<xloc>992</xloc>
<yloc>48</yloc>
</GUI>
</transform>
@ -357,7 +295,7 @@ DO UPDATE SET
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -445,7 +383,6 @@ DO UPDATE SET
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS guardianship_external_id,
@ -463,15 +400,15 @@ DO UPDATE SET
NULLIF(ch->'dataRozhdDok'->>'mesyacz', '')::int,
NULLIF(ch->'dataRozhdDok'->>'den', '')::int
) AS birth_date,
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils,
true AS is_guardian
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array'
AND '${M_R_CR_DATE}'::timestamp >= c.recruit_create_date;</sql>
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -519,6 +456,40 @@ WHERE
<yloc>48</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>704</xloc>
<yloc>48</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Insert / update</source_transform>

View file

@ -60,14 +60,28 @@
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
r.idm_id as recruitment_id
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'citizen_guardianship_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -95,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -146,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -197,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -248,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -299,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -55,16 +55,6 @@
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -80,6 +70,11 @@
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -101,33 +96,6 @@
<yloc>448</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>is_wanted</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>880</xloc>
<yloc>624</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -319,12 +287,12 @@ SELECT
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataNachRozisk', 'YYYY-MM-DD') AS wanted_start_date,
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataPrekrRozysk', 'YYYY-MM-DD') AS wanted_end_date,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'osnovPrekrRozysk' AS grounds_stopping_search,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrgPrekrRozysk' AS name_organ_end_search
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrgPrekrRozysk' AS name_organ_end_search,
true AS is_wanted
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
WHERE'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object'
</sql>
<variables_active>Y</variables_active>

View file

@ -55,16 +55,6 @@
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -80,6 +70,11 @@
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -101,33 +96,6 @@
<yloc>384</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>is_wanted</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>864</xloc>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -386,12 +354,12 @@ SELECT
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataNachRozisk', 'YYYY-MM-DD') AS wanted_start_date,
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataPrekrRozysk', 'YYYY-MM-DD') AS wanted_end_date,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'osnovPrekrRozysk' AS grounds_stopping_search,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrgPrekrRozysk' AS name_organ_end_search
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrgPrekrRozysk' AS name_organ_end_search,
true AS is_wanted
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
WHERE'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object'
</sql>
@ -416,16 +384,19 @@ WHERE'${IDM_ID}' != ''
<commit>10000</commit>
<connection>ervu-dashboard</connection>
<error_ignored>N</error_ignored>
<ignore_flag_field/>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>&lt;></condition>
<field>is_wanted</field>
<name>is_wanted</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen</table>

View file

@ -25,11 +25,6 @@
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Change job status on error</from>
<to>Abort</to>
@ -45,11 +40,6 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream 2</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Change job status on error</to>
@ -80,6 +70,11 @@
<to>Identify last row in a stream 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream 2</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -101,33 +96,6 @@
<yloc>432</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>is_wanted</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>880</xloc>
<yloc>640</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -400,12 +368,12 @@ SELECT
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataNachRozisk', 'YYYY-MM-DD') AS wanted_start_date,
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataPrekrRozysk', 'YYYY-MM-DD') AS wanted_end_date,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'osnovPrekrRozysk' AS grounds_stopping_search,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrgPrekrRozysk' AS name_organ_end_search
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrgPrekrRozysk' AS name_organ_end_search,
true AS is_wanted // Наличие информации о розыске
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
WHERE'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object'
</sql>
<variables_active>Y</variables_active>

View file

@ -59,14 +59,29 @@
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
r.idm_id as recruitment_id
<limit/>
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'citizen_information_search_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -94,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -145,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -196,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -247,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -298,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -60,16 +60,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Unique rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Unique rows</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 2</to>
@ -80,6 +70,16 @@
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -283,7 +283,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
ri.recruit_id AS recruit_id,
(supr->>'id')::uuid AS spouse_external_id,
@ -321,8 +320,7 @@ CROSS JOIN LATERAL (
) AS supr(supr)
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND '${M_R_CR_DATE}'::timestamp >= r.recruit_create_date;</sql>
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'));</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -467,8 +465,8 @@ WHERE
</GUI>
</transform>
<transform>
<name>Unique rows</name>
<type>Unique</type>
<name>Sort rows</name>
<type>SortRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
@ -477,18 +475,27 @@ WHERE
<method>none</method>
<schema_name/>
</partitioning>
<count_rows>N</count_rows>
<directory>${java.io.tmpdir}</directory>
<prefix>out</prefix>
<sort_size>1000000</sort_size>
<free_memory/>
<compress>N</compress>
<compress_variable/>
<unique_rows>Y</unique_rows>
<fields>
<field>
<case_insensitive>N</case_insensitive>
<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>
<reject_duplicate_row>N</reject_duplicate_row>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>400</yloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -50,11 +50,6 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Unique rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update 2</from>
<to>Filter rows</to>
@ -65,11 +60,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Unique rows</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 2</to>
@ -80,6 +70,16 @@
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -436,7 +436,6 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
ri.recruit_id AS recruit_id,
(supr->>'id')::uuid AS spouse_external_id,
@ -475,8 +474,7 @@ CROSS JOIN LATERAL (
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND '${M_R_CR_DATE}'::timestamp >= r.recruit_create_date
AND r.update_date >= '${M_R_UP_DATE}'::timestamp;
AND ri.update_date >= '${M_R_UP_DATE}'::timestamp;
</sql>
<variables_active>Y</variables_active>
<attributes/>
@ -486,8 +484,8 @@ WHERE
</GUI>
</transform>
<transform>
<name>Unique rows</name>
<type>Unique</type>
<name>Sort rows</name>
<type>SortRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
@ -496,14 +494,23 @@ WHERE
<method>none</method>
<schema_name/>
</partitioning>
<count_rows>N</count_rows>
<directory>${java.io.tmpdir}</directory>
<prefix>out</prefix>
<sort_size>1000000</sort_size>
<free_memory/>
<compress>N</compress>
<compress_variable/>
<unique_rows>Y</unique_rows>
<fields>
<field>
<case_insensitive>N</case_insensitive>
<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>
<reject_duplicate_row>N</reject_duplicate_row>
<attributes/>
<GUI>
<xloc>768</xloc>

View file

@ -82,21 +82,11 @@ M_R_CR_DATE
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Unique rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update 2</from>
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Unique rows</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 2</to>
@ -107,6 +97,16 @@ M_R_CR_DATE
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -480,7 +480,6 @@ DO UPDATE SET
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
ri.recruit_id AS recruit_id,
(supr->>'id')::uuid AS spouse_external_id,
@ -518,8 +517,7 @@ CROSS JOIN LATERAL (
) AS supr(supr)
WHERE
'${IDM_ID}' != ''
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
AND '${M_R_CR_DATE}'::timestamp >= r.recruit_create_date;</sql>
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'));</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -528,8 +526,8 @@ WHERE
</GUI>
</transform>
<transform>
<name>Unique rows</name>
<type>Unique</type>
<name>Sort rows</name>
<type>SortRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
@ -538,14 +536,23 @@ WHERE
<method>none</method>
<schema_name/>
</partitioning>
<count_rows>N</count_rows>
<directory>${java.io.tmpdir}</directory>
<prefix>out</prefix>
<sort_size>1000000</sort_size>
<free_memory/>
<compress>N</compress>
<compress_variable/>
<unique_rows>Y</unique_rows>
<fields>
<field>
<case_insensitive>N</case_insensitive>
<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>
<reject_duplicate_row>N</reject_duplicate_row>
<attributes/>
<GUI>
<xloc>704</xloc>

View file

@ -59,14 +59,29 @@
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
r.idm_id as recruitment_id
<limit/>
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'citizen_spouse_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -94,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -145,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -196,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -247,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -298,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -285,7 +285,6 @@ 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}'))
AND '${M_R_CR_DATE}'::timestamp >= r.recruit_create_date
JOIN LATERAL (
SELECT passport_data
FROM UNNEST(ARRAY[

View file

@ -357,8 +357,7 @@ 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}'))
AND '${M_R_CR_DATE}'::timestamp >= r.recruit_create_date
AND r.update_date >= '${M_R_UP_DATE}'::timestamp
AND ri.update_date >= '${M_R_UP_DATE}'::timestamp
JOIN LATERAL (
SELECT passport_data
FROM UNNEST(ARRAY[

View file

@ -371,7 +371,6 @@ 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}'))
AND '${M_R_CR_DATE}'::timestamp >= r.recruit_create_date
JOIN LATERAL (
SELECT passport_data
FROM UNNEST(ARRAY[

View file

@ -59,14 +59,29 @@
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
r.idm_id as recruitment_id
<limit/>
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'passport_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -94,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -145,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -196,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -247,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -298,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -55,26 +55,6 @@
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -85,6 +65,21 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -106,33 +101,6 @@
<yloc>224</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>has_criminal_prosecution</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>32</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -284,36 +252,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>32</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>832</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -329,7 +267,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>176</yloc>
<yloc>32</yloc>
</GUI>
</transform>
<transform>
@ -355,7 +293,6 @@ ugolov_presl AS (
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}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
)
SELECT
@ -381,12 +318,13 @@ SELECT
NULLIF(up->'sledSud'->>'statusNaim', '') AS conviction_status,
TO_DATE(up->'sledSud'->>'dataPrekrUD', 'YYYY-MM-DD') AS close_date,
NULLIF(up->'sledSudTekst'->>'svedTekst' , '') AS sled_sud_tekst_sved_tekst,
NULLIF(up->'sledSudTekst'->&gt;'statusNaim', '') AS sled_sud_tekst_status_naim,
NULLIF(up->'sledSudTekst'->>'statusNaim', '') AS sled_sud_tekst_status_naim,
CASE
WHEN (up->>'sledSud') IS NOT NULL AND up->>'sledSud' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в структурированном формате'
WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде'
ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей'
END AS type_info
END AS type_info,
true AS has_criminal_prosecution
FROM ervu_dashboard.citizen r
JOIN ugolov_presl up ON r.recruit_id = up.recruit_id
LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true
@ -556,6 +494,40 @@ GROUP BY r.recruit_id, up;</sql>
<yloc>32</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>832</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Table output</source_transform>

View file

@ -50,26 +50,6 @@
<to>Abort</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream 2</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -85,6 +65,21 @@
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream 2</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -106,33 +101,6 @@
<yloc>592</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>has_criminal_prosecution</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -287,36 +255,6 @@ and recruitment_id = '${IDM_ID}';</sql>
<yloc>416</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>736</xloc>
<yloc>640</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream 2</name>
<type>DetectLastRow</type>
@ -332,7 +270,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>528</yloc>
<yloc>416</yloc>
</GUI>
</transform>
<transform>
@ -474,6 +412,40 @@ and recruitment_id = '${IDM_ID}';</sql>
<yloc>768</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>736</xloc>
<yloc>560</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
@ -498,7 +470,6 @@ ugolov_presl AS (
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}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
)
@ -530,7 +501,8 @@ SELECT
WHEN (up->>'sledSud') IS NOT NULL AND up->>'sledSud' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в структурированном формате'
WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде'
ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей'
END AS type_info
END AS type_info,
true AS has_criminal_prosecution
FROM ervu_dashboard.citizen r
JOIN ugolov_presl up ON r.recruit_id = up.recruit_id
LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true

View file

@ -55,26 +55,6 @@
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -85,6 +65,21 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -106,33 +101,6 @@
<yloc>736</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>has_criminal_prosecution</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>576</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -301,36 +269,6 @@ DO UPDATE SET
<yloc>576</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>800</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -346,7 +284,7 @@ DO UPDATE SET
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>704</yloc>
<yloc>576</yloc>
</GUI>
</transform>
<transform>
@ -511,7 +449,6 @@ ugolov_presl AS (
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}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
)
SELECT
@ -537,12 +474,13 @@ SELECT
NULLIF(up->'sledSud'->>'statusNaim', '') AS conviction_status,
TO_DATE(up->'sledSud'->>'dataPrekrUD', 'YYYY-MM-DD') AS close_date,
NULLIF(up->'sledSudTekst'->>'svedTekst' , '') AS sled_sud_tekst_sved_tekst,
NULLIF(up->'sledSudTekst'-&gt;&gt;'statusNaim', '') AS sled_sud_tekst_status_naim,
NULLIF(up->'sledSudTekst'->>'statusNaim', '') AS sled_sud_tekst_status_naim,
CASE
WHEN (up->>'sledSud') IS NOT NULL AND up->>'sledSud' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в структурированном формате'
WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде'
ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей'
END AS type_info
END AS type_info,
true AS has_criminal_prosecution
FROM ervu_dashboard.citizen r
JOIN ugolov_presl up ON r.recruit_id = up.recruit_id
LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true
@ -594,6 +532,40 @@ GROUP BY r.recruit_id, up;</sql>
<yloc>576</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>768</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Insert / update</source_transform>

View file

@ -59,14 +59,29 @@
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
r.idm_id as recruitment_id
<limit/>
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'prosecution_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -94,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSIN
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -145,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSIN
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -196,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSIN
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -247,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSIN
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -298,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSIN
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>

View file

@ -55,26 +55,6 @@
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -85,6 +65,21 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -106,41 +101,6 @@
<yloc>448</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>has_punishment_execution_info</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
<field>
<length>-1</length>
<name>has_sentence_info</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>880</xloc>
<yloc>624</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -292,36 +252,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>624</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>720</xloc>
<yloc>464</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -340,6 +270,40 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>624</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>720</xloc>
<yloc>464</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
@ -361,7 +325,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
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}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT recruit_id,
@ -383,7 +346,7 @@ SELECT recruit_id,
punishment_info ->> 'naimSubekt' AS region_name, -- Наименование субъекта
punishment_info ->> 'naimOrg' AS facility_name, -- Название учреждения
punishment_info ->> 'adresOrg' AS facility_address, -- Адрес учреждения
punishment_info -&gt;&gt; 'nomerUD' AS criminal_case_number, -- Номер уголовного дела
punishment_info ->> 'nomerUD' AS criminal_case_number, -- Номер уголовного дела
TO_DATE(punishment_info ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, -- Дата начала срока
TO_DATE(punishment_info ->> 'dataOkonchSrok', 'YYYY-MM-DD') AS planned_date, -- Планируемая дата освобождения
CASE
@ -392,7 +355,9 @@ SELECT recruit_id,
ELSE punishment_info ->> 'kodPerekvalif'
END AS article_modification_flag, -- Признак переквалификации
punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения
TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date -- Фактическая дата освобождения
TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, -- Фактическая дата освобождения
true AS has_punishment_execution_info,
true AS has_sentence_info
FROM punishment_data
LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true
GROUP BY recruit_id, punishment_info;</sql>

View file

@ -32,8 +32,8 @@
<fontitalic>N</fontitalic>
<fontsize>-1</fontsize>
<height>26</height>
<xloc>987</xloc>
<yloc>654</yloc>
<xloc>976</xloc>
<yloc>736</yloc>
<note>has_punishment_execution_info</note>
<width>180</width>
</notepad>
@ -74,26 +74,6 @@
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
@ -104,6 +84,21 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -125,41 +120,6 @@
<yloc>384</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>has_punishment_execution_info</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
<field>
<length>-1</length>
<name>has_sentence_info</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>864</xloc>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -314,36 +274,6 @@ and recruitment_id = '${IDM_ID}';</sql>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>752</xloc>
<yloc>400</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
@ -512,7 +442,6 @@ and recruitment_id = '${IDM_ID}';</sql>
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}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
@ -544,7 +473,9 @@ SELECT recruit_id,
ELSE punishment_info ->> 'kodPerekvalif'
END AS article_modification_flag, -- Признак переквалификации
punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения
TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date -- Фактическая дата освобождения
TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, -- Фактическая дата освобождения
true AS has_punishment_execution_info,
true AS has_sentence_info
FROM punishment_data
LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true
GROUP BY recruit_id, punishment_info;</sql>
@ -604,6 +535,40 @@ GROUP BY recruit_id, punishment_info;</sql>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>752</xloc>
<yloc>384</yloc>
</GUI>
</transform>
<transform_error_handling>
<error>
<source_transform>Insert / update</source_transform>

View file

@ -25,11 +25,6 @@
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Add constants</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Change job status on error</from>
<to>Abort</to>
@ -45,16 +40,6 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Group by</from>
<to>Identify last row in a stream 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream 2</from>
<to>Add constants</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Change job status on error</to>
@ -82,7 +67,17 @@
</hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>Identify last row in a stream 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream 2</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
@ -106,41 +101,6 @@
<yloc>432</yloc>
</GUI>
</transform>
<transform>
<name>Add constants</name>
<type>Constant</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
<field>
<length>-1</length>
<name>has_punishment_execution_info</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
<field>
<length>-1</length>
<name>has_sentence_info</name>
<nullif>true</nullif>
<precision>-1</precision>
<set_empty_string>N</set_empty_string>
<type>Boolean</type>
</field>
</fields>
<attributes/>
<GUI>
<xloc>880</xloc>
<yloc>640</yloc>
</GUI>
</transform>
<transform>
<name>Change job status on error</name>
<type>ExecSql</type>
@ -309,36 +269,6 @@ DO UPDATE SET
<yloc>640</yloc>
</GUI>
</transform>
<transform>
<name>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>
</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>432</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream 2</name>
<type>DetectLastRow</type>
@ -486,6 +416,40 @@ DO UPDATE SET
<yloc>272</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</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>out</prefix>
<sort_size>1000000</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>448</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
@ -507,7 +471,6 @@ DO UPDATE SET
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}'))
AND '${M_R_CR_DATE}'::timestamp >= ri.created_at
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
)
SELECT recruit_id,
@ -538,7 +501,9 @@ SELECT recruit_id,
ELSE punishment_info ->> 'kodPerekvalif'
END AS article_modification_flag, -- Признак переквалификации
punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения
TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date -- Фактическая дата освобождения
TO_DATE(punishment_info ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date, -- Фактическая дата освобождения
true AS has_punishment_execution_info,
true AS has_sentence_info
FROM punishment_data
LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true
GROUP BY recruit_id, punishment_info;</sql>

View file

@ -59,14 +59,29 @@
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
r.idm_id as recruitment_id
<limit/>
<sql>WITH mud AS (SELECT recruitment_id,
MAX(execution_datetime) AS max_upd_date
FROM etl.job_execution
WHERE job_name = '${JOB_NAME}'
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
LEFT JOIN etl.job_execution je
ON r.idm_id = je.recruitment_id
and job_name = 'punishment_job'
where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING');</sql>
<variables_active>N</variables_active>
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je
on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
@ -94,7 +109,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -145,7 +160,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -196,7 +211,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -247,7 +262,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
@ -298,7 +313,7 @@ where je.status in ('SUCCESS', 'DELTA_ERROR', 'DELTA_SUCCESS', 'DELTA_PROCESSING
<parameters>
<variable_mapping>
<variable>IDM_ID</variable>
<field>recruitment_id</field>
<field>idm_id</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>