add workflow 泰克客户,dev

This commit is contained in:
root 2024-09-02 13:19:59 +08:00
parent 0c9339b9fc
commit 8cb03defb3
2 changed files with 39 additions and 25 deletions

View File

@ -20,8 +20,9 @@ CREATE TABLE IF NOT EXISTS p20_pdm.t01_udesk_record (
, blacklist varchar(20)
, inquiry_content varchar(20)
, icr_record text
, call_id varchar(50)
,primary key( record_time,call_id )
, call_id varchar(50)
, udesk_source varchar(50)
,primary key( record_time,duration,type,call_id )
);
COMMENT ON COLUMN p20_pdm.t01_udesk_record.record_time IS '记录时间';
@ -44,5 +45,6 @@ CREATE TABLE IF NOT EXISTS p20_pdm.t01_udesk_record (
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 COLUMN p20_pdm.t01_udesk_record.udesk_source IS '来源';
COMMENT ON TABLE p20_pdm.t01_udesk_record IS 'Udesk记录';

View File

@ -4,11 +4,11 @@
/*Brilliance stems from wisdoms. */
/*************Head Section**************************************************************************/
/*Script Use: Periodically load data to :t01_udesk_record(Udesk记录) */
/*Create Date:2024-01-25 11:31:31 */
/*Create Date:2024-09-02 11:38:45 */
/*SDM Developed By: dev */
/*SDM Developed Date: 2024-01-15 */
/*SDM Checked By: dev */
/*SDM Checked Date: 2024-01-25 */
/*SDM Checked Date: 2024-09-02 */
/*Script Developed By: dev */
/*Script Checked By: dev */
/*Source table 1: p10_sa.s98_s_udesk_record */
@ -41,6 +41,7 @@ ON COMMIT PRESERVE ROWS;
/*****************************************************************************************************/
/* GROUP 1:Source Table:s98_s_udesk_record************************************************************/
/*****************************************************************************************************/
INSERT INTO t01_udesk_record_agi_CUR_I (
record_time /*记录时间*/
,duration /*通话时长*/
@ -62,6 +63,7 @@ INSERT INTO t01_udesk_record_agi_CUR_I (
,inquiry_content /*咨询内容*/
,icr_record /*IVR录音*/
,call_id /*Call ID*/
,udesk_source /*来源*/
)
SELECT
COALESCE(TO_TIMESTAMP(CAST(p0.record_time AS VARCHAR(19)),'YYYY-MM-DD HH24:mi:ss'),TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*record_time*/
@ -84,22 +86,23 @@ SELECT
,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*/
,COALESCE(TRIM(CAST(p0.source AS varchar(50))),'') /*udesk_source*/
FROM p10_sa.s98_s_udesk_record p0
where call_result is not null
;
/*将不同数据插入到临时表 */
;INSERT INTO t01_udesk_record_agi_INS (
duration /*通话时长*/
,cust /*客户*/
cust /*客户*/
,mobile_phone /*客户电话*/
,call_result /*通话结果*/
,call_origin_location /*归属地*/
,relay_number /*中继号*/
,satisfaction /*满意度评价*/
,type /*通话类型*/
,device_status /*设备状态*/
,company_name /*公司*/
,queue_status /*排队状态*/
@ -110,19 +113,20 @@ FROM p10_sa.s98_s_udesk_record p0
,blacklist /*是否在黑名单*/
,inquiry_content /*咨询内容*/
,icr_record /*IVR录音*/
,udesk_source /*来源*/
,record_time /*记录时间*/
,duration /*通话时长*/
,type /*通话类型*/
,call_id /*Call ID*/
)
SELECT
P1.duration /*通话时长*/
,P1.cust /*客户*/
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 /*排队状态*/
@ -133,19 +137,20 @@ FROM p10_sa.s98_s_udesk_record p0
,P1.blacklist /*是否在黑名单*/
,P1.inquiry_content /*咨询内容*/
,P1.icr_record /*IVR录音*/
,P1.udesk_source /*来源*/
,P1.record_time /*记录时间*/
,P1.duration /*通话时长*/
,P1.type /*通话类型*/
,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
ON 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
@ -156,17 +161,18 @@ ON P1.duration = P2.duration
AND P1.blacklist = P2.blacklist
AND P1.inquiry_content = P2.inquiry_content
AND P1.icr_record = P2.icr_record
AND P1.udesk_source = P2.udesk_source
AND P1.record_time = P2.record_time
AND P1.duration = P2.duration
AND P1.type = P2.type
AND P1.call_id = P2.call_id
WHERE P2.duration IS NULL
OR P2.cust IS NULL
WHERE 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
@ -177,20 +183,21 @@ WHERE P2.duration IS NULL
OR P2.blacklist IS NULL
OR P2.inquiry_content IS NULL
OR P2.icr_record IS NULL
OR P2.udesk_source IS NULL
OR P2.record_time IS NULL
OR P2.duration IS NULL
OR P2.type IS NULL
OR P2.call_id IS NULL
;
/*将新增数据插入到目标表 */
;INSERT INTO :PDMDB.t01_udesk_record (
duration /*通话时长*/
,cust /*客户*/
cust /*客户*/
,mobile_phone /*客户电话*/
,call_result /*通话结果*/
,call_origin_location /*归属地*/
,relay_number /*中继号*/
,satisfaction /*满意度评价*/
,type /*通话类型*/
,device_status /*设备状态*/
,company_name /*公司*/
,queue_status /*排队状态*/
@ -201,19 +208,20 @@ WHERE P2.duration IS NULL
,blacklist /*是否在黑名单*/
,inquiry_content /*咨询内容*/
,icr_record /*IVR录音*/
,udesk_source /*来源*/
,record_time /*记录时间*/
,duration /*通话时长*/
,type /*通话类型*/
,call_id /*Call ID*/
)
SELECT
P1.duration /*通话时长*/
,P1.cust /*客户*/
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 /*排队状态*/
@ -224,22 +232,25 @@ SELECT
,P1.blacklist /*是否在黑名单*/
,P1.inquiry_content /*咨询内容*/
,P1.icr_record /*IVR录音*/
,P1.udesk_source /*来源*/
,P1.record_time /*记录时间*/
,P1.duration /*通话时长*/
,P1.type /*通话类型*/
,P1.call_id /*Call ID*/
FROM t01_udesk_record_agi_INS P1
ON CONFLICT ( record_time,call_id)
ON CONFLICT ( record_time,duration,type,call_id)
DO UPDATE SET
record_time=excluded.record_time
,call_id=excluded.call_id
,duration=excluded.duration
,type=excluded.type
,call_id=excluded.call_id
,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
@ -250,6 +261,7 @@ DO UPDATE SET
,blacklist=excluded.blacklist
,inquiry_content=excluded.inquiry_content
,icr_record=excluded.icr_record
,udesk_source=excluded.udesk_source
;