add workflow 天润Smart-ccc工单数据,dev

This commit is contained in:
root 2024-08-01 17:04:23 +08:00
parent ba47d55c40
commit b41926216d
1 changed files with 10 additions and 9 deletions

View File

@ -4,7 +4,7 @@
/*Brilliance stems from wisdoms. */
/*************Head Section**************************************************************************/
/*Script Use: Periodically load data to :f_ccc_work_ticket_integ(smartccc工单信息集成) */
/*Create Date:2024-08-01 10:28:41 */
/*Create Date:2024-08-01 17:01:22 */
/*SDM Developed By: dev */
/*SDM Developed Date: 2024-07-09 */
/*SDM Checked By: dev */
@ -43,6 +43,7 @@ ON COMMIT PRESERVE ROWS;
/*****************************************************************************************************/
/* GROUP 1:Source Table:t01_ccc_work_ticket_info******************************************************/
/*****************************************************************************************************/
INSERT INTO f_ccc_work_ticket_integ_agi_CUR_I (
PEXTENSION_CODE /*来源代码*/
,PEXTENSION /*来源*/
@ -102,9 +103,7 @@ SELECT
when p1."source" ='呼叫中心' then '305972X317938'
else '401890X401890' end,'') /*PEXTENSION_CODE*/
,coalesce(p1."source",'') /*PEXTENSION*/
,coalesce((SELECT jsonb_extract_path_text(j, 'value')
FROM jsonb_array_elements(p1.customize::jsonb) j
WHERE jsonb_extract_path_text(j, 'name') = '姓名'),'') /*LAST_NAME*/
,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(p1.customize::jsonb) j
@ -113,8 +112,8 @@ SELECT
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')
FROM jsonb_array_elements(p1.customize::jsonb) j
WHERE jsonb_extract_path_text(j, 'name') = '城市'),'') /*CITY*/
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*/
,'CN' /*COUNTRY_CODE*/
,coalesce(p2.postalcode,'') /*POSTAL_CODE*/
@ -184,9 +183,11 @@ FROM :PDMDB.t01_ccc_work_ticket_info p0
LEFT JOIN :PDMDB.t01_ccc_cust_info p1
ON p0.customer_id =p1.id
LEFT JOIN :PDMDB.t00_china_city_info p2
ON (SELECT jsonb_extract_path_text(j, 'value')
FROM jsonb_array_elements(p1.customize::jsonb) j
WHERE jsonb_extract_path_text(j, 'name') = '城市') = p2.city_name
ON p2.city_name like 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') = '297755'),'')::text||'%'
where p0 .state_selected ='Leads'
;