add workflow 天润dynamic邮件同步,dev

This commit is contained in:
root 2024-11-22 10:11:25 +08:00
parent df66233715
commit 86abb9564f
1 changed files with 10 additions and 6 deletions

View File

@ -4,11 +4,11 @@
/*Brilliance stems from wisdoms. */ /*Brilliance stems from wisdoms. */
/*************Head Section**************************************************************************/ /*************Head Section**************************************************************************/
/*Script Use: Periodically load data to :f_ccc_work_ticket_integ(smartccc工单信息集成) */ /*Script Use: Periodically load data to :f_ccc_work_ticket_integ(smartccc工单信息集成) */
/*Create Date:2024-10-17 14:52:27 */ /*Create Date:2024-11-22 10:09:19 */
/*SDM Developed By: dev */ /*SDM Developed By: dev */
/*SDM Developed Date: 2024-07-09 */ /*SDM Developed Date: 2024-07-09 */
/*SDM Checked By: dev */ /*SDM Checked By: dev */
/*SDM Checked Date: 2024-10-17 */ /*SDM Checked Date: 2024-11-22 */
/*Script Developed By: dev */ /*Script Developed By: dev */
/*Script Checked By: dev */ /*Script Checked By: dev */
/*Source table 1: :PDMDB.t01_ccc_cust_info */ /*Source table 1: :PDMDB.t01_ccc_cust_info */
@ -107,7 +107,11 @@ SELECT
,coalesce(p1."source",'') /*PEXTENSION*/ ,coalesce(p1."source",'') /*PEXTENSION*/
,COALESCE(TRIM(CAST(p0.customer_name AS varchar(20))),'') /*LAST_NAME*/ ,COALESCE(TRIM(CAST(p0.customer_name AS varchar(20))),'') /*LAST_NAME*/
,coalesce(p0.id,'') /*SUFFIX*/ ,coalesce(p0.id,'') /*SUFFIX*/
,coalesce((SELECT jsonb_extract_path_text(j, 'value') ,'Company: '||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'),(SELECT jsonb_extract_path_text(j, 'value')
FROM jsonb_array_elements(p1.customize::jsonb) j
WHERE jsonb_extract_path_text(j, 'name') = '公司名称'),'')||',Enduser: '||coalesce((SELECT jsonb_extract_path_text(j, 'value')
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
WHERE jsonb_extract_path_text(j, 'id') = '297756'),(SELECT jsonb_extract_path_text(j, 'value') WHERE jsonb_extract_path_text(j, 'id') = '297756'),(SELECT jsonb_extract_path_text(j, 'value')
FROM jsonb_array_elements(p1.customize::jsonb) j FROM jsonb_array_elements(p1.customize::jsonb) j
@ -123,7 +127,7 @@ SELECT
,coalesce(p2.prov_name,'') /*STATE_COUNTY_LOCATION*/ ,coalesce(p2.prov_name,'') /*STATE_COUNTY_LOCATION*/
,'CN' /*COUNTRY_CODE*/ ,'CN' /*COUNTRY_CODE*/
,coalesce(p2.postalcode,'') /*POSTAL_CODE*/ ,coalesce(p2.postalcode,'') /*POSTAL_CODE*/
,coalesce(find_first_phone_number(replace(replace(replace(COALESCE(p1.tel,'{}'),'"',''),'[','{'),']','}')::text[]),find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'null') /*CONTACT_MOBILE_NUMBER*/ ,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*/ ,coalesce(p1.email,'') /*EMAIL_ADDRESS*/
,'YES' /*REQUEST_A_DEMO*/ ,'YES' /*REQUEST_A_DEMO*/
,'YES' /*REQUEST_A_QUOTE*/ ,'YES' /*REQUEST_A_QUOTE*/
@ -200,8 +204,8 @@ WHERE jsonb_extract_path_text(field, 'id')::int = 299137),'') /*LEAD_PROD
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/ ,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/
,current_timestamp(0) /*Etl_Proc_Dt*/ ,current_timestamp(0) /*Etl_Proc_Dt*/
,0 /*Etl_Batch_No*/ ,0 /*Etl_Batch_No*/
,case when cardinality(array_remove(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[],find_first_phone_number(replace(replace(replace(COALESCE(p1.tel,'{}'),'"',''),'[','{'),']','}')::text[])))=0 then '' ,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(COALESCE(p1.tel,'{}'),'"',''),'[','{'),']','}')::text[],find_first_phone_number(replace(replace(replace(COALESCE(p1.tel,'{}'),'"',''),'[','{'),']','}')::text[]))) 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*/ end /*second_mobile_number*/
,coalesce(find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'') /*company_phone_number*/ ,coalesce(find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'') /*company_phone_number*/