add workflow 泰克CRM,dev

This commit is contained in:
root 2025-12-28 18:38:27 +08:00
parent a21013abee
commit a6a80eb8cd
1 changed files with 80 additions and 3 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 :cust_contact_mapping(客户联系方式映射) */ /*Script Use: Periodically load data to :cust_contact_mapping(客户联系方式映射) */
/*Create Date:2025-12-23 11:16:37 */ /*Create Date:2025-12-28 18:38:08 */
/*SDM Developed By: dev */ /*SDM Developed By: dev */
/*SDM Developed Date: 2024-01-19 */ /*SDM Developed Date: 2024-01-19 */
/*SDM Checked By: dev */ /*SDM Checked By: dev */
/*SDM Checked Date: 2025-12-23 */ /*SDM Checked Date: 2025-12-28 */
/*Script Developed By: dev */ /*Script Developed By: dev */
/*Script Checked By: dev */ /*Script Checked By: dev */
/*Source table 1: p30_common.d_scrm_contact */ /*Source table 1: p30_common.d_scrm_contact */
@ -83,36 +83,113 @@ FROM (select '' contact_id,user_id
from ( from (
select case when tel ~ '^1[3-9]\d{9}$' then tel select case when tel ~ '^1[3-9]\d{9}$' then tel
when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email
when (length(regexp_replace(
tel,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
tel,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then tel
else name else name
end user_id,id crm_contact_account,'SMART CCC' src_channel from p30_common.d_ccc_cust_info end user_id,id crm_contact_account,'SMART CCC' src_channel from p30_common.d_ccc_cust_info
union all union all
select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone
when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email
when (length(regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then mobile_phone
else full_name else full_name
end user_id,crm_contact_account,'CRM' src_channel from p30_common.d_crm_contact end user_id,crm_contact_account,'CRM' src_channel from p30_common.d_crm_contact
union all union all
select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone
when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email
when length(wechat_id) >5 then wechat_id when length(wechat_id) >5 then wechat_id
when (length(regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then mobile_phone
else full_name else full_name
end user_id,scrm_leads_id,'SCRM' from p30_common.d_scrm_contact end user_id,scrm_leads_id,'SCRM' from p30_common.d_scrm_contact
union all union all
select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone
when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email
when (length(regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then mobile_phone
else full_name else full_name
end user_id,livechat_leads_id,'Livechat' from p30_common.d_livechat_contact end user_id,livechat_leads_id,'Livechat' from p30_common.d_livechat_contact
union all union all
select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone select case when mobile_phone ~ '^1[3-9]\d{9}$' then mobile_phone
when (length(regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
mobile_phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then mobile_phone
else full_name else full_name
end user_id,udesk_contact,'Udesk' from p30_common.d_udesk_contact end user_id,udesk_contact,'Udesk' from p30_common.d_udesk_contact
union all union all
select case when phone ~ '^1[3-9]\d{9}$' then phone select case when phone ~ '^1[3-9]\d{9}$' then phone
when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email
when (length(regexp_replace(
phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then phone
else contact_name else contact_name
end user_id,contact_id::text partner_contact_account,'Partner' src_channel from p30_common.d_partner_contact end user_id,contact_id::text partner_contact_account,'Partner' src_channel from p30_common.d_partner_contact
union all union all
select case when phone ~ '^1[3-9]\d{9}$' then phone select case when phone ~ '^1[3-9]\d{9}$' then phone
when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email when email ~ '[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$' then email
when (length(regexp_replace(
phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
)) between 7 and 17 and regexp_replace(
phone,
'(\+|\-|\#|\(|\)|||\ |\.|\*)',
'',
'g'
) ~ '^\d+$') then phone
else contact_name else contact_name
end user_id,jdy_contact_id jdy_contact_account,'JDY' from p30_common.d_jdy_contact_info end user_id,jdy_contact_id jdy_contact_account,'JDY' from p30_common.d_jdy_contact_info
where dw_contact_id not like 'LCON-%')p1 where dw_contact_id not like 'LCON-%')p1