change some blocks

This commit is contained in:
Fusionshh 2025-10-28 23:57:02 +03:00
parent 0a02fd319e
commit 863745e966
19 changed files with 930 additions and 1303 deletions

View file

@ -18,27 +18,6 @@
<modified_date>2025/08/05 14:31:22.799</modified_date>
</info>
<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>42</height>
<xloc>192</xloc>
<yloc>432</yloc>
<note>1. Убрать лишнее из input (Закоментированные строки запроса, незакоменченная переменная лимит в конце)
2. Убрать error_code из output в части error handling</note>
<width>624</width>
</notepad>
</notepads>
<order>
<hop>
@ -51,16 +30,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Filter rows</to>
@ -71,11 +40,6 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table output</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Detect empty stream</from>
<to>Change job status on success</to>
@ -86,6 +50,16 @@
<to>Abort</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -103,7 +77,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1216</xloc>
<xloc>944</xloc>
<yloc>512</yloc>
</GUI>
</transform>
@ -139,7 +113,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>704</xloc>
<yloc>512</yloc>
</GUI>
</transform>
@ -171,7 +145,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1216</xloc>
<xloc>944</xloc>
<yloc>160</yloc>
</GUI>
</transform>
@ -217,8 +191,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<attributes/>
<GUI>
<xloc>1216</xloc>
<yloc>320</yloc>
<xloc>496</xloc>
<yloc>160</yloc>
</GUI>
</transform>
<transform>
@ -253,25 +227,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>912</xloc>
<yloc>160</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>
<xloc>944</xloc>
<yloc>320</yloc>
</GUI>
</transform>
@ -288,47 +244,42 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>SELECT
r.system_pgs_status,
r.full_name,
r.last_name,
r.first_name,
r.middle_name,
r.gender,
r.birth_date,
EXTRACT(YEAR FROM AGE(r.birth_date)) AS age,
r.birth_place,
r.phone,
r.email,
r.id AS recruit_id,
r.vu_current_info,
r.military_registration_date AS date_registration,
r.vu_unset_date AS date_deregistration,
-- NULLIF(ri.info->'svedFL'->'svedSemPolozh'->>'semPolozh','')::int AS marital_status, -- Проставлять в рамках блока семья?
r.system_create_date AS recruit_create_date,
r.system_update_date AS update_date,
r.current_recruitment_id AS recruitment_id,
r.target_recruitment_id,
system_id_ern AS id_ern, -- id единого регистра населения
ra.id_pack,
r.registered_reason,-- причина постановки на воинский учет
(r.vu_current_info->'personalDataProcessingAgreeConfirmed')::bool AS has_agree_confirmed, -- получено согласте на обработку персональных данных
r.vu_document_received,-- факт выдачи документа воинского учета
r.vu_document_receive_date, -- дата выдачи документа воинского учета
r.vu_unset_date, -- дата снятия с учета
r.source, -- источник сведений
r.system_esia_id
FROM public.recruits AS r
LEFT JOIN public.recruit_association ra on ra.id_ern = r.system_id_ern
-- LEFT JOIN (
-- SELECT
-- ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn,
-- recruit_id,
-- hidden
-- FROM public.decision_deferment_dto
-- ) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false
where current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}');</sql>
<sql>with filtered_data as (SELECT r.system_pgs_status,
r.full_name,
r.last_name,
r.first_name,
r.middle_name,
r.gender,
r.birth_date,
EXTRACT(YEAR FROM AGE(r.birth_date)) AS age,
r.birth_place,
r.phone,
r.email,
r.id AS recruit_id,
r.vu_current_info,
r.military_registration_date AS date_registration,
r.vu_unset_date AS date_deregistration,
r.system_create_date AS recruit_create_date,
r.system_update_date AS update_date,
r.current_recruitment_id AS recruitment_id,
r.target_recruitment_id,
system_id_ern AS id_ern, -- id единого регистра населения
ra.id_pack,
r.registered_reason,-- причина постановки на воинский учет
coalesce((r.vu_current_info ->> 'personalDataProcessingAgreeConfirmed')::bool, false) AS has_agree_confirmed, -- получено согласте на обработку персональных данных
r.vu_document_received,-- факт выдачи документа воинского учета
r.vu_document_receive_date, -- дата выдачи документа воинского учета
r.vu_unset_date, -- дата снятия с учета
r.source, -- источник сведений
r.system_esia_id
FROM public.recruits AS r
LEFT JOIN public.recruit_association ra on ra.id_ern = r.system_id_ern
where current_recruitment_id = '${IDM_ID}'
or (current_recruitment_id is null and 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>
<attributes/>
<GUI>
@ -340,7 +291,7 @@ where current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null an
<name>Table output</name>
<type>TableOutput</type>
<description/>
<distribute>N</distribute>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -478,7 +429,7 @@ where current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null an
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>704</xloc>
<yloc>320</yloc>
</GUI>
</transform>

View file

@ -18,27 +18,6 @@
<modified_date>2025/08/11 13:22:56.048</modified_date>
</info>
<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>41</height>
<xloc>326</xloc>
<yloc>407</yloc>
<note>1. Insert/update отсутсвует error_description
</note>
<width>246</width>
</notepad>
</notepads>
<order>
<hop>
@ -46,16 +25,6 @@
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
@ -66,11 +35,6 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Detect empty stream</from>
<to>Change job status on success</to>
@ -86,6 +50,16 @@
<to>Abort</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -103,7 +77,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1056</xloc>
<xloc>880</xloc>
<yloc>384</yloc>
</GUI>
</transform>
@ -139,7 +113,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>832</xloc>
<xloc>656</xloc>
<yloc>384</yloc>
</GUI>
</transform>
@ -171,7 +145,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1056</xloc>
<xloc>880</xloc>
<yloc>80</yloc>
</GUI>
</transform>
@ -220,8 +194,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>224</yloc>
<xloc>464</xloc>
<yloc>80</yloc>
</GUI>
</transform>
<transform>
@ -256,25 +230,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>832</xloc>
<yloc>80</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>640</xloc>
<xloc>880</xloc>
<yloc>224</yloc>
</GUI>
</transform>
@ -282,7 +238,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>N</distribute>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -443,7 +399,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>832</xloc>
<xloc>656</xloc>
<yloc>224</yloc>
</GUI>
</transform>
@ -461,99 +417,44 @@ and recruitment_id = '${IDM_ID}';</sql>
<connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row>
<limit/>
<sql>/*
with
adresses as ( -- по одному ли адресу тут должно быть??
SELECT
r.id as recruit_id,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg
FROM
public.recruits AS r
LEFT JOIN
LATERAL jsonb_array_elements(r.addresses) AS addr ON true
WHERE '${ID_F1}' != '' -- Проверка на пустую строку
AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}' >= r.system_create_date::timestamp
GROUP BY
r.id
)
*/
SELECT
r.system_pgs_status,
r.full_name,
r.last_name,
r.first_name,
r.middle_name,
r.gender,
--ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils,
--ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn,
r.birth_date,
EXTRACT(YEAR FROM AGE(r.birth_date)) AS age,
r.birth_place,
r.phone,
r.email,
r.id AS recruit_id, --ri.recruit_id,
--ri.info,
r.vu_current_info,
r.military_registration_date AS date_registration,
r.vu_unset_date AS date_deregistration,
NULLIF(ri.info->'svedFL'->'svedSemPolozh'->>'semPolozh','')::int AS marital_status,
--ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number,
--ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series,
--ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date,
r.system_create_date AS recruit_create_date,
r.system_update_date AS update_date,
/*
CASE
WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT'
ELSE 'NOTCONVICT'
END AS convicts,
*/
r.current_recruitment_id AS recruitment_id,
r.target_recruitment_id,
--mrr.value AS reason_registration,
--adr.actualAddress as residence, -- адрес места жительства
--adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства
--adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства
--adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания
--adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания
--adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания
--case
-- when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица'
-- when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы'
-- else null
--end as type_place_stay, -- тип регистрации
-- address_actual -- Адрес фактического проживания ***1
-- source_info_actual -- Источник сведений о месте фактического проживания ***1
-- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1
-- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1
system_id_ern AS id_ern, -- id единого регистра населения
ra.id_pack,
r.registered_reason,-- причина постановки на воинский учет
(r.vu_current_info->'personalDataProcessingAgreeConfirmed')::bool AS has_agree_confirmed, -- получено согласте на обработку персональных данных
r.vu_document_received,-- факт выдачи документа воинского учета
r.vu_document_receive_date, -- дата выдачи документа воинского учета
r.vu_unset_date, -- дата снятия с учета
r.source, -- источник сведений
r.system_esia_id
FROM public.recruits AS r
JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}'))
AND r.system_update_date >= '${M_R_UP_DATE}'::timestamp
LEFT JOIN (
SELECT
ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn,
recruit_id,
hidden
FROM public.decision_deferment_dto
) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false
LEFT JOIN public.recruit_association ra on ra.id_ern = r.system_id_ern
<sql>with filtered_data as (SELECT r.system_pgs_status,
r.full_name,
r.last_name,
r.first_name,
r.middle_name,
r.gender,
r.birth_date,
EXTRACT(YEAR FROM AGE(r.birth_date)) AS age,
r.birth_place,
r.phone,
r.email,
r.id AS recruit_id,
r.vu_current_info,
r.military_registration_date AS date_registration,
r.vu_unset_date AS date_deregistration,
r.system_create_date AS recruit_create_date,
r.system_update_date AS update_date,
r.current_recruitment_id AS recruitment_id,
r.target_recruitment_id,
system_id_ern AS id_ern, -- id единого регистра населения
ra.id_pack,
r.registered_reason,-- причина постановки на воинский учет
coalesce((r.vu_current_info ->> 'personalDataProcessingAgreeConfirmed')::bool, false) AS has_agree_confirmed, -- получено согласте на обработку персональных данных
r.vu_document_received,-- факт выдачи документа воинского учета
r.vu_document_receive_date, -- дата выдачи документа воинского учета
r.vu_unset_date, -- дата снятия с учета
r.source, -- источник сведений
r.system_esia_id
FROM public.recruits AS r
LEFT JOIN public.recruit_association ra on ra.id_ern = r.system_id_ern
where (current_recruitment_id = '${IDM_ID}'
or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}'))
AND r.system_update_date >= '${MAX_UPDATE_DATE}'::timestamp)
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd;
</sql>
<variables_active>Y</variables_active>
<attributes/>

View file

@ -18,27 +18,6 @@
<modified_date>2025/08/08 13:25:52.319</modified_date>
</info>
<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>41</height>
<xloc>432</xloc>
<yloc>352</yloc>
<note>1. Insert/update отсутсвует error_description
</note>
<width>246</width>
</notepad>
</notepads>
<order>
<hop>
@ -46,26 +25,11 @@
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / 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>
<from>Detect empty stream</from>
<to>Change job status on success</to>
@ -86,6 +50,16 @@
<to>Abort</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -103,7 +77,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1152</xloc>
<xloc>976</xloc>
<yloc>352</yloc>
</GUI>
</transform>
@ -139,7 +113,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>896</xloc>
<xloc>720</xloc>
<yloc>352</yloc>
</GUI>
</transform>
@ -171,7 +145,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1216</xloc>
<xloc>976</xloc>
<yloc>96</yloc>
</GUI>
</transform>
@ -234,8 +208,8 @@ DO UPDATE SET
</partitioning>
<attributes/>
<GUI>
<xloc>1216</xloc>
<yloc>208</yloc>
<xloc>480</xloc>
<yloc>96</yloc>
</GUI>
</transform>
<transform>
@ -270,25 +244,7 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>896</xloc>
<yloc>96</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>688</xloc>
<xloc>976</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -296,7 +252,7 @@ DO UPDATE SET
<name>Insert / update</name>
<type>InsertUpdate</type>
<description/>
<distribute>N</distribute>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -310,7 +266,6 @@ DO UPDATE SET
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen</table>
@ -458,7 +413,7 @@ DO UPDATE SET
<update_bypassed>Y</update_bypassed>
<attributes/>
<GUI>
<xloc>896</xloc>
<xloc>720</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -475,98 +430,41 @@ DO UPDATE SET
</partitioning>
<connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row>
<sql>/*
with
adresses as ( -- по одному ли адресу тут должно быть??
SELECT
r.id as recruit_id,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'reg' END) AS actualAddress,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateStart' END) AS actualAddress_regDateStart,
MAX(CASE WHEN addr->>'type' = 'actualAddress' THEN addr->>'regDateEnd' END) AS actualAddress_regDateEnd,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'reg' END) AS residenceAddress,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateStart' END) AS residenceAddress_regDateStart,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'regDateEnd' END) AS residenceAddress_regDateEnd,
MAX(CASE WHEN addr->>'type' = 'residenceAddress' THEN addr->>'kodTipReg' END) AS residenceAddress_kodTipReg
FROM
public.recruits AS r
LEFT JOIN
LATERAL jsonb_array_elements(r.addresses) AS addr ON true
WHERE '${ID_F1}' != '' -- Проверка на пустую строку
AND COALESCE(current_recruitment_id, target_recruitment_id) = '${ID_F1}'
AND '${M_R_CR_DATE}' >= r.system_create_date::timestamp
GROUP BY
r.id
)
*/
SELECT
r.system_pgs_status,
r.full_name,
r.last_name,
r.first_name,
r.middle_name,
r.gender,
--ri.info->'svedFL'->'svedBS'->'snils'->'aktSNILS'->>'snils' AS snils,
--ri.info->'svedFL'->'svedBS'->'inn'->'aktINN'->>'inn' AS inn,
r.birth_date,
EXTRACT(YEAR FROM AGE(r.birth_date)) AS age,
r.birth_place,
r.phone,
r.email,
r.id AS recruit_id, --ri.recruit_id,
--ri.info,
r.vu_current_info,
r.military_registration_date AS date_registration,
r.vu_unset_date AS date_deregistration,
NULLIF(ri.info->'svedFL'->'svedSemPolozh'->>'semPolozh','')::int AS marital_status,
--ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'nomDok' AS passport_number,
--ri.info->'svedFL'->'pasportRF'->'aktPasportRF'->>'serDok' AS passport_series,
--ri.info->'svedFL'->'svedVoin'->'voin'->>'dataReg' AS issue_date,
r.system_create_date AS recruit_create_date,
r.system_update_date AS update_date,
/*
CASE
WHEN r.vu_current_info->>'recruitmentCommercialInfo' = 'true' THEN 'CONVICT'
ELSE 'NOTCONVICT'
END AS convicts,
*/
r.current_recruitment_id AS recruitment_id,
r.target_recruitment_id,
-- mrr.value AS reason_registration,
--adr.actualAddress as residence, -- адрес места жительства
--adr.actualAddress_regDateStart as start_date_residence, -- дата регистрации по месту жительства
--adr.actualAddress_regDateEnd as end_date_residence, -- дата снятия с регистрации по месту жительства
--adr.residenceAddress as address_place_stay, -- адресс регистрации по месту пребывания
--adr.residenceAddress_regDateStart as start_date_place_stay, -- дата регистрации по месту пребывания
--adr.residenceAddress_regDateEnd as end_date_place_stay, -- дата снятия с регистрации по месту пребывания
--case
-- when adr.residenceAddress_kodTipReg='1' then 'В жилом помещении, не являющимся местом жительства физического лица'
-- when adr.residenceAddress_kodTipReg='2' then 'В учреждении уголовно-исполнительной системы'
-- else null
--end as type_place_stay, -- тип регистрации
-- address_actual -- Адрес фактического проживания ***1
-- source_info_actual -- Источник сведений о месте фактического проживания ***1
-- date_info_actual -- Дата получения сведений об адресе фактического проживания ***1
-- date_loss_info_actual -- Дата потери актуальности сведений об адресе фактического проживания ***1
system_id_ern AS id_ern, -- id единого регистра населения
ra.id_pack,
r.registered_reason,-- причина постановки на воинский учет
(r.vu_current_info->'personalDataProcessingAgreeConfirmed')::bool AS has_agree_confirmed, -- получено согласте на обработку персональных данных
r.vu_document_received,-- факт выдачи документа воинского учета
r.vu_document_receive_date, -- дата выдачи документа воинского учета
r.vu_unset_date, -- дата снятия с учета
r.source, -- источник сведений
r.system_esia_id
FROM public.recruits AS r
JOIN public.recruits_info AS ri ON ri.recruit_id = r.id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null and target_recruitment_id = '${IDM_ID}'))
LEFT JOIN (
SELECT
ROW_NUMBER() OVER (PARTITION BY recruit_id ORDER BY created_at DESC) as rn,
recruit_id,
hidden
FROM public.decision_deferment_dto
) ddd ON ddd.recruit_id = r.id and ddd.rn = 1 and ddd.hidden is false
LEFT JOIN public.recruit_association ra on ra.id_ern = r.system_id_ern
<sql>with filtered_data as (SELECT r.system_pgs_status,
r.full_name,
r.last_name,
r.first_name,
r.middle_name,
r.gender,
r.birth_date,
EXTRACT(YEAR FROM AGE(r.birth_date)) AS age,
r.birth_place,
r.phone,
r.email,
r.id AS recruit_id,
r.vu_current_info,
r.military_registration_date AS date_registration,
r.vu_unset_date AS date_deregistration,
r.system_create_date AS recruit_create_date,
r.system_update_date AS update_date,
r.current_recruitment_id AS recruitment_id,
r.target_recruitment_id,
system_id_ern AS id_ern, -- id единого регистра населения
ra.id_pack,
r.registered_reason,-- причина постановки на воинский учет
coalesce((r.vu_current_info ->> 'personalDataProcessingAgreeConfirmed')::bool, false) AS has_agree_confirmed, -- получено согласте на обработку персональных данных
r.vu_document_received,-- факт выдачи документа воинского учета
r.vu_document_receive_date, -- дата выдачи документа воинского учета
r.vu_unset_date, -- дата снятия с учета
r.source, -- источник сведений
r.system_esia_id
FROM public.recruits AS r
LEFT JOIN public.recruit_association ra on ra.id_ern = r.system_id_ern
where current_recruitment_id = '${IDM_ID}'
or (current_recruitment_id is null and 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>
<attributes/>

View file

@ -31,6 +31,11 @@
<to>citizen_flow_delta.hpl</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>get_max_source_update_date</from>
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>citizen_flow_delta.hpl 2</to>
@ -118,6 +123,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -145,6 +155,29 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<yloc>128</yloc>
</GUI>
</transform>
<transform>
<name>get_max_source_update_date</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT max(update_date) AS max_update_date
FROM ervu_dashboard.citizen;</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>192</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>citizen_flow_delta.hpl 2</name>
<type>PipelineExecutor</type>
@ -169,6 +202,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -192,8 +230,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>224</yloc>
<xloc>544</xloc>
<yloc>208</yloc>
</GUI>
</transform>
<transform>
@ -220,6 +258,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -243,8 +286,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>560</xloc>
<yloc>304</yloc>
<xloc>544</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
@ -271,6 +314,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -294,7 +342,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>576</xloc>
<xloc>544</xloc>
<yloc>368</yloc>
</GUI>
</transform>
@ -322,6 +370,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -345,8 +398,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>576</xloc>
<yloc>464</yloc>
<xloc>544</xloc>
<yloc>448</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -47,7 +47,7 @@
<schedulerType>0</schedulerType>
<weekDay>1</weekDay>
<parallel>N</parallel>
<xloc>96</xloc>
<xloc>160</xloc>
<yloc>304</yloc>
<attributes_hac/>
</action>
@ -90,7 +90,7 @@
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>Y</parallel>
<xloc>1296</xloc>
<xloc>1152</xloc>
<yloc>304</yloc>
<attributes_hac/>
</action>
@ -116,7 +116,7 @@
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1296</xloc>
<xloc>1152</xloc>
<yloc>608</yloc>
<attributes_hac/>
</action>
@ -228,7 +228,6 @@
</field>
</fields>
<file_variable_type>CURRENT_WORKFLOW</file_variable_type>
<filename/>
<replacevars>N</replacevars>
<parallel>N</parallel>
<xloc>336</xloc>
@ -352,34 +351,6 @@
<note>Дельта</note>
<width>49</width>
</notepad>
<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>150</height>
<xloc>1200</xloc>
<yloc>80</yloc>
<note>citizen_appealing_violations_fz53_job
M_R_UP_DATE
M_R_CR_DATE
0001-01-01 00:00:00
3001-01-01 00:00:00</note>
<width>206</width>
</notepad>
</notepads>
<attributes/>
</workflow>

View file

@ -33,39 +33,11 @@
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>26</height>
<xloc>848</xloc>
<yloc>295</yloc>
<xloc>352</xloc>
<yloc>480</yloc>
<note>в таблице нет апдейт даты</note>
<width>154</width>
</notepad>
<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>150</height>
<xloc>544</xloc>
<yloc>960</yloc>
<note>+ - 3.в этой таблице может быть несколько одинаковых recruit_id
1. тут false нужно в true и заливать в citizen
1. is_appealing_violations_fz53 case when можно заменить на not ad.hidden и без java expression передавать в апдейт
2. Убрать лишнее из input
3. Зачем группировка нужна если исходные данные не массив? </note>
<width>642</width>
</notepad>
</notepads>
<order>
<hop>
@ -93,31 +65,11 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>Table output</from>
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -128,6 +80,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -145,7 +112,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1648</xloc>
<xloc>1264</xloc>
<yloc>832</yloc>
</GUI>
</transform>
@ -181,7 +148,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1280</xloc>
<xloc>1088</xloc>
<yloc>832</yloc>
</GUI>
</transform>
@ -213,7 +180,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1600</xloc>
<xloc>1088</xloc>
<yloc>480</yloc>
</GUI>
</transform>
@ -259,7 +226,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<attributes/>
<GUI>
<xloc>800</xloc>
<xloc>640</xloc>
<yloc>480</yloc>
</GUI>
</transform>
@ -295,13 +262,13 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1600</xloc>
<xloc>1088</xloc>
<yloc>656</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
@ -310,50 +277,33 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>800</xloc>
<yloc>656</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>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
ad.recruit_id,
ad.create_date, -- дата создания обжалования
ad.appeal_number AS number_appealed, -- номер обжалуемого решения
ad.appeal_date AS date_appealed, -- дата обжалуемого решения
ad.result_number AS case_number, -- номер принятого решения
ad.result_date AS decision_date, -- дата принятия решения
CASE
WHEN ad.result = '1' THEN 'Удовлетворена'
WHEN ad.result = '2' THEN 'Частично удовлетворена'
WHEN ad.result = '3' THEN 'Отказано в удовлетворении'
ELSE NULL
END AS result_appeal, -- код рассмотрения
ad.commission_name AS name_commission, -- наименование комиссии, принявшей решение
ad.reason_for_add_entry AS grounds, -- основание для внесения записи
ad.hidden,
CASE
WHEN ad.hidden is false THEN true
ELSE false
END AS has_appealing_violations_fz53
<limit/>
<sql>with filtered_data as ( SELECT
ad.recruit_id,
ad.create_date, -- дата создания обжалования
ad.appeal_number AS number_appealed, -- номер обжалуемого решения
ad.appeal_date AS date_appealed, -- дата обжалуемого решения
ad.result_number AS case_number, -- номер принятого решения
ad.result_date AS decision_date, -- дата принятия решения
CASE
WHEN ad.result = '1' THEN 'Удовлетворена'
WHEN ad.result = '2' THEN 'Частично удовлетворена'
WHEN ad.result = '3' THEN 'Отказано в удовлетворении'
END AS result_appeal, -- код рассмотрения
ad.commission_name AS name_commission, -- наименование комиссии, принявшей решение
ad.reason_for_add_entry AS grounds, -- основание для внесения записи
ad.hidden,
NOT ad.hidden AS has_appealing_violations_fz53,
ctid
FROM public.appeal_document_dto ad
JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${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>
<attributes/>
@ -432,7 +382,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1040</xloc>
<xloc>848</xloc>
<yloc>656</yloc>
</GUI>
</transform>
@ -467,7 +417,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1040</xloc>
<xloc>848</xloc>
<yloc>832</yloc>
</GUI>
</transform>
@ -501,7 +451,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров
</fields>
<attributes/>
<GUI>
<xloc>800</xloc>
<xloc>640</xloc>
<yloc>832</yloc>
</GUI>
</transform>

View file

@ -385,14 +385,11 @@ and recruitment_id = '${IDM_ID}';</sql>
ad.commission_name AS name_commission, -- наименование комиссии, принявшей решение
ad.reason_for_add_entry AS grounds, -- основание для внесения записи
ad.hidden,
CASE
WHEN ad.hidden is false THEN true
ELSE false
END AS has_appealing_violations_fz53
NOT ad.hidden AS has_appealing_violations_fz53
FROM public.appeal_document_dto ad
JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
AND ad.create_date >= '${M_R_CR_DATE}'::timestamp
AND ad.create_date >= '${MAX_CREATE_DATE}'::timestamp
</sql>
<variables_active>Y</variables_active>
<attributes/>
@ -415,16 +412,13 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров
<commit>10000</commit>
<connection>ervu-dashboard</connection>
<error_ignored>Y</error_ignored>
<ignore_flag_field/>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>&lt;></condition>
<field>has_appealing_violations_fz53</field>
<name>has_appealing_violations_fz53</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen</table>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1488</xloc>
<xloc>1120</xloc>
<yloc>368</yloc>
</GUI>
</transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1232</xloc>
<xloc>944</xloc>
<yloc>368</yloc>
</GUI>
</transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1488</xloc>
<xloc>944</xloc>
<yloc>64</yloc>
</GUI>
</transform>
@ -229,7 +224,7 @@ DO UPDATE SET
</partitioning>
<attributes/>
<GUI>
<xloc>656</xloc>
<xloc>480</xloc>
<yloc>64</yloc>
</GUI>
</transform>
@ -265,25 +260,7 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1488</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>656</xloc>
<xloc>944</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -305,13 +282,11 @@ DO UPDATE SET
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>create_date</field>
<name>create_date</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_appealing_violations_fz53</table>
@ -369,7 +344,7 @@ DO UPDATE SET
<update_bypassed>Y</update_bypassed>
<attributes/>
<GUI>
<xloc>928</xloc>
<xloc>704</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -377,7 +352,7 @@ DO UPDATE SET
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -386,29 +361,31 @@ DO UPDATE SET
</partitioning>
<connection>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
ad.recruit_id,
ad.create_date, -- дата создания обжалования
ad.appeal_number AS number_appealed, -- номер обжалуемого решения
ad.appeal_date AS date_appealed, -- дата обжалуемого решения
ad.result_number AS case_number, -- номер принятого решения
ad.result_date AS decision_date, -- дата принятия решения
CASE
WHEN ad.result = '1' THEN 'Удовлетворена'
WHEN ad.result = '2' THEN 'Частично удовлетворена'
WHEN ad.result = '3' THEN 'Отказано в удовлетворении'
ELSE NULL
END AS result_appeal, -- код рассмотрения
ad.commission_name AS name_commission, -- наименование комиссии, принявшей решение
ad.reason_for_add_entry AS grounds, -- основание для внесения записи
ad.hidden,
CASE
WHEN ad.hidden is false THEN true
ELSE false
END AS has_appealing_violations_fz53
<limit/>
<sql>with filtered_data as ( SELECT
ad.recruit_id,
ad.create_date, -- дата создания обжалования
ad.appeal_number AS number_appealed, -- номер обжалуемого решения
ad.appeal_date AS date_appealed, -- дата обжалуемого решения
ad.result_number AS case_number, -- номер принятого решения
ad.result_date AS decision_date, -- дата принятия решения
CASE
WHEN ad.result = '1' THEN 'Удовлетворена'
WHEN ad.result = '2' THEN 'Частично удовлетворена'
WHEN ad.result = '3' THEN 'Отказано в удовлетворении'
END AS result_appeal, -- код рассмотрения
ad.commission_name AS name_commission, -- наименование комиссии, принявшей решение
ad.reason_for_add_entry AS grounds, -- основание для внесения записи
ad.hidden,
NOT ad.hidden AS has_appealing_violations_fz53,
ctid
FROM public.appeal_document_dto ad
JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${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>
<attributes/>
@ -453,7 +430,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>928</xloc>
<xloc>704</xloc>
<yloc>368</yloc>
</GUI>
</transform>
@ -487,7 +464,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров
</fields>
<attributes/>
<GUI>
<xloc>656</xloc>
<xloc>480</xloc>
<yloc>368</yloc>
</GUI>
</transform>

View file

@ -18,6 +18,27 @@
<modified_date>2025/08/11 13:16:11.204</modified_date>
</info>
<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>42</height>
<xloc>48</xloc>
<yloc>112</yloc>
<note>тащить только те военкоматы по которым появились новые записи в бд dds?
не факт что мы можешь считать обновление recruits_info как обновление данных в dds?</note>
<width>500</width>
</notepad>
</notepads>
<order>
<hop>
@ -25,6 +46,11 @@
<to>citizen_appealing_violations_fz53_flow_delta.hpl</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>get_max_source_update_date</from>
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>citizen_appealing_violations_fz53_flow_delta.hpl 2</to>
@ -85,7 +111,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<attributes/>
<GUI>
<xloc>352</xloc>
<yloc>288</yloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform>
@ -112,6 +138,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_CREATE_DATE</variable>
<field>max_create_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -135,8 +166,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>128</yloc>
<xloc>592</xloc>
<yloc>144</yloc>
</GUI>
</transform>
<transform>
@ -163,6 +194,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_CREATE_DATE</variable>
<field>max_create_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -186,8 +222,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>704</xloc>
<yloc>208</yloc>
<xloc>592</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform>
@ -214,6 +250,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_CREATE_DATE</variable>
<field>max_create_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -237,8 +278,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>288</yloc>
<xloc>592</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform>
@ -265,6 +306,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_CREATE_DATE</variable>
<field>max_create_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -288,8 +334,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>368</yloc>
<xloc>592</xloc>
<yloc>384</yloc>
</GUI>
</transform>
<transform>
@ -316,6 +362,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_CREATE_DATE</variable>
<field>max_create_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -339,8 +390,31 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>720</xloc>
<yloc>432</yloc>
<xloc>592</xloc>
<yloc>464</yloc>
</GUI>
</transform>
<transform>
<name>get_max_source_update_date</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT max(create_date) AS max_create_date
FROM ervu_dashboard.citizen_appealing_violations_fz53;</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>192</xloc>
<yloc>304</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</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>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1712</xloc>
<xloc>1392</xloc>
<yloc>800</yloc>
</GUI>
</transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1376</xloc>
<xloc>1184</xloc>
<yloc>800</yloc>
</GUI>
</transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1712</xloc>
<xloc>1184</xloc>
<yloc>480</yloc>
</GUI>
</transform>
@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>704</xloc>
<yloc>480</yloc>
</GUI>
</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>
<attributes/>
<GUI>
<xloc>1712</xloc>
<xloc>1184</xloc>
<yloc>640</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
@ -262,64 +257,43 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>912</xloc>
<yloc>640</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>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
i.recruit_id,
i.created_at,
i.updated_at,
--, -- сведения о факте уголовного преследования
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер уголовного дела (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения уголовного дела
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший уголовное дело
i.decision_number AS case_number, -- номер уголовного дела (судебный)
i.decision_date AS sentence_date, -- дата приговора
i.extra_info->>'court' AS court_decision, -- суд вынесший приговор
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Штраф'
WHEN i.extra_info->>'punishment' = '2' THEN 'Обязательные работы'
WHEN i.extra_info->>'punishment' = '3' THEN 'Арест'
WHEN i.extra_info->>'punishment' = '4' THEN 'Лишение свободы на определенный срок'
ELSE NULL
END AS type_punishment, -- вид наказания
CASE
WHEN i.decision_reason = '1' THEN 'Уклонение от призыва на военную службу'
WHEN i.decision_reason = '2' THEN 'Уклонение от прохождения альтернативной гражданской службы лиц, освобожденных от военной службы'
ELSE null
END AS decision_reason, -- Причины уголовного наказания в связи с фз53
i.hidden,
CASE
WHEN i.hidden is false THEN true
ELSE false
END AS has_criminal_liability_fz53,
(i.extra_info->>'dateApplication')::date AS date_application,--дата с которой наложена мера
i.extra_info->>'description' AS description,--описание наказания
i.extra_info->>'reasonForAddEntry' AS reason_for_add_entry--основания для внесения записи
<limit/>
<sql>with filtered_data as (SELECT
i.recruit_id,
i.created_at,
i.updated_at,
--, -- сведения о факте уголовного преследования
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер уголовного дела (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения уголовного дела
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший уголовное дело
i.decision_number AS case_number, -- номер уголовного дела (судебный)
i.decision_date AS sentence_date, -- дата приговора
i.extra_info->>'court' AS court_decision, -- суд вынесший приговор
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Штраф'
WHEN i.extra_info->>'punishment' = '2' THEN 'Обязательные работы'
WHEN i.extra_info->>'punishment' = '3' THEN 'Арест'
WHEN i.extra_info->>'punishment' = '4' THEN 'Лишение свободы на определенный срок'
END AS type_punishment, -- вид наказания
CASE
WHEN i.decision_reason = '1' THEN 'Уклонение от призыва на военную службу'
WHEN i.decision_reason = '2' THEN 'Уклонение от прохождения альтернативной гражданской службы лиц, освобожденных от военной службы'
END AS decision_reason, -- Причины уголовного наказания в связи с фз53
i.hidden,
NOT i.hidden as has_criminal_liability_fz53,
(i.extra_info->>'dateApplication')::date AS date_application,--дата с которой наложена мера
i.extra_info->>'description' AS description,--описание наказания
i.extra_info->>'reasonForAddEntry' AS reason_for_add_entry,--основания для внесения записи
ctid
FROM public.infringement i
JOIN public.recruit r ON r.id = i.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE i.type = 'CRIMINAL'</sql>
JOIN public.recruit r ON r.id = i.recruit_id -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE i.type = 'CRIMINAL')
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -417,7 +391,7 @@ WHERE i.type = 'CRIMINAL'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1168</xloc>
<xloc>960</xloc>
<yloc>640</yloc>
</GUI>
</transform>
@ -452,7 +426,7 @@ WHERE i.type = 'CRIMINAL'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1168</xloc>
<xloc>960</xloc>
<yloc>800</yloc>
</GUI>
</transform>
@ -486,7 +460,7 @@ WHERE i.type = 'CRIMINAL'</sql>
</fields>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>704</xloc>
<yloc>800</yloc>
</GUI>
</transform>

View file

@ -133,7 +133,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1280</xloc>
<xloc>1232</xloc>
<yloc>720</yloc>
</GUI>
</transform>
@ -165,7 +165,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1536</xloc>
<xloc>1232</xloc>
<yloc>368</yloc>
</GUI>
</transform>
@ -250,7 +250,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1536</xloc>
<xloc>1232</xloc>
<yloc>528</yloc>
</GUI>
</transform>
@ -290,11 +290,13 @@ and recruitment_id = '${IDM_ID}';</sql>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>created_at</field>
<name>created_at</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_criminal_liability_fz53</table>
@ -473,7 +475,7 @@ WHERE i.type = 'CRIMINAL'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1008</xloc>
<xloc>992</xloc>
<yloc>720</yloc>
</GUI>
</transform>

View file

@ -50,34 +50,29 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>sort_by_recruit_id</from>
<to>Update</to>
<enabled>Y</enabled>
</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>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Insert / update</from>
<to>Filter rows</to>
<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>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1296</xloc>
<xloc>1136</xloc>
<yloc>384</yloc>
</GUI>
</transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1104</xloc>
<xloc>944</xloc>
<yloc>384</yloc>
</GUI>
</transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1424</xloc>
<xloc>944</xloc>
<yloc>48</yloc>
</GUI>
</transform>
@ -229,7 +224,7 @@ DO UPDATE SET
</partitioning>
<attributes/>
<GUI>
<xloc>688</xloc>
<xloc>480</xloc>
<yloc>48</yloc>
</GUI>
</transform>
@ -265,25 +260,7 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1424</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>688</xloc>
<xloc>944</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -305,13 +282,11 @@ DO UPDATE SET
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>created_at</field>
<name>created_at</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_criminal_liability_fz53</table>
@ -394,7 +369,7 @@ DO UPDATE SET
<update_bypassed>Y</update_bypassed>
<attributes/>
<GUI>
<xloc>896</xloc>
<xloc>704</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -402,7 +377,7 @@ DO UPDATE SET
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -411,44 +386,40 @@ DO UPDATE SET
</partitioning>
<connection>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
i.recruit_id,
i.created_at,
i.updated_at,
--, -- сведения о факте уголовного преследования
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер уголовного дела (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения уголовного дела
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший уголовное дело
i.decision_number AS case_number, -- номер уголовного дела (судебный)
i.decision_date AS sentence_date, -- дата приговора
i.extra_info->>'court' AS court_decision, -- суд вынесший приговор
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Штраф'
WHEN i.extra_info->>'punishment' = '2' THEN 'Обязательные работы'
WHEN i.extra_info->>'punishment' = '3' THEN 'Арест'
WHEN i.extra_info->>'punishment' = '4' THEN 'Лишение свободы на определенный срок'
ELSE NULL
END AS type_punishment, -- вид наказания
CASE
WHEN i.decision_reason = '1' THEN 'Уклонение от призыва на военную службу'
WHEN i.decision_reason = '2' THEN 'Уклонение от прохождения альтернативной гражданской службы лиц, освобожденных от военной службы'
ELSE null
END AS decision_reason, -- Причины уголовного наказания в связи с фз53
i.hidden,
CASE
WHEN i.hidden is false THEN true
ELSE false
END AS has_criminal_liability_fz53,
(i.extra_info->>'dateApplication')::date AS date_application,--дата с которой наложена мера
i.extra_info->>'description' AS description,--описание наказания
i.extra_info->>'reasonForAddEntry' AS reason_for_add_entry--основания для внесения записи
<sql>with filtered_data as (SELECT
i.recruit_id,
i.created_at,
i.updated_at,
--, -- сведения о факте уголовного преследования
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер уголовного дела (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения уголовного дела
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший уголовное дело
i.decision_number AS case_number, -- номер уголовного дела (судебный)
i.decision_date AS sentence_date, -- дата приговора
i.extra_info->>'court' AS court_decision, -- суд вынесший приговор
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Штраф'
WHEN i.extra_info->>'punishment' = '2' THEN 'Обязательные работы'
WHEN i.extra_info->>'punishment' = '3' THEN 'Арест'
WHEN i.extra_info->>'punishment' = '4' THEN 'Лишение свободы на определенный срок'
END AS type_punishment, -- вид наказания
CASE
WHEN i.decision_reason = '1' THEN 'Уклонение от призыва на военную службу'
WHEN i.decision_reason = '2' THEN 'Уклонение от прохождения альтернативной гражданской службы лиц, освобожденных от военной службы'
END AS decision_reason, -- Причины уголовного наказания в связи с фз53
i.hidden,
NOT i.hidden as has_criminal_liability_fz53,
(i.extra_info->>'dateApplication')::date AS date_application,--дата с которой наложена мера
i.extra_info->>'description' AS description,--описание наказания
i.extra_info->>'reasonForAddEntry' AS reason_for_add_entry,--основания для внесения записи
ctid
FROM public.infringement i
JOIN public.recruit r ON r.id = i.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE i.type = 'CRIMINAL'</sql>
JOIN public.recruit r ON r.id = i.recruit_id -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE i.type = 'CRIMINAL')
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -470,16 +441,13 @@ WHERE i.type = 'CRIMINAL'</sql>
<commit>10000</commit>
<connection>ervu-dashboard</connection>
<error_ignored>Y</error_ignored>
<ignore_flag_field/>
<lookup>
<key>
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>&lt;></condition>
<field>has_criminal_liability_fz53</field>
<name>has_criminal_liability_fz53</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen</table>
@ -492,7 +460,7 @@ WHERE i.type = 'CRIMINAL'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>880</xloc>
<xloc>704</xloc>
<yloc>384</yloc>
</GUI>
</transform>
@ -526,7 +494,7 @@ WHERE i.type = 'CRIMINAL'</sql>
</fields>
<attributes/>
<GUI>
<xloc>688</xloc>
<xloc>480</xloc>
<yloc>384</yloc>
</GUI>
</transform>

View file

@ -25,6 +25,11 @@
<to>citizen_criminal_liability_fz53_flow_delta.hpl</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>get_max_source_update_date</from>
<to>Table input</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>citizen_criminal_liability_fz53_flow_delta.hpl 2</to>
@ -84,7 +89,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<variables_active>Y</variables_active>
<attributes/>
<GUI>
<xloc>352</xloc>
<xloc>336</xloc>
<yloc>288</yloc>
</GUI>
</transform>
@ -112,6 +117,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -139,6 +149,29 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<yloc>128</yloc>
</GUI>
</transform>
<transform>
<name>get_max_source_update_date</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT max(updated_at) AS max_update_date
FROM ervu_dashboard.citizen_criminal_liability_fz53;</sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>176</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
<name>citizen_criminal_liability_fz53_flow_delta.hpl 2</name>
<type>PipelineExecutor</type>
@ -163,6 +196,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -186,7 +224,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>640</xloc>
<xloc>624</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -214,6 +252,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -237,8 +280,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>640</xloc>
<yloc>304</yloc>
<xloc>624</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform>
@ -265,6 +308,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -288,8 +336,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>656</xloc>
<yloc>416</yloc>
<xloc>624</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform>
@ -316,6 +364,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<field>idm_id</field>
<input/>
</variable_mapping>
<variable_mapping>
<variable>MAX_UPDATE_DATE</variable>
<field>max_update_date</field>
<input/>
</variable_mapping>
<inherit_all_vars>Y</inherit_all_vars>
</parameters>
<execution_result_target_transform/>
@ -339,8 +392,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
<executors_output_transform/>
<attributes/>
<GUI>
<xloc>656</xloc>
<yloc>528</yloc>
<xloc>624</xloc>
<yloc>448</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Table output</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>sort_by_recruit_id</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Abort</name>
@ -97,8 +92,8 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1424</xloc>
<yloc>1056</yloc>
<xloc>1104</xloc>
<yloc>992</yloc>
</GUI>
</transform>
<transform>
@ -133,8 +128,8 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1216</xloc>
<yloc>1056</yloc>
<xloc>896</xloc>
<yloc>992</yloc>
</GUI>
</transform>
<transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1424</xloc>
<xloc>896</xloc>
<yloc>656</yloc>
</GUI>
</transform>
@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<attributes/>
<GUI>
<xloc>688</xloc>
<xloc>512</xloc>
<yloc>656</yloc>
</GUI>
</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>
<attributes/>
<GUI>
<xloc>1424</xloc>
<xloc>896</xloc>
<yloc>832</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
@ -262,60 +257,42 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>832</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>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
i.recruit_id,
i.created_at,
i.updated_at,
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер дела об административном правонарушении (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения дела об административном правонарушении
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший дело об административном правонарушении
i.decision_number AS case_number, -- номер дела об административном правонарушении
i.decision_date AS date_resolution, -- дата постановления
i.extra_info->>'reasonForAddEntry' AS article_koap_rf, -- пункт, часть, статья КоАП РФ
i.extra_info->>'court' AS court_decision, -- суд, вынесший постановление
i.extra_info->>'vkName' AS name_vc, -- военкомат, принявший решение о применении мер
CASE
WHEN i.decision_reason = '1' THEN 'Неисполнение гражданами обязанностей по воинскому учету'
WHEN i.decision_reason = '2' THEN 'Уклонение от медицинского обследования'
WHEN i.decision_reason = '3' THEN 'Умышленные порча или утрата документов воинского учета'
ELSE NULL
END AS reason_use, -- причина применения
i.extra_info->>'dateApplication' AS start_date, -- дата с которой наложена мера
i.extra_info->>'description' AS size_term_punishment, -- размер и срок наказания
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Предупреждение'
WHEN i.extra_info->>'punishment' = '2' THEN 'Административный штраф'
ELSE NULL
END AS type_punishment, -- вид наказания
i.hidden,
CASE
WHEN i.hidden is false THEN true
ELSE false
END AS has_liability_fz53
<limit/>
<sql>with filtered_data as (SELECT
i.recruit_id,
i.created_at,
i.updated_at,
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер дела об административном правонарушении (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения дела об административном правонарушении
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший дело об административном правонарушении
i.decision_number AS case_number, -- номер дела об административном правонарушении
i.decision_date AS date_resolution, -- дата постановления
i.extra_info->>'reasonForAddEntry' AS article_koap_rf, -- пункт, часть, статья КоАП РФ
i.extra_info->>'court' AS court_decision, -- суд, вынесший постановление
i.extra_info->>'vkName' AS name_vc, -- военкомат, принявший решение о применении мер
CASE
WHEN i.decision_reason = '1' THEN 'Неисполнение гражданами обязанностей по воинскому учету'
WHEN i.decision_reason = '2' THEN 'Уклонение от медицинского обследования'
WHEN i.decision_reason = '3' THEN 'Умышленные порча или утрата документов воинского учета'
END AS reason_use, -- причина применения
i.extra_info->>'dateApplication' AS start_date, -- дата с которой наложена мера
i.extra_info->>'description' AS size_term_punishment, -- размер и срок наказания
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Предупреждение'
WHEN i.extra_info->>'punishment' = '2' THEN 'Административный штраф'
END AS type_punishment, -- вид наказания
i.hidden,
NOT i.hidden AS has_liability_fz53,
ctid
FROM public.infringement i
JOIN public.recruit r ON r.id = i.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE type = 'ADMINISTRATIVE'</sql>
JOIN public.recruit r ON r.id = i.recruit_id -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE type = 'ADMINISTRATIVE')
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -417,7 +394,7 @@ WHERE type = 'ADMINISTRATIVE'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>880</xloc>
<xloc>704</xloc>
<yloc>832</yloc>
</GUI>
</transform>
@ -452,8 +429,8 @@ WHERE type = 'ADMINISTRATIVE'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>880</xloc>
<yloc>1056</yloc>
<xloc>704</xloc>
<yloc>992</yloc>
</GUI>
</transform>
<transform>
@ -486,8 +463,8 @@ WHERE type = 'ADMINISTRATIVE'</sql>
</fields>
<attributes/>
<GUI>
<xloc>688</xloc>
<yloc>1056</yloc>
<xloc>512</xloc>
<yloc>992</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1520</xloc>
<xloc>1296</xloc>
<yloc>576</yloc>
</GUI>
</transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1232</xloc>
<xloc>1008</xloc>
<yloc>576</yloc>
</GUI>
</transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1552</xloc>
<xloc>1008</xloc>
<yloc>240</yloc>
</GUI>
</transform>
@ -214,7 +209,7 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<attributes/>
<GUI>
<xloc>832</xloc>
<xloc>624</xloc>
<yloc>240</yloc>
</GUI>
</transform>
@ -250,25 +245,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1552</xloc>
<yloc>400</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>832</xloc>
<xloc>1008</xloc>
<yloc>400</yloc>
</GUI>
</transform>
@ -382,7 +359,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1040</xloc>
<xloc>832</xloc>
<yloc>400</yloc>
</GUI>
</transform>
@ -390,7 +367,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -399,41 +376,42 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<connection>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
i.recruit_id,
i.created_at,
i.updated_at,
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер дела об административном правонарушении (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения дела об административном правонарушении
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший дело об административном правонарушении
i.decision_number AS case_number, -- номер дела об административном правонарушении
i.decision_date AS date_resolution, -- дата постановления
i.extra_info->>'reasonForAddEntry' AS article_koap_rf, -- пункт, часть, статья КоАП РФ
i.extra_info->>'court' AS court_decision, -- суд, вынесший постановление
i.extra_info->>'vkName' AS name_vc, -- военкомат, принявший решение о применении мер
CASE
WHEN i.decision_reason = '1' THEN 'Неисполнение гражданами обязанностей по воинскому учету'
WHEN i.decision_reason = '2' THEN 'Уклонение от медицинского обследования'
WHEN i.decision_reason = '3' THEN 'Умышленные порча или утрата документов воинского учета'
ELSE NULL
END AS reason_use, -- причина применения
i.extra_info->>'dateApplication' AS start_date, -- дата с которой наложена мера
i.extra_info->>'description' AS size_term_punishment, -- размер и срок наказания
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Предупреждение'
WHEN i.extra_info->>'punishment' = '2' THEN 'Административный штраф'
ELSE NULL
END AS type_punishment, -- вид наказания
i.hidden,
CASE
WHEN i.hidden is false THEN true
ELSE false
END AS has_liability_fz53
<limit/>
<sql>with filtered_data as (SELECT
i.recruit_id,
i.created_at,
i.updated_at,
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер дела об административном правонарушении (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения дела об административном правонарушении
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший дело об административном правонарушении
i.decision_number AS case_number, -- номер дела об административном правонарушении
i.decision_date AS date_resolution, -- дата постановления
i.extra_info->>'reasonForAddEntry' AS article_koap_rf, -- пункт, часть, статья КоАП РФ
i.extra_info->>'court' AS court_decision, -- суд, вынесший постановление
i.extra_info->>'vkName' AS name_vc, -- военкомат, принявший решение о применении мер
CASE
WHEN i.decision_reason = '1' THEN 'Неисполнение гражданами обязанностей по воинскому учету'
WHEN i.decision_reason = '2' THEN 'Уклонение от медицинского обследования'
WHEN i.decision_reason = '3' THEN 'Умышленные порча или утрата документов воинского учета'
END AS reason_use, -- причина применения
i.extra_info->>'dateApplication' AS start_date, -- дата с которой наложена мера
i.extra_info->>'description' AS size_term_punishment, -- размер и срок наказания
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Предупреждение'
WHEN i.extra_info->>'punishment' = '2' THEN 'Административный штраф'
END AS type_punishment, -- вид наказания
i.hidden,
NOT i.hidden AS has_liability_fz53,
ctid
FROM public.infringement i
JOIN public.recruit r ON r.id = i.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
AND i.updated_at >= '${M_INFR_UP_DATE}'::timestamp
WHERE type = 'ADMINISTRATIVE'
JOIN public.recruit r ON r.id = i.recruit_id -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
AND i.updated_at >= '${M_INFR_UP_DATE}'::timestamp
WHERE type = 'ADMINISTRATIVE')
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd;
</sql>
<variables_active>Y</variables_active>
<attributes/>
@ -478,7 +456,7 @@ WHERE type = 'ADMINISTRATIVE'
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1040</xloc>
<xloc>832</xloc>
<yloc>576</yloc>
</GUI>
</transform>
@ -512,7 +490,7 @@ WHERE type = 'ADMINISTRATIVE'
</fields>
<attributes/>
<GUI>
<xloc>832</xloc>
<xloc>624</xloc>
<yloc>576</yloc>
</GUI>
</transform>

View file

@ -45,26 +45,6 @@
<to>Change job status on success</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</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>
</order>
<transform>
<name>Abort</name>
@ -97,8 +92,8 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1280</xloc>
<yloc>400</yloc>
<xloc>1136</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
@ -133,8 +128,8 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1072</xloc>
<yloc>400</yloc>
<xloc>928</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
@ -165,8 +160,8 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1472</xloc>
<yloc>48</yloc>
<xloc>928</xloc>
<yloc>80</yloc>
</GUI>
</transform>
<transform>
@ -229,8 +224,8 @@ DO UPDATE SET
</partitioning>
<attributes/>
<GUI>
<xloc>656</xloc>
<yloc>48</yloc>
<xloc>480</xloc>
<yloc>80</yloc>
</GUI>
</transform>
<transform>
@ -265,25 +260,7 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1472</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>656</xloc>
<xloc>928</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -305,13 +282,11 @@ DO UPDATE SET
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>created_at</field>
<name>created_at</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizen_liability_fz53</table>
@ -399,7 +374,7 @@ DO UPDATE SET
<update_bypassed>Y</update_bypassed>
<attributes/>
<GUI>
<xloc>848</xloc>
<xloc>640</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -407,7 +382,7 @@ DO UPDATE SET
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -416,40 +391,40 @@ DO UPDATE SET
</partitioning>
<connection>postgres.decision-document-service</connection>
<execute_each_row>N</execute_each_row>
<sql>SELECT
i.recruit_id,
i.created_at,
i.updated_at,
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер дела об административном правонарушении (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения дела об административном правонарушении
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший дело об административном правонарушении
i.decision_number AS case_number, -- номер дела об административном правонарушении
i.decision_date AS date_resolution, -- дата постановления
i.extra_info->>'reasonForAddEntry' AS article_koap_rf, -- пункт, часть, статья КоАП РФ
i.extra_info->>'court' AS court_decision, -- суд, вынесший постановление
i.extra_info->>'vkName' AS name_vc, -- военкомат, принявший решение о применении мер
CASE
WHEN i.decision_reason = '1' THEN 'Неисполнение гражданами обязанностей по воинскому учету'
WHEN i.decision_reason = '2' THEN 'Уклонение от медицинского обследования'
WHEN i.decision_reason = '3' THEN 'Умышленные порча или утрата документов воинского учета'
ELSE NULL
END AS reason_use, -- причина применения
i.extra_info->>'dateApplication' AS start_date, -- дата с которой наложена мера
i.extra_info->>'description' AS size_term_punishment, -- размер и срок наказания
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Предупреждение'
WHEN i.extra_info->>'punishment' = '2' THEN 'Административный штраф'
ELSE NULL
END AS type_punishment, -- вид наказания
i.hidden,
CASE
WHEN i.hidden is false THEN true
ELSE false
END AS is_liability_fz53
<limit/>
<sql>with filtered_data as (SELECT
i.recruit_id,
i.created_at,
i.updated_at,
i.extra_info->>'preTrialNumber' AS case_number_before, -- номер дела об административном правонарушении (досудебный)
i.extra_info->>'createInfringementDate' AS date_initiation, -- дата возбуждения дела об административном правонарушении
i.extra_info->>'organization' AS body_initiated, -- орган, возбудивший дело об административном правонарушении
i.decision_number AS case_number, -- номер дела об административном правонарушении
i.decision_date AS date_resolution, -- дата постановления
i.extra_info->>'reasonForAddEntry' AS article_koap_rf, -- пункт, часть, статья КоАП РФ
i.extra_info->>'court' AS court_decision, -- суд, вынесший постановление
i.extra_info->>'vkName' AS name_vc, -- военкомат, принявший решение о применении мер
CASE
WHEN i.decision_reason = '1' THEN 'Неисполнение гражданами обязанностей по воинскому учету'
WHEN i.decision_reason = '2' THEN 'Уклонение от медицинского обследования'
WHEN i.decision_reason = '3' THEN 'Умышленные порча или утрата документов воинского учета'
END AS reason_use, -- причина применения
i.extra_info->>'dateApplication' AS start_date, -- дата с которой наложена мера
i.extra_info->>'description' AS size_term_punishment, -- размер и срок наказания
CASE
WHEN i.extra_info->>'punishment' = '1' THEN 'Предупреждение'
WHEN i.extra_info->>'punishment' = '2' THEN 'Административный штраф'
END AS type_punishment, -- вид наказания
i.hidden,
NOT i.hidden AS has_liability_fz53,
ctid
FROM public.infringement i
JOIN public.recruit r ON r.id = i.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE type = 'ADMINISTRATIVE'</sql>
JOIN public.recruit r ON r.id = i.recruit_id -- Проверка на пустую строку
AND (r.current_recruitment = '${IDM_ID}' or (r.current_recruitment is null and r.target_recruitment = '${IDM_ID}'))
WHERE type = 'ADMINISTRATIVE')
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -493,8 +468,8 @@ WHERE type = 'ADMINISTRATIVE'</sql>
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>848</xloc>
<yloc>400</yloc>
<xloc>640</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform>
@ -527,8 +502,8 @@ WHERE type = 'ADMINISTRATIVE'</sql>
</fields>
<attributes/>
<GUI>
<xloc>656</xloc>
<yloc>400</yloc>
<xloc>480</xloc>
<yloc>352</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1504</xloc>
<xloc>1168</xloc>
<yloc>496</yloc>
</GUI>
</transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1280</xloc>
<xloc>976</xloc>
<yloc>496</yloc>
</GUI>
</transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1536</xloc>
<xloc>976</xloc>
<yloc>160</yloc>
</GUI>
</transform>
@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
</partitioning>
<attributes/>
<GUI>
<xloc>688</xloc>
<xloc>496</xloc>
<yloc>160</yloc>
</GUI>
</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>
<attributes/>
<GUI>
<xloc>1536</xloc>
<xloc>976</xloc>
<yloc>320</yloc>
</GUI>
</transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
@ -262,46 +257,29 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<method>none</method>
<schema_name/>
</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-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>select
ri.recruit_id,
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataSved', 'YYYY-MM-DD') AS source_update_date, -- дата обновления сведений
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnPriob' acquiring_basis, -- основание приобретения гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' acquiring_number, -- номер решения о приобретении гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshPriob', 'YYYY-MM-DD') acquiring_date, -- дата решения о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshPriob' acquiring_authority, -- наименование органа, принявшего решение о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' renunciation_basis, -- основание выхода гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshVyh' renunciation_number, -- номер решения о выходе из гражданства РФ +
to_date(ri.info->'svedFL'-&gt;'svedGrazhdanRF'->'grazhdanRF'->>'dataReshVyh', 'YYYY-MM-DD') renunciation_date, -- дата решения о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshVyh' renunciation_authority, -- наименование органа, принявшего решение о выходе из гражданства РФ +
CASE
WHEN ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' is not null THEN true
ELSE false
END AS has_acquired_citizenship
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
(ri.info->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' is not null or ri.info->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' is not null)</sql>
<limit/>
<sql>with filtered_data as (select
ri.recruit_id,
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataSved', 'YYYY-MM-DD') AS source_update_date, -- дата обновления сведений
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnPriob' acquiring_basis, -- основание приобретения гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' acquiring_number, -- номер решения о приобретении гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshPriob', 'YYYY-MM-DD') acquiring_date, -- дата решения о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshPriob' acquiring_authority, -- наименование органа, принявшего решение о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' renunciation_basis, -- основание выхода гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshVyh' renunciation_number, -- номер решения о выходе из гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshVyh', 'YYYY-MM-DD') renunciation_date, -- дата решения о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshVyh' renunciation_authority, -- наименование органа, принявшего решение о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' &lt;&gt; 'null' AS has_acquired_citizenship,
CTID
FROM ervu_dashboard.recruits_info ri
where coalesce(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
and (ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'nomReshPriob' &lt;&gt; 'null' or
ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' &lt;&gt; 'null'))
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -379,7 +357,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1056</xloc>
<xloc>736</xloc>
<yloc>320</yloc>
</GUI>
</transform>
@ -414,7 +392,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>1056</xloc>
<xloc>736</xloc>
<yloc>496</yloc>
</GUI>
</transform>
@ -448,7 +426,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
</fields>
<attributes/>
<GUI>
<xloc>688</xloc>
<xloc>496</xloc>
<yloc>496</yloc>
</GUI>
</transform>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -97,8 +92,8 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1392</xloc>
<yloc>528</yloc>
<xloc>1120</xloc>
<yloc>496</yloc>
</GUI>
</transform>
<transform>
@ -133,8 +128,8 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1216</xloc>
<yloc>528</yloc>
<xloc>928</xloc>
<yloc>496</yloc>
</GUI>
</transform>
<transform>
@ -165,8 +160,8 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1408</xloc>
<yloc>208</yloc>
<xloc>928</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform>
@ -214,8 +209,8 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>208</yloc>
<xloc>560</xloc>
<yloc>224</yloc>
</GUI>
</transform>
<transform>
@ -250,25 +245,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1408</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>768</xloc>
<xloc>928</xloc>
<yloc>352</yloc>
</GUI>
</transform>
@ -357,7 +334,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>960</xloc>
<xloc>752</xloc>
<yloc>352</yloc>
</GUI>
</transform>
@ -365,7 +342,7 @@ and recruitment_id = '${IDM_ID}';</sql>
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -374,28 +351,34 @@ and recruitment_id = '${IDM_ID}';</sql>
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>select
ri.recruit_id,
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataSved', 'YYYY-MM-DD') AS source_update_date, -- дата обновления сведений
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnPriob' acquiring_basis, -- основание приобретения гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' acquiring_number, -- номер решения о приобретении гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshPriob', 'YYYY-MM-DD') acquiring_date, -- дата решения о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshPriob' acquiring_authority, -- наименование органа, принявшего решение о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' renunciation_basis, -- основание выхода гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshVyh' renunciation_number, -- номер решения о выходе из гражданства РФ +
to_date(ri.info->'svedFL'-&gt;'svedGrazhdanRF'->'grazhdanRF'->>'dataReshVyh', 'YYYY-MM-DD') renunciation_date, -- дата решения о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshVyh' renunciation_authority, -- наименование органа, принявшего решение о выходе из гражданства РФ +
CASE
WHEN ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' is not null THEN true
ELSE false
END AS has_acquired_citizenship
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
and to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataSved', 'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}'
--AND ri.updated_at >= '${M_R_UP_DATE}'::timestamp
where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
(ri.info->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' is not null or ri.info->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' is not null)</sql>
<limit/>
<sql>with filtered_data as (select ri.recruit_id,
to_date(ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'dataSved',
'YYYY-MM-DD') AS source_update_date, -- дата обновления сведений
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnPriob' acquiring_basis, -- основание приобретения гражданства РФ +
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'nomReshPriob' acquiring_number, -- номер решения о приобретении гражданства РФ +
to_date(ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'dataReshPriob',
'YYYY-MM-DD') acquiring_date, -- дата решения о приобретении гражданства РФ +
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->>
'organReshPriob' acquiring_authority, -- наименование органа, принявшего решение о приобретении гражданства РФ +
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' renunciation_basis, -- основание выхода гражданства РФ +
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'nomReshVyh' renunciation_number, -- номер решения о выходе из гражданства РФ +
to_date(ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'dataReshVyh',
'YYYY-MM-DD') renunciation_date, -- дата решения о выходе из гражданства РФ +
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'organReshVyh' renunciation_authority, -- наименование органа, принявшего решение о выходе из гражданства РФ +
ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'nomReshPriob' &lt;&gt;
'null' AS has_acquired_citizenship,
CTID
FROM ervu_dashboard.recruits_info ri
where coalesce(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
and (ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'nomReshPriob' &lt;&gt; 'null' or
ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' &lt;&gt; 'null')
and to_date(ri.info -> 'svedFL' -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'dataSved',
'YYYY-MM-DD') > '${MAX_SOURCE_UPDATE_DATE}')
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd
</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -439,8 +422,8 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>960</xloc>
<yloc>528</yloc>
<xloc>752</xloc>
<yloc>496</yloc>
</GUI>
</transform>
<transform>
@ -473,8 +456,8 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
</fields>
<attributes/>
<GUI>
<xloc>768</xloc>
<yloc>528</yloc>
<xloc>560</xloc>
<yloc>496</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -50,26 +50,6 @@
<to>Change job status on error</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>Insert / update</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>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>
<from>sort_by_recruit_id</from>
<to>Update</to>
@ -80,6 +60,21 @@
<to>Filter rows</to>
<enabled>Y</enabled>
</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>
<transform>
<name>Abort</name>
@ -97,7 +92,7 @@
<row_threshold>0</row_threshold>
<attributes/>
<GUI>
<xloc>1312</xloc>
<xloc>1072</xloc>
<yloc>400</yloc>
</GUI>
</transform>
@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1104</xloc>
<xloc>864</xloc>
<yloc>400</yloc>
</GUI>
</transform>
@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}';
</sql>
<attributes/>
<GUI>
<xloc>1424</xloc>
<xloc>864</xloc>
<yloc>64</yloc>
</GUI>
</transform>
@ -229,7 +224,7 @@ DO UPDATE SET
</partitioning>
<attributes/>
<GUI>
<xloc>672</xloc>
<xloc>480</xloc>
<yloc>64</yloc>
</GUI>
</transform>
@ -265,25 +260,7 @@ DO UPDATE SET
<send_true_to>Change job status on success</send_true_to>
<attributes/>
<GUI>
<xloc>1424</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>672</xloc>
<xloc>864</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -305,19 +282,16 @@ DO UPDATE SET
<condition>=</condition>
<field>recruit_id</field>
<name>recruit_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>acquiring_number</field>
<name>acquiring_number</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>renunciation_number</field>
<name>renunciation_number</name>
<name2/>
</key>
<schema>ervu_dashboard</schema>
<table>citizenship</table>
@ -375,7 +349,7 @@ DO UPDATE SET
<update_bypassed>Y</update_bypassed>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>656</xloc>
<yloc>208</yloc>
</GUI>
</transform>
@ -383,7 +357,7 @@ DO UPDATE SET
<name>Table input</name>
<type>TableInput</type>
<description/>
<distribute>Y</distribute>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
@ -392,26 +366,27 @@ DO UPDATE SET
</partitioning>
<connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row>
<sql>select
ri.recruit_id,
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataSved', 'YYYY-MM-DD') AS source_update_date, -- дата обновления сведений
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnPriob' acquiring_basis, -- основание приобретения гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' acquiring_number, -- номер решения о приобретении гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshPriob', 'YYYY-MM-DD') acquiring_date, -- дата решения о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshPriob' acquiring_authority, -- наименование органа, принявшего решение о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' renunciation_basis, -- основание выхода гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshVyh' renunciation_number, -- номер решения о выходе из гражданства РФ +
to_date(ri.info->'svedFL'-&gt;'svedGrazhdanRF'->'grazhdanRF'->>'dataReshVyh', 'YYYY-MM-DD') renunciation_date, -- дата решения о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshVyh' renunciation_authority, -- наименование органа, принявшего решение о выходе из гражданства РФ +
CASE
WHEN ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' is not null THEN true
ELSE false
END AS has_acquired_citizenship
FROM ervu_dashboard.recruits_info ri
join ervu_dashboard.citizen r ON r.recruit_id = ri.recruit_id AND '${IDM_ID}' != '' -- Проверка на пустую строку
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}'))
where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
(ri.info->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' is not null or ri.info->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' is not null)</sql>
<limit/>
<sql>with filtered_data as (select
ri.recruit_id,
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataSved', 'YYYY-MM-DD') AS source_update_date, -- дата обновления сведений
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnPriob' acquiring_basis, -- основание приобретения гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' acquiring_number, -- номер решения о приобретении гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshPriob', 'YYYY-MM-DD') acquiring_date, -- дата решения о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshPriob' acquiring_authority, -- наименование органа, принявшего решение о приобретении гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'osnVyh' renunciation_basis, -- основание выхода гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshVyh' renunciation_number, -- номер решения о выходе из гражданства РФ +
to_date(ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'dataReshVyh', 'YYYY-MM-DD') renunciation_date, -- дата решения о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'organReshVyh' renunciation_authority, -- наименование органа, принявшего решение о выходе из гражданства РФ +
ri.info->'svedFL'->'svedGrazhdanRF'->'grazhdanRF'->>'nomReshPriob' &lt;&gt; 'null' AS has_acquired_citizenship,
CTID
FROM ervu_dashboard.recruits_info ri
where coalesce(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
and (ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'nomReshPriob' &lt;&gt; 'null' or
ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' &lt;&gt; 'null'))
select fd.*,
fd.ctid = (select max(ctid) from filtered_data) as last_row
from filtered_data fd;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -439,11 +414,6 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
<field>recruit_id</field>
<name>recruit_id</name>
</key>
<key>
<condition>&lt;></condition>
<field>acquired_citizenship</field>
<name>acquired_citizenship</name>
</key>
<schema>ervu_dashboard</schema>
<table>citizen</table>
<value>
@ -455,7 +425,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
<use_batch>Y</use_batch>
<attributes/>
<GUI>
<xloc>912</xloc>
<xloc>656</xloc>
<yloc>400</yloc>
</GUI>
</transform>
@ -489,7 +459,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and
</fields>
<attributes/>
<GUI>
<xloc>672</xloc>
<xloc>480</xloc>
<yloc>400</yloc>
</GUI>
</transform>