diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow.hpl index 6742e9a..2fd05df 100644 --- a/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow.hpl @@ -18,27 +18,6 @@ 2025/08/05 14:31:22.799 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 42 - 192 - 432 - 1. Убрать лишнее из input (Закоментированные строки запроса, незакоменченная переменная лимит в конце) -2. Убрать error_code из output в части error handling - 624 - @@ -51,16 +30,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Table output - Y - Table output Filter rows @@ -71,11 +40,6 @@ Change job status on success Y - - Table output - Detect empty stream - Y - Detect empty stream Change job status on success @@ -86,6 +50,16 @@ Abort Y + + Table input + Table output + Y + + + Table input + Detect empty stream + Y + Abort @@ -103,7 +77,7 @@ 0 - 1216 + 944 512 @@ -139,7 +113,7 @@ and recruitment_id = '${IDM_ID}'; - 912 + 704 512 @@ -171,7 +145,7 @@ and recruitment_id = '${IDM_ID}'; - 1216 + 944 160 @@ -217,8 +191,8 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); - 1216 - 320 + 496 + 160 @@ -253,25 +227,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Change job status on success - 912 - 160 - - - - Identify last row in a stream - DetectLastRow - - Y - - 1 - - none - - - last_row - - - 704 + 944 320 @@ -288,47 +244,42 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); ervu_person_registry N - - 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}'); + 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; + Y @@ -340,7 +291,7 @@ where current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null an Table output TableOutput - N + Y 1 @@ -478,7 +429,7 @@ where current_recruitment_id = '${IDM_ID}' or (current_recruitment_id is null an Y - 912 + 704 320 diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_delta.hpl index 69a43f6..b8be0c5 100644 --- a/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_delta.hpl @@ -18,27 +18,6 @@ 2025/08/11 13:22:56.048 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 41 - 326 - 407 - 1. Insert/update отсутсвует error_description - - 246 - @@ -46,16 +25,6 @@ Table input Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - Insert / update Filter rows @@ -66,11 +35,6 @@ Change job status on success Y - - Insert / update - Detect empty stream - Y - Detect empty stream Change job status on success @@ -86,6 +50,16 @@ Abort Y + + Table input + Detect empty stream + Y + + + Table input + Insert / update + Y + Abort @@ -103,7 +77,7 @@ 0 - 1056 + 880 384 @@ -139,7 +113,7 @@ and recruitment_id = '${IDM_ID}'; - 832 + 656 384 @@ -171,7 +145,7 @@ and recruitment_id = '${IDM_ID}'; - 1056 + 880 80 @@ -220,8 +194,8 @@ and recruitment_id = '${IDM_ID}'; - 1056 - 224 + 464 + 80 @@ -256,25 +230,7 @@ and recruitment_id = '${IDM_ID}'; Change job status on success - 832 - 80 - - - - Identify last row in a stream - DetectLastRow - - Y - - 1 - - none - - - last_row - - - 640 + 880 224 @@ -282,7 +238,7 @@ and recruitment_id = '${IDM_ID}'; Insert / update InsertUpdate - N + Y 1 @@ -443,7 +399,7 @@ and recruitment_id = '${IDM_ID}'; N - 832 + 656 224 @@ -461,99 +417,44 @@ and recruitment_id = '${IDM_ID}'; ervu_person_registry N - /* -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 + 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; + + Y diff --git a/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_repeat.hpl index e58ea9b..faedc62 100644 --- a/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/parallel/citizen_flow_repeat.hpl @@ -18,27 +18,6 @@ 2025/08/08 13:25:52.319 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 41 - 432 - 352 - 1. Insert/update отсутсвует error_description - - 246 - @@ -46,26 +25,11 @@ Table input Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - Insert / update Filter rows Y - - Insert / update - Detect empty stream - Y - Detect empty stream Change job status on success @@ -86,6 +50,16 @@ Abort Y + + Table input + Insert / update + Y + + + Table input + Detect empty stream + Y + Abort @@ -103,7 +77,7 @@ 0 - 1152 + 976 352 @@ -139,7 +113,7 @@ and recruitment_id = '${IDM_ID}'; - 896 + 720 352 @@ -171,7 +145,7 @@ and recruitment_id = '${IDM_ID}'; - 1216 + 976 96 @@ -234,8 +208,8 @@ DO UPDATE SET - 1216 - 208 + 480 + 96 @@ -270,25 +244,7 @@ DO UPDATE SET Change job status on success - 896 - 96 - - - - Identify last row in a stream - DetectLastRow - - Y - - 1 - - none - - - last_row - - - 688 + 976 208 @@ -296,7 +252,7 @@ DO UPDATE SET Insert / update InsertUpdate - N + Y 1 @@ -310,7 +266,6 @@ DO UPDATE SET = recruit_id recruit_id - ervu_dashboard citizen
@@ -458,7 +413,7 @@ DO UPDATE SET Y - 896 + 720 208 @@ -475,98 +430,41 @@ DO UPDATE SET
ervu_person_registry N - /* -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 + 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; Y diff --git a/mappings/info_recruits/citizen_tables/citizen/recruitment_five_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen/recruitment_five_flow_delta.hpl index d54ae6b..ea45ba9 100644 --- a/mappings/info_recruits/citizen_tables/citizen/recruitment_five_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen/recruitment_five_flow_delta.hpl @@ -31,6 +31,11 @@ citizen_flow_delta.hpl Y + + get_max_source_update_date + Table input + Y + Table input citizen_flow_delta.hpl 2 @@ -118,6 +123,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -145,6 +155,29 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') 128
+ + get_max_source_update_date + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT max(update_date) AS max_update_date +FROM ervu_dashboard.citizen; + N + + + 192 + 288 + + citizen_flow_delta.hpl 2 PipelineExecutor @@ -169,6 +202,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -192,8 +230,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 560 - 224 + 544 + 208 @@ -220,6 +258,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -243,8 +286,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 560 - 304 + 544 + 288 @@ -271,6 +314,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -294,7 +342,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 576 + 544 368 @@ -322,6 +370,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -345,8 +398,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 576 - 464 + 544 + 448 diff --git a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/citizen_appealing_violations_fz53_job.hwf b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/citizen_appealing_violations_fz53_job.hwf index 037a1e0..7a11c05 100644 --- a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/citizen_appealing_violations_fz53_job.hwf +++ b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/citizen_appealing_violations_fz53_job.hwf @@ -47,7 +47,7 @@ 0 1 N - 96 + 160 304 @@ -90,7 +90,7 @@ N Y Y - 1296 + 1152 304 @@ -116,7 +116,7 @@ N Y N - 1296 + 1152 608 @@ -228,7 +228,6 @@ CURRENT_WORKFLOW - N N 336 @@ -352,34 +351,6 @@ Дельта 49 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 150 - 1200 - 80 - 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 - 206 - diff --git a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow.hpl b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow.hpl index e0d3f37..0a4cd5f 100644 --- a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow.hpl @@ -33,39 +33,11 @@ Segoe UI 9 26 - 848 - 295 + 352 + 480 в таблице нет апдейт даты 154 - - 251 - 232 - 201 - 90 - 58 - 14 - N - 90 - 58 - 14 - N - Segoe UI - 9 - 150 - 544 - 960 - + - 3.в этой таблице может быть несколько одинаковых recruit_id - 1. тут false нужно в true и заливать в citizen - - - - -1. is_appealing_violations_fz53 case when можно заменить на not ad.hidden и без java expression передавать в апдейт -2. Убрать лишнее из input -3. Зачем группировка нужна если исходные данные не массив? - 642 - @@ -93,31 +65,11 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Table output - Y - - - Identify last row in a stream - Detect empty stream - Y - Table output Change job status on error Y - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -128,6 +80,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + Table output + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -145,7 +112,7 @@ 0 - 1648 + 1264 832 @@ -181,7 +148,7 @@ and recruitment_id = '${IDM_ID}'; - 1280 + 1088 832 @@ -213,7 +180,7 @@ and recruitment_id = '${IDM_ID}'; - 1600 + 1088 480 @@ -259,7 +226,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); - 800 + 640 480 @@ -295,13 +262,13 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Change job status on success - 1600 + 1088 656 - Identify last row in a stream - DetectLastRow + Table input + TableInput N @@ -310,50 +277,33 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); none - last_row - - - 800 - 656 - - - - Table input - TableInput - - Y - - 1 - - none - - postgres.decision-document-service N - 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 + + 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; Y @@ -432,7 +382,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров Y - 1040 + 848 656 @@ -467,7 +417,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров Y - 1040 + 848 832 @@ -501,7 +451,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров - 800 + 640 832 diff --git a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_delta.hpl index 9eae4b7..9415dc6 100644 --- a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_delta.hpl @@ -385,14 +385,11 @@ and recruitment_id = '${IDM_ID}'; 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 Y @@ -415,16 +412,13 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров 10000 ervu-dashboard Y + = recruit_id recruit_id - - - <> - has_appealing_violations_fz53 - has_appealing_violations_fz53 + ervu_dashboard citizen
diff --git a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_repeat.hpl index 95b7228..d46fd0e 100644 --- a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/parallel/citizen_appealing_violations_fz53_flow_repeat.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - Insert / update - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + Insert / update + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -97,7 +92,7 @@ 0 - 1488 + 1120 368 @@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}'; - 1232 + 944 368 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1488 + 944 64 @@ -229,7 +224,7 @@ DO UPDATE SET - 656 + 480 64 @@ -265,25 +260,7 @@ DO UPDATE SET Change job status on success - 1488 - 208 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 656 + 944 208 @@ -305,13 +282,11 @@ DO UPDATE SET = recruit_id recruit_id - = create_date create_date - ervu_dashboard citizen_appealing_violations_fz53
@@ -369,7 +344,7 @@ DO UPDATE SET Y - 928 + 704 208 @@ -377,7 +352,7 @@ DO UPDATE SET Table input TableInput - Y + N 1 @@ -386,29 +361,31 @@ DO UPDATE SET postgres.decision-document-service N - 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 + + 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 Y @@ -453,7 +430,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров Y - 928 + 704 368 @@ -487,7 +464,7 @@ JOIN public.recruit r ON r.id = ad.recruit_id AND '${IDM_ID}' != '' -- Пров - 656 + 480 368 diff --git a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/recruitment_five_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/recruitment_five_flow_delta.hpl index 1a1d620..bedc64f 100644 --- a/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/recruitment_five_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_appealing_violations_fz53/recruitment_five_flow_delta.hpl @@ -18,6 +18,27 @@ 2025/08/11 13:16:11.204 + + 251 + 232 + 201 + 90 + 58 + 14 + N + 90 + 58 + 14 + N + Segoe UI + 9 + 42 + 48 + 112 + тащить только те военкоматы по которым появились новые записи в бд dds? +не факт что мы можешь считать обновление recruits_info как обновление данных в dds? + 500 + @@ -25,6 +46,11 @@ citizen_appealing_violations_fz53_flow_delta.hpl Y + + get_max_source_update_date + Table input + Y + Table input citizen_appealing_violations_fz53_flow_delta.hpl 2 @@ -85,7 +111,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') 352 - 288 + 304 @@ -112,6 +138,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_CREATE_DATE + max_create_date + + Y @@ -135,8 +166,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 688 - 128 + 592 + 144 @@ -163,6 +194,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_CREATE_DATE + max_create_date + + Y @@ -186,8 +222,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 704 - 208 + 592 + 224 @@ -214,6 +250,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_CREATE_DATE + max_create_date + + Y @@ -237,8 +278,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 720 - 288 + 592 + 304 @@ -265,6 +306,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_CREATE_DATE + max_create_date + + Y @@ -288,8 +334,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 720 - 368 + 592 + 384 @@ -316,6 +362,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_CREATE_DATE + max_create_date + + Y @@ -339,8 +390,31 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 720 - 432 + 592 + 464 + + + + get_max_source_update_date + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT max(create_date) AS max_create_date +FROM ervu_dashboard.citizen_appealing_violations_fz53; + N + + + 192 + 304 diff --git a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow.hpl b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow.hpl index eca09c6..2b400ca 100644 --- a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Table output - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + sort_by_recruit_id + Y + + + Table input + Detect empty stream + Y + + + Table input + Table output + Y + Abort @@ -97,7 +92,7 @@ 0 - 1712 + 1392 800 @@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}'; - 1376 + 1184 800 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1712 + 1184 480 @@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); - 912 + 704 480 @@ -247,13 +242,13 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Change job status on success - 1712 + 1184 640 - Identify last row in a stream - DetectLastRow + Table input + TableInput N @@ -262,64 +257,43 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); none - last_row - - - 912 - 640 - - - - Table input - TableInput - - Y - - 1 - - none - - postgres.decision-document-service N - 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--основания для внесения записи - + + 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' + 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 Y @@ -417,7 +391,7 @@ WHERE i.type = 'CRIMINAL' Y - 1168 + 960 640 @@ -452,7 +426,7 @@ WHERE i.type = 'CRIMINAL' Y - 1168 + 960 800 @@ -486,7 +460,7 @@ WHERE i.type = 'CRIMINAL' - 912 + 704 800 diff --git a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_delta.hpl index 7092f82..1249fc6 100644 --- a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_delta.hpl @@ -133,7 +133,7 @@ and recruitment_id = '${IDM_ID}'; - 1280 + 1232 720 @@ -165,7 +165,7 @@ and recruitment_id = '${IDM_ID}'; - 1536 + 1232 368 @@ -250,7 +250,7 @@ and recruitment_id = '${IDM_ID}'; Change job status on success - 1536 + 1232 528 @@ -290,11 +290,13 @@ and recruitment_id = '${IDM_ID}'; = recruit_id recruit_id + = created_at created_at + ervu_dashboard citizen_criminal_liability_fz53
@@ -473,7 +475,7 @@ WHERE i.type = 'CRIMINAL' Y - 1008 + 992 720 diff --git a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_repeat.hpl index eca19ae..4abbe60 100644 --- a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/parallel/citizen_criminal_liability_fz53_flow_repeat.hpl @@ -50,34 +50,29 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update Y - Identify last row in a stream + Insert / update + Filter rows + Y + + + Table input Detect empty stream Y - Insert / update - Filter rows + Table input + Insert / update + Y + + + Table input + sort_by_recruit_id Y @@ -97,7 +92,7 @@ 0 - 1296 + 1136 384 @@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}'; - 1104 + 944 384 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1424 + 944 48 @@ -229,7 +224,7 @@ DO UPDATE SET - 688 + 480 48 @@ -265,25 +260,7 @@ DO UPDATE SET Change job status on success - 1424 - 208 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 688 + 944 208 @@ -305,13 +282,11 @@ DO UPDATE SET = recruit_id recruit_id - = created_at created_at - ervu_dashboard citizen_criminal_liability_fz53
@@ -394,7 +369,7 @@ DO UPDATE SET Y - 896 + 704 208 @@ -402,7 +377,7 @@ DO UPDATE SET Table input TableInput - Y + N 1 @@ -411,44 +386,40 @@ DO UPDATE SET postgres.decision-document-service N - 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--основания для внесения записи - + 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' + 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 Y @@ -470,16 +441,13 @@ WHERE i.type = 'CRIMINAL' 10000 ervu-dashboard Y + = recruit_id recruit_id - - - <> - has_criminal_liability_fz53 - has_criminal_liability_fz53 + ervu_dashboard citizen
@@ -492,7 +460,7 @@ WHERE i.type = 'CRIMINAL' Y - 880 + 704 384 @@ -526,7 +494,7 @@ WHERE i.type = 'CRIMINAL' - 688 + 480 384 diff --git a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/recruitment_five_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/recruitment_five_flow_delta.hpl index 6c17ddf..36d016d 100644 --- a/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/recruitment_five_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_criminal_liability_fz53/recruitment_five_flow_delta.hpl @@ -25,6 +25,11 @@ citizen_criminal_liability_fz53_flow_delta.hpl Y + + get_max_source_update_date + Table input + Y + Table input citizen_criminal_liability_fz53_flow_delta.hpl 2 @@ -84,7 +89,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') Y - 352 + 336 288 @@ -112,6 +117,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -139,6 +149,29 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') 128
+ + get_max_source_update_date + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT max(updated_at) AS max_update_date +FROM ervu_dashboard.citizen_criminal_liability_fz53; + N + + + 176 + 288 + + citizen_criminal_liability_fz53_flow_delta.hpl 2 PipelineExecutor @@ -163,6 +196,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -186,7 +224,7 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 640 + 624 208 @@ -214,6 +252,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -237,8 +280,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 640 - 304 + 624 + 288 @@ -265,6 +308,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -288,8 +336,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 656 - 416 + 624 + 368 @@ -316,6 +364,11 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') idm_id + + MAX_UPDATE_DATE + max_update_date + + Y @@ -339,8 +392,8 @@ where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING') - 656 - 528 + 624 + 448 diff --git a/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow.hpl b/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow.hpl index ccb6f6d..d36c1ba 100644 --- a/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Table output - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - - - Identify last row in a stream - Detect empty stream - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + Table output + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -97,8 +92,8 @@ 0 - 1424 - 1056 + 1104 + 992 @@ -133,8 +128,8 @@ and recruitment_id = '${IDM_ID}'; - 1216 - 1056 + 896 + 992 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1424 + 896 656 @@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); - 688 + 512 656 @@ -247,13 +242,13 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Change job status on success - 1424 + 896 832 - Identify last row in a stream - DetectLastRow + Table input + TableInput N @@ -262,60 +257,42 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); none - last_row - - - 688 - 832 - - - - Table input - TableInput - - Y - - 1 - - none - - postgres.decision-document-service N - 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 + + 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' + 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; Y @@ -417,7 +394,7 @@ WHERE type = 'ADMINISTRATIVE' Y - 880 + 704 832 @@ -452,8 +429,8 @@ WHERE type = 'ADMINISTRATIVE' Y - 880 - 1056 + 704 + 992 @@ -486,8 +463,8 @@ WHERE type = 'ADMINISTRATIVE' - 688 - 1056 + 512 + 992 diff --git a/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_delta.hpl index 93c00bf..23dc1ac 100644 --- a/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_delta.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + Insert / update + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -97,7 +92,7 @@ 0 - 1520 + 1296 576 @@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}'; - 1232 + 1008 576 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1552 + 1008 240 @@ -214,7 +209,7 @@ and recruitment_id = '${IDM_ID}'; - 832 + 624 240 @@ -250,25 +245,7 @@ and recruitment_id = '${IDM_ID}'; Change job status on success - 1552 - 400 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 832 + 1008 400 @@ -382,7 +359,7 @@ and recruitment_id = '${IDM_ID}'; N - 1040 + 832 400 @@ -390,7 +367,7 @@ and recruitment_id = '${IDM_ID}'; Table input TableInput - Y + N 1 @@ -399,41 +376,42 @@ and recruitment_id = '${IDM_ID}'; postgres.decision-document-service N - 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 + + 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; + Y @@ -478,7 +456,7 @@ WHERE type = 'ADMINISTRATIVE' Y - 1040 + 832 576 @@ -512,7 +490,7 @@ WHERE type = 'ADMINISTRATIVE' - 832 + 624 576 diff --git a/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_repeat.hpl index 24e2ada..1ddeb11 100644 --- a/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/citizen_liability_fz53/parallel/citizen_liability_fz53_flow_repeat.hpl @@ -45,26 +45,6 @@ Change job status on success Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Insert / update + Y + + + Table input + Detect empty stream + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -97,8 +92,8 @@ 0 - 1280 - 400 + 1136 + 352 @@ -133,8 +128,8 @@ and recruitment_id = '${IDM_ID}'; - 1072 - 400 + 928 + 352 @@ -165,8 +160,8 @@ and recruitment_id = '${IDM_ID}'; - 1472 - 48 + 928 + 80 @@ -229,8 +224,8 @@ DO UPDATE SET - 656 - 48 + 480 + 80 @@ -265,25 +260,7 @@ DO UPDATE SET Change job status on success - 1472 - 208 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 656 + 928 208 @@ -305,13 +282,11 @@ DO UPDATE SET = recruit_id recruit_id - = created_at created_at - ervu_dashboard citizen_liability_fz53
@@ -399,7 +374,7 @@ DO UPDATE SET Y - 848 + 640 208 @@ -407,7 +382,7 @@ DO UPDATE SET Table input TableInput - Y + N 1 @@ -416,40 +391,40 @@ DO UPDATE SET postgres.decision-document-service N - 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 + + 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' + 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; Y @@ -493,8 +468,8 @@ WHERE type = 'ADMINISTRATIVE' Y - 848 - 400 + 640 + 352 @@ -527,8 +502,8 @@ WHERE type = 'ADMINISTRATIVE' - 656 - 400 + 480 + 352 diff --git a/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow.hpl b/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow.hpl index ee7e57b..08b6af7 100644 --- a/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow.hpl +++ b/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Table output - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + sort_by_recruit_id + Y + + + Table input + Table output + Y + Abort @@ -97,7 +92,7 @@ 0 - 1504 + 1168 496 @@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}'; - 1280 + 976 496 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1536 + 976 160 @@ -211,7 +206,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); - 688 + 496 160 @@ -247,13 +242,13 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); Change job status on success - 1536 + 976 320 - Identify last row in a stream - DetectLastRow + Table input + TableInput N @@ -262,46 +257,29 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}'); none - last_row - - - 688 - 320 - - - - Table input - TableInput - - Y - - 1 - - none - - ervu-dashboard N - 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, -- наименование органа, принявшего решение о выходе из гражданства РФ + - 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) + + 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' <> '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' <> 'null' or + ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' <> 'null')) +select fd.*, + fd.ctid = (select max(ctid) from filtered_data) as last_row +from filtered_data fd; Y @@ -379,7 +357,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and Y - 1056 + 736 320 @@ -414,7 +392,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and Y - 1056 + 736 496 @@ -448,7 +426,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and - 688 + 496 496 diff --git a/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_delta.hpl b/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_delta.hpl index 99c28bc..febce35 100644 --- a/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_delta.hpl +++ b/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_delta.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + Insert / update + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -97,8 +92,8 @@ 0 - 1392 - 528 + 1120 + 496 @@ -133,8 +128,8 @@ and recruitment_id = '${IDM_ID}'; - 1216 - 528 + 928 + 496 @@ -165,8 +160,8 @@ and recruitment_id = '${IDM_ID}'; - 1408 - 208 + 928 + 224 @@ -214,8 +209,8 @@ and recruitment_id = '${IDM_ID}'; - 768 - 208 + 560 + 224 @@ -250,25 +245,7 @@ and recruitment_id = '${IDM_ID}'; Change job status on success - 1408 - 352 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 768 + 928 352 @@ -357,7 +334,7 @@ and recruitment_id = '${IDM_ID}'; N - 960 + 752 352 @@ -365,7 +342,7 @@ and recruitment_id = '${IDM_ID}'; Table input TableInput - Y + N 1 @@ -374,28 +351,34 @@ and recruitment_id = '${IDM_ID}'; ervu-dashboard N - 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, -- наименование органа, принявшего решение о выходе из гражданства РФ + - 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) + + 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' <> + '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' <> 'null' or + ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' <> '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 + Y @@ -439,8 +422,8 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and Y - 960 - 528 + 752 + 496 @@ -473,8 +456,8 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and - 768 - 528 + 560 + 496 diff --git a/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_repeat.hpl index 382462e..7d094d1 100644 --- a/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/citizenship/parallel/citizenship_flow_repeat.hpl @@ -50,26 +50,6 @@ Change job status on error Y - - Table input - Identify last row in a stream - Y - - - Identify last row in a stream - Insert / update - Y - - - Identify last row in a stream - Detect empty stream - Y - - - Identify last row in a stream - sort_by_recruit_id - Y - sort_by_recruit_id Update @@ -80,6 +60,21 @@ Filter rows Y + + Table input + Detect empty stream + Y + + + Table input + Insert / update + Y + + + Table input + sort_by_recruit_id + Y + Abort @@ -97,7 +92,7 @@ 0 - 1312 + 1072 400 @@ -133,7 +128,7 @@ and recruitment_id = '${IDM_ID}'; - 1104 + 864 400 @@ -165,7 +160,7 @@ and recruitment_id = '${IDM_ID}'; - 1424 + 864 64 @@ -229,7 +224,7 @@ DO UPDATE SET - 672 + 480 64 @@ -265,25 +260,7 @@ DO UPDATE SET Change job status on success - 1424 - 208 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 672 + 864 208 @@ -305,19 +282,16 @@ DO UPDATE SET = recruit_id recruit_id - = acquiring_number acquiring_number - = renunciation_number renunciation_number - ervu_dashboard citizenship
@@ -375,7 +349,7 @@ DO UPDATE SET Y - 912 + 656 208 @@ -383,7 +357,7 @@ DO UPDATE SET Table input TableInput - Y + N 1 @@ -392,26 +366,27 @@ DO UPDATE SET ervu-dashboard N - 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, -- наименование органа, принявшего решение о выходе из гражданства РФ + - 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) + + 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' <> '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' <> 'null' or + ri.info -> 'svedGrazhdanRF' -> 'grazhdanRF' ->> 'osnVyh' <> 'null')) +select fd.*, + fd.ctid = (select max(ctid) from filtered_data) as last_row +from filtered_data fd; Y @@ -439,11 +414,6 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and recruit_id recruit_id - - <> - acquired_citizenship - acquired_citizenship - ervu_dashboard citizen
@@ -455,7 +425,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and Y - 912 + 656 400 @@ -489,7 +459,7 @@ where --ri.info->'svedGrazhdanRF'->>'prOtsGrazhdanRF' is null and - 672 + 480 400