add workflow 天润Smart-ccc会话数据,dev

This commit is contained in:
root 2024-09-14 17:51:18 +08:00
parent 3fb4bb51d8
commit 4b05d31173
2 changed files with 14 additions and 3 deletions

View File

@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS p30_common.d_ccc_cust_info (
, phase_id VARCHAR(10)
, phase_reason_id VARCHAR(10)
, promote_source VARCHAR(20)
, origin_tel text
, Etl_Batch_No varchar(50)
, Etl_First_Dt timestamp(0)
, Etl_Job varchar(200)
@ -61,6 +62,7 @@ CREATE TABLE IF NOT EXISTS p30_common.d_ccc_cust_info (
COMMENT ON COLUMN p30_common.d_ccc_cust_info.phase_id IS '客户阶段id';
COMMENT ON COLUMN p30_common.d_ccc_cust_info.phase_reason_id IS '阶段原因id';
COMMENT ON COLUMN p30_common.d_ccc_cust_info.promote_source IS '推广来源';
COMMENT ON COLUMN p30_common.d_ccc_cust_info.origin_tel IS '原始电话';
COMMENT ON COLUMN p30_common.d_ccc_cust_info.Etl_Batch_No IS '作业批次号';
COMMENT ON COLUMN p30_common.d_ccc_cust_info.Etl_First_Dt IS '最初入库时间';
COMMENT ON COLUMN p30_common.d_ccc_cust_info.Etl_Job IS '作业名称';

View File

@ -4,11 +4,11 @@
/*Brilliance stems from wisdoms. */
/*************Head Section**************************************************************************/
/*Script Use: Periodically load data to :d_ccc_cust_info(ccc客户信息) */
/*Create Date:2024-08-01 10:57:52 */
/*Create Date:2024-09-14 16:21:41 */
/*SDM Developed By: dev */
/*SDM Developed Date: 2024-08-01 */
/*SDM Checked By: dev */
/*SDM Checked Date: 2024-08-01 */
/*SDM Checked Date: 2024-09-14 */
/*Script Developed By: dev */
/*Script Checked By: dev */
/*Source table 1: :PDMDB.t01_ccc_cust_info */
@ -67,6 +67,7 @@ INSERT INTO d_ccc_cust_info_agi_CUR_I (
,phase_id /*客户阶段id*/
,phase_reason_id /*阶段原因id*/
,promote_source /*推广来源*/
,origin_tel /*原始电话*/
,Etl_Batch_No /*作业批次号*/
,Etl_First_Dt /*最初入库时间*/
,Etl_Job /*作业名称*/
@ -79,7 +80,7 @@ SELECT
COALESCE(TRIM(p0.id),'') /*id*/
,COALESCE(TRIM(p0.name),'') /*name*/
,COALESCE(TRIM(p0.sex),'') /*sex*/
,coalesce(replace(replace(replace(replace(split_part(p0.tel,',',1),'"',''),'[',''),']',''),'null',''),'') /*tel*/
,coalesce(find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'null') /*tel*/
,COALESCE(TRIM(p0.email),'') /*email*/
,COALESCE(TRIM(p0.address),'') /*address*/
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
@ -111,6 +112,7 @@ SELECT
,COALESCE(TRIM(p0.phase_id),'') /*phase_id*/
,COALESCE(TRIM(p0.phase_reason_id),'') /*phase_reason_id*/
,COALESCE(TRIM(p0.promote_source),'') /*promote_source*/
,COALESCE(TRIM(p0.tel),'') /*origin_tel*/
,0 /*Etl_Batch_No*/
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/
,:ETLJOB /*Etl_Job*/
@ -150,6 +152,7 @@ FROM :PDMDB.t01_ccc_cust_info p0
,phase_id /*客户阶段id*/
,phase_reason_id /*阶段原因id*/
,promote_source /*推广来源*/
,origin_tel /*原始电话*/
,id /*客户资料id*/
,Etl_Batch_No /*作业批次号*/
,Etl_First_Dt /*最初入库时间*/
@ -185,6 +188,7 @@ FROM :PDMDB.t01_ccc_cust_info p0
,P1.phase_id /*客户阶段id*/
,P1.phase_reason_id /*阶段原因id*/
,P1.promote_source /*推广来源*/
,P1.origin_tel /*原始电话*/
,P1.id /*客户资料id*/
,P1.Etl_Batch_No /*作业批次号*/
,P1.Etl_First_Dt /*最初入库时间*/
@ -220,6 +224,7 @@ ON P1.name = P2.name
AND P1.phase_id = P2.phase_id
AND P1.phase_reason_id = P2.phase_reason_id
AND P1.promote_source = P2.promote_source
AND P1.origin_tel = P2.origin_tel
AND P1.id = P2.id
WHERE P2.name IS NULL
@ -246,6 +251,7 @@ WHERE P2.name IS NULL
OR P2.phase_id IS NULL
OR P2.phase_reason_id IS NULL
OR P2.promote_source IS NULL
OR P2.origin_tel IS NULL
OR P2.id IS NULL
;
@ -275,6 +281,7 @@ WHERE P2.name IS NULL
,phase_id /*客户阶段id*/
,phase_reason_id /*阶段原因id*/
,promote_source /*推广来源*/
,origin_tel /*原始电话*/
,id /*客户资料id*/
,Etl_Batch_No /*作业批次号*/
,Etl_First_Dt /*最初入库时间*/
@ -310,6 +317,7 @@ SELECT
,P1.phase_id /*客户阶段id*/
,P1.phase_reason_id /*阶段原因id*/
,P1.promote_source /*推广来源*/
,P1.origin_tel /*原始电话*/
,P1.id /*客户资料id*/
,P1.Etl_Batch_No /*作业批次号*/
,P1.Etl_First_Dt /*最初入库时间*/
@ -347,6 +355,7 @@ DO UPDATE SET
,phase_id=excluded.phase_id
,phase_reason_id=excluded.phase_reason_id
,promote_source=excluded.promote_source
,origin_tel=excluded.origin_tel
,Etl_Batch_No=excluded.Etl_Batch_No
,Etl_First_Dt=excluded.Etl_First_Dt
,Etl_Job=excluded.Etl_Job