свежая версия со стенда
This commit is contained in:
parent
d288a7519e
commit
13aeb606dc
280 changed files with 75366 additions and 20884 deletions
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<pipeline>
|
||||
<info>
|
||||
<name>recruitment_campaign.subpoenas(reg)</name>
|
||||
|
|
@ -7,7 +8,6 @@
|
|||
<pipeline_version/>
|
||||
<pipeline_type>Normal</pipeline_type>
|
||||
<pipeline_status>0</pipeline_status>
|
||||
<directory>/</directory>
|
||||
<parameters>
|
||||
</parameters>
|
||||
<capture_transform_performance>N</capture_transform_performance>
|
||||
|
|
@ -17,8 +17,6 @@
|
|||
<created_date>2024/08/09 13:13:59.825</created_date>
|
||||
<modified_user>-</modified_user>
|
||||
<modified_date>2024/08/09 13:13:59.825</modified_date>
|
||||
<key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA=</key_for_session_key>
|
||||
<is_key_private>N</is_key_private>
|
||||
</info>
|
||||
<notepads>
|
||||
</notepads>
|
||||
|
|
@ -33,26 +31,11 @@
|
|||
<to>Get variables 4 3</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Get variables 4 3 2</from>
|
||||
<to>Select values 4 3 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (subpoena) весна/регионы</from>
|
||||
<to>Get variables 4 3 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Select values 4 3</from>
|
||||
<to>Insert / update (recruitment_campaign.subpoenas) 3</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Select values 4 3 2</from>
|
||||
<to>Insert / update (recruitment_campaign.subpoenas) 3 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Get variables 4 3</name>
|
||||
|
|
@ -67,81 +50,24 @@
|
|||
</partitioning>
|
||||
<fields>
|
||||
<field>
|
||||
<name>REG_ID</name>
|
||||
<variable/>
|
||||
<type>String</type>
|
||||
<format/>
|
||||
<currency/>
|
||||
<decimal/>
|
||||
<group/>
|
||||
<length>-1</length>
|
||||
<name>REG_ID</name>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
<type>String</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>VK_ARRAY</name>
|
||||
<variable/>
|
||||
<type>String</type>
|
||||
<format/>
|
||||
<currency/>
|
||||
<decimal/>
|
||||
<group/>
|
||||
<length>-1</length>
|
||||
<name>VK_ARRAY</name>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
<type>String</type>
|
||||
</field>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>416</xloc>
|
||||
<yloc>400</yloc>
|
||||
<draw>Y</draw>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Get variables 4 3 2</name>
|
||||
<type>GetVariable</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<fields>
|
||||
<field>
|
||||
<name>REG_ID</name>
|
||||
<variable/>
|
||||
<type>String</type>
|
||||
<format/>
|
||||
<currency/>
|
||||
<decimal/>
|
||||
<group/>
|
||||
<length>-1</length>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
</field>
|
||||
<field>
|
||||
<name>VK_ARRAY</name>
|
||||
<variable/>
|
||||
<type>String</type>
|
||||
<format/>
|
||||
<currency/>
|
||||
<decimal/>
|
||||
<group/>
|
||||
<length>-1</length>
|
||||
<precision>-1</precision>
|
||||
<trim_type>none</trim_type>
|
||||
</field>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>416</xloc>
|
||||
<yloc>480</yloc>
|
||||
<draw>Y</draw>
|
||||
<xloc>1344</xloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -155,18 +81,26 @@
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<commit>100</commit>
|
||||
<update_bypassed>N</update_bypassed>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>REG_ID</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>schema</field>
|
||||
<name>schema</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>spring_autumn</field>
|
||||
<name>spring_autumn</name>
|
||||
</key>
|
||||
<schema>recruitment_campaign</schema>
|
||||
<table>subpoenas</table>
|
||||
<key>
|
||||
<name>REG_ID</name>
|
||||
<field>recruitment_id</field>
|
||||
<condition>=</condition>
|
||||
<name2/>
|
||||
</key>
|
||||
<value>
|
||||
<name>subpoena</name>
|
||||
<rename>count_subpoena</rename>
|
||||
|
|
@ -267,145 +201,17 @@
|
|||
<rename>appear_date_is_good_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>schema</name>
|
||||
<rename>schema</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>896</xloc>
|
||||
<yloc>400</yloc>
|
||||
<draw>Y</draw>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Insert / update (recruitment_campaign.subpoenas) 3 2</name>
|
||||
<type>InsertUpdate</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<commit>100</commit>
|
||||
<update_bypassed>N</update_bypassed>
|
||||
<lookup>
|
||||
<schema>recruitment_campaign</schema>
|
||||
<table>subpoenas</table>
|
||||
<key>
|
||||
<name>REG_ID</name>
|
||||
<field>recruitment_id</field>
|
||||
<condition>=</condition>
|
||||
<name2/>
|
||||
</key>
|
||||
<value>
|
||||
<name>subpoena</name>
|
||||
<rename>count_subpoena</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>appeared</name>
|
||||
<rename>count_appeared</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>not_appeared</name>
|
||||
<rename>count_not_appeared</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>not_ap_good_reason</name>
|
||||
<rename>count_not_ap_good_reason</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>introduced_measures</name>
|
||||
<rename>count_introduced_measures</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>ap_not_required</name>
|
||||
<rename>count_ap_not_required</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>restrictions_applied</name>
|
||||
<rename>count_restrictions_applied</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>appeared_percent</name>
|
||||
<rename>appeared_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>not_appeared_percent</name>
|
||||
<rename>not_appeared_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>not_ap_good_reason_percent</name>
|
||||
<rename>not_ap_good_reason_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>ap_not_required_percent</name>
|
||||
<rename>ap_not_required_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>restrictions_applied_percent</name>
|
||||
<rename>restrictions_applied_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>introduced_measures_percent</name>
|
||||
<rename>introduced_measures_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>recruitment_id</name>
|
||||
<rename>recruitment_id</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>rest</name>
|
||||
<rename>rest</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>spring_autumn</name>
|
||||
<rename>spring_autumn</rename>
|
||||
<update>N</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>count_not_delivery</name>
|
||||
<rename>count_not_delivery</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>appear_date_is_good</name>
|
||||
<rename>appear_date_is_good</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>not_delivery_percent</name>
|
||||
<rename>not_delivery_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
<value>
|
||||
<name>appear_date_is_good_percent</name>
|
||||
<rename>appear_date_is_good_percent</rename>
|
||||
<update>Y</update>
|
||||
</value>
|
||||
</lookup>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>896</xloc>
|
||||
<yloc>480</yloc>
|
||||
<draw>Y</draw>
|
||||
<xloc>1824</xloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -457,253 +263,9 @@
|
|||
</meta>
|
||||
</fields>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>592</xloc>
|
||||
<yloc>400</yloc>
|
||||
<draw>Y</draw>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Select values 4 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>REG_ID</name>
|
||||
<rename>REG_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>VK_ARRAY</name>
|
||||
<rename>VK_ARRAY</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/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>592</xloc>
|
||||
<yloc>480</yloc>
|
||||
<draw>Y</draw>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input (subpoena) весна/регионы</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>postgres.subpoena</connection>
|
||||
<sql>WITH subpoena_data AS (
|
||||
SELECT
|
||||
s.id AS subpoena_id,
|
||||
s.status_id,
|
||||
sr.type,
|
||||
ssh.code AS sub_stat_hist,
|
||||
s.send_date,
|
||||
sh.date_time::timestamp AS history_date,
|
||||
rdi.restriction_document_cancel_id AS restr_dc,
|
||||
rdi.applied_date AS ap_date,
|
||||
rdi.id AS rdi_id,
|
||||
ssi.delivery_code AS d_code,
|
||||
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn
|
||||
FROM subpoena s
|
||||
JOIN subpoena_history AS sh ON sh.subpoena_id = s.id
|
||||
JOIN subpoena_status AS ss ON ss.id = s.status_id
|
||||
JOIN subpoena_status AS ssh ON ssh.id = sh.status_id
|
||||
JOIN subpoena_reason AS sr ON sr.id = s.reason_id
|
||||
LEFT JOIN restriction_document AS rd ON rd.subpoena_id = s.id
|
||||
LEFT JOIN restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
|
||||
LEFT JOIN subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
|
||||
WHERE sr.type = '3'
|
||||
AND ssh.code NOT IN ('3.14','3.7','3.72', '3.71')
|
||||
AND (
|
||||
COALESCE('${VK_ARRAY}', '') = ''
|
||||
OR s.department_id = ANY (
|
||||
string_to_array(
|
||||
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')),
|
||||
','
|
||||
)::uuid[]
|
||||
)
|
||||
)
|
||||
),
|
||||
last_status AS (
|
||||
SELECT *
|
||||
FROM subpoena_data
|
||||
WHERE rn = 1
|
||||
),
|
||||
t1 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IS NOT NULL
|
||||
),
|
||||
t2 AS (
|
||||
SELECT ROUND(AVG(EXTRACT(DAY FROM (history_date::timestamp - send_date::timestamp))), 1) AS average_appeared
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('4.1', '4.2', '4')
|
||||
),
|
||||
t3 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('4.1', '4.2', '4')
|
||||
),
|
||||
t4 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist = '5'
|
||||
),
|
||||
t5 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_not_ap_good_reason
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist = '5.1'
|
||||
),
|
||||
t6 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_ap_not_required
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('3.8', '5.2')
|
||||
),
|
||||
t7 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_restrictions_applied
|
||||
FROM last_status
|
||||
WHERE restr_dc IS NULL
|
||||
),
|
||||
t8 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_introduced_measures
|
||||
FROM last_status
|
||||
WHERE restr_dc IS NULL AND ap_date IS NOT NULL
|
||||
),
|
||||
t9 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_paper
|
||||
FROM last_status
|
||||
WHERE d_code != '7'
|
||||
),
|
||||
t10 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_electron
|
||||
FROM last_status
|
||||
WHERE d_code = '7'
|
||||
),
|
||||
t11 AS (
|
||||
SELECT COUNT (DISTINCT rdi_id) AS count_restrictions
|
||||
FROM last_status
|
||||
),
|
||||
t12 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_not_delivery
|
||||
FROM last_status
|
||||
WHERE d_code IS NULL
|
||||
),
|
||||
t13 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS appear_date_is_good
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('3','3.12', '3.13', '3.15', '3.1')
|
||||
)
|
||||
SELECT
|
||||
COALESCE(t1.count_subpoena, 0) AS count_subpoena,
|
||||
COALESCE(t2.average_appeared, 0) AS average_appeared,
|
||||
COALESCE(t3.count_appeared, 0) AS count_appeared,
|
||||
COALESCE(t4.count_not_appeared, 0) AS count_not_appeared,
|
||||
COALESCE(t5.count_not_ap_good_reason, 0) AS count_not_ap_good_reason,
|
||||
COALESCE(t6.count_ap_not_required, 0) AS count_ap_not_required,
|
||||
COALESCE(t7.count_restrictions_applied, 0) AS count_restrictions_applied,
|
||||
COALESCE(t8.count_introduced_measures, 0) AS count_introduced_measures,
|
||||
COALESCE(t9.count_paper, 0) AS count_paper,
|
||||
COALESCE(t10.count_electron, 0) AS count_electron,
|
||||
COALESCE(t11.count_restrictions, 0) AS count_restrictions,
|
||||
COALESCE(t12.count_not_delivery, 0) AS count_not_delivery,
|
||||
COALESCE(t13.appear_date_is_good, 0) AS appear_date_is_good,
|
||||
ROUND(COALESCE(t3.count_appeared, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS appeared_percent,
|
||||
ROUND(COALESCE(t4.count_not_appeared, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS not_appeared_percent,
|
||||
ROUND(COALESCE(t5.count_not_ap_good_reason, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS not_ap_good_reason_percent,
|
||||
ROUND(COALESCE(t6.count_ap_not_required, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS ap_not_required_percent,
|
||||
ROUND(COALESCE(t10.count_electron, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS electron_percent,
|
||||
ROUND(COALESCE(t9.count_paper, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS paper_percent,
|
||||
ROUND(COALESCE(t7.count_restrictions_applied, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS restrictions_applied_percent,
|
||||
ROUND(COALESCE(t8.count_introduced_measures, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS introduced_measures_percent,
|
||||
ROUND(COALESCE(t12.count_not_delivery, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS not_delivery_percent,
|
||||
ROUND(COALESCE(t13.appear_date_is_good, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS appear_date_is_good_percent,
|
||||
'${REG_ID}' AS recruitment_id,
|
||||
1 AS org,
|
||||
0 AS rest,
|
||||
'Весна' AS spring_autumn
|
||||
FROM t1
|
||||
FULL OUTER JOIN t2 ON true
|
||||
FULL OUTER JOIN t3 ON true
|
||||
FULL OUTER JOIN t4 ON true
|
||||
FULL OUTER JOIN t5 ON true
|
||||
FULL OUTER JOIN t6 ON true
|
||||
FULL OUTER JOIN t7 ON true
|
||||
FULL OUTER JOIN t8 ON true
|
||||
FULL OUTER JOIN t9 ON true
|
||||
FULL OUTER JOIN t10 ON true
|
||||
FULL OUTER JOIN t11 ON true
|
||||
FULL OUTER JOIN t12 ON true
|
||||
FULL OUTER JOIN t13 ON true
|
||||
WHERE NOT (
|
||||
COALESCE('${VK_ARRAY}', '') = ''
|
||||
AND (
|
||||
COALESCE(t1.count_subpoena, 0) > 0
|
||||
OR COALESCE(t2.average_appeared, 0) > 0
|
||||
OR COALESCE(t3.count_appeared, 0) > 0
|
||||
OR COALESCE(t4.count_not_appeared, 0) > 0
|
||||
OR COALESCE(t5.count_not_ap_good_reason, 0) > 0
|
||||
OR COALESCE(t6.count_ap_not_required, 0) > 0
|
||||
OR COALESCE(t7.count_restrictions_applied, 0) > 0
|
||||
OR COALESCE(t8.count_introduced_measures, 0) > 0
|
||||
OR COALESCE(t9.count_paper, 0) > 0
|
||||
OR COALESCE(t10.count_electron, 0) > 0
|
||||
OR COALESCE(t11.count_restrictions, 0) > 0
|
||||
OR COALESCE(t12.count_not_delivery, 0) > 0
|
||||
OR COALESCE(t13.appear_date_is_good, 0) > 0
|
||||
)
|
||||
);</sql>
|
||||
<limit>0</limit>
|
||||
<lookup/>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<variables_active>Y</variables_active>
|
||||
<lazy_conversion_active>N</lazy_conversion_active>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>160</xloc>
|
||||
<yloc>480</yloc>
|
||||
<draw>Y</draw>
|
||||
<xloc>1520</xloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -717,179 +279,105 @@ WHERE NOT (
|
|||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>postgres.subpoena</connection>
|
||||
<sql>WITH subpoena_data AS (
|
||||
SELECT
|
||||
s.id AS subpoena_id,
|
||||
s.status_id,
|
||||
sr.type,
|
||||
ssh.code AS sub_stat_hist,
|
||||
s.send_date,
|
||||
sh.date_time::timestamp AS history_date,
|
||||
rdi.restriction_document_cancel_id AS restr_dc,
|
||||
rdi.applied_date AS ap_date,
|
||||
rdi.id AS rdi_id,
|
||||
ssi.delivery_code AS d_code,
|
||||
ROW_NUMBER() OVER (PARTITION BY s.id ORDER BY sh.date_time DESC) AS rn
|
||||
FROM subpoena s
|
||||
JOIN subpoena_history AS sh ON sh.subpoena_id = s.id
|
||||
JOIN subpoena_status AS ss ON ss.id = s.status_id
|
||||
JOIN subpoena_status AS ssh ON ssh.id = sh.status_id
|
||||
JOIN subpoena_reason AS sr ON sr.id = s.reason_id
|
||||
LEFT JOIN restriction_document AS rd ON rd.subpoena_id = s.id
|
||||
LEFT JOIN restriction_document_item AS rdi ON rdi.restriction_document_create_id = rd.id
|
||||
LEFT JOIN subpoena_send_info AS ssi ON ssi.subpoena_id = s.id
|
||||
WHERE sr.type = '3'
|
||||
AND ssh.code NOT IN ('3.14','3.7','3.72', '3.71')
|
||||
AND (
|
||||
COALESCE('${VK_ARRAY}', '') = ''
|
||||
OR s.department_id = ANY (
|
||||
string_to_array(
|
||||
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')),
|
||||
','
|
||||
)::uuid[]
|
||||
)
|
||||
)
|
||||
),
|
||||
last_status AS (
|
||||
SELECT *
|
||||
FROM subpoena_data
|
||||
WHERE rn = 1
|
||||
),
|
||||
t1 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_subpoena
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IS NOT NULL
|
||||
),
|
||||
t2 AS (
|
||||
SELECT ROUND(AVG(EXTRACT(DAY FROM (history_date::timestamp - send_date::timestamp))), 1) AS average_appeared
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('4.1', '4.2', '4')
|
||||
),
|
||||
t3 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_appeared
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('4.1', '4.2', '4')
|
||||
),
|
||||
t4 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_not_appeared
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist = '5'
|
||||
),
|
||||
t5 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_not_ap_good_reason
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist = '5.1'
|
||||
),
|
||||
t6 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_ap_not_required
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('3.8', '5.2')
|
||||
),
|
||||
t7 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_restrictions_applied
|
||||
FROM last_status
|
||||
WHERE restr_dc IS NULL
|
||||
),
|
||||
t8 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_introduced_measures
|
||||
FROM last_status
|
||||
WHERE restr_dc IS NULL AND ap_date IS NOT NULL
|
||||
),
|
||||
t9 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_paper
|
||||
FROM last_status
|
||||
WHERE d_code != '7'
|
||||
),
|
||||
t10 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_electron
|
||||
FROM last_status
|
||||
WHERE d_code = '7'
|
||||
),
|
||||
t11 AS (
|
||||
SELECT COUNT (DISTINCT rdi_id) AS count_restrictions
|
||||
FROM last_status
|
||||
),
|
||||
t12 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS count_not_delivery
|
||||
FROM last_status
|
||||
WHERE d_code IS NULL
|
||||
),
|
||||
t13 AS (
|
||||
SELECT COUNT(DISTINCT subpoena_id) AS appear_date_is_good
|
||||
FROM last_status
|
||||
WHERE sub_stat_hist IN ('3','3.12', '3.13', '3.15', '3.1')
|
||||
)
|
||||
SELECT
|
||||
COALESCE(t1.count_subpoena, 0) AS count_subpoena,
|
||||
COALESCE(t2.average_appeared, 0) AS average_appeared,
|
||||
COALESCE(t3.count_appeared, 0) AS count_appeared,
|
||||
COALESCE(t4.count_not_appeared, 0) AS count_not_appeared,
|
||||
COALESCE(t5.count_not_ap_good_reason, 0) AS count_not_ap_good_reason,
|
||||
COALESCE(t6.count_ap_not_required, 0) AS count_ap_not_required,
|
||||
COALESCE(t7.count_restrictions_applied, 0) AS count_restrictions_applied,
|
||||
COALESCE(t8.count_introduced_measures, 0) AS count_introduced_measures,
|
||||
COALESCE(t9.count_paper, 0) AS count_paper,
|
||||
COALESCE(t10.count_electron, 0) AS count_electron,
|
||||
COALESCE(t11.count_restrictions, 0) AS count_restrictions,
|
||||
COALESCE(t12.count_not_delivery, 0) AS count_not_delivery,
|
||||
COALESCE(t13.appear_date_is_good, 0) AS appear_date_is_good,
|
||||
ROUND(COALESCE(t3.count_appeared, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS appeared_percent,
|
||||
ROUND(COALESCE(t4.count_not_appeared, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS not_appeared_percent,
|
||||
ROUND(COALESCE(t5.count_not_ap_good_reason, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS not_ap_good_reason_percent,
|
||||
ROUND(COALESCE(t6.count_ap_not_required, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS ap_not_required_percent,
|
||||
ROUND(COALESCE(t10.count_electron, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS electron_percent,
|
||||
ROUND(COALESCE(t9.count_paper, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS paper_percent,
|
||||
ROUND(COALESCE(t7.count_restrictions_applied, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS restrictions_applied_percent,
|
||||
ROUND(COALESCE(t8.count_introduced_measures, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS introduced_measures_percent,
|
||||
ROUND(COALESCE(t12.count_not_delivery, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS not_delivery_percent,
|
||||
ROUND(COALESCE(t13.appear_date_is_good, 0) * 100.0 / NULLIF(t1.count_subpoena, 0), 2) AS appear_date_is_good_percent,
|
||||
'${REG_ID}' AS recruitment_id,
|
||||
1 AS org,
|
||||
0 AS rest,
|
||||
'Осень' AS spring_autumn
|
||||
FROM t1
|
||||
FULL OUTER JOIN t2 ON true
|
||||
FULL OUTER JOIN t3 ON true
|
||||
FULL OUTER JOIN t4 ON true
|
||||
FULL OUTER JOIN t5 ON true
|
||||
FULL OUTER JOIN t6 ON true
|
||||
FULL OUTER JOIN t7 ON true
|
||||
FULL OUTER JOIN t8 ON true
|
||||
FULL OUTER JOIN t9 ON true
|
||||
FULL OUTER JOIN t10 ON true
|
||||
FULL OUTER JOIN t11 ON true
|
||||
FULL OUTER JOIN t12 ON true
|
||||
FULL OUTER JOIN t13 ON true
|
||||
WHERE NOT (
|
||||
COALESCE('${VK_ARRAY}', '') = ''
|
||||
AND (
|
||||
COALESCE(t1.count_subpoena, 0) > 0
|
||||
OR COALESCE(t2.average_appeared, 0) > 0
|
||||
OR COALESCE(t3.count_appeared, 0) > 0
|
||||
OR COALESCE(t4.count_not_appeared, 0) > 0
|
||||
OR COALESCE(t5.count_not_ap_good_reason, 0) > 0
|
||||
OR COALESCE(t6.count_ap_not_required, 0) > 0
|
||||
OR COALESCE(t7.count_restrictions_applied, 0) > 0
|
||||
OR COALESCE(t8.count_introduced_measures, 0) > 0
|
||||
OR COALESCE(t9.count_paper, 0) > 0
|
||||
OR COALESCE(t10.count_electron, 0) > 0
|
||||
OR COALESCE(t11.count_restrictions, 0) > 0
|
||||
OR COALESCE(t12.count_not_delivery, 0) > 0
|
||||
OR COALESCE(t13.appear_date_is_good, 0) > 0
|
||||
)
|
||||
);</sql>
|
||||
<limit>0</limit>
|
||||
<lookup/>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>SELECT
|
||||
COALESCE(SUM(subpoena), 0) count_subpoena,
|
||||
COALESCE(SUM(appeared), 0) count_appeared,
|
||||
COALESCE(SUM(not_appeared), 0) count_not_appeared,
|
||||
COALESCE(SUM(not_ap_good_reason), 0) count_not_ap_good_reason,
|
||||
COALESCE(SUM(introduced_measures), 0) count_introduced_measures,
|
||||
COALESCE(SUM(ap_not_required), 0) count_ap_not_required,
|
||||
COALESCE(SUM(restrictions_applied), 0) count_restrictions_applied,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(appeared) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) appeared_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(not_appeared) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) not_appeared_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(not_ap_good_reason) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) not_ap_good_reason_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(ap_not_required) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) ap_not_required_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(restrictions_applied) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) restrictions_applied_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(introduced_measures) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) introduced_measures_percent,
|
||||
COALESCE(SUM(rest), 0) rest,
|
||||
COALESCE(SUM(count_not_delivery), 0) count_not_delivery,
|
||||
COALESCE(SUM(appear_date_is_good), 0) appear_date_is_good,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(count_not_delivery) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) not_delivery_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(count_not_delivery) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) not_delivery_percent,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(subpoena) > 0
|
||||
THEN ROUND((SUM(appear_date_is_good) / SUM(subpoena) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) appear_date_is_good_percent,
|
||||
'${REG_ID}' AS recruitment_id,
|
||||
spring_autumn,
|
||||
'Organization' AS schema
|
||||
FROM recruitment_campaign.subpoenas
|
||||
WHERE recruitment_id = ANY ('${VK_ARRAY}')
|
||||
AND schema IN ('Department', 'REG_LVL')
|
||||
AND recording_date = CURRENT_DATE
|
||||
GROUP BY spring_autumn;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<lazy_conversion_active>N</lazy_conversion_active>
|
||||
<attributes/>
|
||||
<cluster_schema/>
|
||||
<GUI>
|
||||
<xloc>160</xloc>
|
||||
<yloc>400</yloc>
|
||||
<draw>Y</draw>
|
||||
<xloc>1088</xloc>
|
||||
<yloc>448</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue