284 lines
8.2 KiB
XML
284 lines
8.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<pipeline>
|
|
<info>
|
|
<name>recruitment_campaign.appeals(m_c)</name>
|
|
<name_sync_with_filename>Y</name_sync_with_filename>
|
|
<description/>
|
|
<extended_description/>
|
|
<pipeline_version/>
|
|
<pipeline_type>Normal</pipeline_type>
|
|
<pipeline_status>0</pipeline_status>
|
|
<parameters>
|
|
</parameters>
|
|
<capture_transform_performance>N</capture_transform_performance>
|
|
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
|
|
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
|
|
<created_user>-</created_user>
|
|
<created_date>2024/08/02 11:56:22.507</created_date>
|
|
<modified_user>-</modified_user>
|
|
<modified_date>2024/08/02 11:56:22.507</modified_date>
|
|
</info>
|
|
<notepads>
|
|
</notepads>
|
|
<order>
|
|
<hop>
|
|
<from>Get variables 3 2</from>
|
|
<to>Select values 3 2</to>
|
|
<enabled>N</enabled>
|
|
</hop>
|
|
<hop>
|
|
<from>Table input (appeal_document) регионы</from>
|
|
<to>Get variables 3 2</to>
|
|
<enabled>N</enabled>
|
|
</hop>
|
|
<hop>
|
|
<from>Select values 3 2</from>
|
|
<to>Insert / update (main_dashboard.appeals)</to>
|
|
<enabled>N</enabled>
|
|
</hop>
|
|
<hop>
|
|
<from>Table input (appeal_document) регионы</from>
|
|
<to>Insert / update (main_dashboard.appeals)</to>
|
|
<enabled>Y</enabled>
|
|
</hop>
|
|
</order>
|
|
<transform>
|
|
<name>Get variables 3 2</name>
|
|
<type>GetVariable</type>
|
|
<description/>
|
|
<distribute>Y</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<fields>
|
|
<field>
|
|
<length>-1</length>
|
|
<name>REC_ID</name>
|
|
<precision>-1</precision>
|
|
<trim_type>none</trim_type>
|
|
<type>String</type>
|
|
</field>
|
|
<field>
|
|
<length>-1</length>
|
|
<name>SCM</name>
|
|
<precision>-1</precision>
|
|
<trim_type>none</trim_type>
|
|
<type>String</type>
|
|
</field>
|
|
</fields>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>960</xloc>
|
|
<yloc>416</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform>
|
|
<name>Insert / update (main_dashboard.appeals)</name>
|
|
<type>InsertUpdate</type>
|
|
<description/>
|
|
<distribute>Y</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<commit>100</commit>
|
|
<connection>ervu-dashboard</connection>
|
|
<lookup>
|
|
<key>
|
|
<condition>=</condition>
|
|
<field>recruitment_id</field>
|
|
<name>recruitment_id</name>
|
|
</key>
|
|
<key>
|
|
<condition>=</condition>
|
|
<field>spring_autumn</field>
|
|
<name>spring_autumn</name>
|
|
</key>
|
|
<key>
|
|
<condition>=</condition>
|
|
<field>recording_date</field>
|
|
<name>recording_date</name>
|
|
</key>
|
|
<schema>recruitment_campaign</schema>
|
|
<table>appeals</table>
|
|
<value>
|
|
<name>total_appeals</name>
|
|
<rename>total_appeals</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>average_consideration</name>
|
|
<rename>average_consideration</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>resolved</name>
|
|
<rename>resolved</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>not_resolved</name>
|
|
<rename>not_resolved</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>not_resolved_percent</name>
|
|
<rename>not_resolved_percent</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>average_rating</name>
|
|
<rename>average_rating</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>resolved_percent</name>
|
|
<rename>resolved_percent</rename>
|
|
<update>Y</update>
|
|
</value>
|
|
<value>
|
|
<name>recruitment_id</name>
|
|
<rename>recruitment_id</rename>
|
|
<update>N</update>
|
|
</value>
|
|
<value>
|
|
<name>spring_autumn</name>
|
|
<rename>spring_autumn</rename>
|
|
<update>N</update>
|
|
</value>
|
|
</lookup>
|
|
<update_bypassed>N</update_bypassed>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>1200</xloc>
|
|
<yloc>336</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform>
|
|
<name>Select values 3 2</name>
|
|
<type>SelectValues</type>
|
|
<description/>
|
|
<distribute>Y</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<fields>
|
|
<select_unspecified>N</select_unspecified>
|
|
<meta>
|
|
<name>REC_ID</name>
|
|
<rename>REC_ID</rename>
|
|
<type>String</type>
|
|
<length>-2</length>
|
|
<precision>-2</precision>
|
|
<conversion_mask/>
|
|
<date_format_lenient>false</date_format_lenient>
|
|
<date_format_locale/>
|
|
<date_format_timezone/>
|
|
<lenient_string_to_number>false</lenient_string_to_number>
|
|
<encoding/>
|
|
<decimal_symbol/>
|
|
<grouping_symbol/>
|
|
<currency_symbol/>
|
|
<storage_type/>
|
|
</meta>
|
|
<meta>
|
|
<name>SCM</name>
|
|
<rename>SCM</rename>
|
|
<type>String</type>
|
|
<length>-2</length>
|
|
<precision>-2</precision>
|
|
<conversion_mask/>
|
|
<date_format_lenient>false</date_format_lenient>
|
|
<date_format_locale/>
|
|
<date_format_timezone/>
|
|
<lenient_string_to_number>false</lenient_string_to_number>
|
|
<encoding/>
|
|
<decimal_symbol/>
|
|
<grouping_symbol/>
|
|
<currency_symbol/>
|
|
<storage_type/>
|
|
</meta>
|
|
</fields>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>1088</xloc>
|
|
<yloc>416</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform>
|
|
<name>Table input (appeal_document) регионы</name>
|
|
<type>TableInput</type>
|
|
<description/>
|
|
<distribute>N</distribute>
|
|
<custom_distribution/>
|
|
<copies>1</copies>
|
|
<partitioning>
|
|
<method>none</method>
|
|
<schema_name/>
|
|
</partitioning>
|
|
<connection>postgres.appeal-document-service</connection>
|
|
<execute_each_row>N</execute_each_row>
|
|
<limit>0</limit>
|
|
<sql>-- ad.extra_info->>'result' = '**' 1 - удовлетворена, 2 - частично удовлетворена, 3 - отказано в удовлетворении
|
|
WITH
|
|
ids AS (
|
|
SELECT unnest(string_to_array(trim(both '{}' from '${ARR_MC}'), ','))::uuid AS recruitment_id
|
|
),
|
|
season_separations AS (
|
|
SELECT 'Осень' AS spring_autumn
|
|
UNION ALL
|
|
SELECT 'Весна' AS spring_autumn
|
|
),
|
|
data_combinations AS (
|
|
-- Создаём все комбинации target_recruitment_id и spring_autumn
|
|
SELECT
|
|
i.recruitment_id AS recruitment_id,
|
|
ss.spring_autumn
|
|
FROM ids i
|
|
CROSS JOIN season_separations ss
|
|
),
|
|
appeals_data AS (
|
|
SELECT
|
|
vk_id AS recruitment_id,
|
|
COUNT(*) AS total_appeals,
|
|
ROUND(AVG((TRIM(BOTH '"' FROM (ad.extra_info ->> 'resultDate')::text)::date - ad.appeal_date)), 2) AS average_consideration,
|
|
COUNT(CASE WHEN ad.extra_info->>'result' in ('1', '2') THEN 1 ELSE 0 END) AS resolved,
|
|
COUNT(CASE WHEN ad.extra_info->>'result' = '3' THEN 1 ELSE 0 END) AS not_resolved
|
|
FROM public.appeal_document ad
|
|
WHERE vk_id::uuid IN (SELECT recruitment_id FROM ids)
|
|
AND ad.extra_info ->> 'resultDate' IS NOT NULL AND ad.extra_info ->> 'resultDate'!=''
|
|
GROUP BY vk_id
|
|
)
|
|
SELECT
|
|
current_date AS recording_date,
|
|
COALESCE(ad.total_appeals, 0) AS total_appeals,
|
|
COALESCE(ad.average_consideration, 0) AS average_consideration,
|
|
COALESCE(ad.resolved, 0) AS resolved,
|
|
COALESCE(ad.not_resolved, 0) AS not_resolved,
|
|
COALESCE(ROUND(COALESCE(ad.resolved, 0) * 100.0 / NULLIF(ad.total_appeals, 0), 2), 0) AS resolved_percent,
|
|
COALESCE(ROUND(COALESCE(ad.not_resolved, 0) * 100.0 / NULLIF(ad.total_appeals, 0), 2), 0) AS not_resolved_percent,
|
|
dc.recruitment_id,
|
|
0 AS average_rating,
|
|
dc.spring_autumn
|
|
FROM data_combinations dc
|
|
LEFT JOIN appeals_data AS ad
|
|
ON ad.recruitment_id = dc.recruitment_id;</sql>
|
|
<variables_active>Y</variables_active>
|
|
<attributes/>
|
|
<GUI>
|
|
<xloc>848</xloc>
|
|
<yloc>336</yloc>
|
|
</GUI>
|
|
</transform>
|
|
<transform_error_handling>
|
|
</transform_error_handling>
|
|
<attributes/>
|
|
</pipeline>
|