Поменял логику, при необходимости откатить

This commit is contained in:
adel.ka 2025-10-21 12:53:28 +03:00
parent 360e9f3e77
commit 44c15abe85
24 changed files with 1179 additions and 1656 deletions

View file

@ -40,21 +40,11 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update 2</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Filter rows</from> <from>Filter rows</from>
<to>Change job status on success </to> <to>Change job status on success </to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update 2</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success </to> <to>Change job status on success </to>
@ -65,26 +55,31 @@
<to>Table output</to> <to>Table output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Group by 2</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>User defined Java expression 2</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table output</from> <from>Table output</from>
<to>Change job status on error </to> <to>Change job status on error </to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table output</from> <from>Table input </from>
<to>Group by 2</to> <to>Group by 2</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Group by 2</from>
<to>User defined Java expression 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input </from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -171,8 +166,8 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1744</xloc> <xloc>576</xloc>
<yloc>608</yloc> <yloc>1040</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -217,8 +212,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1568</xloc> <xloc>304</xloc>
<yloc>480</yloc> <yloc>1040</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -253,8 +248,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<send_true_to>Change job status on success </send_true_to> <send_true_to>Change job status on success </send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1392</xloc> <xloc>896</xloc>
<yloc>608</yloc> <yloc>1040</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -298,25 +293,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<prefix>grp</prefix> <prefix>grp</prefix>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>560</xloc> <xloc>304</xloc>
<yloc>480</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>784</xloc>
<yloc>480</yloc> <yloc>480</yloc>
</GUI> </GUI>
</transform> </transform>
@ -324,7 +301,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<name>Table input </name> <name>Table input </name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -334,7 +311,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH children_data AS (
SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS child_external_id, (ch->>'id')::uuid AS child_external_id,
NULLIF(ch->>'idERN', '') AS child_id_ern, NULLIF(ch->>'idERN', '') AS child_id_ern,
@ -356,15 +334,16 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
ch->'svedAZRozhd'->>'nomerZapis' AS birth_az_number, ch->'svedAZRozhd'->>'nomerZapis' AS birth_az_number,
CASE WHEN dates.death_date IS NOT NULL THEN 1 ELSE 0 END AS is_dead, CASE WHEN dates.death_date IS NOT NULL THEN 1 ELSE 0 END AS is_dead,
CASE CASE
WHEN dates.death_date IS NOT NULL THEN 0 -- умершие не могут быть несовершеннолетними WHEN dates.death_date IS NOT NULL THEN 0
WHEN dates.birth_date IS NULL THEN 0 -- если дата рождения неизвестна, считаем взрослым WHEN dates.birth_date IS NULL THEN 0
WHEN dates.birth_date > CURRENT_DATE - INTERVAL '18 years' THEN 1 WHEN dates.birth_date > CURRENT_DATE - INTERVAL '18 years' THEN 1
ELSE 0 ELSE 0
END AS is_minor END AS is_minor,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') AS ch JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL ( CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') AS ch
CROSS JOIN LATERAL (
SELECT SELECT
MAKE_DATE( MAKE_DATE(
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
@ -376,11 +355,16 @@ CROSS JOIN LATERAL (
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz', '')::int, NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den', '')::int NULLIF(ch->'svedSmert'->'dataSmert'->>'den', '')::int
) AS death_date ) AS death_date
) AS dates ) AS dates
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array';</sql> AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM children_data) as last_row
FROM children_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -466,7 +450,7 @@ WHERE
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>560</xloc> <xloc>896</xloc>
<yloc>800</yloc> <yloc>800</yloc>
</GUI> </GUI>
</transform> </transform>
@ -550,7 +534,7 @@ WHERE
</formula> </formula>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1024</xloc> <xloc>688</xloc>
<yloc>480</yloc> <yloc>480</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -18,26 +18,6 @@
<modified_date>2025/08/11 13:22:56.048</modified_date> <modified_date>2025/08/11 13:22:56.048</modified_date>
</info> </info>
<notepads> <notepads>
<notepad>
<backgroundcolorblue>251</backgroundcolorblue>
<backgroundcolorgreen>232</backgroundcolorgreen>
<backgroundcolorred>201</backgroundcolorred>
<bordercolorblue>90</bordercolorblue>
<bordercolorgreen>58</bordercolorgreen>
<bordercolorred>14</bordercolorred>
<fontbold>N</fontbold>
<fontcolorblue>90</fontcolorblue>
<fontcolorgreen>58</fontcolorgreen>
<fontcolorred>14</fontcolorred>
<fontitalic>N</fontitalic>
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>26</height>
<xloc>574</xloc>
<yloc>358</yloc>
<note>1. insert/update, update указан лишний error_code для error handling</note>
<width>384</width>
</notepad>
</notepads> </notepads>
<order> <order>
<hop> <hop>
@ -45,11 +25,6 @@
<to>Change job status on error </to> <to>Change job status on error </to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update </from> <from>Update </from>
<to>Change job status on error </to> <to>Change job status on error </to>
@ -65,21 +40,11 @@
<to>Table input 2</to> <to>Table input 2</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update </from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Filter rows</from> <from>Filter rows</from>
<to>Change job status on success </to> <to>Change job status on success </to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update </from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success </to> <to>Change job status on success </to>
@ -91,18 +56,28 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Group by</from> <from>Table input 2</from>
<to>Identify last row in a stream</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Group by</from>
<to>User defined Java expression</to> <to>User defined Java expression</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input 2</from> <from>Table input 2</from>
<to>Insert / update</to> <to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input 2</from>
<to>Group by</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -191,8 +166,8 @@ and status = 'DELTA_PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1872</xloc> <xloc>784</xloc>
<yloc>0</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -239,8 +214,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1616</xloc> <xloc>496</xloc>
<yloc>144</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -275,8 +250,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success </send_true_to> <send_true_to>Change job status on success </send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1616</xloc> <xloc>1072</xloc>
<yloc>0</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -320,25 +295,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<prefix>grp</prefix> <prefix>grp</prefix>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>784</xloc> <xloc>496</xloc>
<yloc>0</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>1024</xloc>
<yloc>0</yloc> <yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>
@ -432,7 +389,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>784</xloc> <xloc>1072</xloc>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
@ -440,7 +397,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input 2</name> <name>Table input 2</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -450,7 +407,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH children_data AS (
SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS child_external_id, (ch->>'id')::uuid AS child_external_id,
NULLIF(ch->>'idERN', '') AS child_id_ern, NULLIF(ch->>'idERN', '') AS child_id_ern,
@ -472,15 +430,16 @@ and recruitment_id = '${IDM_ID}';</sql>
ch->'svedAZRozhd'->>'nomerZapis' AS birth_az_number, ch->'svedAZRozhd'->>'nomerZapis' AS birth_az_number,
CASE WHEN dates.death_date IS NOT NULL THEN 1 ELSE 0 END AS is_dead, CASE WHEN dates.death_date IS NOT NULL THEN 1 ELSE 0 END AS is_dead,
CASE CASE
WHEN dates.death_date IS NOT NULL THEN 0 -- умершие не могут быть несовершеннолетними WHEN dates.death_date IS NOT NULL THEN 0
WHEN dates.birth_date IS NULL THEN 0 -- если дата рождения неизвестна, считаем взрослым WHEN dates.birth_date IS NULL THEN 0
WHEN dates.birth_date > CURRENT_DATE - INTERVAL '18 years' THEN 1 WHEN dates.birth_date > CURRENT_DATE - INTERVAL '18 years' THEN 1
ELSE 0 ELSE 0
END AS is_minor END AS is_minor,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') AS ch JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL ( CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') AS ch
CROSS JOIN LATERAL (
SELECT SELECT
MAKE_DATE( MAKE_DATE(
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
@ -492,12 +451,17 @@ CROSS JOIN LATERAL (
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz', '')::int, NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den', '')::int NULLIF(ch->'svedSmert'->'dataSmert'->>'den', '')::int
) AS death_date ) AS death_date
) AS dates ) AS dates
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp, AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array';</sql> AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM children_data) as last_row
FROM children_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -585,7 +549,7 @@ WHERE
</formula> </formula>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1232</xloc> <xloc>784</xloc>
<yloc>0</yloc> <yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -18,26 +18,6 @@
<modified_date>2025/08/08 13:25:52.319</modified_date> <modified_date>2025/08/08 13:25:52.319</modified_date>
</info> </info>
<notepads> <notepads>
<notepad>
<backgroundcolorblue>251</backgroundcolorblue>
<backgroundcolorgreen>232</backgroundcolorgreen>
<backgroundcolorred>201</backgroundcolorred>
<bordercolorblue>90</bordercolorblue>
<bordercolorgreen>58</bordercolorgreen>
<bordercolorred>14</bordercolorred>
<fontbold>N</fontbold>
<fontcolorblue>90</fontcolorblue>
<fontcolorgreen>58</fontcolorgreen>
<fontcolorred>14</fontcolorred>
<fontitalic>N</fontitalic>
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>26</height>
<xloc>368</xloc>
<yloc>592</yloc>
<note>1.Insert/update не указан error_description для error handling</note>
<width>338</width>
</notepad>
</notepads> </notepads>
<order> <order>
<hop> <hop>
@ -60,26 +40,11 @@
<to>Change job status on error 2</to> <to>Change job status on error 2</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Group by</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Filter rows</from> <from>Filter rows</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -91,18 +56,28 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Group by</from> <from>Table input 2</from>
<to>Identify last row in a stream</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Group by</from>
<to>User defined Java expression</to> <to>User defined Java expression</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input 2</from> <from>Table input 2</from>
<to>Insert / update</to> <to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input 2</from>
<to>Group by</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -192,8 +167,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1440</xloc> <xloc>416</xloc>
<yloc>0</yloc> <yloc>608</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -255,8 +230,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1216</xloc> <xloc>224</xloc>
<yloc>0</yloc> <yloc>608</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -291,8 +266,8 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1216</xloc> <xloc>608</xloc>
<yloc>128</yloc> <yloc>608</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -336,26 +311,8 @@ DO UPDATE SET
<prefix>grp</prefix> <prefix>grp</prefix>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>608</xloc> <xloc>224</xloc>
<yloc>192</yloc> <yloc>176</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>608</xloc>
<yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -456,7 +413,7 @@ DO UPDATE SET
<name>Table input 2</name> <name>Table input 2</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -465,8 +422,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH children_data AS (
<sql>SELECT SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS child_external_id, (ch->>'id')::uuid AS child_external_id,
NULLIF(ch->>'idERN', '') AS child_id_ern, NULLIF(ch->>'idERN', '') AS child_id_ern,
@ -488,15 +445,16 @@ DO UPDATE SET
ch->'svedAZRozhd'->>'nomerZapis' AS birth_az_number, ch->'svedAZRozhd'->>'nomerZapis' AS birth_az_number,
CASE WHEN dates.death_date IS NOT NULL THEN 1 ELSE 0 END AS is_dead, CASE WHEN dates.death_date IS NOT NULL THEN 1 ELSE 0 END AS is_dead,
CASE CASE
WHEN dates.death_date IS NOT NULL THEN 0 -- умершие не могут быть несовершеннолетними WHEN dates.death_date IS NOT NULL THEN 0
WHEN dates.birth_date IS NULL THEN 0 -- если дата рождения неизвестна, считаем взрослым WHEN dates.birth_date IS NULL THEN 0
WHEN dates.birth_date > CURRENT_DATE - INTERVAL '18 years' THEN 1 WHEN dates.birth_date > CURRENT_DATE - INTERVAL '18 years' THEN 1
ELSE 0 ELSE 0
END AS is_minor END AS is_minor,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') AS ch JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL ( CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedDeti'->'rebenok') AS ch
CROSS JOIN LATERAL (
SELECT SELECT
MAKE_DATE( MAKE_DATE(
NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int, NULLIF(ch->'svedFLBS'->'dataRozhdDok'->>'god', '')::int,
@ -508,15 +466,20 @@ CROSS JOIN LATERAL (
NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz', '')::int, NULLIF(ch->'svedSmert'->'dataSmert'->>'mesyacz', '')::int,
NULLIF(ch->'svedSmert'->'dataSmert'->>'den', '')::int NULLIF(ch->'svedSmert'->'dataSmert'->>'den', '')::int
) AS death_date ) AS death_date
) AS dates ) AS dates
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array';</sql> AND jsonb_typeof(ri.info->'svedFL'->'svedDeti'->'rebenok') = 'array'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM children_data) as last_row
FROM children_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>272</xloc> <xloc>224</xloc>
<yloc>432</yloc> <yloc>432</yloc>
</GUI> </GUI>
</transform> </transform>
@ -560,7 +523,7 @@ WHERE
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>976</xloc> <xloc>976</xloc>
<yloc>0</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -600,8 +563,8 @@ WHERE
</formula> </formula>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>800</xloc> <xloc>608</xloc>
<yloc>0</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
<transform_error_handling> <transform_error_handling>

View file

@ -35,11 +35,6 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -51,18 +46,18 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input</from> <from>Table output</from>
<to>Identify last row in a stream</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Table input</from>
<to>Table output</to> <to>Table output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table output</from> <from>Table input</from>
<to>Filter rows</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -118,7 +113,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>832</xloc> <xloc>928</xloc>
<yloc>704</yloc> <yloc>704</yloc>
</GUI> </GUI>
</transform> </transform>
@ -197,7 +192,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>832</xloc> <xloc>576</xloc>
<yloc>96</yloc> <yloc>96</yloc>
</GUI> </GUI>
</transform> </transform>
@ -237,29 +232,11 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -268,9 +245,10 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH address_data AS (
<sql>SELECT SELECT
ri.recruit_id::uuid, ri.recruit_id::uuid,
ri.ctid as source_ctid,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS residence_address, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS residence_address,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateStart')::date END) AS residence_registration_date, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateStart')::date END) AS residence_registration_date,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateEnd')::date END) AS residence_deregistration_date, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateEnd')::date END) AS residence_deregistration_date,
@ -281,22 +259,26 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
CASE CASE
WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '1' THEN 'В жилом помещении, не являющимся местом жительства физического лица' WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '1' THEN 'В жилом помещении, не являющимся местом жительства физического лица'
WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '2' THEN 'В учреждении уголовно-исполнительной системы' WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '2' THEN 'В учреждении уголовно-исполнительной системы'
ELSE NULL
END AS place_stay_registration_type, END AS place_stay_registration_type,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN addr->>'reg' END) AS factual_address, MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN addr->>'reg' END) AS factual_address,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateStart')::date END) AS factual_info_received_date, MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateStart')::date END) AS factual_info_received_date,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateEnd')::date END) AS factual_info_expiry_date MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateEnd')::date END) AS factual_info_expiry_date
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL jsonb_array_elements(ri.addresses) AS addr CROSS JOIN LATERAL jsonb_array_elements(ri.addresses) AS addr
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
GROUP BY ri.recruit_id;</sql> GROUP BY ri.recruit_id, ri.ctid
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM address_data) as last_row
FROM address_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>464</xloc> <xloc>576</xloc>
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
@ -374,7 +356,7 @@ GROUP BY ri.recruit_id;</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>832</xloc> <xloc>928</xloc>
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -51,20 +51,15 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <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>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -200,7 +195,7 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>752</xloc> <xloc>400</xloc>
<yloc>16</yloc> <yloc>16</yloc>
</GUI> </GUI>
</transform> </transform>
@ -240,24 +235,6 @@ and recruitment_id = '${IDM_ID}';</sql>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>944</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Insert / update</name> <name>Insert / update</name>
<type>InsertUpdate</type> <type>InsertUpdate</type>
@ -346,7 +323,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -356,8 +333,10 @@ and recruitment_id = '${IDM_ID}';</sql>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH address_data AS (
SELECT
ri.recruit_id::uuid, ri.recruit_id::uuid,
ri.ctid as source_ctid,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS residence_address, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS residence_address,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateStart')::date END) AS residence_registration_date, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateStart')::date END) AS residence_registration_date,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateEnd')::date END) AS residence_deregistration_date, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateEnd')::date END) AS residence_deregistration_date,
@ -368,19 +347,23 @@ and recruitment_id = '${IDM_ID}';</sql>
CASE CASE
WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '1' THEN 'В жилом помещении, не являющимся местом жительства физического лица' WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '1' THEN 'В жилом помещении, не являющимся местом жительства физического лица'
WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '2' THEN 'В учреждении уголовно-исполнительной системы' WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '2' THEN 'В учреждении уголовно-исполнительной системы'
ELSE NULL
END AS place_stay_registration_type, END AS place_stay_registration_type,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN addr->>'reg' END) AS factual_address, MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN addr->>'reg' END) AS factual_address,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateStart')::date END) AS factual_info_received_date, MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateStart')::date END) AS factual_info_received_date,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateEnd')::date END) AS factual_info_expiry_date MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateEnd')::date END) AS factual_info_expiry_date
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL jsonb_array_elements(ri.addresses) AS addr CROSS JOIN LATERAL jsonb_array_elements(ri.addresses) AS addr
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
GROUP BY ri.recruit_id;</sql> GROUP BY ri.recruit_id, ri.ctid
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM address_data) as last_row
FROM address_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -30,11 +30,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -51,18 +46,18 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input</from> <from>Table input</from>
<to>Insert / update</to> <to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -214,7 +209,7 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>768</xloc> <xloc>480</xloc>
<yloc>16</yloc> <yloc>16</yloc>
</GUI> </GUI>
</transform> </transform>
@ -254,24 +249,6 @@ DO UPDATE SET
<yloc>272</yloc> <yloc>272</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>960</xloc>
<yloc>272</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Insert / update</name> <name>Insert / update</name>
<type>InsertUpdate</type> <type>InsertUpdate</type>
@ -360,7 +337,7 @@ DO UPDATE SET
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -369,9 +346,10 @@ DO UPDATE SET
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH address_data AS (
<sql>SELECT SELECT
ri.recruit_id::uuid, ri.recruit_id::uuid,
ri.ctid as source_ctid,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS residence_address, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS residence_address,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateStart')::date END) AS residence_registration_date, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateStart')::date END) AS residence_registration_date,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateEnd')::date END) AS residence_deregistration_date, MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN (addr->>'regDateEnd')::date END) AS residence_deregistration_date,
@ -382,18 +360,22 @@ DO UPDATE SET
CASE CASE
WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '1' THEN 'В жилом помещении, не являющимся местом жительства физического лица' WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '1' THEN 'В жилом помещении, не являющимся местом жительства физического лица'
WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '2' THEN 'В учреждении уголовно-исполнительной системы' WHEN MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) = '2' THEN 'В учреждении уголовно-исполнительной системы'
ELSE NULL
END AS place_stay_registration_type, END AS place_stay_registration_type,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN addr->>'reg' END) AS factual_address, MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN addr->>'reg' END) AS factual_address,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateStart')::date END) AS factual_info_received_date, MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateStart')::date END) AS factual_info_received_date,
MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateEnd')::date END) AS factual_info_expiry_date MAX(CASE WHEN addr->>'type' = 'residentialAddress' THEN (addr->>'regDateEnd')::date END) AS factual_info_expiry_date
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
CROSS JOIN LATERAL jsonb_array_elements(ri.addresses) AS addr CROSS JOIN LATERAL jsonb_array_elements(ri.addresses) AS addr
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
GROUP BY ri.recruit_id;</sql> GROUP BY ri.recruit_id, ri.ctid
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM address_data) as last_row
FROM address_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -45,11 +45,6 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Filter rows</from> <from>Filter rows</from>
<to>Change job status on success 2</to> <to>Change job status on success 2</to>
@ -61,22 +56,22 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Table input</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table output</from> <from>Table output</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
@ -166,8 +161,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1840</xloc> <xloc>816</xloc>
<yloc>0</yloc> <yloc>720</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -212,8 +207,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1280</xloc> <xloc>496</xloc>
<yloc>688</yloc> <yloc>560</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -248,26 +243,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<send_true_to>Change job status on success 2</send_true_to> <send_true_to>Change job status on success 2</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1520</xloc> <xloc>816</xloc>
<yloc>0</yloc> <yloc>464</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>1008</xloc>
<yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -300,7 +277,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>720</xloc> <xloc>496</xloc>
<yloc>0</yloc> <yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>
@ -308,7 +285,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -317,8 +294,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH guardianship_data AS (
<sql>SELECT SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS guardianship_external_id, (ch->>'id')::uuid AS guardianship_external_id,
NULLIF(ch->>'idERN', '') AS guardian_id_ern, NULLIF(ch->>'idERN', '') AS guardian_id_ern,
@ -336,14 +313,20 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
NULLIF(ch->'dataRozhdDok'->>'den', '')::int NULLIF(ch->'dataRozhdDok'->>'den', '')::int
) AS birth_date, ) AS birth_date,
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils, REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils,
true AS is_guardian true AS is_guardian,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
WHERE CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch
WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array';</sql> AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM guardianship_data) as last_row
FROM guardianship_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -417,7 +400,7 @@ WHERE
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>720</xloc> <xloc>816</xloc>
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -50,34 +50,29 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Filter rows</from> <from>Filter rows</from>
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Table input</from>
<to>Update</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Insert / update</from>
<to>Detect empty stream</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -169,8 +164,8 @@ WHERE job_name = '${JOB_NAME}'
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1712</xloc> <xloc>880</xloc>
<yloc>0</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -217,8 +212,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1216</xloc> <xloc>544</xloc>
<yloc>608</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -253,26 +248,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1456</xloc> <xloc>880</xloc>
<yloc>0</yloc> <yloc>384</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>944</xloc>
<yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -350,7 +327,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>880</xloc>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
@ -384,7 +361,7 @@ and recruitment_id = '${IDM_ID}';</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>544</xloc>
<yloc>0</yloc> <yloc>0</yloc>
</GUI> </GUI>
</transform> </transform>
@ -392,7 +369,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -401,8 +378,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH guardianship_data AS (
<sql>SELECT SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS guardianship_external_id, (ch->>'id')::uuid AS guardianship_external_id,
NULLIF(ch->>'idERN', '') AS guardian_id_ern, NULLIF(ch->>'idERN', '') AS guardian_id_ern,
@ -420,15 +397,21 @@ and recruitment_id = '${IDM_ID}';</sql>
NULLIF(ch->'dataRozhdDok'->>'den', '')::int NULLIF(ch->'dataRozhdDok'->>'den', '')::int
) AS birth_date, ) AS birth_date,
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils, REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils,
true AS is_guardian true AS is_guardian,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
WHERE CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch
WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array' AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array'
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp;</sql> AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM guardianship_data) as last_row
FROM guardianship_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -45,11 +45,6 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Filter rows</from> <from>Filter rows</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -61,23 +56,23 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Sort rows</from>
<to>Update</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Insert / update</from>
<to>Detect empty stream</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -170,8 +165,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1808</xloc> <xloc>704</xloc>
<yloc>48</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -233,8 +228,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1232</xloc> <xloc>416</xloc>
<yloc>576</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -269,26 +264,8 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1504</xloc> <xloc>704</xloc>
<yloc>48</yloc> <yloc>384</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>992</xloc>
<yloc>48</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -400,7 +377,7 @@ DO UPDATE SET
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>416</xloc>
<yloc>48</yloc> <yloc>48</yloc>
</GUI> </GUI>
</transform> </transform>
@ -408,7 +385,7 @@ DO UPDATE SET
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -418,7 +395,8 @@ DO UPDATE SET
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH guardianship_data AS (
SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(ch->>'id')::uuid AS guardianship_external_id, (ch->>'id')::uuid AS guardianship_external_id,
NULLIF(ch->>'idERN', '') AS guardian_id_ern, NULLIF(ch->>'idERN', '') AS guardian_id_ern,
@ -436,14 +414,20 @@ DO UPDATE SET
NULLIF(ch->'dataRozhdDok'->>'den', '')::int NULLIF(ch->'dataRozhdDok'->>'den', '')::int
) AS birth_date, ) AS birth_date,
REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils, REGEXP_REPLACE(ch->>'snils', '[-\s]', '', 'g') AS snils,
true AS is_guardian true AS is_guardian,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch JOIN ervu_dashboard.citizen c ON c.recruit_id = ri.recruit_id
WHERE CROSS JOIN LATERAL jsonb_array_elements(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') AS ch
WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array';</sql> AND jsonb_typeof(ri.info->'svedFL'->'svedOpekun'->'svedSoczPod') = 'array'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM guardianship_data) as last_row
FROM guardianship_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -40,11 +40,6 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -55,24 +50,24 @@
<to>Table output</to> <to>Table output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table output</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Table input</from>
<to>Update</to> <to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -92,8 +87,8 @@
<row_threshold>0</row_threshold> <row_threshold>0</row_threshold>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1168</xloc> <xloc>880</xloc>
<yloc>448</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -128,8 +123,8 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1008</xloc> <xloc>720</xloc>
<yloc>448</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -161,8 +156,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1488</xloc> <xloc>1104</xloc>
<yloc>624</yloc> <yloc>160</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -207,8 +202,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1488</xloc> <xloc>336</xloc>
<yloc>320</yloc> <yloc>160</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -243,33 +238,15 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1200</xloc> <xloc>1104</xloc>
<yloc>624</yloc> <yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -278,9 +255,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH wanted_data AS (
<sql> SELECT
SELECT
ri.recruit_id, ri.recruit_id,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrg' AS name_organ_start_search, ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrg' AS name_organ_start_search,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'ugolovZakon' AS article_criminal_code, ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'ugolovZakon' AS article_criminal_code,
@ -288,13 +264,18 @@ SELECT
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataPrekrRozysk', 'YYYY-MM-DD') AS wanted_end_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' ->> '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 true AS is_wanted,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
WHERE'${IDM_ID}' != '' WHERE '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object' AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object'
</sql> )
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM wanted_data) as last_row
FROM wanted_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -400,7 +381,7 @@ WHERE'${IDM_ID}' != ''
<use_batch>N</use_batch> <use_batch>N</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1008</xloc> <xloc>336</xloc>
<yloc>624</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -30,11 +30,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -55,23 +50,23 @@
<to>Insert / update</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Update</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
@ -92,8 +87,8 @@
<row_threshold>0</row_threshold> <row_threshold>0</row_threshold>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1120</xloc> <xloc>1008</xloc>
<yloc>384</yloc> <yloc>480</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -128,8 +123,8 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>960</xloc> <xloc>752</xloc>
<yloc>384</yloc> <yloc>480</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -161,8 +156,8 @@ and status = 'DELTA_PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1280</xloc> <xloc>1008</xloc>
<yloc>608</yloc> <yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -210,8 +205,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1280</xloc> <xloc>400</xloc>
<yloc>224</yloc> <yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -246,26 +241,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1072</xloc> <xloc>1008</xloc>
<yloc>608</yloc> <yloc>224</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>752</xloc>
<yloc>608</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -336,7 +313,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -345,9 +322,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH wanted_data AS (
<sql> SELECT
SELECT
ri.recruit_id, ri.recruit_id,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrg' AS name_organ_start_search, ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrg' AS name_organ_start_search,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'ugolovZakon' AS article_criminal_code, ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'ugolovZakon' AS article_criminal_code,
@ -355,14 +331,19 @@ SELECT
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataPrekrRozysk', 'YYYY-MM-DD') AS wanted_end_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' ->> '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 true AS is_wanted,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
WHERE'${IDM_ID}' != '' WHERE '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object' AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object'
</sql> )
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM wanted_data) as last_row
FROM wanted_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -406,8 +387,8 @@ WHERE'${IDM_ID}' != ''
<use_batch>N</use_batch> <use_batch>N</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>960</xloc> <xloc>400</xloc>
<yloc>608</yloc> <yloc>480</yloc>
</GUI> </GUI>
</transform> </transform>
<transform_error_handling> <transform_error_handling>

View file

@ -45,16 +45,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Insert / update</from> <from>Insert / update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
@ -67,14 +57,19 @@
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Insert / update</from>
<to>Identify last row in a stream 2</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream 2</from> <from>Table input</from>
<to>Update</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -92,8 +87,8 @@
<row_threshold>0</row_threshold> <row_threshold>0</row_threshold>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1152</xloc> <xloc>1008</xloc>
<yloc>432</yloc> <yloc>416</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -128,8 +123,8 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>992</xloc> <xloc>688</xloc>
<yloc>432</yloc> <yloc>416</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -161,8 +156,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1312</xloc> <xloc>1024</xloc>
<yloc>640</yloc> <yloc>80</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -224,8 +219,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1312</xloc> <xloc>416</xloc>
<yloc>272</yloc> <yloc>80</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -260,26 +255,8 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1136</xloc> <xloc>1024</xloc>
<yloc>640</yloc> <yloc>272</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream 2</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>640</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -350,7 +327,7 @@ DO UPDATE SET
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -360,8 +337,8 @@ DO UPDATE SET
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql> <sql>WITH wanted_data AS (
SELECT SELECT
ri.recruit_id, ri.recruit_id,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrg' AS name_organ_start_search, ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'naimOrg' AS name_organ_start_search,
ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'ugolovZakon' AS article_criminal_code, ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'ugolovZakon' AS article_criminal_code,
@ -369,13 +346,18 @@ SELECT
TO_DATE(ri.info -> 'svedFL' -> 'extend' -> 'rozysk' ->> 'dataPrekrRozysk', 'YYYY-MM-DD') AS wanted_end_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' ->> '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 // Наличие информации о розыске true AS is_wanted,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
WHERE'${IDM_ID}' != '' WHERE '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object' AND jsonb_typeof(ri.info->'svedFL'->'extend'->'rozysk') = 'object'
</sql> )
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM wanted_data) as last_row
FROM wanted_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -419,8 +401,8 @@ WHERE'${IDM_ID}' != ''
<use_batch>N</use_batch> <use_batch>N</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>992</xloc> <xloc>416</xloc>
<yloc>640</yloc> <yloc>416</yloc>
</GUI> </GUI>
</transform> </transform>
<transform_error_handling> <transform_error_handling>

View file

@ -35,11 +35,6 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -50,34 +45,34 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output 2</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table output 2</from> <from>Table output 2</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Identify last row in a stream</from>
<to>Table output 2</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table input</from> <from>Table input</from>
<to>Table output</to> <to>Table output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table output</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream</to> <to>Table output 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>912</xloc> <xloc>736</xloc>
<yloc>192</yloc> <yloc>192</yloc>
</GUI> </GUI>
</transform> </transform>
@ -166,8 +161,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1120</xloc> <xloc>576</xloc>
<yloc>64</yloc> <yloc>912</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -212,8 +207,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1120</xloc> <xloc>352</xloc>
<yloc>576</yloc> <yloc>912</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -249,25 +244,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>736</xloc> <xloc>736</xloc>
<yloc>64</yloc> <yloc>912</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>288</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -300,15 +277,15 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>736</xloc> <xloc>352</xloc>
<yloc>416</yloc> <yloc>192</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -317,8 +294,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <sql>WITH spouse_data AS (
<sql>SELECT SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(supr->>'id')::uuid AS spouse_external_id, (supr->>'id')::uuid AS spouse_external_id,
NULLIF(supr->>'idERN', '') AS spouse_id_ern, NULLIF(supr->>'idERN', '') AS spouse_id_ern,
@ -345,17 +322,24 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
CASE CASE
WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
ELSE false ELSE false
END AS information_excluded END AS information_excluded,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL ( JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
CROSS JOIN LATERAL (
SELECT supri SELECT supri
FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array' WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr(supr) ) AS supr(supr)
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}';</sql> AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM spouse_data) as last_row
FROM spouse_data;
</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -495,7 +479,7 @@ WHERE
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>736</xloc> <xloc>544</xloc>
<yloc>192</yloc> <yloc>192</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -40,44 +40,39 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update 2</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Insert / update 2</from> <from>Insert / update 2</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update 2</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table input</from> <from>Table input</from>
<to>Insert / update</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream</to> <to>Insert / update 2</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -136,7 +131,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>960</xloc> <xloc>768</xloc>
<yloc>176</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
@ -169,8 +164,8 @@ WHERE job_name = '${JOB_NAME}'
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1200</xloc> <xloc>1072</xloc>
<yloc>80</yloc> <yloc>688</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -217,8 +212,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1200</xloc> <xloc>496</xloc>
<yloc>496</yloc> <yloc>688</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -253,26 +248,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>768</xloc> <xloc>1072</xloc>
<yloc>80</yloc> <yloc>496</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>272</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -419,7 +396,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>768</xloc> <xloc>496</xloc>
<yloc>176</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
@ -453,8 +430,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>768</xloc> <xloc>496</xloc>
<yloc>384</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -471,7 +448,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH spouse_data AS (
SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(supr->>'id')::uuid AS spouse_external_id, (supr->>'id')::uuid AS spouse_external_id,
NULLIF(supr->>'idERN', '') AS spouse_id_ern, NULLIF(supr->>'idERN', '') AS spouse_id_ern,
@ -498,18 +476,24 @@ and recruitment_id = '${IDM_ID}';</sql>
CASE CASE
WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
ELSE false ELSE false
END AS information_excluded END AS information_excluded,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL ( JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
CROSS JOIN LATERAL (
SELECT supri SELECT supri
FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array' WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr(supr) ) AS supr(supr)
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND ri.update_date >= '${M_R_UP_DATE}'::timestamp; AND ri.update_date >= '${M_R_UP_DATE}'::timestamp
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM spouse_data) as last_row
FROM spouse_data;
</sql> </sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>

View file

@ -32,8 +32,8 @@
<fontitalic>N</fontitalic> <fontitalic>N</fontitalic>
<fontsize>-1</fontsize> <fontsize>-1</fontsize>
<height>149</height> <height>149</height>
<xloc>528</xloc> <xloc>0</xloc>
<yloc>608</yloc> <yloc>64</yloc>
<note> <note>
M_R_UP_DATE M_R_UP_DATE
@ -67,44 +67,39 @@ M_R_CR_DATE
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update 2</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Insert / update 2</from> <from>Insert / update 2</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update 2</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table input</from> <from>Table input</from>
<to>Insert / update</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream</to> <to>Insert / update 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -163,7 +158,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>912</xloc> <xloc>704</xloc>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
@ -198,8 +193,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1152</xloc> <xloc>944</xloc>
<yloc>64</yloc> <yloc>752</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -261,8 +256,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1152</xloc> <xloc>352</xloc>
<yloc>528</yloc> <yloc>752</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -297,26 +292,8 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>944</xloc>
<yloc>64</yloc> <yloc>528</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>704</xloc>
<yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -463,7 +440,7 @@ DO UPDATE SET
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>352</xloc>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
@ -497,8 +474,8 @@ DO UPDATE SET
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>352</xloc>
<yloc>416</yloc> <yloc>368</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -515,7 +492,8 @@ DO UPDATE SET
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH spouse_data AS (
SELECT
ri.recruit_id AS recruit_id, ri.recruit_id AS recruit_id,
(supr->>'id')::uuid AS spouse_external_id, (supr->>'id')::uuid AS spouse_external_id,
NULLIF(supr->>'idERN', '') AS spouse_id_ern, NULLIF(supr->>'idERN', '') AS spouse_id_ern,
@ -542,17 +520,24 @@ DO UPDATE SET
CASE CASE
WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true WHEN ri.info->'svedFL'->'svedSemPolozh'->>'svedSuprIskl' = '1' THEN true
ELSE false ELSE false
END AS information_excluded END AS information_excluded,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id FROM ervu_dashboard.recruits_info ri
CROSS JOIN LATERAL ( JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
CROSS JOIN LATERAL (
SELECT supri SELECT supri
FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri FROM jsonb_array_elements(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') AS supri
WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array' WHERE jsonb_typeof(ri.info->'svedFL'->'svedSemPolozh'->'suprugi') = 'array'
) AS supr(supr) ) AS supr(supr)
WHERE WHERE
'${IDM_ID}' != '' '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}';</sql> AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
)
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM spouse_data) as last_row
FROM spouse_data;
</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -30,26 +30,11 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </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>Table output</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table output</from> <from>Table output</from>
<to>Filter rows</to> <to>Filter rows</to>
@ -65,6 +50,16 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table input</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -197,7 +192,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>896</xloc> <xloc>496</xloc>
<yloc>176</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
@ -237,29 +232,11 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -269,7 +246,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH passport_data AS (
SELECT
ri.recruit_id, ri.recruit_id,
NULLIF(p.passport_data->>'nomDok', '') AS passport_number, NULLIF(p.passport_data->>'nomDok', '') AS passport_number,
NULLIF(p.passport_data->>'serDok', '') AS passport_series, NULLIF(p.passport_data->>'serDok', '') AS passport_series,
@ -279,23 +257,28 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
CASE CASE
WHEN NULLIF(p.passport_data->>'kodStatus', '') = '1' THEN TRUE WHEN NULLIF(p.passport_data->>'kodStatus', '') = '1' THEN TRUE
ELSE FALSE ELSE FALSE
END AS actual END AS actual,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen r FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r
ON r.recruit_id = ri.recruit_id ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' AND '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
JOIN LATERAL ( JOIN LATERAL (
SELECT passport_data SELECT passport_data
FROM UNNEST(ARRAY[ FROM UNNEST(ARRAY[
ri.info->'svedFL'->'svedBS'->'pasportRF'->'aktPasportRF', ri.info->'svedFL'->'svedBS'->'pasportRF'->'aktPasportRF',
ri.info->'svedFL'->'svedBS'->'pasportRF'->'predPasportRF' ri.info->'svedFL'->'svedBS'->'pasportRF'->'predPasportRF'
]) AS passport_data ]) AS passport_data
WHERE passport_data IS NOT NULL AND passport_data::text &lt;&gt; 'null' WHERE passport_data IS NOT NULL AND passport_data::text &lt;&gt; 'null'
) AS p ON TRUE ) AS p ON TRUE
WHERE LENGTH(REGEXP_REPLACE(p.passport_data->>'serDok', '[^0-9]', '', 'g')) = 4 and WHERE LENGTH(REGEXP_REPLACE(p.passport_data->>'serDok', '[^0-9]', '', 'g')) = 4
AND LENGTH(REGEXP_REPLACE(p.passport_data->>'nomDok', '[^0-9]', '', 'g')) = 6
LENGTH(REGEXP_REPLACE(p.passport_data->>'nomDok', '[^0-9]', '', 'g')) = 6</sql> )
SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM passport_data) as last_row
FROM passport_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -30,26 +30,11 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </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> <hop>
<from>Insert / update</from> <from>Insert / update</from>
<to>Filter rows</to> <to>Filter rows</to>
@ -65,6 +50,16 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -200,7 +195,7 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>752</xloc> <xloc>400</xloc>
<yloc>80</yloc> <yloc>80</yloc>
</GUI> </GUI>
</transform> </transform>
@ -240,24 +235,6 @@ and recruitment_id = '${IDM_ID}';</sql>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Insert / update</name> <name>Insert / update</name>
<type>InsertUpdate</type> <type>InsertUpdate</type>
@ -331,7 +308,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -341,7 +318,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH passport_data AS (
SELECT
ri.recruit_id, ri.recruit_id,
NULLIF(p.passport_data->>'nomDok', '') AS passport_number, NULLIF(p.passport_data->>'nomDok', '') AS passport_number,
NULLIF(p.passport_data->>'serDok', '') AS passport_series, NULLIF(p.passport_data->>'serDok', '') AS passport_series,
@ -351,26 +329,29 @@ and recruitment_id = '${IDM_ID}';</sql>
CASE CASE
WHEN NULLIF(p.passport_data->>'kodStatus', '') = '1' THEN TRUE WHEN NULLIF(p.passport_data->>'kodStatus', '') = '1' THEN TRUE
ELSE FALSE ELSE FALSE
END AS actual END AS actual,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen r FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r
ON r.recruit_id = ri.recruit_id ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' AND '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, 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 r.update_date >= '${M_R_UP_DATE}'::timestamp
JOIN LATERAL ( JOIN LATERAL (
SELECT passport_data SELECT passport_data
FROM UNNEST(ARRAY[ FROM UNNEST(ARRAY[
ri.info->'svedFL'->'svedBS'->'pasportRF'->'aktPasportRF', ri.info->'svedFL'->'svedBS'->'pasportRF'->'aktPasportRF',
ri.info->'svedFL'->'svedBS'->'pasportRF'->'predPasportRF' ri.info->'svedFL'->'svedBS'->'pasportRF'->'predPasportRF'
]) AS passport_data ]) AS passport_data
WHERE passport_data IS NOT NULL AND passport_data::text &lt;&gt; 'null' WHERE passport_data IS NOT NULL AND passport_data::text &lt;&gt; 'null'
) AS p ON TRUE ) AS p ON TRUE
WHERE LENGTH(REGEXP_REPLACE(p.passport_data->>'serDok', '[^0-9]', '', 'g')) = 4 and WHERE LENGTH(REGEXP_REPLACE(p.passport_data->>'serDok', '[^0-9]', '', 'g')) = 4
AND LENGTH(REGEXP_REPLACE(p.passport_data->>'nomDok', '[^0-9]', '', 'g')) = 6
LENGTH(REGEXP_REPLACE(p.passport_data->>'nomDok', '[^0-9]', '', 'g')) = 6 )
</sql> SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM passport_data) as last_row
FROM passport_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -30,11 +30,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -50,21 +45,21 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </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> <hop>
<from>Change job status on error</from> <from>Change job status on error</from>
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -214,7 +209,7 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>768</xloc> <xloc>416</xloc>
<yloc>16</yloc> <yloc>16</yloc>
</GUI> </GUI>
</transform> </transform>
@ -254,24 +249,6 @@ DO UPDATE SET
<yloc>272</yloc> <yloc>272</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>608</xloc>
<yloc>272</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Insert / update</name> <name>Insert / update</name>
<type>InsertUpdate</type> <type>InsertUpdate</type>
@ -345,7 +322,7 @@ DO UPDATE SET
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -355,7 +332,8 @@ DO UPDATE SET
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>SELECT <sql>WITH passport_data AS (
SELECT
ri.recruit_id, ri.recruit_id,
NULLIF(p.passport_data->>'nomDok', '') AS passport_number, NULLIF(p.passport_data->>'nomDok', '') AS passport_number,
NULLIF(p.passport_data->>'serDok', '') AS passport_series, NULLIF(p.passport_data->>'serDok', '') AS passport_series,
@ -365,24 +343,28 @@ DO UPDATE SET
CASE CASE
WHEN NULLIF(p.passport_data->>'kodStatus', '') = '1' THEN TRUE WHEN NULLIF(p.passport_data->>'kodStatus', '') = '1' THEN TRUE
ELSE FALSE ELSE FALSE
END AS actual END AS actual,
FROM ervu_dashboard.recruits_info ri ri.ctid as source_ctid
JOIN ervu_dashboard.citizen r FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r
ON r.recruit_id = ri.recruit_id ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' AND '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
JOIN LATERAL ( JOIN LATERAL (
SELECT passport_data SELECT passport_data
FROM UNNEST(ARRAY[ FROM UNNEST(ARRAY[
ri.info->'svedFL'->'svedBS'->'pasportRF'->'aktPasportRF', ri.info->'svedFL'->'svedBS'->'pasportRF'->'aktPasportRF',
ri.info->'svedFL'->'svedBS'->'pasportRF'->'predPasportRF' ri.info->'svedFL'->'svedBS'->'pasportRF'->'predPasportRF'
]) AS passport_data ]) AS passport_data
WHERE passport_data IS NOT NULL AND passport_data::text &lt;&gt; 'null' WHERE passport_data IS NOT NULL AND passport_data::text &lt;&gt; 'null'
) AS p ON TRUE ) AS p ON TRUE
WHERE LENGTH(REGEXP_REPLACE(p.passport_data->>'serDok', '[^0-9]', '', 'g')) = 4 and WHERE LENGTH(REGEXP_REPLACE(p.passport_data->>'serDok', '[^0-9]', '', 'g')) = 4
AND LENGTH(REGEXP_REPLACE(p.passport_data->>'nomDok', '[^0-9]', '', 'g')) = 6
LENGTH(REGEXP_REPLACE(p.passport_data->>'nomDok', '[^0-9]', '', 'g')) = 6 )
</sql> SELECT
*,
source_ctid = (SELECT MAX(source_ctid) FROM passport_data) as last_row
FROM passport_data;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -40,11 +40,6 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -55,29 +50,29 @@
<to>Table output</to> <to>Table output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Table input</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream</to> <to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1056</xloc> <xloc>848</xloc>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
@ -166,8 +161,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1456</xloc> <xloc>1072</xloc>
<yloc>32</yloc> <yloc>640</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -212,8 +207,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1456</xloc> <xloc>480</xloc>
<yloc>464</yloc> <yloc>640</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -248,26 +243,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1200</xloc> <xloc>1072</xloc>
<yloc>32</yloc> <yloc>464</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -300,15 +277,15 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>832</xloc> <xloc>480</xloc>
<yloc>224</yloc> <yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -318,14 +295,14 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>WITH <sql>WITH ugolov_presl AS (
ugolov_presl AS (
SELECT SELECT
jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up, jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up,
ri.recruit_id ri.recruit_id,
ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' -- Проверка на пустую строку AND '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array' WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
) )
@ -358,11 +335,12 @@ SELECT
WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде' WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде'
ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей' ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей'
END AS type_info, END AS type_info,
true AS has_criminal_prosecution true AS has_criminal_prosecution,
up.source_ctid = (SELECT MAX(source_ctid) FROM ugolov_presl) as last_row
FROM ervu_dashboard.citizen r FROM ervu_dashboard.citizen r
JOIN ugolov_presl up ON r.recruit_id = up.recruit_id 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 LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true
GROUP BY r.recruit_id, up;</sql> GROUP BY r.recruit_id, up.up, up.source_ctid;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -484,7 +462,7 @@ GROUP BY r.recruit_id, up;</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>832</xloc> <xloc>848</xloc>
<yloc>464</yloc> <yloc>464</yloc>
</GUI> </GUI>
</transform> </transform>
@ -524,7 +502,7 @@ GROUP BY r.recruit_id, up;</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1056</xloc> <xloc>848</xloc>
<yloc>32</yloc> <yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -30,11 +30,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -50,11 +45,6 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
@ -66,18 +56,23 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Sort rows</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Insert / update</from>
<to>Identify last row in a stream 2</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream 2</from> <from>Table input</from>
<to>Update</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>880</xloc> <xloc>736</xloc>
<yloc>592</yloc> <yloc>592</yloc>
</GUI> </GUI>
</transform> </transform>
@ -166,8 +161,8 @@ and status = 'DELTA_PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1152</xloc> <xloc>896</xloc>
<yloc>416</yloc> <yloc>944</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -215,8 +210,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1152</xloc> <xloc>384</xloc>
<yloc>768</yloc> <yloc>944</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -251,26 +246,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1024</xloc> <xloc>896</xloc>
<yloc>416</yloc> <yloc>768</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream 2</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>736</xloc>
<yloc>416</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -442,15 +419,15 @@ and recruitment_id = '${IDM_ID}';</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>736</xloc> <xloc>384</xloc>
<yloc>560</yloc> <yloc>416</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -460,15 +437,14 @@ and recruitment_id = '${IDM_ID}';</sql>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>WITH <sql>WITH ugolov_presl AS (
ugolov_presl AS (
SELECT SELECT
jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up, jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up,
ri.recruit_id ri.recruit_id,
--'prOtsSvedUgolovPresl' ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' -- Проверка на пустую строку AND '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array' WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
@ -476,37 +452,38 @@ ugolov_presl AS (
SELECT SELECT
r.recruit_id AS recruit_id, r.recruit_id AS recruit_id,
(up->>'id')::uuid AS prosecution_external_id, (up->>'id')::uuid AS prosecution_external_id,
NULLIF(up->'sledSud'->>'uk', '') AS uk_name, -- УК осуждения NULLIF(up->'sledSud'->>'uk', '') AS uk_name,
NULLIF(up->'sledSud'->'extend'->>'nomerUDPredv', '') AS case_number, -- номер уголовного дела (предварительный) NULLIF(up->'sledSud'->'extend'->>'nomerUDPredv', '') AS case_number,
NULLIF(up->'sledSud'->'extend'->>'svedPerekvalif', '') AS reclassification, -- сведения о переквалификации деяния NULLIF(up->'sledSud'->'extend'->>'svedPerekvalif', '') AS reclassification,
NULLIF(up->'sledSud'->'extend'->>'naimVidUgolovPresl', '') AS kind, -- наименование вида уголовного преследования NULLIF(up->'sledSud'->'extend'->>'naimVidUgolovPresl', '') AS kind,
CASE CASE
WHEN up->'sledSud'->'extend'->>'priznakPeredachSud' = '1' THEN true -- передано в суд WHEN up->'sledSud'->'extend'->>'priznakPeredachSud' = '1' THEN true
ELSE false -- нет или нет инфы ELSE false -- нет или нет инфы
END AS transfer_to_court, -- признак передачи в суд уголовного дела в отношении гражданина END AS transfer_to_court,
NULLIF(up->'sledSud'->>'naimSud','') AS court_name, -- Наименование суда, вынесшего приговор NULLIF(up->'sledSud'->>'naimSud','') AS court_name,
NULLIF(up->'sledSud'->>'nomerUD','') AS case_number_court, -- номер уголовного дела (судебный) NULLIF(up->'sledSud'->>'nomerUD','') AS case_number_court,
STRING_AGG(TRIM(BOTH ' "' FROM law.f), ', ') AS law_point, -- статьи уголовного кодекса STRING_AGG(TRIM(BOTH ' "' FROM law.f), ', ') AS law_point,
NULLIF(up->'sledSud'->>'naimOrgan', '') AS authority_name, -- наименование органа, принявшего решение о возбуждении уголовного дела NULLIF(up->'sledSud'->>'naimOrgan', '') AS authority_name,
NULLIF(up->'sledSud'->'svedSnyat'->>'osnSnyatSud', '') AS conviction_removal_basis, -- основание снятия судимости NULLIF(up->'sledSud'->'svedSnyat'->>'osnSnyatSud', '') AS conviction_removal_basis,
TO_DATE(up->'sledSud'->'svedSnyat'->>'dataSnyatSud', 'YYYY-MM-DD') AS conviction_removal_date, -- дата снятия судимости TO_DATE(up->'sledSud'->'svedSnyat'->>'dataSnyatSud', 'YYYY-MM-DD') AS conviction_removal_date,
TO_DATE(up->'sledSud'->>'dataOsuzhd', 'YYYY-MM-DD') AS conviction_date, -- дата осуждения TO_DATE(up->'sledSud'->>'dataOsuzhd', 'YYYY-MM-DD') AS conviction_date,
TO_DATE(up->'sledSud'->>'dataVozbUD', 'YYYY-MM-DD') AS create_date, -- дата возбуждения уголовного дела TO_DATE(up->'sledSud'->>'dataVozbUD', 'YYYY-MM-DD') AS create_date,
NULLIF(up->'sledSud'->>'osnPrekrUD', '') AS termination_basis, -- основания прекращения уголовного дела NULLIF(up->'sledSud'->>'osnPrekrUD', '') AS termination_basis,
NULLIF(up->'sledSud'->>'statusNaim', '') AS conviction_status, -- статус судимости NULLIF(up->'sledSud'->>'statusNaim', '') AS conviction_status,
TO_DATE(up->'sledSud'->>'dataPrekrUD', 'YYYY-MM-DD') AS close_date, -- дата прекращения уголовного дела TO_DATE(up->'sledSud'->>'dataPrekrUD', 'YYYY-MM-DD') AS close_date,
NULLIF(up->'sledSudTekst'->>'svedTekst' , '') AS sled_sud_tekst_sved_tekst, -- текст судимости в текстовом формате NULLIF(up->'sledSudTekst'->>'svedTekst' , '') AS sled_sud_tekst_sved_tekst,
NULLIF(up->'sledSudTekst'->>'statusNaim', '') AS sled_sud_tekst_status_naim, -- статус судимости в текстовом формате NULLIF(up->'sledSudTekst'->>'statusNaim', '') AS sled_sud_tekst_status_naim,
CASE CASE
WHEN (up->>'sledSud') IS NOT NULL AND up->>'sledSud' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в структурированном формате' WHEN (up->>'sledSud') IS NOT NULL AND up->>'sledSud' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в структурированном формате'
WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде' WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде'
ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей' ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей'
END AS type_info, END AS type_info,
true AS has_criminal_prosecution true AS has_criminal_prosecution,
up.source_ctid = (SELECT MAX(source_ctid) FROM ugolov_presl) as last_row
FROM ervu_dashboard.citizen r FROM ervu_dashboard.citizen r
JOIN ugolov_presl up ON r.recruit_id = up.recruit_id 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 LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true
GROUP BY r.recruit_id, up;</sql> GROUP BY r.recruit_id, up.up, up.source_ctid;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -550,7 +527,7 @@ GROUP BY r.recruit_id, up;</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>880</xloc> <xloc>736</xloc>
<yloc>416</yloc> <yloc>416</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -30,11 +30,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -55,29 +50,29 @@
<to>Insert / update</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Sort rows</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Insert / update</from>
<to>Update</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>944</xloc> <xloc>768</xloc>
<yloc>736</yloc> <yloc>736</yloc>
</GUI> </GUI>
</transform> </transform>
@ -166,8 +161,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1296</xloc> <xloc>928</xloc>
<yloc>576</yloc> <yloc>1088</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -229,8 +224,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1296</xloc> <xloc>432</xloc>
<yloc>944</yloc> <yloc>1088</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -265,26 +260,8 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1088</xloc> <xloc>928</xloc>
<yloc>576</yloc> <yloc>944</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>576</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -456,15 +433,15 @@ DO UPDATE SET
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>768</xloc> <xloc>432</xloc>
<yloc>768</yloc> <yloc>576</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -474,14 +451,14 @@ DO UPDATE SET
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>WITH <sql>WITH ugolov_presl AS (
ugolov_presl AS (
SELECT SELECT
jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up, jsonb_array_elements(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') AS up,
ri.recruit_id ri.recruit_id,
ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' -- Проверка на пустую строку AND '${IDM_ID}' != ''
AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' AND COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array' WHERE jsonb_typeof(ri.info->'svedFL'->'svedUgolovPresl'->'faktyUgolovPresl') = 'array'
) )
@ -514,15 +491,16 @@ SELECT
WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде' WHEN (up->>'sledSudTekst') IS NOT NULL AND up->>'sledSudTekst' != 'null' THEN 'Сведения о фактах уголовного преследования или судимости в текстовом виде'
ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей' ELSE 'Есть сведения о фактах уголовного преследования или судимости без указания подробностей'
END AS type_info, END AS type_info,
true AS has_criminal_prosecution true AS has_criminal_prosecution,
up.source_ctid = (SELECT MAX(source_ctid) FROM ugolov_presl) as last_row
FROM ervu_dashboard.citizen r FROM ervu_dashboard.citizen r
JOIN ugolov_presl up ON r.recruit_id = up.recruit_id 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 LEFT JOIN LATERAL jsonb_array_elements_text(up->'sledSud'->'statiUK') AS law(f) ON true
GROUP BY r.recruit_id, up;</sql> GROUP BY r.recruit_id, up.up, up.source_ctid;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>416</xloc> <xloc>432</xloc>
<yloc>944</yloc> <yloc>944</yloc>
</GUI> </GUI>
</transform> </transform>
@ -562,7 +540,7 @@ GROUP BY r.recruit_id, up;</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>976</xloc> <xloc>768</xloc>
<yloc>576</yloc> <yloc>576</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -40,11 +40,6 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -55,29 +50,29 @@
<to>Table output</to> <to>Table output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table output</from> <from>Sort rows</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Table output</from>
<to>Update</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -166,8 +161,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1488</xloc> <xloc>544</xloc>
<yloc>624</yloc> <yloc>144</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -212,8 +207,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1488</xloc> <xloc>336</xloc>
<yloc>320</yloc> <yloc>144</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -247,27 +242,9 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</compare> </compare>
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI>
<xloc>1200</xloc>
<yloc>624</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI> <GUI>
<xloc>720</xloc> <xloc>720</xloc>
<yloc>624</yloc> <yloc>144</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -300,15 +277,15 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>720</xloc> <xloc>336</xloc>
<yloc>464</yloc> <yloc>624</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -319,8 +296,10 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>WITH punishment_data AS ( <sql>WITH punishment_data AS (
SELECT ri.recruit_id, SELECT
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info,
ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' AND '${IDM_ID}' != ''
@ -328,7 +307,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null' WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null'
) )
SELECT recruit_id, SELECT recruit_id,
(punishment_info ->&gt; 'id')::uuid AS punishment_external_id, (punishment_info ->> 'id')::uuid AS punishment_external_id,
-- Блок "Сведения о вынесенном приговоре" -- Блок "Сведения о вынесенном приговоре"
punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания punishment_info ->> 'vidNakaz' AS punishment_type, -- Вид наказания
punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания punishment_info ->> 'kodVidNakaz' AS punishment_code, -- Код вида наказания
@ -347,7 +326,7 @@ SELECT recruit_id,
punishment_info ->> 'naimOrg' AS facility_name, -- Название учреждения punishment_info ->> 'naimOrg' AS facility_name, -- Название учреждения
punishment_info ->> 'adresOrg' AS facility_address, -- Адрес учреждения punishment_info ->> 'adresOrg' AS facility_address, -- Адрес учреждения
punishment_info ->> 'nomerUD' AS criminal_case_number, -- Номер уголовного дела punishment_info ->> 'nomerUD' AS criminal_case_number, -- Номер уголовного дела
TO_DATE(punishment_info ->&gt; 'dataNachSrok', 'YYYY-MM-DD') AS start_date, -- Дата начала срока TO_DATE(punishment_info ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date, -- Дата начала срока
TO_DATE(punishment_info ->> 'dataOkonchSrok', 'YYYY-MM-DD') AS planned_date, -- Планируемая дата освобождения TO_DATE(punishment_info ->> 'dataOkonchSrok', 'YYYY-MM-DD') AS planned_date, -- Планируемая дата освобождения
CASE CASE
WHEN punishment_info ->> 'kodPerekvalif' = '1' THEN 'Изменений статьи не было' WHEN punishment_info ->> 'kodPerekvalif' = '1' THEN 'Изменений статьи не было'
@ -357,10 +336,11 @@ SELECT recruit_id,
punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения 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_punishment_execution_info,
true AS has_sentence_info true AS has_sentence_info,
source_ctid = (SELECT MAX(source_ctid) FROM punishment_data) as last_row
FROM punishment_data FROM punishment_data
LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true
GROUP BY recruit_id, punishment_info;</sql> GROUP BY recruit_id, punishment_info,source_ctid;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -49,11 +49,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Detect empty stream</from> <from>Detect empty stream</from>
<to>Change job status on success</to> <to>Change job status on success</to>
@ -74,31 +69,31 @@
<to>Insert / update</to> <to>Insert / update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Update</from> <from>Update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Table input</from>
<to>Identify last row in a stream</to> <to>Detect empty stream</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream</from> <from>Sort rows</from>
<to>Update</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -185,8 +180,8 @@ and status = 'DELTA_PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1280</xloc> <xloc>608</xloc>
<yloc>608</yloc> <yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -234,8 +229,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1280</xloc> <xloc>400</xloc>
<yloc>224</yloc> <yloc>32</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -270,26 +265,8 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1072</xloc> <xloc>784</xloc>
<yloc>608</yloc> <yloc>32</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>752</xloc>
<yloc>608</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -417,7 +394,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>752</xloc> <xloc>784</xloc>
<yloc>224</yloc> <yloc>224</yloc>
</GUI> </GUI>
</transform> </transform>
@ -451,15 +428,15 @@ and recruitment_id = '${IDM_ID}';</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>752</xloc> <xloc>400</xloc>
<yloc>384</yloc> <yloc>608</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -468,10 +445,11 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/>
<sql>WITH punishment_data AS ( <sql>WITH punishment_data AS (
SELECT ri.recruit_id, SELECT
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info,
ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' AND '${IDM_ID}' != ''
@ -509,10 +487,11 @@ SELECT recruit_id,
punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения 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_punishment_execution_info,
true AS has_sentence_info true AS has_sentence_info,
source_ctid = (SELECT MAX(source_ctid) FROM punishment_data) as last_row
FROM punishment_data FROM punishment_data
LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true
GROUP BY recruit_id, punishment_info;</sql> GROUP BY recruit_id, punishment_info,source_ctid;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>

View file

@ -45,16 +45,6 @@
<to>Change job status on error</to> <to>Change job status on error</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Update</from>
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Insert / update</from> <from>Insert / update</from>
<to>Change job status on error</to> <to>Change job status on error</to>
@ -66,18 +56,23 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Insert / update</from> <from>Table input</from>
<to>Sort rows</to> <to>Sort rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Sort rows</from> <from>Sort rows</from>
<to>Identify last row in a stream 2</to> <to>Update</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Identify last row in a stream 2</from> <from>Table input</from>
<to>Update</to> <to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -166,8 +161,8 @@ and status = 'PROCESSING';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1312</xloc> <xloc>640</xloc>
<yloc>640</yloc> <yloc>112</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -229,8 +224,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1312</xloc> <xloc>416</xloc>
<yloc>272</yloc> <yloc>112</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -265,26 +260,8 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to> <send_true_to>Change job status on success</send_true_to>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1136</xloc> <xloc>816</xloc>
<yloc>640</yloc> <yloc>112</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream 2</name>
<type>DetectLastRow</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>640</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -412,7 +389,7 @@ DO UPDATE SET
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>688</xloc> <xloc>816</xloc>
<yloc>272</yloc> <yloc>272</yloc>
</GUI> </GUI>
</transform> </transform>
@ -446,15 +423,15 @@ DO UPDATE SET
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>688</xloc> <xloc>416</xloc>
<yloc>448</yloc> <yloc>640</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -465,8 +442,10 @@ DO UPDATE SET
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit/> <limit/>
<sql>WITH punishment_data AS ( <sql>WITH punishment_data AS (
SELECT ri.recruit_id, SELECT
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info ri.recruit_id,
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS punishment_info,
ri.ctid as source_ctid
FROM ervu_dashboard.recruits_info ri FROM ervu_dashboard.recruits_info ri
JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id JOIN ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id
AND '${IDM_ID}' != '' AND '${IDM_ID}' != ''
@ -503,10 +482,11 @@ SELECT recruit_id,
punishment_info ->> 'osnOsvob' AS release_reason, -- Основание освобождения 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_punishment_execution_info,
true AS has_sentence_info true AS has_sentence_info,
source_ctid = (SELECT MAX(source_ctid) FROM punishment_data) as last_row
FROM punishment_data FROM punishment_data
LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true LEFT JOIN LATERAL jsonb_array_elements_text(punishment_info -> 'statiUK') AS law_articles ON true
GROUP BY recruit_id, punishment_info;</sql> GROUP BY recruit_id, punishment_info,source_ctid;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>