diff --git a/mappings/info_recruits/citizen_tables/work/employer/parallel/employer_flow_repeat.hpl b/mappings/info_recruits/citizen_tables/work/employer/parallel/employer_flow_repeat.hpl index ca4869d..c95a03b 100644 --- a/mappings/info_recruits/citizen_tables/work/employer/parallel/employer_flow_repeat.hpl +++ b/mappings/info_recruits/citizen_tables/work/employer/parallel/employer_flow_repeat.hpl @@ -9,6 +9,16 @@ Normal 0 + + IDM_ID + 0e0535ab-5303-43ea-b36a-8c0a2a8d0ed5 + + + + JOB_NAME + employer_job + + N 1000 @@ -31,59 +41,49 @@ employer_input Y - - employer_input - Identify last row in a stream - Y - - - Identify last row in a stream - employer_upsert - Y - employer_upsert Change job status on error Y - - Detect empty stream - Change job status on success - Y - - - Identify last row in a stream - Detect empty stream - Y - Filter rows Change job status on success Y + + employer_input + Detect empty stream + Y + filter_non_actual_employers Update Y - Identify last row in a stream + employer_input filter_non_actual_employers Y + + employer_upsert + Filter rows + Y + + + employer_input + employer_upsert + Y + Update Change job status on error Y - employer_upsert - Block until transforms finish - Y - - - Block until transforms finish - Filter rows + Detect empty stream + Change job status on success Y @@ -103,30 +103,8 @@ 0 - 1520 - 560 - - - - Block until transforms finish - BlockUntilTransformsFinish - - Y - - 1 - - none - - - - - Update - - - - - 1328 - 400 + 1184 + 608 @@ -145,7 +123,7 @@ error_description - ervu-dashboard + ervu-dashboard-118 Y N Y @@ -161,8 +139,8 @@ and recruitment_id = '${IDM_ID}'; - 1136 - 560 + 976 + 608 @@ -179,8 +157,11 @@ and recruitment_id = '${IDM_ID}'; ervu-dashboard + Y + N + Y N N @@ -191,9 +172,10 @@ WHERE job_name = '${JOB_NAME}' and recruitment_id = '${IDM_ID}'; + - 1520 + 1280 256 @@ -211,8 +193,11 @@ and recruitment_id = '${IDM_ID}'; ervu-dashboard + N + N + Y N N @@ -223,6 +208,7 @@ DO UPDATE SET status = 'PROCESSING', error_description = null, execution_datetime = current_timestamp; + 352 @@ -242,7 +228,7 @@ SET status = 'PROCESSING', - 704 + 544 256 @@ -279,25 +265,7 @@ SET status = 'PROCESSING', Change job status on success - 1520 - 400 - - - - Identify last row in a stream - DetectLastRow - - N - - 1 - - none - - - last_row - - - 704 + 1280 400 @@ -315,11 +283,13 @@ SET status = 'PROCESSING', 10000 ervu-dashboard N + = recruit_id recruit_id + ervu_dashboard citizen
@@ -332,15 +302,15 @@ SET status = 'PROCESSING', Y - 896 - 560 + 736 + 608 employer_input TableInput - Y + N 1 @@ -350,61 +320,65 @@ SET status = 'PROCESSING', ervu-dashboard N 0 - with filteredData as (select ri.recruit_id, - ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'aktRabotodat' as rabotodat, - true as actual_employer - from ervu_dashboard.recruits_info ri - where ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'aktRabotodat' != 'null' - AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) + with filteredData as ( + select ri.recruit_id, + ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'aktRabotodat' as rabotodat, + true as actual_employer, + ctid + from ervu_dashboard.recruits_info ri + where COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' + and (ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'aktRabotodat') <> 'null' - union all + union all - select ri.recruit_id, - ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'predRabotodat' as rabotodat, - false as actual_employer - from ervu_dashboard.recruits_info ri - where ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'predRabotodat' != 'null' - AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) + select ri.recruit_id, + ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'predRabotodat' as rabotodat, + false as actual_employer, + ctid + from ervu_dashboard.recruits_info ri + where COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}' + and (ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'predRabotodat') <> 'null' ) select - fd.recruit_id, - to_date(rabotodat ->> 'dataSved', 'YYYY-MM-DD') as source_update_date, - rabotodat ->> 'id' as source_id, - COALESCE(rabotodat -> 'extend' ->> 'status', '0') = '1' as status, - rabotodat -> 'extend' ->> 'adresRabotodat' as address, - rabotodat -> 'extend' ->> 'tipPodrazdRabotodat' as separate_unit_type, - rabotodat -> 'extend' ->> 'adresPodrazdRabotodat' as separate_unit_address, - case - when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' - then 'Индивидуальный предприниматель' - when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' then 'Юридическое лицо' - when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' then 'Глава КФХ' - when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' then 'Физическое лицо' - end as employer_category_name, - rabotodat -> 'svedYUL' -> 'naimOrg' as name, - case - when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' - then rabotodat -> 'svedIP' ->> 'innfl' - when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' - then rabotodat -> 'svedYUL' ->> 'innyul' - when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' - then rabotodat -> 'svedGlKFH' ->> 'innfl' - when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' - then rabotodat -> 'svedPlatFL' ->> 'innfl' - end as inn, - case - when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' - then rabotodat -> 'extend' -> 'svedYUL' ->> 'ogrn' - when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' - then rabotodat -> 'svedIP' ->> 'ogrnip' - end as ogrn, - case - when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' - then rabotodat -> 'extend' -> 'svedYUL' ->> 'kpp' - end as kpp, - coalesce(rabotodat -> 'svedYUL' -> 'extend' ->> 'priznakOpk', '0') = '1' as is_opk_org, - actual_employer, - coalesce(rabotodat -> 'extend' ->> 'statusRabotodat', '0') = '1' as status + fd.recruit_id, + to_date(rabotodat ->> 'dataSved', 'YYYY-MM-DD') as source_update_date, + rabotodat ->> 'id' as source_id, + COALESCE(rabotodat -> 'extend' ->> 'status', '0') = '1' as status, + rabotodat -> 'extend' ->> 'adresRabotodat' as address, + rabotodat -> 'extend' ->> 'tipPodrazdRabotodat' as separate_unit_type, + rabotodat -> 'extend' ->> 'adresPodrazdRabotodat' as separate_unit_address, + case + when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' + then 'Индивидуальный предприниматель' + when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' then 'Юридическое лицо' + when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' then 'Глава КФХ' + when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' then 'Физическое лицо' + end as employer_category_name, + rabotodat -> 'svedYUL' ->> 'naimOrg' as name, + case + when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' + then rabotodat -> 'svedIP' ->> 'innfl' + when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' + then rabotodat -> 'svedYUL' ->> 'innyul' + when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' + then rabotodat -> 'svedGlKFH' ->> 'innfl' + when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' + then rabotodat -> 'svedPlatFL' ->> 'innfl' + end as inn, + case + when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' + then rabotodat -> 'extend' -> 'svedYUL' ->> 'ogrn' + when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' + then rabotodat -> 'svedIP' ->> 'ogrnip' + end as ogrn, + case + when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' + then rabotodat -> 'extend' -> 'svedYUL' ->> 'kpp' + end as kpp, + coalesce(rabotodat -> 'svedYUL' -> 'extend' ->> 'priznakOpk', '0') = '1' as is_opk_org, + actual_employer, + coalesce(rabotodat -> 'extend' ->> 'statusRabotodat', '0') = '1' as status, + fd.ctid = (select max(ctid) from filteredData) as last_row from filteredData fd; Y @@ -431,6 +405,7 @@ from filteredData fd; = source_id source_id + ervu_dashboard employer
@@ -508,7 +483,7 @@ from filteredData fd; N - 1136 + 976 400
@@ -544,8 +519,8 @@ from filteredData fd; Update - 704 - 560 + 544 + 608