fix deferment_liberation_permission flows

This commit is contained in:
Fusionshh 2025-11-09 17:26:48 +03:00
parent fff5eeb018
commit 5700985794
4 changed files with 312 additions and 279 deletions

View file

@ -50,26 +50,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>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>
<from>Identify last row in a stream</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>sort_by_recruit_id</from> <from>sort_by_recruit_id</from>
<to>Update</to> <to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to> <to>Filter 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>Table input</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold> <row_threshold>0</row_threshold>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1328</xloc> <xloc>1056</xloc>
<yloc>496</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1168</xloc> <xloc>880</xloc>
<yloc>496</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1392</xloc> <xloc>1056</xloc>
<yloc>176</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>688</xloc> <xloc>496</xloc>
<yloc>176</yloc> <yloc>176</yloc>
</GUI> </GUI>
</transform> </transform>
@ -247,13 +242,13 @@ 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>1056</xloc>
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
<name>Identify last row in a stream</name> <name>Table input</name>
<type>DetectLastRow</type> <type>TableInput</type>
<description/> <description/>
<distribute>N</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
@ -262,63 +257,32 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<method>none</method> <method>none</method>
<schema_name/> <schema_name/>
</partitioning> </partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection> <connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<sql>WITH <limit/>
part_recruits AS ( <sql>with filtered_data as (SELECT
SELECT d.id AS deferment_id,
id
FROM public.recruits
WHERE '${IDM_ID}' != '' -- Проверка на пустую строку
AND (current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}'))
),
p_recruits_deferment AS (
SELECT
d.id AS deferment_id,
d.recruit_id,
rd.code AS base_deferment, -- коды основания права на отсрочку
d.postponement_date, -- Дата окончания действия права на отсрочку
d.date_of_information, -- Дата начала действия права на отсрочку
d.hidden,
d.system_create_date,
d.system_update_date
FROM public.recruits_deferment d
JOIN public.ervu_reason_for_deferment rd ON d.ervu_reason_for_deferment_id = rd.id
)
SELECT
d.deferment_id,
d.recruit_id, d.recruit_id,
d.base_deferment, -- коды основания права на отсрочку rd.code AS base_deferment, -- коды основания права на отсрочку
d.postponement_date, -- Дата окончания действия права на отсрочку d.postponement_date, -- Дата окончания действия права на отсрочку
d.date_of_information, -- Дата начала действия права на отсрочку d.date_of_information, -- Дата начала действия права на отсрочку
d.hidden, d.hidden,
d.system_create_date AS created_at, d.system_create_date AS created_at,
d.system_update_date AS updated_at, d.system_update_date AS updated_at,
'permission' AS permission_fact, -- ключ принадлежности к праву на отсрочку 'permission' AS permission_fact, -- ключ принадлежности к праву на отсрочку
CASE NOT d.hidden AS defer_conscription, -- наличие права на отсрочку от призыва
WHEN d.hidden is false THEN true CTID
ELSE false FROM public.recruits r
END AS defer_conscription -- наличие права на отсрочку от призыва JOIN public.recruits_deferment d
FROM part_recruits r ON r.id = d.recruit_id
JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql> JOIN public.ervu_reason_for_deferment rd
ON d.ervu_reason_for_deferment_id = rd.id
WHERE (r.current_recruitment_id = '${IDM_ID}'
OR (r.current_recruitment_id IS NULL AND r.target_recruitment_id = '${IDM_ID}')
))
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -392,7 +356,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>912</xloc> <xloc>672</xloc>
<yloc>320</yloc> <yloc>320</yloc>
</GUI> </GUI>
</transform> </transform>
@ -427,7 +391,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>928</xloc> <xloc>672</xloc>
<yloc>496</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>
@ -461,7 +425,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>688</xloc> <xloc>496</xloc>
<yloc>496</yloc> <yloc>496</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -50,26 +50,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>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>sort_by_recruit_id</from> <from>sort_by_recruit_id</from>
<to>Update</to> <to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to> <to>Filter 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>Table input</from>
<to>sort_by_recruit_id</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>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold> <row_threshold>0</row_threshold>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1392</xloc> <xloc>1200</xloc>
<yloc>528</yloc> <yloc>528</yloc>
</GUI> </GUI>
</transform> </transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1200</xloc> <xloc>1008</xloc>
<yloc>528</yloc> <yloc>528</yloc>
</GUI> </GUI>
</transform> </transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1440</xloc> <xloc>1008</xloc>
<yloc>208</yloc> <yloc>208</yloc>
</GUI> </GUI>
</transform> </transform>
@ -214,7 +209,7 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>752</xloc> <xloc>560</xloc>
<yloc>208</yloc> <yloc>208</yloc>
</GUI> </GUI>
</transform> </transform>
@ -250,25 +245,7 @@ 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>1440</xloc> <xloc>1008</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>752</xloc>
<yloc>352</yloc> <yloc>352</yloc>
</GUI> </GUI>
</transform> </transform>
@ -342,7 +319,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed> <update_bypassed>N</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>960</xloc> <xloc>784</xloc>
<yloc>352</yloc> <yloc>352</yloc>
</GUI> </GUI>
</transform> </transform>
@ -350,7 +327,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>
@ -359,44 +336,33 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning> </partitioning>
<connection>ervu_person_registry</connection> <connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<sql>WITH <limit/>
part_recruits AS ( <sql>with filtered_data as (SELECT
SELECT d.id AS deferment_id,
id d.recruit_id,
FROM public.recruits rd.code AS base_deferment, -- коды основания права на отсрочку
WHERE '${IDM_ID}' != '' -- Проверка на пустую строку d.postponement_date, -- Дата окончания действия права на отсрочку
AND (current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}')) d.date_of_information, -- Дата начала действия права на отсрочку
), d.hidden,
p_recruits_deferment AS ( d.system_create_date AS created_at,
SELECT d.system_update_date AS updated_at,
d.id AS deferment_id, 'permission' AS permission_fact, -- ключ принадлежности к праву на отсрочку
d.recruit_id, NOT d.hidden AS defer_conscription, -- наличие права на отсрочку от призыва
rd.code AS base_deferment, -- коды основания права на отсрочку CTID
d.postponement_date, -- Дата окончания действия права на отсрочку FROM public.recruits r
d.date_of_information, -- Дата начала действия права на отсрочку JOIN public.recruits_deferment d
d.hidden, ON r.id = d.recruit_id
d.system_create_date, JOIN public.ervu_reason_for_deferment rd
d.system_update_date ON d.ervu_reason_for_deferment_id = rd.id
FROM public.recruits_deferment d WHERE (r.current_recruitment_id = '${IDM_ID}'
JOIN public.ervu_reason_for_deferment rd ON d.ervu_reason_for_deferment_id = rd.id OR (r.current_recruitment_id IS NULL AND r.target_recruitment_id = '${IDM_ID}')
WHERE d.system_update_date >= '${M_RECDEF_UP_DATE}'::timestamp )
) and case when '${MAX_SOURCE_UPDATE_DATE}' &lt;&gt; ''
SELECT then d.system_update_date > to_date('${MAX_SOURCE_UPDATE_DATE}', 'YYYY-MM-DD')
d.deferment_id, else true end )
d.recruit_id, select fd.*,
d.base_deferment, -- коды основания права на отсрочку fd.ctid = (select max(ctid) from filtered_data) as last_row
d.postponement_date, -- Дата окончания действия права на отсрочку from filtered_data fd</sql>
d.date_of_information, -- Дата начала действия права на отсрочку
d.hidden,
d.system_create_date AS created_at,
d.system_update_date AS updated_at,
'permission' AS permission_fact, -- ключ принадлежности к праву на отсрочку
CASE
WHEN d.hidden is false THEN true
ELSE false
END AS defer_conscription -- наличие права на отсрочку от призыва
FROM part_recruits r
JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -440,7 +406,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>976</xloc> <xloc>784</xloc>
<yloc>528</yloc> <yloc>528</yloc>
</GUI> </GUI>
</transform> </transform>
@ -474,7 +440,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>752</xloc> <xloc>560</xloc>
<yloc>528</yloc> <yloc>528</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -50,26 +50,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>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>sort_by_recruit_id</from> <from>sort_by_recruit_id</from>
<to>Update</to> <to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to> <to>Filter 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>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
</order> </order>
<transform> <transform>
<name>Abort</name> <name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold> <row_threshold>0</row_threshold>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1488</xloc> <xloc>1120</xloc>
<yloc>400</yloc> <yloc>400</yloc>
</GUI> </GUI>
</transform> </transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1184</xloc> <xloc>912</xloc>
<yloc>400</yloc> <yloc>400</yloc>
</GUI> </GUI>
</transform> </transform>
@ -165,8 +160,8 @@ and recruitment_id = '${IDM_ID}';
</sql> </sql>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>1488</xloc> <xloc>1120</xloc>
<yloc>48</yloc> <yloc>64</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -229,8 +224,8 @@ DO UPDATE SET
</partitioning> </partitioning>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>480</xloc>
<yloc>48</yloc> <yloc>64</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -265,25 +260,7 @@ 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>1488</xloc> <xloc>1120</xloc>
<yloc>208</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>704</xloc>
<yloc>208</yloc> <yloc>208</yloc>
</GUI> </GUI>
</transform> </transform>
@ -305,7 +282,6 @@ DO UPDATE SET
<condition>=</condition> <condition>=</condition>
<field>deferment_id</field> <field>deferment_id</field>
<name>deferment_id</name> <name>deferment_id</name>
<name2/>
</key> </key>
<schema>ervu_dashboard</schema> <schema>ervu_dashboard</schema>
<table>deferment_liberation</table> <table>deferment_liberation</table>
@ -358,7 +334,7 @@ DO UPDATE SET
<update_bypassed>Y</update_bypassed> <update_bypassed>Y</update_bypassed>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>912</xloc> <xloc>688</xloc>
<yloc>208</yloc> <yloc>208</yloc>
</GUI> </GUI>
</transform> </transform>
@ -366,7 +342,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>
@ -375,43 +351,30 @@ DO UPDATE SET
</partitioning> </partitioning>
<connection>ervu_person_registry</connection> <connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<sql>WITH <limit/>
part_recruits AS ( <sql>with filtered_data as (SELECT
SELECT d.id AS deferment_id,
id
FROM public.recruits
WHERE '${IDM_ID}' != '' -- Проверка на пустую строку
AND (current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}'))
),
p_recruits_deferment AS (
SELECT
d.id AS deferment_id,
d.recruit_id,
rd.code AS base_deferment, -- коды основания права на отсрочку
d.postponement_date, -- Дата окончания действия права на отсрочку
d.date_of_information, -- Дата начала действия права на отсрочку
d.hidden,
d.system_create_date,
d.system_update_date
FROM public.recruits_deferment d
JOIN public.ervu_reason_for_deferment rd ON d.ervu_reason_for_deferment_id = rd.id
)
SELECT
d.deferment_id,
d.recruit_id, d.recruit_id,
d.base_deferment, -- коды основания права на отсрочку rd.code AS base_deferment, -- коды основания права на отсрочку
d.postponement_date, -- Дата окончания действия права на отсрочку d.postponement_date, -- Дата окончания действия права на отсрочку
d.date_of_information, -- Дата начала действия права на отсрочку d.date_of_information, -- Дата начала действия права на отсрочку
d.hidden, d.hidden,
d.system_create_date AS created_at, d.system_create_date AS created_at,
d.system_update_date AS updated_at, d.system_update_date AS updated_at,
'permission' AS permission_fact, -- ключ принадлежности к праву на отсрочку 'permission' AS permission_fact, -- ключ принадлежности к праву на отсрочку
CASE NOT d.hidden AS defer_conscription, -- наличие права на отсрочку от призыва
WHEN d.hidden is false THEN true CTID
ELSE false FROM public.recruits r
END AS defer_conscription -- наличие права на отсрочку от призыва JOIN public.recruits_deferment d
FROM part_recruits r ON r.id = d.recruit_id
JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql> JOIN public.ervu_reason_for_deferment rd
ON d.ervu_reason_for_deferment_id = rd.id
WHERE (r.current_recruitment_id = '${IDM_ID}'
OR (r.current_recruitment_id IS NULL AND r.target_recruitment_id = '${IDM_ID}')
))
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
@ -455,7 +418,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
<use_batch>Y</use_batch> <use_batch>Y</use_batch>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>912</xloc> <xloc>688</xloc>
<yloc>400</yloc> <yloc>400</yloc>
</GUI> </GUI>
</transform> </transform>
@ -489,7 +452,7 @@ JOIN p_recruits_deferment d ON r.id = d.recruit_id</sql>
</fields> </fields>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>704</xloc> <xloc>480</xloc>
<yloc>400</yloc> <yloc>400</yloc>
</GUI> </GUI>
</transform> </transform>

View file

@ -20,36 +20,164 @@
<notepads> <notepads>
</notepads> </notepads>
<order> <order>
<hop>
<from>Table input 2</from>
<to>Append streams</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input 3</from>
<to>Append streams</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Append streams</from>
<to>Sort rows</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>Table input</from> <from>Table input</from>
<to>Table input 2</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>deferment_liberation_permission_flow_delta.hpl</to> <to>deferment_liberation_permission_flow_delta.hpl</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input</from> <from>Table input</from>
<to>Table input 3</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Sort rows</from>
<to>deferment_liberation_permission_flow_delta.hpl 2</to> <to>deferment_liberation_permission_flow_delta.hpl 2</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input</from> <from>Sort rows</from>
<to>deferment_liberation_permission_flow_delta.hpl 3</to> <to>deferment_liberation_permission_flow_delta.hpl 3</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input</from> <from>Sort rows</from>
<to>deferment_liberation_permission_flow_delta.hpl 4</to> <to>deferment_liberation_permission_flow_delta.hpl 4</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Table input</from> <from>Sort rows</from>
<to>deferment_liberation_permission_flow_delta.hpl 5</to> <to>deferment_liberation_permission_flow_delta.hpl 5</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
<transform>
<name>Append streams</name>
<type>Append</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<attributes/>
<GUI>
<xloc>592</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Sort rows</name>
<type>SortRows</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<directory>${java.io.tmpdir}</directory>
<prefix>out</prefix>
<sort_size>100000</sort_size>
<free_memory/>
<compress>N</compress>
<compress_variable/>
<unique_rows>Y</unique_rows>
<fields>
<field>
<name>recruitment_id</name>
<ascending>Y</ascending>
<case_sensitive>N</case_sensitive>
<collator_enabled>N</collator_enabled>
<collator_strength>0</collator_strength>
<presorted>N</presorted>
</field>
</fields>
<attributes/>
<GUI>
<xloc>784</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Table input</name> <name>Table input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>select max(updated_at) as max_update_date
from deferment_liberation;</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>192</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>Table input 2</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<lookup>Table input</lookup>
<sql>WITH max_update_date(val) AS (SELECT CAST(? AS timestamp))
SELECT DISTINCT COALESCE(r.current_recruitment_id, r.target_recruitment_id) AS recruitment_id,
? as max_update_date
FROM recruits r
JOIN recruits_deferment rd ON rd.recruit_id = r.id
JOIN max_update_date mud ON TRUE
WHERE (mud.val IS NULL OR rd.system_update_date > mud.val);</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>384</xloc>
<yloc>192</yloc>
</GUI>
</transform>
<transform>
<name>Table input 3</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute> <distribute>Y</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
@ -60,32 +188,19 @@
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit>0</limit> <limit>0</limit>
<sql>WITH mud AS (SELECT recruitment_id, <lookup>Table input</lookup>
MAX(execution_datetime) AS max_upd_date <sql>select r.idm_id as recruitment_id,
FROM etl.job_execution ? as max_update_date
WHERE job_name = '${JOB_NAME}' from ervu_dashboard.recruitment r
AND status IN ('SUCCESS', 'DELTA_SUCCESS')
GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
JOIN mud ON mud.recruitment_id = r.idm_id
JOIN ervu_dashboard.recruits_info ri
ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
AND ri.updated_at > mud.max_upd_date
union
select r2.idm_id
from ervu_dashboard.recruitment r2
join etl.job_execution je join etl.job_execution je
on r2.idm_id = je.recruitment_id on r.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
and je.job_name = '${JOB_NAME}';</sql> and je.job_name = '${JOB_NAME}';</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>352</xloc> <xloc>384</xloc>
<yloc>288</yloc> <yloc>384</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -112,6 +227,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>recruitment_id</field> <field>recruitment_id</field>
<input/> <input/>
</variable_mapping> </variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars> <inherit_all_vars>Y</inherit_all_vars>
</parameters> </parameters>
<execution_result_target_transform/> <execution_result_target_transform/>
@ -135,7 +255,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/> <executors_output_transform/>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>640</xloc> <xloc>1072</xloc>
<yloc>128</yloc> <yloc>128</yloc>
</GUI> </GUI>
</transform> </transform>
@ -163,6 +283,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>recruitment_id</field> <field>recruitment_id</field>
<input/> <input/>
</variable_mapping> </variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars> <inherit_all_vars>Y</inherit_all_vars>
</parameters> </parameters>
<execution_result_target_transform/> <execution_result_target_transform/>
@ -186,7 +311,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/> <executors_output_transform/>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>640</xloc> <xloc>1072</xloc>
<yloc>208</yloc> <yloc>208</yloc>
</GUI> </GUI>
</transform> </transform>
@ -214,6 +339,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>recruitment_id</field> <field>recruitment_id</field>
<input/> <input/>
</variable_mapping> </variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars> <inherit_all_vars>Y</inherit_all_vars>
</parameters> </parameters>
<execution_result_target_transform/> <execution_result_target_transform/>
@ -237,7 +367,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/> <executors_output_transform/>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>640</xloc> <xloc>1072</xloc>
<yloc>288</yloc> <yloc>288</yloc>
</GUI> </GUI>
</transform> </transform>
@ -265,6 +395,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>recruitment_id</field> <field>recruitment_id</field>
<input/> <input/>
</variable_mapping> </variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars> <inherit_all_vars>Y</inherit_all_vars>
</parameters> </parameters>
<execution_result_target_transform/> <execution_result_target_transform/>
@ -288,8 +423,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/> <executors_output_transform/>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>640</xloc> <xloc>1072</xloc>
<yloc>384</yloc> <yloc>368</yloc>
</GUI> </GUI>
</transform> </transform>
<transform> <transform>
@ -316,6 +451,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>recruitment_id</field> <field>recruitment_id</field>
<input/> <input/>
</variable_mapping> </variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars> <inherit_all_vars>Y</inherit_all_vars>
</parameters> </parameters>
<execution_result_target_transform/> <execution_result_target_transform/>
@ -339,8 +479,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/> <executors_output_transform/>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>640</xloc> <xloc>1072</xloc>
<yloc>480</yloc> <yloc>448</yloc>
</GUI> </GUI>
</transform> </transform>
<transform_error_handling> <transform_error_handling>