add workflow 天润dynamic邮件同步,dev
This commit is contained in:
parent
7d31f8a77f
commit
9c65e9de4c
|
@ -54,6 +54,7 @@ CREATE TABLE IF NOT EXISTS p30_common.f_ccc_work_ticket_integ (
|
|||
, Etl_Batch_No varchar(50)
|
||||
, second_mobile_number varchar(20)
|
||||
, company_phone_number varchar(20)
|
||||
, district varchar(50)
|
||||
,primary key( SUFFIX )
|
||||
);
|
||||
|
||||
|
@ -110,5 +111,6 @@ CREATE TABLE IF NOT EXISTS p30_common.f_ccc_work_ticket_integ (
|
|||
COMMENT ON COLUMN p30_common.f_ccc_work_ticket_integ.Etl_Batch_No IS '作业批次号';
|
||||
COMMENT ON COLUMN p30_common.f_ccc_work_ticket_integ.second_mobile_number IS '第二手机号';
|
||||
COMMENT ON COLUMN p30_common.f_ccc_work_ticket_integ.company_phone_number IS '固话号';
|
||||
COMMENT ON COLUMN p30_common.f_ccc_work_ticket_integ.district IS '地区';
|
||||
|
||||
COMMENT ON TABLE p30_common.f_ccc_work_ticket_integ IS 'smartccc工单信息集成';
|
|
@ -1,17 +1,17 @@
|
|||
/***************************************************************************************************/
|
||||
/*script in Sql, generate by SdmCreateScript 2020(by Qihang Feng, QF255001@TERADATA.COM) */
|
||||
/*script in Sql, generate by SdmCreateScript 2024(by IdgValue, qihang.feng@idgvalue.COM) */
|
||||
/*VERSION 01.10 revised on 2020-08-25 */
|
||||
/*Brilliance stems from wisdoms. */
|
||||
/*************Head Section**************************************************************************/
|
||||
/*Script Use: Periodically load data to :f_ccc_work_ticket_integ(smartccc工单信息集成) */
|
||||
/*Create Date:2025-01-02 15:13:12 */
|
||||
/*Create Date:2025-03-17 14:18:33 */
|
||||
/*SDM Developed By: dev */
|
||||
/*SDM Developed Date: 2024-07-09 */
|
||||
/*SDM Checked By: dev */
|
||||
/*SDM Checked Date: 2025-01-02 */
|
||||
/*SDM Checked Date: 2025-03-17 */
|
||||
/*Script Developed By: dev */
|
||||
/*Script Checked By: dev */
|
||||
/*Source table 1: :PDMDB.t00_china_city_postnum */
|
||||
/*Source table 1: :PDMDB.t00_china_city_pnum */
|
||||
/*Source table 2: :PDMDB.t01_ccc_cust_info */
|
||||
/*Source table 3: :PDMDB.t00_china_city_info */
|
||||
/*Source table 4: :PDMDB.t01_ccc_work_ticket_info */
|
||||
|
@ -99,6 +99,7 @@ INSERT INTO f_ccc_work_ticket_integ_agi_CUR_I (
|
|||
,Etl_Batch_No /*作业批次号*/
|
||||
,second_mobile_number /*第二手机号*/
|
||||
,company_phone_number /*固话号*/
|
||||
,district /*地区*/
|
||||
)
|
||||
SELECT
|
||||
case when coalesce(p0.start_form::json->>'formName','') ='选型报价_Outbound' then '449662X449662'
|
||||
|
@ -118,14 +119,14 @@ SELECT
|
|||
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements(p1.customize::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'name') = '职位'),'') /*JOB_TITLE*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
,coalesce(p3.city_name,(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '304585'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '317832'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'') /*CITY*/
|
||||
,coalesce(p2.prov_name,'') /*STATE_COUNTY_LOCATION*/
|
||||
,coalesce(p3.prov_name,p2.prov_name,'') /*STATE_COUNTY_LOCATION*/
|
||||
,'CN' /*COUNTRY_CODE*/
|
||||
,coalesce(p2.postalcode,'') /*POSTAL_CODE*/
|
||||
,coalesce(p3.postnumber,p2.postalcode,'') /*POSTAL_CODE*/
|
||||
,coalesce(find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'null') /*CONTACT_MOBILE_NUMBER*/
|
||||
,coalesce(p1.email,'') /*EMAIL_ADDRESS*/
|
||||
,'YES' /*REQUEST_A_DEMO*/
|
||||
|
@ -211,6 +212,7 @@ WHERE jsonb_extract_path_text(field, 'id')::int = 299137),'') /*LEAD_PROD
|
|||
else find_first_phone_number(array_remove(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[],find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[])))
|
||||
end /*second_mobile_number*/
|
||||
,coalesce(find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'') /*company_phone_number*/
|
||||
,coalesce(p3.district,'') /*district*/
|
||||
|
||||
FROM :PDMDB.t01_ccc_work_ticket_info p0
|
||||
LEFT JOIN :PDMDB.t01_ccc_cust_info p1
|
||||
|
@ -225,11 +227,17 @@ LEFT JOIN :PDMDB.t00_china_city_info p2
|
|||
WHERE jsonb_extract_path_text(j, 'id') = '304585'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'')::text||'%' else '' end
|
||||
where p0.state_selected in ('Leads') and coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
LEFT JOIN :PDMDB.t00_china_city_pnum p3
|
||||
ON p3.full_name = case when length(coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '304585'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '317832'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'') not like '%-%' and p0.update_time >= current_date - interval '7 days'
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'')::text)>0 then coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '317832'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'')::text else '' end
|
||||
where p0.state_selected in ('Leads') and p0.update_time >= current_date - interval '7 days'
|
||||
|
||||
;
|
||||
|
||||
|
@ -293,6 +301,7 @@ INSERT INTO f_ccc_work_ticket_integ_agi_CUR_I (
|
|||
,Etl_Batch_No /*作业批次号*/
|
||||
,second_mobile_number /*第二手机号*/
|
||||
,company_phone_number /*固话号*/
|
||||
,district /*地区*/
|
||||
)
|
||||
SELECT
|
||||
'401890X401890' /*PEXTENSION_CODE*/
|
||||
|
@ -392,6 +401,7 @@ WHERE jsonb_extract_path_text(field, 'id')::int = 299137),'') /*LEAD_PROD
|
|||
,0 /*Etl_Batch_No*/
|
||||
,'' /*second_mobile_number*/
|
||||
,'' /*company_phone_number*/
|
||||
,'' /*district*/
|
||||
|
||||
FROM :PDMDB.t01_ccc_work_ticket_info p0
|
||||
LEFT JOIN :PDMDB.t00_china_city_info p2
|
||||
|
@ -404,196 +414,6 @@ where p0 .state_selected ='TW_leads' and p0.update_time >= current_date - interv
|
|||
|
||||
|
||||
|
||||
/*****************************************************************************************************/
|
||||
/* GROUP 3:Source Table:t01_ccc_work_ticket_info******************************************************/
|
||||
/*****************************************************************************************************/
|
||||
|
||||
INSERT INTO f_ccc_work_ticket_integ_agi_CUR_I (
|
||||
PEXTENSION_CODE /*来源代码*/
|
||||
,PEXTENSION /*来源*/
|
||||
,LAST_NAME /*姓名*/
|
||||
,SUFFIX /*工单ID*/
|
||||
,COMPANY_NAME /*公司名称*/
|
||||
,JOB_TITLE /*职位*/
|
||||
,CITY /*城市*/
|
||||
,STATE_COUNTY_LOCATION /*省份*/
|
||||
,COUNTRY_CODE /*国家*/
|
||||
,POSTAL_CODE /*邮编*/
|
||||
,CONTACT_MOBILE_NUMBER /*电话*/
|
||||
,EMAIL_ADDRESS /*邮箱*/
|
||||
,REQUEST_A_DEMO /*demo标志*/
|
||||
,REQUEST_A_QUOTE /*引用标志*/
|
||||
,HAMCAM /*账户管理员标志*/
|
||||
,PURCHASE_INTENT /*购买意向*/
|
||||
,COMMENTS /*备注*/
|
||||
,INDUSTRY /*行业*/
|
||||
,CCP_PRODUCT_INTEREST_01 /*产品偏好*/
|
||||
,CCP_APP_01_5 /*应用*/
|
||||
,LEAD_PRODUCTS_01_5 /*产品型号*/
|
||||
,PERMISSION_PHONE /*电话授权标志*/
|
||||
,PERMISSION_PHONE_DATE /*电话授权时间*/
|
||||
,PERMISSION_EMAIL /*电子邮件授权标志*/
|
||||
,PERMISSION_EMAIL_DATE /*电子邮件授权时间*/
|
||||
,PERMISSION_MAIL /*邮件授权标志*/
|
||||
,PERMISSION_MAIL_DATE /*邮件授权时间*/
|
||||
,PERMISSION_SMS /*SMS授权标志*/
|
||||
,PERMISSION_SMS_DATE /*SMS授权时间*/
|
||||
,AGREES_TO_PRIVACY_POLICY /*个人信息授权标志*/
|
||||
,PORTAL_TERMS_AGREEMENT_DATE /*协议授权时间*/
|
||||
,CONSENT_TO_COLLECT_PERSONAL_INFO /*个人信息收集标志*/
|
||||
,CONSENT_TO_COLLECT_PERSONAL_INFO_DATE /*个人信息收集时间*/
|
||||
,MARKETING_CONSENT /*MARKETING_CONSENT*/
|
||||
,MARKETING_CONSENT_DATE /*MARKETING_CONSENT_DATE*/
|
||||
,MEANS_OF_CONSENT /*MEANS_OF_CONSENT*/
|
||||
,SOURCE_OF_CONSENT /*SOURCE_OF_CONSENT*/
|
||||
,VERSION_OF_PRIVACY_NOTICE /*VERSION_OF_PRIVACY_NOTICE*/
|
||||
,RECORD_OF_CONSENT /*RECORD_OF_CONSENT*/
|
||||
,EXACT_CONSENT_LANGUAGE /*EXACT_CONSENT_LANGUAGE*/
|
||||
,BRAND_TEKTRONIX /*BRAND_TEKTRONIX*/
|
||||
,BRAND_SSO /*BRAND_SSO*/
|
||||
,BRAND_KEITHLEY /*BRAND_KEITHLEY*/
|
||||
,EMAIL_PREFERENCE /*EMAIL_PREFERENCE*/
|
||||
,Src_Sysname /*来源系统*/
|
||||
,Etl_Job /*作业名称*/
|
||||
,Src_Table /*来源表*/
|
||||
,Etl_Tx_Dt /*作业运行时间*/
|
||||
,Etl_First_Dt /*最初入库时间*/
|
||||
,Etl_Proc_Dt /*本次入库时间*/
|
||||
,Etl_Batch_No /*作业批次号*/
|
||||
,second_mobile_number /*第二手机号*/
|
||||
,company_phone_number /*固话号*/
|
||||
)
|
||||
SELECT
|
||||
case when coalesce(p0.start_form::json->>'formName','') ='选型报价_Outbound' then '449662X449662'
|
||||
else coalesce(case when p0."source" ='0' then '305972X317938'
|
||||
when p0."source" ='11' then '445769X445769'
|
||||
else '401890X401890' end,'') end /*PEXTENSION_CODE*/
|
||||
,coalesce(p1."source",'') /*PEXTENSION*/
|
||||
,COALESCE(TRIM(CAST(p0.customer_name AS varchar(20))),'') /*LAST_NAME*/
|
||||
,coalesce(p0.id,'') /*SUFFIX*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '305038'),'')||(case when coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297756'),'') = '' then '' else ',Enduser: '||coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297756'),'') end) /*COMPANY_NAME*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements(p1.customize::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'name') = '职位'),'') /*JOB_TITLE*/
|
||||
,coalesce(split_part(p3.full_name,'-',1),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '304585'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'') /*CITY*/
|
||||
,coalesce(p3.province,'') /*STATE_COUNTY_LOCATION*/
|
||||
,'CN' /*COUNTRY_CODE*/
|
||||
,coalesce(p3.postnumber,'') /*POSTAL_CODE*/
|
||||
,coalesce(find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'null') /*CONTACT_MOBILE_NUMBER*/
|
||||
,coalesce(p1.email,'') /*EMAIL_ADDRESS*/
|
||||
,'YES' /*REQUEST_A_DEMO*/
|
||||
,'YES' /*REQUEST_A_QUOTE*/
|
||||
,'YES' /*HAMCAM*/
|
||||
,4 /*PURCHASE_INTENT*/
|
||||
,'L - mql '||case when p0.workflow_name ='CN离线工单_选型报价' then coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 297757),'') else coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 298246),'') end ||' 预算情况:'||coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 303805),' None ')||';决策权确认:'||coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 303806),' None ')||';计划购买时间:'||coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 298249),' None ')||';' /*COMMENTS*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_297729
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 297729),'') /*INDUSTRY*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298247
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 298247),'') /*CCP_PRODUCT_INTEREST_01*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_297730
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 297730),'') /*CCP_APP_01_5*/
|
||||
,coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298300
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 304927),(SELECT jsonb_extract_path_text(field, 'value') AS value_298300
|
||||
FROM (
|
||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||
) AS t
|
||||
WHERE jsonb_extract_path_text(field, 'id')::int = 299137),'') /*LEAD_PRODUCTS_01_5*/
|
||||
,'YES' /*PERMISSION_PHONE*/
|
||||
,p0.create_time /*PERMISSION_PHONE_DATE*/
|
||||
,'YES' /*PERMISSION_EMAIL*/
|
||||
,p0.create_time /*PERMISSION_EMAIL_DATE*/
|
||||
,'YES' /*PERMISSION_MAIL*/
|
||||
,p0.create_time /*PERMISSION_MAIL_DATE*/
|
||||
,'YES' /*PERMISSION_SMS*/
|
||||
,p0.create_time /*PERMISSION_SMS_DATE*/
|
||||
,'YES' /*AGREES_TO_PRIVACY_POLICY*/
|
||||
,p0.create_time /*PORTAL_TERMS_AGREEMENT_DATE*/
|
||||
,'YES' /*CONSENT_TO_COLLECT_PERSONAL_INFO*/
|
||||
,p0.create_time /*CONSENT_TO_COLLECT_PERSONAL_INFO_DATE*/
|
||||
,'' /*MARKETING_CONSENT*/
|
||||
,TO_TIMESTAMP(:NULLDATE,'YYYYMMDD') /*MARKETING_CONSENT_DATE*/
|
||||
,'' /*MEANS_OF_CONSENT*/
|
||||
,'' /*SOURCE_OF_CONSENT*/
|
||||
,'' /*VERSION_OF_PRIVACY_NOTICE*/
|
||||
,'' /*RECORD_OF_CONSENT*/
|
||||
,'' /*EXACT_CONSENT_LANGUAGE*/
|
||||
,'' /*BRAND_TEKTRONIX*/
|
||||
,'' /*BRAND_SSO*/
|
||||
,'' /*BRAND_KEITHLEY*/
|
||||
,'' /*EMAIL_PREFERENCE*/
|
||||
,Substr('t01_ccc_work_ticket_info',1,3) /*Src_Sysname*/
|
||||
,:ETLJOB /*Etl_Job*/
|
||||
,'t01_ccc_work_ticket_info' /*Src_Table*/
|
||||
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_Tx_Dt*/
|
||||
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/
|
||||
,current_timestamp(0) /*Etl_Proc_Dt*/
|
||||
,0 /*Etl_Batch_No*/
|
||||
,case when cardinality(array_remove(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[],find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[])))=0 then ''
|
||||
else find_first_phone_number(array_remove(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[],find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[])))
|
||||
end /*second_mobile_number*/
|
||||
,coalesce(find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'') /*company_phone_number*/
|
||||
|
||||
FROM :PDMDB.t01_ccc_work_ticket_info p0
|
||||
LEFT JOIN :PDMDB.t01_ccc_cust_info p1
|
||||
ON p0.customer_id =p1.id
|
||||
LEFT JOIN (SELECT * FROM :PDMDB.t00_china_city_postnum where full_name like '%-%') p3
|
||||
ON p3.full_name = case when length(coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '304585'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'')::text)>0 then coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '304585'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||
WHERE jsonb_extract_path_text(j, 'id') = '297755'),'')::text else '' end
|
||||
where p0.state_selected in ('Leads') and p3.full_name like '%-%' and p0.update_time >= current_date - interval '7 days'
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
/*将不同数据插入到临时表 */
|
||||
;INSERT INTO f_ccc_work_ticket_integ_agi_INS (
|
||||
PEXTENSION_CODE /*来源代码*/
|
||||
|
@ -641,6 +461,7 @@ where p0.state_selected in ('Leads') and p3.full_name like '%-%' and p0.update_t
|
|||
,EMAIL_PREFERENCE /*EMAIL_PREFERENCE*/
|
||||
,second_mobile_number /*第二手机号*/
|
||||
,company_phone_number /*固话号*/
|
||||
,district /*地区*/
|
||||
,SUFFIX /*工单ID*/
|
||||
,Src_Sysname /*来源系统*/
|
||||
,Etl_Job /*作业名称*/
|
||||
|
@ -697,6 +518,7 @@ where p0.state_selected in ('Leads') and p3.full_name like '%-%' and p0.update_t
|
|||
,P1.EMAIL_PREFERENCE /*EMAIL_PREFERENCE*/
|
||||
,P1.second_mobile_number /*第二手机号*/
|
||||
,P1.company_phone_number /*固话号*/
|
||||
,P1.district /*地区*/
|
||||
,P1.SUFFIX /*工单ID*/
|
||||
,P1.Src_Sysname /*来源系统*/
|
||||
,P1.Etl_Job /*作业名称*/
|
||||
|
@ -753,6 +575,7 @@ ON P1.PEXTENSION_CODE = P2.PEXTENSION_CODE
|
|||
AND P1.EMAIL_PREFERENCE = P2.EMAIL_PREFERENCE
|
||||
AND P1.second_mobile_number = P2.second_mobile_number
|
||||
AND P1.company_phone_number = P2.company_phone_number
|
||||
AND P1.district = P2.district
|
||||
AND P1.SUFFIX = P2.SUFFIX
|
||||
|
||||
WHERE P2.PEXTENSION_CODE IS NULL
|
||||
|
@ -800,6 +623,7 @@ WHERE P2.PEXTENSION_CODE IS NULL
|
|||
OR P2.EMAIL_PREFERENCE IS NULL
|
||||
OR P2.second_mobile_number IS NULL
|
||||
OR P2.company_phone_number IS NULL
|
||||
OR P2.district IS NULL
|
||||
OR P2.SUFFIX IS NULL
|
||||
|
||||
;
|
||||
|
@ -850,6 +674,7 @@ WHERE P2.PEXTENSION_CODE IS NULL
|
|||
,EMAIL_PREFERENCE /*EMAIL_PREFERENCE*/
|
||||
,second_mobile_number /*第二手机号*/
|
||||
,company_phone_number /*固话号*/
|
||||
,district /*地区*/
|
||||
,SUFFIX /*工单ID*/
|
||||
,Src_Sysname /*来源系统*/
|
||||
,Etl_Job /*作业名称*/
|
||||
|
@ -906,6 +731,7 @@ SELECT
|
|||
,P1.EMAIL_PREFERENCE /*EMAIL_PREFERENCE*/
|
||||
,P1.second_mobile_number /*第二手机号*/
|
||||
,P1.company_phone_number /*固话号*/
|
||||
,P1.district /*地区*/
|
||||
,P1.SUFFIX /*工单ID*/
|
||||
,P1.Src_Sysname /*来源系统*/
|
||||
,P1.Etl_Job /*作业名称*/
|
||||
|
@ -964,6 +790,7 @@ DO UPDATE SET
|
|||
,EMAIL_PREFERENCE=excluded.EMAIL_PREFERENCE
|
||||
,second_mobile_number=excluded.second_mobile_number
|
||||
,company_phone_number=excluded.company_phone_number
|
||||
,district=excluded.district
|
||||
,Src_Sysname=excluded.Src_Sysname
|
||||
,Etl_Job=excluded.Etl_Job
|
||||
,Src_Table=excluded.Src_Table
|
||||
|
|
Loading…
Reference in New Issue