add workflow 市场News-Agents调度,dev
This commit is contained in:
parent
2747e86030
commit
043a0da645
|
|
@ -74,11 +74,12 @@ order by p1.tek_opportunity_id,status_last_update desc,p1.as_of_date asc;
|
||||||
delete from p60_mart.news_letter_info
|
delete from p60_mart.news_letter_info
|
||||||
where source_system='market_summary';
|
where source_system='market_summary';
|
||||||
INSERT INTO p60_mart.news_letter_info
|
INSERT INTO p60_mart.news_letter_info
|
||||||
(account_name, saler_name, whitelist_flag, newsletter_title, summary, key_products, tek_relevance, industry, prov_name, city_name, district, contact_qty, total_funnel, report_amt,source_url,business_type,create_tm,source_system,data_source)
|
(account_name, saler_name, whitelist_flag, newsletter_title, summary, key_products, tek_relevance, industry, prov_name, city_name, district, contact_qty, total_funnel, report_amt,source_url,business_type,create_tm,source_system,data_source,portal_url,zip_url)
|
||||||
select distinct on (p1.company_name,p1.source_url) p1.company_name account_name, coalesce(saler_name,''), whitelist_flag, newsletter_title, summary
|
select distinct on (p1.company_name,p1.source_url) p1.company_name account_name, coalesce(saler_name,''), whitelist_flag, newsletter_title, summary
|
||||||
, case when p5.data_json::text like '{%' then replace(replace(replace(p5.data_json->>'主营产品'::text,'"',''),'[',''),']','')
|
, case when p5.data_json::text like '{%' then replace(replace(replace(p5.data_json->>'主营产品'::text,'"',''),'[',''),']','')
|
||||||
when p5.data_json::text like '[%' then replace(replace(replace(p5.data_json::text,'"',''),'[',''),']','') else '' end
|
when p5.data_json::text like '[%' then replace(replace(replace(p5.data_json::text,'"',''),'[',''),']','') else '' end
|
||||||
,coalesce(p5.recomend_product_series::text,'') tek_relevance, industry, coalesce(prov_name,''), coalesce(city_name), district,coalesce(p2.contact_qty,0) contact_qty, coalesce(total_amt,0)+coalesce(total_amount,0) total_funnel,coalesce(total_amt,0) report_amt,p1.source_url,p1.business_type,p1.create_tm,'market_summary',p1.data_source from newsletter_t1 p1
|
,coalesce(p5.recomend_product_series::text,'') tek_relevance, industry, coalesce(prov_name,''), coalesce(city_name), district,coalesce(p2.contact_qty,0) contact_qty, coalesce(total_amt,0)+coalesce(total_amount,0) total_funnel,coalesce(total_amt,0) report_amt,p1.source_url,p1.business_type,p1.create_tm,'market_summary',p1.data_source,p6.门户资源包,p6.压缩包链接
|
||||||
|
from newsletter_t1 p1
|
||||||
left join (select company,count(*) contact_qty from newsletter_contact_t1 group by 1 ) p2
|
left join (select company,count(*) contact_qty from newsletter_contact_t1 group by 1 ) p2
|
||||||
on p1.company_name=p2.company
|
on p1.company_name=p2.company
|
||||||
left join (select customer_name,sum(total_amt) total_amt from newsletter_funnel_one_t1 group by 1) p3
|
left join (select customer_name,sum(total_amt) total_amt from newsletter_funnel_one_t1 group by 1) p3
|
||||||
|
|
@ -87,6 +88,8 @@ left join (select account_name,sum(total_amount) total_amount from newsletter_fu
|
||||||
on p1.company_name=p4.account_name
|
on p1.company_name=p4.account_name
|
||||||
left join p70_ai_intelligence.agent_recommendation_cache p5
|
left join p70_ai_intelligence.agent_recommendation_cache p5
|
||||||
on p1.company_name=p5.company_name
|
on p1.company_name=p5.company_name
|
||||||
|
left join p70_ai_intelligence.key_recommendation p6
|
||||||
|
on regexp_replace(p5.matched_keys, '[^\u4e00-\u9fa5]', '', 'g')like '%'||regexp_replace(p6.关键词, '[^\u4e00-\u9fa5]', '', 'g') ||'%'
|
||||||
order by p1.company_name,p1.source_url,p1.create_tm desc,p5.created_at desc;
|
order by p1.company_name,p1.source_url,p1.create_tm desc,p5.created_at desc;
|
||||||
|
|
||||||
drop table if exists newsletter_funnel_one_t2;
|
drop table if exists newsletter_funnel_one_t2;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue