From c0a571ffd8825fb3a2fdfa90fe3593efe04abccc Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 26 Mar 2025 13:59:12 +0300 Subject: [PATCH] fix --- .../country/appeals.topic_appeal.hpl | 300 ++++++++++++++++ .../country/job_recruitments_country.hwf | 62 ++++ v1_apache-hop dash mapping/job_general.hwf | 2 +- ...in_dashboard.waiting_registration(m_c).hpl | 14 +- .../appeals.topic_appeal(m_d).hpl | 334 ++++++++++++++++++ .../mil_district/job_recruitments_mildis.hwf | 66 ++++ .../region/appeals.reasons_appeal(reg).hpl | 153 +------- .../region/appeals.topic_appeal(reg).hpl | 248 +++++++++++++ .../region/job_recruitments_region.hwf | 57 +++ .../region/main_dashboard.appeals(reg).hpl | 3 +- 10 files changed, 1084 insertions(+), 155 deletions(-) create mode 100644 v1_apache-hop dash mapping/country/appeals.topic_appeal.hpl create mode 100644 v1_apache-hop dash mapping/mil_district/appeals.topic_appeal(m_d).hpl create mode 100644 v1_apache-hop dash mapping/region/appeals.topic_appeal(reg).hpl diff --git a/v1_apache-hop dash mapping/country/appeals.topic_appeal.hpl b/v1_apache-hop dash mapping/country/appeals.topic_appeal.hpl new file mode 100644 index 0000000..1b596fe --- /dev/null +++ b/v1_apache-hop dash mapping/country/appeals.topic_appeal.hpl @@ -0,0 +1,300 @@ + + + + appeals.topic_appeal + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/01/28 11:14:23.116 + - + 2025/01/28 11:14:23.116 + + + + + + Execute SQL script + Table input (subpoena) РФ/осень + Y + + + Get variables 2 2 + Select values 2 2 + Y + + + Select values 2 2 + Insert / update (appeals.topic_appeal) + Y + + + Table input (subpoena) РФ/осень + Get variables 2 2 + Y + + + + Execute SQL script + ExecSql + + N + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + DELETE FROM appeals.topic_appeal +WHERE recording_date = current_date + AND schema = 'Ministry' + AND recruitment_id = '${REG_ID}' + + + 336 + 448 + + + + Get variables 2 2 + GetVariable + + Y + + 1 + + none + + + + + -1 + REG_ID + -1 + none + String + + + -1 + VK_ARRAY + -1 + none + String + + + + + 800 + 448 + + + + Insert / update (appeals.topic_appeal) + InsertUpdate + + Y + + 1 + + none + + + 100 + ervu-dashboard + + + = + schema + schema + + + + = + recruitment_id + REG_ID + + + appeals + topic_appeal
+ + recruitment_id + recruitment_id + N + + + schema + schema + N + + + registration + registration + Y + + + registration_percent + registration_percent + Y + + + sabpoena + sabpoena + Y + + + sabpoena_percent + sabpoena_percent + Y + + + temporary_measures + temporary_measures + Y + + + temporary_measures_percent + temporary_measures_percent + Y + + + appear + appear + Y + +
+ N + + + 1296 + 448 + +
+ + Select values 2 2 + SelectValues + + Y + + 1 + + none + + + + N + + REG_ID + REG_ID + String + -2 + -2 + + false + + + false + + + + + + + + VK_ARRAY + VK_ARRAY + String + -2 + -2 + + false + + + false + + + + + + + + + + 1008 + 448 + + + + Table input (subpoena) РФ/осень + TableInput + + Y + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT + COALESCE(SUM(appear), 0) appear, + COALESCE(SUM(registration), 0) registration, + COALESCE(SUM(sabpoena), 0) sabpoena, + COALESCE(SUM(temporary_measures), 0) temporary_measures, + COALESCE( + CASE + WHEN SUM(appear) > 0 + THEN ROUND((SUM(registration) / SUM(appear) * 100), 2) + ELSE 0 + END, + 0 + ) registration_percent, + COALESCE( + CASE + WHEN SUM(appear) > 0 + THEN ROUND((SUM(sabpoena) / SUM(appear) * 100), 2) + ELSE 0 + END, + 0 + ) sabpoena_percent, + COALESCE( + CASE + WHEN SUM(appear) > 0 + THEN ROUND((SUM(temporary_measures) / SUM(appear) * 100), 2) + ELSE 0 + END, + 0 + ) temporary_measures_percent, + '${REG_ID}' AS recruitment_id, + 'Ministry' AS schema +FROM appeals.topic_appeal +WHERE recruitment_id = ANY ('${VK_ARRAY}') +AND schema = 'Region' +AND recording_date = CURRENT_DATE; + Y + + + 576 + 448 + + + + + +
diff --git a/v1_apache-hop dash mapping/country/job_recruitments_country.hwf b/v1_apache-hop dash mapping/country/job_recruitments_country.hwf index a966c43..752f622 100644 --- a/v1_apache-hop dash mapping/country/job_recruitments_country.hwf +++ b/v1_apache-hop dash mapping/country/job_recruitments_country.hwf @@ -771,6 +771,54 @@ 544 + + appeals.topic_appeal.hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/country/appeals.topic_appeal.hpl + + + Basic + + + VK_ARRAY + VK_ARRAY_ID + + + + REG_ID + RECRUITMENT_REG_ID + + + Y + + Y + local + N + N + Y + N + 1360 + 464 + + + + Success 17 + + SUCCESS + + N + 1536 + 464 + + @@ -1004,6 +1052,20 @@ Y N + + appeals.topic_appeal.hpl + Success 17 + Y + Y + N + + + select_recruitments_country + appeals.topic_appeal.hpl + Y + Y + N + diff --git a/v1_apache-hop dash mapping/job_general.hwf b/v1_apache-hop dash mapping/job_general.hwf index 223a88c..c17184a 100644 --- a/v1_apache-hop dash mapping/job_general.hwf +++ b/v1_apache-hop dash mapping/job_general.hwf @@ -26,7 +26,7 @@ 0 1 N - 320 + 288 240 diff --git a/v1_apache-hop dash mapping/mil_com/main_dashboard.waiting_registration(m_c).hpl b/v1_apache-hop dash mapping/mil_com/main_dashboard.waiting_registration(m_c).hpl index 8faa23c..1ac7202 100644 --- a/v1_apache-hop dash mapping/mil_com/main_dashboard.waiting_registration(m_c).hpl +++ b/v1_apache-hop dash mapping/mil_com/main_dashboard.waiting_registration(m_c).hpl @@ -93,13 +93,11 @@ = recruitment_id recruitment_id - = recording_date recording_date - main_dashboard waiting_registration
@@ -234,10 +232,12 @@ ids AS ( SELECT unnest(string_to_array(trim(both '{}' from '${ARR_MC}'), ','))::uuid AS recruitment_id ), last_status as (select recruit_id, - max(date_time) filter (where status in ('1', '12.7', '8.2', '8.3')) max_date_time - from recruits_history - where status in ('1', '12.7', '8.2', '8.3') - group by recruit_id), + max(rh.date_time) filter (where rh.status in ('1', '12.7', '8.2', '8.3')) max_date_time + from recruits_history rh + join recruits r on r.id = rh.recruit_id + where rh.status in ('1', '12.7', '8.2', '8.3') + and r.current_recruitment_id is null + group by rh.recruit_id), notregistered as ( select distinct rh.recruit_id, @@ -279,7 +279,7 @@ vse AS ( r.id in (SELECT recruit_id FROM notregistered) and rh.id in (SELECT recruit_history_id FROM notregistered) and coalesce(r.target_recruitment_id,rh.target_recruitment_id) ::uuid IN (SELECT recruitment_id FROM ids) - AND r.current_recruitment_id is null + --AND r.current_recruitment_id is null ), extracted_children AS ( SELECT diff --git a/v1_apache-hop dash mapping/mil_district/appeals.topic_appeal(m_d).hpl b/v1_apache-hop dash mapping/mil_district/appeals.topic_appeal(m_d).hpl new file mode 100644 index 0000000..03ef672 --- /dev/null +++ b/v1_apache-hop dash mapping/mil_district/appeals.topic_appeal(m_d).hpl @@ -0,0 +1,334 @@ + + + + appeals.topic_appeal(m_d) + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/01/28 10:29:54.859 + - + 2025/01/28 10:29:54.859 + + + + + + Execute SQL script + Table input (appeals.topic_appeal(m_d)) + Y + + + Get variables 3 2 + Select values 3 2 + Y + + + Insert / update (appeals.topic_appeal) + Execute SQL script 2 + Y + + + Select values 3 2 + Insert / update (appeals.topic_appeal) + Y + + + Table input (appeals.topic_appeal(m_d)) + Get variables 3 2 + Y + + + + Execute SQL script + ExecSql + + N + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + DELETE FROM appeals.topic_appeal +WHERE recording_date = current_date + AND schema = 'Region' + AND recruitment_id = '${MD_ID}' + + + 320 + 256 + + + + Execute SQL script 2 + ExecSql + + N + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + DELETE FROM appeals.topic_appeal +WHERE recording_date = current_date + AND schema = 'MD_LVL' + AND recruitment_id = '${MD_ID}' + + + 1344 + 256 + + + + Get variables 3 2 + GetVariable + + Y + + 1 + + none + + + + + -1 + MD_ID + -1 + none + String + + + -1 + MD_ARRAY + -1 + none + String + + + + + 752 + 256 + + + + Insert / update (appeals.topic_appeal) + InsertUpdate + + Y + + 1 + + none + + + 100 + ervu-dashboard + + + = + recruitment_id + MD_ID + + + + = + schema + schema + + + appeals + topic_appeal
+ + recruitment_id + recruitment_id + N + + + schema + schema + N + + + registration + registration + Y + + + registration_percent + registration_percent + Y + + + sabpoena + sabpoena + Y + + + sabpoena_percent + sabpoena_percent + Y + + + temporary_measures + temporary_measures + Y + + + temporary_measures_percent + temporary_measures_percent + Y + + + appear + appear + Y + +
+ Y + + + 1104 + 256 + +
+ + Select values 3 2 + SelectValues + + Y + + 1 + + none + + + + N + + MD_ID + MD_ID + String + -2 + -2 + + false + + + false + + + + + + + + MD_ARRAY + MD_ARRAY + String + -2 + -2 + + false + + + false + + + + + + + + + + 896 + 256 + + + + Table input (appeals.topic_appeal(m_d)) + TableInput + + N + + 1 + + none + + + ervu-dashboard + N + 0 + SELECT + COALESCE(SUM(appear), 0) appear, + COALESCE(SUM(registration), 0) registration, + COALESCE(SUM(sabpoena), 0) sabpoena, + COALESCE(SUM(temporary_measures), 0) temporary_measures, + COALESCE( + CASE + WHEN SUM(appear) > 0 + THEN ROUND((SUM(registration) / SUM(appear) * 100), 2) + ELSE 0 + END, + 0 + ) registration_percent, + COALESCE( + CASE + WHEN SUM(appear) > 0 + THEN ROUND((SUM(sabpoena) / SUM(appear) * 100), 2) + ELSE 0 + END, + 0 + ) sabpoena_percent, + COALESCE( + CASE + WHEN SUM(appear) > 0 + THEN ROUND((SUM(temporary_measures) / SUM(appear) * 100), 2) + ELSE 0 + END, + 0 + ) temporary_measures_percent, + '${MD_ID}' AS recruitment_id, + 'Region' AS schema +FROM appeals.topic_appeal +WHERE recruitment_id = ANY ('${MD_ARRAY}') +AND schema = 'Organization' +AND recording_date = CURRENT_DATE; + Y + + + 528 + 256 + + + + + +
diff --git a/v1_apache-hop dash mapping/mil_district/job_recruitments_mildis.hwf b/v1_apache-hop dash mapping/mil_district/job_recruitments_mildis.hwf index cba42ad..c938998 100644 --- a/v1_apache-hop dash mapping/mil_district/job_recruitments_mildis.hwf +++ b/v1_apache-hop dash mapping/mil_district/job_recruitments_mildis.hwf @@ -746,15 +746,19 @@ N Y ${PROJECT_HOME}/mil_district/appeals.reasons_appeal(m_d).hpl + + Basic MD_ARRAY MD_ARRAY_ID + MD_ID RECRUITMENT_MD_ID + Y @@ -778,6 +782,54 @@ 624 + + appeals.topic_appeal(m_d).hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/mil_district/appeals.topic_appeal(m_d).hpl + + + Basic + + + MD_ARRAY + MD_ARRAY_ID + + + + MD_ID + RECRUITMENT_MD_ID + + + Y + + Y + local + N + N + Y + N + 1296 + 544 + + + + Success 17 + + SUCCESS + + N + 1552 + 544 + + @@ -1011,6 +1063,20 @@ Y N + + appeals.topic_appeal(m_d).hpl + Success 17 + Y + Y + N + + + job_get_rows_mildis.hwf + appeals.topic_appeal(m_d).hpl + Y + Y + N + diff --git a/v1_apache-hop dash mapping/region/appeals.reasons_appeal(reg).hpl b/v1_apache-hop dash mapping/region/appeals.reasons_appeal(reg).hpl index c71db87..ca290ca 100644 --- a/v1_apache-hop dash mapping/region/appeals.reasons_appeal(reg).hpl +++ b/v1_apache-hop dash mapping/region/appeals.reasons_appeal(reg).hpl @@ -25,26 +25,11 @@ Table input (appeal_document) регионы Y - - Get variables 3 2 - Select values 3 2 - N - Insert / update (main_dashboard.appeals) 2 Execute SQL script 2 Y - - Select values 3 2 - Insert / update (main_dashboard.appeals) 2 - N - - - Table input (appeal_document) регионы - Get variables 3 2 - N - Table input (appeal_document) регионы Insert / update (main_dashboard.appeals) 2 @@ -108,46 +93,6 @@ WHERE recording_date = current_date 336 - - Get variables 3 2 - GetVariable - - Y - - 1 - - none - - - - - -1 - REG_ID - -1 - none - String - - - -1 - VK_ARRAY - -1 - none - String - - - -1 - SCM - -1 - none - String - - - - - 816 - 432 - - Insert / update (main_dashboard.appeals) 2 InsertUpdate @@ -166,19 +111,16 @@ WHERE recording_date = current_date = recruitment_id recruitment_id - = schema schema - = recording_date recording_date - appeals reasons_appeal
@@ -245,77 +187,6 @@ WHERE recording_date = current_date 336
- - Select values 3 2 - SelectValues - - Y - - 1 - - none - - - - N - - REG_ID - REG_ID - String - -2 - -2 - - false - - - false - - - - - - - - VK_ARRAY - VK_ARRAY - String - -2 - -2 - - false - - - false - - - - - - - - SCM - SCM - String - -2 - -2 - - false - - - false - - - - - - - - - - 960 - 432 - - Table input (appeal_document) регионы TableInput @@ -334,27 +205,17 @@ WHERE recording_date = current_date ids AS ( SELECT unnest(string_to_array(trim(both '{}' from '${ARR_REG}'), ','))::uuid AS recruitment_id ), -total_appeals AS ( - SELECT * - FROM appeals.appeals_list - WHERE - region_id::uuid IN (SELECT recruitment_id FROM ids) - AND reasons_appeal IN ('Отзыв жалобы', 'Некорректные данные', 'Досыл документов', 'Несогласие с решением') -), summary_counts AS ( SELECT region_id AS recruitment_id, COUNT(*) AS total_appeals, - SUM(CASE WHEN reasons_appeal = 'Некорректные данные' THEN 1 ELSE 0 END) AS incorrect_inf, --некорректные данные - SUM(CASE WHEN reasons_appeal = 'Досыл документов' THEN 1 ELSE 0 END) AS sending_documents, - SUM(CASE WHEN reasons_appeal = 'Несогласие с решением' THEN 1 ELSE 0 END) AS decision_disagreement, - SUM(CASE WHEN reasons_appeal = 'Отзыв жалобы' THEN 1 ELSE 0 END) AS complaint_withdrawal - /* - sending_documents -- Досыл документов - complaint_withdrawal -- Отзыв жалобы - decision_disagreement --Несогласие с решением*/ - FROM total_appeals - GROUP BY recruitment_id + COUNT(*) FILTER (WHERE fact ILIKE 'Внесли изменения%') AS incorrect_inf, -- Некорректные данные + COUNT(*) FILTER (WHERE fact ILIKE 'Досыл%') AS sending_documents, -- Досыл документов + COUNT(*) FILTER (WHERE fact ILIKE 'Не согласен%') AS decision_disagreement, -- Несогласие с решением + COUNT(*) FILTER (WHERE fact ILIKE 'Прошу%') AS complaint_withdrawal -- Отзыв жалобы + FROM appeals.appeals_list + WHERE region_id::uuid IN (SELECT recruitment_id FROM ids) + GROUP BY region_id ) SELECT 'Organization' AS schema, diff --git a/v1_apache-hop dash mapping/region/appeals.topic_appeal(reg).hpl b/v1_apache-hop dash mapping/region/appeals.topic_appeal(reg).hpl new file mode 100644 index 0000000..e1517a2 --- /dev/null +++ b/v1_apache-hop dash mapping/region/appeals.topic_appeal(reg).hpl @@ -0,0 +1,248 @@ + + + + appeals.topic_appeal(reg) + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/03/25 13:26:59.797 + - + 2025/03/25 13:26:59.797 + + + + + + Execute SQL script + Table input (appeal_document) регионы + Y + + + Insert / update (main_dashboard.appeals) 2 + Execute SQL script 2 + Y + + + Table input (appeal_document) регионы + Insert / update (main_dashboard.appeals) 2 + Y + + + + Execute SQL script + ExecSql + + N + + 1 + + none + + + + + ervu-dashboard + N + N + N + N + N + DELETE FROM appeals.topic_appeal +WHERE recording_date = current_date + AND schema = 'Organization' + + + 528 + 320 + + + + Execute SQL script 2 + ExecSql + + N + + 1 + + none + + + + + ervu-dashboard + N + N + Y + N + N + DELETE FROM appeals.topic_appeal +WHERE recording_date = current_date + AND schema = 'REG_LVL' + + + + 1312 + 320 + + + + Insert / update (main_dashboard.appeals) 2 + InsertUpdate + + Y + + 1 + + none + + + 100 + ervu-dashboard + + + = + recruitment_id + recruitment_id + + + + = + schema + schema + + + + = + recording_date + recording_date + + + appeals + topic_appeal
+ + recruitment_id + recruitment_id + N + + + schema + schema + N + + + registration + registration + Y + + + registration_percent + registration_percent + Y + + + sabpoena + sabpoena + Y + + + sabpoena_percent + sabpoena_percent + Y + + + temporary_measures + temporary_measures + Y + + + temporary_measures_percent + temporary_measures_percent + Y + + + recording_date + recording_date + N + + + appear + appeal + Y + +
+ Y + + + 1072 + 320 + +
+ + Table input (appeal_document) регионы + TableInput + + N + + 1 + + none + + + ervu-dashboard + N + 0 + WITH +ids AS ( + SELECT unnest(string_to_array(trim(both '{}' from '${ARR_REG}'), ','))::uuid AS recruitment_id +), +summary_counts AS ( + SELECT + region_id AS recruitment_id, + COUNT(*) AS total_appeals, + SUM( + CASE + WHEN subcategory LIKE 'Решение о постановке на воинский учёт%' + OR subcategory LIKE 'Отзыв ранее направленной жалобы по воинскому учету%' + OR subcategory LIKE 'Досыл документов к ранее направленной жалобе по воинскому учету%' + OR subcategory LIKE 'Решение об отказе во внесении изменений в Реестр воинского учёта%' + THEN 1 ELSE 0 + END + ) AS registration, -- постановка на учет + SUM(CASE WHEN subcategory LIKE 'Решение (заключение) призывной комиссии по призыву граждан на военную службу%' THEN 1 ELSE 0 END) AS sabpoena, -- повестки (призыв на службу) + SUM(CASE WHEN subcategory LIKE 'Решение об установлении ограничительных мер%' THEN 1 ELSE 0 END) AS temporary_measures -- временные меры + FROM appeals.appeals_list + WHERE region_id::uuid IN (SELECT recruitment_id FROM ids) + GROUP BY region_id +) +SELECT + 'Organization' AS schema, + i.recruitment_id, + current_date AS recording_date, + COALESCE(sc.total_appeals, 0) AS appeal, + COALESCE(sc.registration, 0) AS registration, + COALESCE(sc.sabpoena, 0) AS sabpoena, + COALESCE(sc.temporary_measures, 0) AS temporary_measures, + COALESCE(ROUND(sc.registration * 100.0 / NULLIF(sc.total_appeals, 0), 2), 0) AS registration_percent, + COALESCE(ROUND(sc.sabpoena * 100.0 / NULLIF(sc.total_appeals, 0), 2), 0) AS sabpoena_percent, + COALESCE(ROUND(sc.temporary_measures * 100.0 / NULLIF(sc.total_appeals, 0), 2), 0) AS temporary_measures_percent +FROM ids i +LEFT JOIN summary_counts sc ON sc.recruitment_id = i.recruitment_id + Y + + + 736 + 320 + + + + + +
diff --git a/v1_apache-hop dash mapping/region/job_recruitments_region.hwf b/v1_apache-hop dash mapping/region/job_recruitments_region.hwf index bc3f33a..60ad099 100644 --- a/v1_apache-hop dash mapping/region/job_recruitments_region.hwf +++ b/v1_apache-hop dash mapping/region/job_recruitments_region.hwf @@ -1365,6 +1365,49 @@ WHERE recording_date = current_date 1344 + + appeals.topic_appeal(reg).hpl + + PIPELINE + + N + N + N + N + N + Y + ${PROJECT_HOME}/region/appeals.topic_appeal(reg).hpl + + + Basic + + + ARR_REG + ARRAY_REGION + + + Y + + Y + local + N + N + Y + N + 1696 + 96 + + + + Success 18 + + SUCCESS + + N + 1936 + 96 + + @@ -1724,6 +1767,20 @@ WHERE recording_date = current_date Y N + + array_region.hpl + appeals.topic_appeal(reg).hpl + Y + Y + N + + + appeals.topic_appeal(reg).hpl + Success 18 + Y + Y + N + diff --git a/v1_apache-hop dash mapping/region/main_dashboard.appeals(reg).hpl b/v1_apache-hop dash mapping/region/main_dashboard.appeals(reg).hpl index d976280..8c87ed0 100644 --- a/v1_apache-hop dash mapping/region/main_dashboard.appeals(reg).hpl +++ b/v1_apache-hop dash mapping/region/main_dashboard.appeals(reg).hpl @@ -330,6 +330,7 @@ ids AS ( base_data AS ( SELECT region_id, + solution_type, CASE WHEN incoming_date <> '-' THEN incoming_date::date ELSE NULL @@ -352,7 +353,7 @@ aggregated_data AS ( SELECT region_id AS recruitment_id, COUNT(*) AS total_appeals, - COUNT(*) FILTER (WHERE fact_end_date IS NOT NULL) AS resolved, + COUNT(*) FILTER (WHERE solution_type = 'Решено') AS resolved, -- Среднее время рассмотрения, учитывая возможные NULL для дат ROUND(AVG(CASE WHEN fact_end_date IS NOT NULL AND incoming_date IS NOT NULL