add workflow 天润dynamic邮件同步,dev
This commit is contained in:
parent
86abb9564f
commit
6d7788a423
|
@ -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-11-22 10:09:19 */
|
/*Create Date:2024-12-12 11:47:33 */
|
||||||
/*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-11-22 */
|
/*SDM Checked Date: 2024-12-12 */
|
||||||
/*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,15 +107,13 @@ 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*/
|
||||||
,'Company: '||coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
,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') = '305038'),(SELECT jsonb_extract_path_text(j, 'value')
|
WHERE jsonb_extract_path_text(j, 'id') = '305038'),'')||(case when coalesce((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'),'') = '' then '' else ',Enduser: '||coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||||
FROM jsonb_array_elements(p1.customize::jsonb) j
|
FROM jsonb_array_elements((p0.start_form::json -> 'fields')::jsonb) j
|
||||||
WHERE jsonb_extract_path_text(j, 'name') = '公司名称'),'') /*COMPANY_NAME*/
|
WHERE jsonb_extract_path_text(j, 'id') = '297756'),'') end) /*COMPANY_NAME*/
|
||||||
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
|
||||||
FROM jsonb_array_elements(p1.customize::jsonb) j
|
FROM jsonb_array_elements(p1.customize::jsonb) j
|
||||||
WHERE jsonb_extract_path_text(j, 'name') = '职位'),'') /*JOB_TITLE*/
|
WHERE jsonb_extract_path_text(j, 'name') = '职位'),'') /*JOB_TITLE*/
|
||||||
|
@ -133,11 +131,15 @@ SELECT
|
||||||
,'YES' /*REQUEST_A_QUOTE*/
|
,'YES' /*REQUEST_A_QUOTE*/
|
||||||
,'YES' /*HAMCAM*/
|
,'YES' /*HAMCAM*/
|
||||||
,4 /*PURCHASE_INTENT*/
|
,4 /*PURCHASE_INTENT*/
|
||||||
,'L - mql '||coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
,'L - mql '||case when p0.workflow_name ='CN离线工单_选型报价' then coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
||||||
FROM (
|
FROM (
|
||||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||||
) AS t
|
) AS t
|
||||||
WHERE jsonb_extract_path_text(field, 'id')::int = 298246),'')||' 预算情况:'||coalesce((SELECT jsonb_extract_path_text(field, 'value') AS value_298245
|
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 (
|
FROM (
|
||||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||||
) AS t
|
) AS t
|
||||||
|
@ -348,6 +350,10 @@ WHERE jsonb_extract_path_text(field, 'id')::int = 298249),' None ')||';'
|
||||||
FROM (
|
FROM (
|
||||||
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
SELECT jsonb_array_elements(p0.start_form::jsonb->'fields') AS field
|
||||||
) AS t
|
) 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*/
|
WHERE jsonb_extract_path_text(field, 'id')::int = 299137),'') /*LEAD_PRODUCTS_01_5*/
|
||||||
,'YES' /*PERMISSION_PHONE*/
|
,'YES' /*PERMISSION_PHONE*/
|
||||||
,COALESCE(p0.create_time,TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*PERMISSION_PHONE_DATE*/
|
,COALESCE(p0.create_time,TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*PERMISSION_PHONE_DATE*/
|
||||||
|
|
|
@ -24,7 +24,7 @@ default_args = {
|
||||||
}
|
}
|
||||||
|
|
||||||
dag = DAG('wf_dag_smart_ccc_dynamic_email', default_args=default_args,
|
dag = DAG('wf_dag_smart_ccc_dynamic_email', default_args=default_args,
|
||||||
schedule_interval="5 10,14,16,12,18 * * 1-5",
|
schedule_interval="5 10,14,16,12,18 * * *",
|
||||||
catchup=False,
|
catchup=False,
|
||||||
dagrun_timeout=timedelta(minutes=160),
|
dagrun_timeout=timedelta(minutes=160),
|
||||||
max_active_runs=3)
|
max_active_runs=3)
|
||||||
|
@ -37,7 +37,7 @@ task_failed = EmailOperator (
|
||||||
cc=[""],
|
cc=[""],
|
||||||
subject="smart_ccc_dynamic_email_failed",
|
subject="smart_ccc_dynamic_email_failed",
|
||||||
html_content='<h3>您好,smart_ccc_dynamic_email作业失败,请及时处理" </h3>')
|
html_content='<h3>您好,smart_ccc_dynamic_email作业失败,请及时处理" </h3>')
|
||||||
|
|
||||||
|
|
||||||
dysql_update_dynamic_email_data = SSHOperator(
|
dysql_update_dynamic_email_data = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
|
@ -49,7 +49,7 @@ retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uds_dynamic_data_export = SSHOperator(
|
uds_dynamic_data_export = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
|
@ -59,7 +59,7 @@ params={'my_param':"uds_dynamic_data_export"},
|
||||||
depends_on_past=False,
|
depends_on_past=False,
|
||||||
retries=3,
|
retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
|
|
||||||
f_ccc_work_ticket_integ = SSHOperator(
|
f_ccc_work_ticket_integ = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
task_id='f_ccc_work_ticket_integ',
|
task_id='f_ccc_work_ticket_integ',
|
||||||
|
@ -67,7 +67,7 @@ command='/data/airflow/etl/COM/run_psql.sh {{ ds_nodash }} {{params.my_param}} >
|
||||||
params={'my_param':"f_ccc_work_ticket_integ_agi"},
|
params={'my_param':"f_ccc_work_ticket_integ_agi"},
|
||||||
depends_on_past=False,
|
depends_on_past=False,
|
||||||
retries=3,
|
retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
uds_dynamic_data_export >> dysql_update_dynamic_email_data
|
uds_dynamic_data_export >> dysql_update_dynamic_email_data
|
||||||
f_ccc_work_ticket_integ >> uds_dynamic_data_export
|
f_ccc_work_ticket_integ >> uds_dynamic_data_export
|
||||||
uds_dynamic_data_export >> task_failed
|
uds_dynamic_data_export >> task_failed
|
||||||
|
|
Loading…
Reference in New Issue