add workflow 泰克客户,dev
This commit is contained in:
parent
69223c2afe
commit
a59eee1684
|
@ -0,0 +1,48 @@
|
|||
|
||||
DROP TABLE IF EXISTS p20_pdm.t01_udesk_record;
|
||||
CREATE TABLE IF NOT EXISTS p20_pdm.t01_udesk_record (
|
||||
record_time timestamp(0)
|
||||
, duration time
|
||||
, cust varchar(20)
|
||||
, mobile_phone varchar(20)
|
||||
, call_result varchar(20)
|
||||
, call_origin_location varchar(20)
|
||||
, relay_number varchar(50)
|
||||
, satisfaction varchar(20)
|
||||
, type varchar(20)
|
||||
, device_status varchar(20)
|
||||
, company_name varchar(20)
|
||||
, queue_status varchar(20)
|
||||
, queue_time time
|
||||
, message varchar(20)
|
||||
, hung_up varchar(20)
|
||||
, responsible_group varchar(20)
|
||||
, blacklist varchar(20)
|
||||
, inquiry_content varchar(20)
|
||||
, icr_record text
|
||||
, call_id varchar(50)
|
||||
,primary key( record_time,call_id )
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.record_time IS '记录时间';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.duration IS '通话时长';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.cust IS '客户';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.mobile_phone IS '客户电话';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.call_result IS '通话结果';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.call_origin_location IS '归属地';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.relay_number IS '中继号';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.satisfaction IS '满意度评价';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.type IS '通话类型';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.device_status IS '设备状态';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.company_name IS '公司';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.queue_status IS '排队状态';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.queue_time IS '排队耗时';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.message IS '留言';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.hung_up IS '通话挂断方';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.responsible_group IS '负责组';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.blacklist IS '是否在黑名单';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.inquiry_content IS '咨询内容';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.icr_record IS 'IVR录音';
|
||||
COMMENT ON COLUMN p20_pdm.t01_udesk_record.call_id IS 'Call ID';
|
||||
|
||||
COMMENT ON TABLE p20_pdm.t01_udesk_record IS 'Udesk记录';
|
|
@ -0,0 +1,258 @@
|
|||
/***************************************************************************************************/
|
||||
/*script in Sql, generate by SdmCreateScript 2020(by Qihang Feng, QF255001@TERADATA.COM) */
|
||||
/*VERSION 01.10 revised on 2020-08-25 */
|
||||
/*Brilliance stems from wisdoms. */
|
||||
/*************Head Section**************************************************************************/
|
||||
/*Script Use: Periodically load data to :t01_udesk_record(Udesk记录) */
|
||||
/*Create Date:2024-01-25 11:31:31 */
|
||||
/*SDM Developed By: dev */
|
||||
/*SDM Developed Date: 2024-01-15 */
|
||||
/*SDM Checked By: dev */
|
||||
/*SDM Checked Date: 2024-01-25 */
|
||||
/*Script Developed By: dev */
|
||||
/*Script Checked By: dev */
|
||||
/*Source table 1: p10_sa.s98_s_udesk_record */
|
||||
/*Job Type: Inbound transform (Tier 1 to Tier 2) */
|
||||
/*Target Table:t01_udesk_record */
|
||||
/*ETL Job Name:t01_udesk_record */
|
||||
/*ETL Frequency:Daily */
|
||||
/*ETL Policy:F2 */
|
||||
/********************************************************************************************/
|
||||
/*******Main Section**************************************************************************/
|
||||
\set ON_ERROR_STOP on
|
||||
\set AUTOCOMMIT on
|
||||
\timing on
|
||||
|
||||
|
||||
|
||||
/*创建临时表加载当前数据 */
|
||||
CREATE TEMPORARY TABLE t01_udesk_record_agi_CUR_I
|
||||
( LIKE :PDMDB.t01_udesk_record)
|
||||
ON COMMIT PRESERVE ROWS;
|
||||
|
||||
|
||||
|
||||
/*创建临时表加载不同数据 */
|
||||
CREATE TEMPORARY TABLE t01_udesk_record_agi_INS
|
||||
( LIKE :PDMDB.t01_udesk_record)
|
||||
ON COMMIT PRESERVE ROWS;
|
||||
|
||||
|
||||
/*****************************************************************************************************/
|
||||
/* GROUP 1:Source Table:s98_s_udesk_record************************************************************/
|
||||
/*****************************************************************************************************/
|
||||
INSERT INTO t01_udesk_record_agi_CUR_I (
|
||||
record_time /*记录时间*/
|
||||
,duration /*通话时长*/
|
||||
,cust /*客户*/
|
||||
,mobile_phone /*客户电话*/
|
||||
,call_result /*通话结果*/
|
||||
,call_origin_location /*归属地*/
|
||||
,relay_number /*中继号*/
|
||||
,satisfaction /*满意度评价*/
|
||||
,type /*通话类型*/
|
||||
,device_status /*设备状态*/
|
||||
,company_name /*公司*/
|
||||
,queue_status /*排队状态*/
|
||||
,queue_time /*排队耗时*/
|
||||
,message /*留言*/
|
||||
,hung_up /*通话挂断方*/
|
||||
,responsible_group /*负责组*/
|
||||
,blacklist /*是否在黑名单*/
|
||||
,inquiry_content /*咨询内容*/
|
||||
,icr_record /*IVR录音*/
|
||||
,call_id /*Call ID*/
|
||||
)
|
||||
SELECT
|
||||
COALESCE(TO_TIMESTAMP(CAST(p0.record_time AS VARCHAR(19)),'YYYY-MM-DD HH24:mi:ss'),TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*record_time*/
|
||||
,COALESCE(CAST(p0.duration AS time),'00:00:00'::time) /*duration*/
|
||||
,COALESCE(TRIM(CAST(p0.cust AS varchar(20))),'') /*cust*/
|
||||
,COALESCE(TRIM(CAST(p0.mobile_phone AS varchar(20))),'') /*mobile_phone*/
|
||||
,COALESCE(TRIM(CAST(p0.call_result AS varchar(20))),'') /*call_result*/
|
||||
,COALESCE(TRIM(CAST(p0.call_origin_location AS varchar(20))),'') /*call_origin_location*/
|
||||
,COALESCE(TRIM(CAST(p0.relay_number AS varchar(50))),'') /*relay_number*/
|
||||
,COALESCE(TRIM(CAST(p0.satisfaction AS varchar(20))),'') /*satisfaction*/
|
||||
,COALESCE(TRIM(CAST(p0.type AS varchar(20))),'') /*type*/
|
||||
,COALESCE(TRIM(CAST(p0.device_status AS varchar(20))),'') /*device_status*/
|
||||
,COALESCE(TRIM(CAST(p0.company_name AS varchar(20))),'') /*company_name*/
|
||||
,COALESCE(TRIM(CAST(p0.queue_status AS varchar(20))),'') /*queue_status*/
|
||||
,COALESCE(CAST(p0.queue_time AS time),'00:00:00'::time) /*queue_time*/
|
||||
,COALESCE(TRIM(CAST(p0.message AS varchar(20))),'') /*message*/
|
||||
,COALESCE(TRIM(CAST(p0.hung_up AS varchar(20))),'') /*hung_up*/
|
||||
,COALESCE(TRIM(CAST(p0.responsible_group AS varchar(20))),'') /*responsible_group*/
|
||||
,COALESCE(TRIM(CAST(p0.blacklist AS varchar(20))),'') /*blacklist*/
|
||||
,COALESCE(TRIM(CAST(p0.inquiry_content AS varchar(20))),'') /*inquiry_content*/
|
||||
,COALESCE(TRIM(p0.icr_record),'') /*icr_record*/
|
||||
,COALESCE(TRIM(CAST(p0.call_id AS varchar(50))),'') /*call_id*/
|
||||
|
||||
FROM p10_sa.s98_s_udesk_record p0
|
||||
;
|
||||
|
||||
|
||||
|
||||
/*将不同数据插入到临时表 */
|
||||
;INSERT INTO t01_udesk_record_agi_INS (
|
||||
duration /*通话时长*/
|
||||
,cust /*客户*/
|
||||
,mobile_phone /*客户电话*/
|
||||
,call_result /*通话结果*/
|
||||
,call_origin_location /*归属地*/
|
||||
,relay_number /*中继号*/
|
||||
,satisfaction /*满意度评价*/
|
||||
,type /*通话类型*/
|
||||
,device_status /*设备状态*/
|
||||
,company_name /*公司*/
|
||||
,queue_status /*排队状态*/
|
||||
,queue_time /*排队耗时*/
|
||||
,message /*留言*/
|
||||
,hung_up /*通话挂断方*/
|
||||
,responsible_group /*负责组*/
|
||||
,blacklist /*是否在黑名单*/
|
||||
,inquiry_content /*咨询内容*/
|
||||
,icr_record /*IVR录音*/
|
||||
,record_time /*记录时间*/
|
||||
,call_id /*Call ID*/
|
||||
|
||||
)
|
||||
SELECT
|
||||
P1.duration /*通话时长*/
|
||||
,P1.cust /*客户*/
|
||||
,P1.mobile_phone /*客户电话*/
|
||||
,P1.call_result /*通话结果*/
|
||||
,P1.call_origin_location /*归属地*/
|
||||
,P1.relay_number /*中继号*/
|
||||
,P1.satisfaction /*满意度评价*/
|
||||
,P1.type /*通话类型*/
|
||||
,P1.device_status /*设备状态*/
|
||||
,P1.company_name /*公司*/
|
||||
,P1.queue_status /*排队状态*/
|
||||
,P1.queue_time /*排队耗时*/
|
||||
,P1.message /*留言*/
|
||||
,P1.hung_up /*通话挂断方*/
|
||||
,P1.responsible_group /*负责组*/
|
||||
,P1.blacklist /*是否在黑名单*/
|
||||
,P1.inquiry_content /*咨询内容*/
|
||||
,P1.icr_record /*IVR录音*/
|
||||
,P1.record_time /*记录时间*/
|
||||
,P1.call_id /*Call ID*/
|
||||
|
||||
FROM t01_udesk_record_agi_CUR_I P1
|
||||
LEFT JOIN :PDMDB.t01_udesk_record P2
|
||||
ON P1.duration = P2.duration
|
||||
AND P1.cust = P2.cust
|
||||
AND P1.mobile_phone = P2.mobile_phone
|
||||
AND P1.call_result = P2.call_result
|
||||
AND P1.call_origin_location = P2.call_origin_location
|
||||
AND P1.relay_number = P2.relay_number
|
||||
AND P1.satisfaction = P2.satisfaction
|
||||
AND P1.type = P2.type
|
||||
AND P1.device_status = P2.device_status
|
||||
AND P1.company_name = P2.company_name
|
||||
AND P1.queue_status = P2.queue_status
|
||||
AND P1.queue_time = P2.queue_time
|
||||
AND P1.message = P2.message
|
||||
AND P1.hung_up = P2.hung_up
|
||||
AND P1.responsible_group = P2.responsible_group
|
||||
AND P1.blacklist = P2.blacklist
|
||||
AND P1.inquiry_content = P2.inquiry_content
|
||||
AND P1.icr_record = P2.icr_record
|
||||
AND P1.record_time = P2.record_time
|
||||
AND P1.call_id = P2.call_id
|
||||
|
||||
WHERE P2.duration IS NULL
|
||||
OR P2.cust IS NULL
|
||||
OR P2.mobile_phone IS NULL
|
||||
OR P2.call_result IS NULL
|
||||
OR P2.call_origin_location IS NULL
|
||||
OR P2.relay_number IS NULL
|
||||
OR P2.satisfaction IS NULL
|
||||
OR P2.type IS NULL
|
||||
OR P2.device_status IS NULL
|
||||
OR P2.company_name IS NULL
|
||||
OR P2.queue_status IS NULL
|
||||
OR P2.queue_time IS NULL
|
||||
OR P2.message IS NULL
|
||||
OR P2.hung_up IS NULL
|
||||
OR P2.responsible_group IS NULL
|
||||
OR P2.blacklist IS NULL
|
||||
OR P2.inquiry_content IS NULL
|
||||
OR P2.icr_record IS NULL
|
||||
OR P2.record_time IS NULL
|
||||
OR P2.call_id IS NULL
|
||||
|
||||
;
|
||||
/*将新增数据插入到目标表 */
|
||||
;INSERT INTO :PDMDB.t01_udesk_record (
|
||||
duration /*通话时长*/
|
||||
,cust /*客户*/
|
||||
,mobile_phone /*客户电话*/
|
||||
,call_result /*通话结果*/
|
||||
,call_origin_location /*归属地*/
|
||||
,relay_number /*中继号*/
|
||||
,satisfaction /*满意度评价*/
|
||||
,type /*通话类型*/
|
||||
,device_status /*设备状态*/
|
||||
,company_name /*公司*/
|
||||
,queue_status /*排队状态*/
|
||||
,queue_time /*排队耗时*/
|
||||
,message /*留言*/
|
||||
,hung_up /*通话挂断方*/
|
||||
,responsible_group /*负责组*/
|
||||
,blacklist /*是否在黑名单*/
|
||||
,inquiry_content /*咨询内容*/
|
||||
,icr_record /*IVR录音*/
|
||||
,record_time /*记录时间*/
|
||||
,call_id /*Call ID*/
|
||||
|
||||
)
|
||||
SELECT
|
||||
P1.duration /*通话时长*/
|
||||
,P1.cust /*客户*/
|
||||
,P1.mobile_phone /*客户电话*/
|
||||
,P1.call_result /*通话结果*/
|
||||
,P1.call_origin_location /*归属地*/
|
||||
,P1.relay_number /*中继号*/
|
||||
,P1.satisfaction /*满意度评价*/
|
||||
,P1.type /*通话类型*/
|
||||
,P1.device_status /*设备状态*/
|
||||
,P1.company_name /*公司*/
|
||||
,P1.queue_status /*排队状态*/
|
||||
,P1.queue_time /*排队耗时*/
|
||||
,P1.message /*留言*/
|
||||
,P1.hung_up /*通话挂断方*/
|
||||
,P1.responsible_group /*负责组*/
|
||||
,P1.blacklist /*是否在黑名单*/
|
||||
,P1.inquiry_content /*咨询内容*/
|
||||
,P1.icr_record /*IVR录音*/
|
||||
,P1.record_time /*记录时间*/
|
||||
,P1.call_id /*Call ID*/
|
||||
|
||||
FROM t01_udesk_record_agi_INS P1
|
||||
ON CONFLICT ( record_time,call_id)
|
||||
DO UPDATE SET
|
||||
record_time=excluded.record_time
|
||||
,call_id=excluded.call_id
|
||||
,duration=excluded.duration
|
||||
,cust=excluded.cust
|
||||
,mobile_phone=excluded.mobile_phone
|
||||
,call_result=excluded.call_result
|
||||
,call_origin_location=excluded.call_origin_location
|
||||
,relay_number=excluded.relay_number
|
||||
,satisfaction=excluded.satisfaction
|
||||
,type=excluded.type
|
||||
,device_status=excluded.device_status
|
||||
,company_name=excluded.company_name
|
||||
,queue_status=excluded.queue_status
|
||||
,queue_time=excluded.queue_time
|
||||
,message=excluded.message
|
||||
,hung_up=excluded.hung_up
|
||||
,responsible_group=excluded.responsible_group
|
||||
,blacklist=excluded.blacklist
|
||||
,inquiry_content=excluded.inquiry_content
|
||||
,icr_record=excluded.icr_record
|
||||
|
||||
|
||||
;
|
||||
/*****程序结束退出 */
|
||||
\q
|
||||
|
Loading…
Reference in New Issue