From aa672fcc6aff9ba483dfd44c62102bd76e2b5de5 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 14 Feb 2025 09:59:15 +0800 Subject: [PATCH] =?UTF-8?q?add=20workflow=20=E5=A4=A9=E6=B6=A6Smart-ccc?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E6=95=B0=E6=8D=AE,dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cust_chat_record_info_agi.sql | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dev/workflow/TK_Cust/smart_ccc_chat/ccc客户会话记录信息/cust_chat_record_info_agi.sql b/dev/workflow/TK_Cust/smart_ccc_chat/ccc客户会话记录信息/cust_chat_record_info_agi.sql index 3a23f16..96689b5 100644 --- a/dev/workflow/TK_Cust/smart_ccc_chat/ccc客户会话记录信息/cust_chat_record_info_agi.sql +++ b/dev/workflow/TK_Cust/smart_ccc_chat/ccc客户会话记录信息/cust_chat_record_info_agi.sql @@ -4,7 +4,7 @@ /*Brilliance stems from wisdoms. */ /*************Head Section**************************************************************************/ /*Script Use: Periodically load data to :cust_chat_record_info(ccc客户会话记录信息) */ -/*Create Date:2025-02-14 09:53:28 */ +/*Create Date:2025-02-14 09:58:24 */ /*SDM Developed By: dev */ /*SDM Developed Date: 2024-08-14 */ /*SDM Checked By: dev */ @@ -32,14 +32,14 @@ where visitor_ids <>''*/ /*创建临时表加载当前数据 */ CREATE TEMPORARY TABLE cust_chat_record_info_agi_CUR_I - ( LIKE :MARTDB.cust_chat_record_info) + ( LIKE :MART.cust_chat_record_info) ON COMMIT PRESERVE ROWS; /*创建临时表加载不同数据 */ CREATE TEMPORARY TABLE cust_chat_record_info_agi_INS -( LIKE :MARTDB.cust_chat_record_info) +( LIKE :MART.cust_chat_record_info) ON COMMIT PRESERVE ROWS; @@ -79,26 +79,26 @@ INSERT INTO cust_chat_record_info_agi_CUR_I ( ,Src_Table /*来源表*/ ) SELECT - p0.contact_account /*chat_unique_id*/ + COALESCE(TRIM(p0.chat_unique_id),'') /*chat_unique_id*/ ,'Smart CCC' /*chat_channel*/ ,coalesce(p2.data_detail,'') /*contact_channel*/ - ,'' /*contact_app_id*/ - ,p1.group_name /*app_name*/ + ,COALESCE(TRIM(p0.contact_app_id),'') /*contact_app_id*/ + ,COALESCE(TRIM(p0.app_name),'') /*app_name*/ ,case when app_name ='TW官网' then 'TW' when app_name='CN官网' then 'CN' else '企微客服' end /*group_name*/ - ,p1.pre_chat_service /*queue_name*/ + ,COALESCE(TRIM(CAST(p0.queue_name AS VARCHAR(100))),'') /*queue_name*/ ,case when p0.queue_name in ('选型报价','选型报价统计','TW销售服务','选型报价统计chat') then '产品报价' when p0.queue_name in ('售前技术','售后技术','技术支持统计','技术支持统计chat') then '技术支持' when p0.queue_name in ('保内维修','保外维修与计量','维修计量统计','维修计量统计chat') then '维修与校准' when p0.queue_name in ('其他咨询','其他支持统计','其他支持统计chat') then '其他' when p0.queue_name in ('Joe','Kuang_Chun','Lily','Susan','Tina_Zhang') then '其他' - else '其他' end /*service_name*/ - ,p1.chat_creation_time /*start_time*/ - ,p1.chat_start_time + interval '1second' * p1.chat_duration /*end_time*/ - ,p1.chat_duration /*chat_duration_in_seconds*/ - ,p1.queue_duration /*queue_time*/ - ,p1.chat_referrer_url /*referer_url*/ - ,p1.chat_start_url /*first_visit_page_url*/ - ,p1.visitor_livechat_id /*visitor_id*/ + else '其他' end /*service_name*/ + ,COALESCE(p0.start_time,TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*start_time*/ + ,COALESCE(p0.end_time,TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*end_time*/ + ,COALESCE(p0.chat_duration_in_seconds,0) /*chat_duration_in_seconds*/ + ,COALESCE(p0.queue_time,0) /*queue_time*/ + ,COALESCE(TRIM(p0.referer_url),'') /*referer_url*/ + ,COALESCE(TRIM(p0.first_visit_page_url),'') /*first_visit_page_url*/ + ,COALESCE(TRIM(p0.visitor_id),'') /*visitor_id*/ ,coalesce(p1.name,'') /*visitor_name*/ ,coalesce(p1.tel,'') /*visitor_mobile*/ ,coalesce(p1.email,'') /*visitor_email*/ @@ -268,7 +268,7 @@ where contact_channel ='Chat' and p1.visitor_country_code in ('CN','TW') ,P1.Src_Table /*来源表*/ FROM cust_chat_record_info_agi_CUR_I P1 -LEFT JOIN :MARTDB.cust_chat_record_info P2 +LEFT JOIN :MART.cust_chat_record_info P2 ON P1.chat_channel = P2.chat_channel AND P1.contact_channel = P2.contact_channel AND P1.contact_app_id = P2.contact_app_id @@ -317,7 +317,7 @@ WHERE P2.chat_channel IS NULL ; /*将新增数据插入到目标表 */ -;INSERT INTO :MARTDB.cust_chat_record_info ( +;INSERT INTO :MART.cust_chat_record_info ( chat_channel /*平台*/ ,contact_channel /*接入渠道*/ ,contact_app_id /*接入号ID*/