add workflow 天润Smart-ccc会话数据,dev
This commit is contained in:
parent
b4375c5627
commit
df0f921229
|
@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS p20_pdm.t01_ccc_chat_message_detail (
|
|||
, Etl_Tx_Dt timestamp(0)
|
||||
, Src_Sysname varchar(50)
|
||||
, Src_Table varchar(50)
|
||||
,primary key( message_unique_id,create_time )
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN p20_pdm.t01_ccc_chat_message_detail.message_unique_id IS ' 消息编号';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*Brilliance stems from wisdoms. */
|
||||
/*************Head Section**************************************************************************/
|
||||
/*Script Use: Periodically load data to :t01_ccc_chat_message_detail(smartccc会话消息详情) */
|
||||
/*Create Date:2025-02-14 12:02:48 */
|
||||
/*Create Date:2025-02-14 12:09:18 */
|
||||
/*SDM Developed By: dev */
|
||||
/*SDM Developed Date: 2024-07-19 */
|
||||
/*SDM Checked By: dev */
|
||||
|
@ -16,7 +16,7 @@
|
|||
/*Target Table:t01_ccc_chat_message_detail */
|
||||
/*ETL Job Name:t01_ccc_chat_message_detail */
|
||||
/*ETL Frequency:Daily */
|
||||
/*ETL Policy:F2 */
|
||||
/*ETL Policy:I */
|
||||
/********************************************************************************************/
|
||||
/*******Main Section**************************************************************************/
|
||||
\set ON_ERROR_STOP on
|
||||
|
@ -31,13 +31,6 @@ CREATE TEMPORARY TABLE t01_ccc_chat_message_detail_agi_CUR_I
|
|||
ON COMMIT PRESERVE ROWS;
|
||||
|
||||
|
||||
|
||||
/*创建临时表加载不同数据 */
|
||||
CREATE TEMPORARY TABLE t01_ccc_chat_message_detail_agi_INS
|
||||
( LIKE :PDMDB.t01_ccc_chat_message_detail)
|
||||
ON COMMIT PRESERVE ROWS;
|
||||
|
||||
|
||||
/*****************************************************************************************************/
|
||||
/* GROUP 1:Source Table:s98_s_tr_chat_messages_new****************************************************/
|
||||
/*****************************************************************************************************/
|
||||
|
@ -90,153 +83,52 @@ FROM p10_sa.s98_s_tr_chat_messages_new p0
|
|||
|
||||
|
||||
|
||||
/*将不同数据插入到临时表 */
|
||||
;INSERT INTO t01_ccc_chat_message_detail_agi_INS (
|
||||
chat_unique_id /*在线客服会话ID*/
|
||||
,sender_id /*消息发送方ID*/
|
||||
,sender_name /*消息发送方名称*/
|
||||
,sender_type /*消息发送方类型*/
|
||||
,message_type /*消息类型*/
|
||||
,content /*消息内容*/
|
||||
,file_address /*文件的地址*/
|
||||
,file_name /*文件名称*/
|
||||
,file_url /*文件访问路径*/
|
||||
,send_status /*消息发送状态*/
|
||||
,sensitive_word /*敏感词*/
|
||||
,message_unique_id /* 消息编号*/
|
||||
,create_time /*消息创建时间戳*/
|
||||
,Etl_Batch_No /*作业批次号*/
|
||||
,Etl_First_Dt /*最初入库时间*/
|
||||
,Etl_Job /*作业名称*/
|
||||
,Etl_Proc_Dt /*本次入库时间*/
|
||||
,Etl_Tx_Dt /*作业运行时间*/
|
||||
,Src_Sysname /*来源系统*/
|
||||
,Src_Table /*来源表*/
|
||||
|
||||
)
|
||||
SELECT
|
||||
P1.chat_unique_id /*在线客服会话ID*/
|
||||
,P1.sender_id /*消息发送方ID*/
|
||||
,P1.sender_name /*消息发送方名称*/
|
||||
,P1.sender_type /*消息发送方类型*/
|
||||
,P1.message_type /*消息类型*/
|
||||
,P1.content /*消息内容*/
|
||||
,P1.file_address /*文件的地址*/
|
||||
,P1.file_name /*文件名称*/
|
||||
,P1.file_url /*文件访问路径*/
|
||||
,P1.send_status /*消息发送状态*/
|
||||
,P1.sensitive_word /*敏感词*/
|
||||
,P1.message_unique_id /* 消息编号*/
|
||||
,P1.create_time /*消息创建时间戳*/
|
||||
,P1.Etl_Batch_No /*作业批次号*/
|
||||
,P1.Etl_First_Dt /*最初入库时间*/
|
||||
,P1.Etl_Job /*作业名称*/
|
||||
,P1.Etl_Proc_Dt /*本次入库时间*/
|
||||
,P1.Etl_Tx_Dt /*作业运行时间*/
|
||||
,P1.Src_Sysname /*来源系统*/
|
||||
,P1.Src_Table /*来源表*/
|
||||
|
||||
FROM t01_ccc_chat_message_detail_agi_CUR_I P1
|
||||
LEFT JOIN :PDMDB.t01_ccc_chat_message_detail P2
|
||||
ON P1.chat_unique_id = P2.chat_unique_id
|
||||
AND P1.sender_id = P2.sender_id
|
||||
AND P1.sender_name = P2.sender_name
|
||||
AND P1.sender_type = P2.sender_type
|
||||
AND P1.message_type = P2.message_type
|
||||
AND P1.content = P2.content
|
||||
AND P1.file_address = P2.file_address
|
||||
AND P1.file_name = P2.file_name
|
||||
AND P1.file_url = P2.file_url
|
||||
AND P1.send_status = P2.send_status
|
||||
AND P1.sensitive_word = P2.sensitive_word
|
||||
AND P1.message_unique_id = P2.message_unique_id
|
||||
AND P1.create_time = P2.create_time
|
||||
|
||||
WHERE P2.chat_unique_id IS NULL
|
||||
OR P2.sender_id IS NULL
|
||||
OR P2.sender_name IS NULL
|
||||
OR P2.sender_type IS NULL
|
||||
OR P2.message_type IS NULL
|
||||
OR P2.content IS NULL
|
||||
OR P2.file_address IS NULL
|
||||
OR P2.file_name IS NULL
|
||||
OR P2.file_url IS NULL
|
||||
OR P2.send_status IS NULL
|
||||
OR P2.sensitive_word IS NULL
|
||||
OR P2.message_unique_id IS NULL
|
||||
OR P2.create_time IS NULL
|
||||
|
||||
;
|
||||
/*将新增数据插入到目标表 */
|
||||
;INSERT INTO :PDMDB.t01_ccc_chat_message_detail (
|
||||
chat_unique_id /*在线客服会话ID*/
|
||||
,sender_id /*消息发送方ID*/
|
||||
,sender_name /*消息发送方名称*/
|
||||
,sender_type /*消息发送方类型*/
|
||||
,message_type /*消息类型*/
|
||||
,content /*消息内容*/
|
||||
,file_address /*文件的地址*/
|
||||
,file_name /*文件名称*/
|
||||
,file_url /*文件访问路径*/
|
||||
,send_status /*消息发送状态*/
|
||||
,sensitive_word /*敏感词*/
|
||||
,message_unique_id /* 消息编号*/
|
||||
,create_time /*消息创建时间戳*/
|
||||
,Etl_Batch_No /*作业批次号*/
|
||||
,Etl_First_Dt /*最初入库时间*/
|
||||
,Etl_Job /*作业名称*/
|
||||
,Etl_Proc_Dt /*本次入库时间*/
|
||||
,Etl_Tx_Dt /*作业运行时间*/
|
||||
,Src_Sysname /*来源系统*/
|
||||
,Src_Table /*来源表*/
|
||||
INSERT INTO :PDMDB.t01_ccc_chat_message_detail (
|
||||
message_unique_id /* 消息编号*/
|
||||
,chat_unique_id /*在线客服会话ID*/
|
||||
,sender_id /*消息发送方ID*/
|
||||
,sender_name /*消息发送方名称*/
|
||||
,sender_type /*消息发送方类型*/
|
||||
,message_type /*消息类型*/
|
||||
,content /*消息内容*/
|
||||
,file_address /*文件的地址*/
|
||||
,file_name /*文件名称*/
|
||||
,file_url /*文件访问路径*/
|
||||
,send_status /*消息发送状态*/
|
||||
,sensitive_word /*敏感词*/
|
||||
,create_time /*消息创建时间戳*/
|
||||
,Etl_Batch_No /*作业批次号*/
|
||||
,Etl_First_Dt /*最初入库时间*/
|
||||
,Etl_Job /*作业名称*/
|
||||
,Etl_Proc_Dt /*本次入库时间*/
|
||||
,Etl_Tx_Dt /*作业运行时间*/
|
||||
,Src_Sysname /*来源系统*/
|
||||
,Src_Table /*来源表*/
|
||||
|
||||
)
|
||||
SELECT
|
||||
P1.chat_unique_id /*在线客服会话ID*/
|
||||
,P1.sender_id /*消息发送方ID*/
|
||||
,P1.sender_name /*消息发送方名称*/
|
||||
,P1.sender_type /*消息发送方类型*/
|
||||
,P1.message_type /*消息类型*/
|
||||
,P1.content /*消息内容*/
|
||||
,P1.file_address /*文件的地址*/
|
||||
,P1.file_name /*文件名称*/
|
||||
,P1.file_url /*文件访问路径*/
|
||||
,P1.send_status /*消息发送状态*/
|
||||
,P1.sensitive_word /*敏感词*/
|
||||
,P1.message_unique_id /* 消息编号*/
|
||||
,P1.create_time /*消息创建时间戳*/
|
||||
,P1.Etl_Batch_No /*作业批次号*/
|
||||
,P1.Etl_First_Dt /*最初入库时间*/
|
||||
,P1.Etl_Job /*作业名称*/
|
||||
,P1.Etl_Proc_Dt /*本次入库时间*/
|
||||
,P1.Etl_Tx_Dt /*作业运行时间*/
|
||||
,P1.Src_Sysname /*来源系统*/
|
||||
,P1.Src_Table /*来源表*/
|
||||
|
||||
FROM t01_ccc_chat_message_detail_agi_INS P1
|
||||
ON CONFLICT ( message_unique_id,create_time)
|
||||
DO UPDATE SET
|
||||
message_unique_id=excluded.message_unique_id
|
||||
,create_time=excluded.create_time
|
||||
,chat_unique_id=excluded.chat_unique_id
|
||||
,sender_id=excluded.sender_id
|
||||
,sender_name=excluded.sender_name
|
||||
,sender_type=excluded.sender_type
|
||||
,message_type=excluded.message_type
|
||||
,content=excluded.content
|
||||
,file_address=excluded.file_address
|
||||
,file_name=excluded.file_name
|
||||
,file_url=excluded.file_url
|
||||
,send_status=excluded.send_status
|
||||
,sensitive_word=excluded.sensitive_word
|
||||
,Etl_Batch_No=excluded.Etl_Batch_No
|
||||
,Etl_First_Dt=excluded.Etl_First_Dt
|
||||
,Etl_Job=excluded.Etl_Job
|
||||
,Etl_Proc_Dt=excluded.Etl_Proc_Dt
|
||||
,Etl_Tx_Dt=excluded.Etl_Tx_Dt
|
||||
,Src_Sysname=excluded.Src_Sysname
|
||||
,Src_Table=excluded.Src_Table
|
||||
P1.message_unique_id /* 消息编号*/
|
||||
,P1.chat_unique_id /*在线客服会话ID*/
|
||||
,P1.sender_id /*消息发送方ID*/
|
||||
,P1.sender_name /*消息发送方名称*/
|
||||
,P1.sender_type /*消息发送方类型*/
|
||||
,P1.message_type /*消息类型*/
|
||||
,P1.content /*消息内容*/
|
||||
,P1.file_address /*文件的地址*/
|
||||
,P1.file_name /*文件名称*/
|
||||
,P1.file_url /*文件访问路径*/
|
||||
,P1.send_status /*消息发送状态*/
|
||||
,P1.sensitive_word /*敏感词*/
|
||||
,P1.create_time /*消息创建时间戳*/
|
||||
,P1.Etl_Batch_No /*作业批次号*/
|
||||
,P1.Etl_First_Dt /*最初入库时间*/
|
||||
,P1.Etl_Job /*作业名称*/
|
||||
,P1.Etl_Proc_Dt /*本次入库时间*/
|
||||
,P1.Etl_Tx_Dt /*作业运行时间*/
|
||||
,P1.Src_Sysname /*来源系统*/
|
||||
,P1.Src_Table /*来源表*/
|
||||
|
||||
FROM t01_ccc_chat_message_detail_agi_CUR_I P1;
|
||||
|
||||
;
|
||||
/*****程序结束退出 */
|
||||
|
|
Loading…
Reference in New Issue