add workflow 天润dynamic邮件同步,dev
This commit is contained in:
parent
d33548654a
commit
7b0f19fd41
|
@ -4,11 +4,11 @@
|
|||
/*Brilliance stems from wisdoms. */
|
||||
/*************Head Section**************************************************************************/
|
||||
/*Script Use: Periodically load data to :f_ccc_work_ticket_integ(smartccc工单信息集成) */
|
||||
/*Create Date:2025-03-17 14:18:33 */
|
||||
/*Create Date:2025-04-24 17:00:06 */
|
||||
/*SDM Developed By: dev */
|
||||
/*SDM Developed Date: 2024-07-09 */
|
||||
/*SDM Checked By: dev */
|
||||
/*SDM Checked Date: 2025-03-17 */
|
||||
/*SDM Checked Date: 2025-04-24 */
|
||||
/*Script Developed By: dev */
|
||||
/*Script Checked By: dev */
|
||||
/*Source table 1: :PDMDB.t00_china_city_pnum */
|
||||
|
@ -123,13 +123,11 @@ SELECT
|
|||
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') = '317748'),(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.prov_name,p2.prov_name,'') /*STATE_COUNTY_LOCATION*/
|
||||
,'CN' /*COUNTRY_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*/
|
||||
,case when p1.tel<>'' then coalesce(find_first_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),find_first_not_phone_number(replace(replace(replace(p1.tel,'"',''),'[','{'),']','}')::text[]),'null') else 'null' end /*CONTACT_MOBILE_NUMBER*/
|
||||
,coalesce(p1.email,'') /*EMAIL_ADDRESS*/
|
||||
,'YES' /*REQUEST_A_DEMO*/
|
||||
,'YES' /*REQUEST_A_QUOTE*/
|
||||
|
@ -222,15 +220,11 @@ LEFT JOIN :PDMDB.t01_ccc_cust_info p1
|
|||
LEFT JOIN :PDMDB.t00_china_city_info p2
|
||||
ON p2.city_name like 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') = '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') = '317748'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
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') = '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') = '317748'),(SELECT jsonb_extract_path_text(j, 'value')
|
||||
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
|
||||
LEFT JOIN :PDMDB.t00_china_city_pnum p3
|
||||
|
@ -238,16 +232,12 @@ LEFT JOIN :PDMDB.t00_china_city_pnum p3
|
|||
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') = '317748'),(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') = '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') = '317748'),(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 '1 days'
|
||||
where p0.state_selected in ('Leads') and p0.update_time >= current_date - interval '7 days'
|
||||
|
||||
;
|
||||
|
||||
|
@ -418,7 +408,7 @@ LEFT JOIN :PDMDB.t00_china_city_info p2
|
|||
ON p2.city_name2 like (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') = '304586')::text||'%'
|
||||
where p0 .state_selected ='TW_leads' and p0.update_time >= current_date - interval '3 days'
|
||||
where p0 .state_selected ='TW_leads' and p0.update_time >= current_date - interval '7 days'
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ default_args = {
|
|||
}
|
||||
|
||||
dag = DAG('wf_dag_smart_ccc_dynamic_email', default_args=default_args,
|
||||
schedule_interval="5 10,14,18,12,16 * * *",
|
||||
schedule_interval="5 10,14,18,16 * * *",
|
||||
catchup=False,
|
||||
dagrun_timeout=timedelta(minutes=160),
|
||||
max_active_runs=3)
|
||||
|
|
Loading…
Reference in New Issue