add workflow 天润Smart-ccc通话记录,dev

This commit is contained in:
root 2024-07-03 16:55:07 +08:00
parent 54cf1099e7
commit 7a4476792d
4 changed files with 322 additions and 322 deletions

View File

@ -78,7 +78,7 @@ insert into p10_sa.S98_S_tr_cc_cdr_ib_list
, etl_tx_dt , etl_tx_dt
from p00_tal.S98_S_tr_cc_cdr_ib_list from p00_tal.S98_S_tr_cc_cdr_ib_list
; ;
delete from p12_sfull.S98_S_tr_cc_cdr_ib_list delete from p12_sfull.S98_S_tr_cc_cdr_ib_list where main_unique_id in (select main_unique_id from S98_S_tr_cc_cdr_ib_list)
; ;
; ;
insert into p12_sfull.S98_S_tr_cc_cdr_ib_list insert into p12_sfull.S98_S_tr_cc_cdr_ib_list

View File

@ -5,101 +5,101 @@
delete from p10_sa.S98_S_tr_cc_cdr_ob_detail delete from p10_sa.S98_S_tr_cc_cdr_ob_detail
; ;
insert into p10_sa.S98_S_tr_cc_cdr_ob_detail insert into p10_sa.S98_S_tr_cc_cdr_ob_detail
( cno ( cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, callee_ringing_time , callee_ringing_time
, answer_time , answer_time
, end_time , end_time
, bridge_duration , bridge_duration
, call_type , call_type
, call_type_desc , call_type_desc
, detail_call_type , detail_call_type
, detail_call_type_desc , detail_call_type_desc
, ob_sip_cause , ob_sip_cause
, sip_cause , sip_cause
, sip_cause_desc , sip_cause_desc
, record_file , record_file
, tsi_file , tsi_file
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, main_unique_id , main_unique_id
, unique_id , unique_id
, etl_tx_dt ) , etl_tx_dt )
select select
cno cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, callee_ringing_time , callee_ringing_time
, answer_time , answer_time
, end_time , end_time
, bridge_duration , bridge_duration
, call_type , call_type
, call_type_desc , call_type_desc
, detail_call_type , detail_call_type
, detail_call_type_desc , detail_call_type_desc
, ob_sip_cause , ob_sip_cause
, sip_cause , sip_cause
, sip_cause_desc , sip_cause_desc
, record_file , record_file
, tsi_file , tsi_file
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, main_unique_id , main_unique_id
, unique_id , unique_id
, etl_tx_dt , etl_tx_dt
from p00_tal.S98_S_tr_cc_cdr_ob_detail from p00_tal.S98_S_tr_cc_cdr_ob_detail
; ;
delete from p12_sfull.S98_S_tr_cc_cdr_ob_detail delete from p12_sfull.S98_S_tr_cc_cdr_ob_detail where unique_id in (select unique_id from p10_sa.S98_S_tr_cc_cdr_ob_detail)
; ;
; ;
insert into p12_sfull.S98_S_tr_cc_cdr_ob_detail insert into p12_sfull.S98_S_tr_cc_cdr_ob_detail
( cno ( cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, callee_ringing_time , callee_ringing_time
, answer_time , answer_time
, end_time , end_time
, bridge_duration , bridge_duration
, call_type , call_type
, call_type_desc , call_type_desc
, detail_call_type , detail_call_type
, detail_call_type_desc , detail_call_type_desc
, ob_sip_cause , ob_sip_cause
, sip_cause , sip_cause
, sip_cause_desc , sip_cause_desc
, record_file , record_file
, tsi_file , tsi_file
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, main_unique_id , main_unique_id
, unique_id , unique_id
, etl_tx_dt ) , etl_tx_dt )
select select
cno cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, callee_ringing_time , callee_ringing_time
, answer_time , answer_time
, end_time , end_time
, bridge_duration , bridge_duration
, call_type , call_type
, call_type_desc , call_type_desc
, detail_call_type , detail_call_type
, detail_call_type_desc , detail_call_type_desc
, ob_sip_cause , ob_sip_cause
, sip_cause , sip_cause
, sip_cause_desc , sip_cause_desc
, record_file , record_file
, tsi_file , tsi_file
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, main_unique_id , main_unique_id
, unique_id , unique_id
, etl_tx_dt , etl_tx_dt
from p10_sa.S98_S_tr_cc_cdr_ob_detail from p10_sa.S98_S_tr_cc_cdr_ob_detail
; ;

View File

@ -5,249 +5,249 @@
delete from p10_sa.S98_S_tr_cc_cdr_ob_list delete from p10_sa.S98_S_tr_cc_cdr_ob_list
; ;
insert into p10_sa.S98_S_tr_cc_cdr_ob_list insert into p10_sa.S98_S_tr_cc_cdr_ob_list
( customer_number ( customer_number
, customer_number_encrypt , customer_number_encrypt
, customer_area , customer_area
, customer_province , customer_province
, customer_city , customer_city
, call_type , call_type
, call_type_key , call_type_key
, left_clid , left_clid
, left_clid_area , left_clid_area
, left_clid_province , left_clid_province
, left_clid_city , left_clid_city
, trunk_group_key , trunk_group_key
, xnumber , xnumber
, xnumber_area , xnumber_area
, xnumber_province , xnumber_province
, xnumber_city , xnumber_city
, status , status
, status_desc , status_desc
, tag_names , tag_names
, main_unique_id , main_unique_id
, request_unique_id , request_unique_id
, ob_sip_cause , ob_sip_cause
, on_hook_source , on_hook_source
, record_file , record_file
, asr_record , asr_record
, evaluation , evaluation
, investigation_keys , investigation_keys
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, rtc_uid , rtc_uid
, cno , cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, up_time , up_time
, callee_ringing_time , callee_ringing_time
, bridge_time , bridge_time
, end_time , end_time
, bridge_duration , bridge_duration
, total_duration , total_duration
, pre_ring_wait_duration , pre_ring_wait_duration
, callee_ringing_duration , callee_ringing_duration
, ob_wait_duration , ob_wait_duration
, task_id , task_id
, task_name , task_name
, task_inventory_id , task_inventory_id
, exist_ticket , exist_ticket
, ticket_ids , ticket_ids
, exist_business , exist_business
, business_ids , business_ids
, user_field , user_field
, exist_customer , exist_customer
, customer_area_code , customer_area_code
, customer_post_code , customer_post_code
, customer_vip , customer_vip
, enterprise_id , enterprise_id
, mark_data , mark_data
, type , type
, etl_tx_dt ) , etl_tx_dt )
select select
customer_number customer_number
, customer_number_encrypt , customer_number_encrypt
, customer_area , customer_area
, customer_province , customer_province
, customer_city , customer_city
, call_type , call_type
, call_type_key , call_type_key
, left_clid , left_clid
, left_clid_area , left_clid_area
, left_clid_province , left_clid_province
, left_clid_city , left_clid_city
, trunk_group_key , trunk_group_key
, xnumber , xnumber
, xnumber_area , xnumber_area
, xnumber_province , xnumber_province
, xnumber_city , xnumber_city
, status , status
, status_desc , status_desc
, tag_names , tag_names
, main_unique_id , main_unique_id
, request_unique_id , request_unique_id
, ob_sip_cause , ob_sip_cause
, on_hook_source , on_hook_source
, record_file , record_file
, asr_record , asr_record
, evaluation , evaluation
, investigation_keys , investigation_keys
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, rtc_uid , rtc_uid
, cno , cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, up_time , up_time
, callee_ringing_time , callee_ringing_time
, bridge_time , bridge_time
, end_time , end_time
, bridge_duration , bridge_duration
, total_duration , total_duration
, pre_ring_wait_duration , pre_ring_wait_duration
, callee_ringing_duration , callee_ringing_duration
, ob_wait_duration , ob_wait_duration
, task_id , task_id
, task_name , task_name
, task_inventory_id , task_inventory_id
, exist_ticket , exist_ticket
, ticket_ids , ticket_ids
, exist_business , exist_business
, business_ids , business_ids
, user_field , user_field
, exist_customer , exist_customer
, customer_area_code , customer_area_code
, customer_post_code , customer_post_code
, customer_vip , customer_vip
, enterprise_id , enterprise_id
, mark_data , mark_data
, type , type
, etl_tx_dt , etl_tx_dt
from p00_tal.S98_S_tr_cc_cdr_ob_list from p00_tal.S98_S_tr_cc_cdr_ob_list
; ;
delete from p12_sfull.S98_S_tr_cc_cdr_ob_list delete from p12_sfull.S98_S_tr_cc_cdr_ob_list where main_unique_id in (select main_unique_id from p10_sa.S98_S_tr_cc_cdr_ob_list)
; ;
; ;
insert into p12_sfull.S98_S_tr_cc_cdr_ob_list insert into p12_sfull.S98_S_tr_cc_cdr_ob_list
( customer_number ( customer_number
, customer_number_encrypt , customer_number_encrypt
, customer_area , customer_area
, customer_province , customer_province
, customer_city , customer_city
, call_type , call_type
, call_type_key , call_type_key
, left_clid , left_clid
, left_clid_area , left_clid_area
, left_clid_province , left_clid_province
, left_clid_city , left_clid_city
, trunk_group_key , trunk_group_key
, xnumber , xnumber
, xnumber_area , xnumber_area
, xnumber_province , xnumber_province
, xnumber_city , xnumber_city
, status , status
, status_desc , status_desc
, tag_names , tag_names
, main_unique_id , main_unique_id
, request_unique_id , request_unique_id
, ob_sip_cause , ob_sip_cause
, on_hook_source , on_hook_source
, record_file , record_file
, asr_record , asr_record
, evaluation , evaluation
, investigation_keys , investigation_keys
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, rtc_uid , rtc_uid
, cno , cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, up_time , up_time
, callee_ringing_time , callee_ringing_time
, bridge_time , bridge_time
, end_time , end_time
, bridge_duration , bridge_duration
, total_duration , total_duration
, pre_ring_wait_duration , pre_ring_wait_duration
, callee_ringing_duration , callee_ringing_duration
, ob_wait_duration , ob_wait_duration
, task_id , task_id
, task_name , task_name
, task_inventory_id , task_inventory_id
, exist_ticket , exist_ticket
, ticket_ids , ticket_ids
, exist_business , exist_business
, business_ids , business_ids
, user_field , user_field
, exist_customer , exist_customer
, customer_area_code , customer_area_code
, customer_post_code , customer_post_code
, customer_vip , customer_vip
, enterprise_id , enterprise_id
, mark_data , mark_data
, type , type
, etl_tx_dt ) , etl_tx_dt )
select select
customer_number customer_number
, customer_number_encrypt , customer_number_encrypt
, customer_area , customer_area
, customer_province , customer_province
, customer_city , customer_city
, call_type , call_type
, call_type_key , call_type_key
, left_clid , left_clid
, left_clid_area , left_clid_area
, left_clid_province , left_clid_province
, left_clid_city , left_clid_city
, trunk_group_key , trunk_group_key
, xnumber , xnumber
, xnumber_area , xnumber_area
, xnumber_province , xnumber_province
, xnumber_city , xnumber_city
, status , status
, status_desc , status_desc
, tag_names , tag_names
, main_unique_id , main_unique_id
, request_unique_id , request_unique_id
, ob_sip_cause , ob_sip_cause
, on_hook_source , on_hook_source
, record_file , record_file
, asr_record , asr_record
, evaluation , evaluation
, investigation_keys , investigation_keys
, call_id , call_id
, webrtc_call_id , webrtc_call_id
, rtc_uid , rtc_uid
, cno , cno
, client_name , client_name
, client_number , client_number
, start_time , start_time
, up_time , up_time
, callee_ringing_time , callee_ringing_time
, bridge_time , bridge_time
, end_time , end_time
, bridge_duration , bridge_duration
, total_duration , total_duration
, pre_ring_wait_duration , pre_ring_wait_duration
, callee_ringing_duration , callee_ringing_duration
, ob_wait_duration , ob_wait_duration
, task_id , task_id
, task_name , task_name
, task_inventory_id , task_inventory_id
, exist_ticket , exist_ticket
, ticket_ids , ticket_ids
, exist_business , exist_business
, business_ids , business_ids
, user_field , user_field
, exist_customer , exist_customer
, customer_area_code , customer_area_code
, customer_post_code , customer_post_code
, customer_vip , customer_vip
, enterprise_id , enterprise_id
, mark_data , mark_data
, type , type
, etl_tx_dt , etl_tx_dt
from p10_sa.S98_S_tr_cc_cdr_ob_list from p10_sa.S98_S_tr_cc_cdr_ob_list
; ;

View File

@ -65,8 +65,8 @@ def build_query_string(params):
def request_data_signature_get(): def request_data_signature_get():
print(f'开始请求外呼记录数据') print(f'开始请求外呼记录数据')
url='https://api-bj.clink.cn/cc/list_cdr_ob' url='https://api-bj.clink.cn/cc/list_cdr_ob'
# param={'Timestamp':current_time_utc,'Expires':86400,'startTime':previous_hour_timestamp(1),'startTimeEnd':previous_hour_timestamp(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'} param={'Timestamp':current_time_utc,'Expires':86400,'startTime':previous_hour_timestamp(1),'startTimeEnd':previous_hour_timestamp(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'}
param={'Timestamp':current_time_utc,'Expires':86400,'startTime':1717516800,'startTimeEnd':previous_hour_timestamp(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'} # param={'Timestamp':current_time_utc,'Expires':86400,'startTime':1717516800,'startTimeEnd':previous_hour_timestamp(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'}
print(f'param: {param}') print(f'param: {param}')
url_path = build_query_string(param) url_path = build_query_string(param)
url_param = url_path url_param = url_path
@ -148,7 +148,7 @@ def load_detail_data_to_db(ids, dataList):
json_object = json.dumps(dataList) json_object = json.dumps(dataList)
idstr = ','.join(ids) idstr = ','.join(ids)
cur=conn.cursor() cur=conn.cursor()
sql="update data_api.cc_details_ids_exp set is_loaded = '1' where api_id = '7a38de24858a40ed9837f61ca7f80b08' and id in (%s); INSERT INTO data_api.cc_cdr_ob_details (id,api_id,data,total_num,is_loaded,status,request_tm,execute_tm,remark) values (%s,%s,%s,%s,'0','0',current_timestamp(0),current_timestamp(0),'')" sql="update data_api.cc_details_ids_exp set is_loaded = '1' where api_id = '7a38de24858a40ed9837f61ca7f80b08' and id in (%s);update data_api.cc_cdr_ob_details set is_loaded = '1' where api_id = '7a38de24858a40ed9837f61ca7f80b08'; INSERT INTO data_api.cc_cdr_ob_details (id,api_id,data,total_num,is_loaded,status,request_tm,execute_tm,remark) values (%s,%s,%s,%s,'0','0',current_timestamp(0),current_timestamp(0),'')"
cur.execute(sql,[idstr,dataId,'7a38de24858a40ed9837f61ca7f80b08', json_object, total]) cur.execute(sql,[idstr,dataId,'7a38de24858a40ed9837f61ca7f80b08', json_object, total])
conn.commit() conn.commit()
cur.close() cur.close()