add workflow 天润Smart-ccc客户数据,dev
This commit is contained in:
		
							parent
							
								
									2bf8aa429b
								
							
						
					
					
						commit
						74837b781b
					
				|  | @ -3,115 +3,5 @@ | |||
| \set AUTOCOMMIT on | ||||
| \timing on | ||||
|   | ||||
| DELETE FROM data_api.tr_ticket_list; | ||||
| 
 | ||||
| insert into  data_api.tr_ticket_list (  | ||||
| 	 id  | ||||
| 	, workflow_id  | ||||
| 	, workflow_name  | ||||
| 	, type  | ||||
| 	, topic  | ||||
| 	, level  | ||||
| 	, status  | ||||
| 	, creator_name  | ||||
| 	, creator_id  | ||||
| 	, creator_type  | ||||
| 	, modifier_id  | ||||
| 	, modifier_type  | ||||
| 	, source  | ||||
| 	, timeout  | ||||
| 	, end_time  | ||||
| 	, create_time  | ||||
| 	, close_time  | ||||
| 	, state_selected  | ||||
| 	, last_reminder_time  | ||||
| 	, reminder_count  | ||||
| 	, customer_id  | ||||
| 	, customer_name  | ||||
| 	, customer_tel  | ||||
| 	, customer_email  | ||||
| 	, customer_address  | ||||
| 	, customer_creator_id  | ||||
| 	, customer_creator_name  | ||||
| 	, customer_modifier_id  | ||||
| 	, customer_modifier_name  | ||||
| 	, tags  | ||||
| 	, system_form  | ||||
| 	,etl_tx_dt | ||||
| ) | ||||
| select  | ||||
| 	 case when trim(both from id)='' then null else  id::text  end  id  | ||||
| 	, case when trim(both from workflow_id)='' then null else  workflow_id::text  end  workflow_id  | ||||
| 	, case when trim(both from workflow_name)='' then null else  workflow_name::text  end  workflow_name  | ||||
| 	, case when trim(both from type)='' then null else  type::text  end  type  | ||||
| 	, case when trim(both from topic)='' then null else  topic::text  end  topic  | ||||
| 	, case when trim(both from level)='' then null else  level::text  end  level  | ||||
| 	, case when trim(both from status)='' then null else  status::text  end  status  | ||||
| 	, case when trim(both from creator_name)='' then null else  creator_name::text  end  creator_name  | ||||
| 	, case when trim(both from creator_id)='' then null else  creator_id::text  end  creator_id  | ||||
| 	, case when trim(both from creator_type)='' then null else  creator_type::text  end  creator_type  | ||||
| 	, case when trim(both from modifier_id)='' then null else  modifier_id::text  end  modifier_id  | ||||
| 	, case when trim(both from modifier_type)='' then null else  modifier_type::text  end  modifier_type  | ||||
| 	, case when trim(both from source)='' then null else  source::text  end  source  | ||||
| 	, case when trim(both from timeout)='' then null else  timeout::text  end  timeout  | ||||
| 	, case when trim(both from end_time)='' then null else  end_time::text  end  end_time  | ||||
| 	, case when trim(both from create_time)='' then null else  create_time::text  end  create_time  | ||||
| 	, case when trim(both from close_time)='' then null else  close_time::text  end  close_time  | ||||
| 	, case when trim(both from state_selected)='' then null else  state_selected::text  end  state_selected  | ||||
| 	, case when trim(both from last_reminder_time)='' then null else  last_reminder_time::text  end  last_reminder_time  | ||||
| 	, case when trim(both from reminder_count)='' then null else  reminder_count::text  end  reminder_count  | ||||
| 	, case when trim(both from customer_id)='' then null else  customer_id::text  end  customer_id  | ||||
| 	, case when trim(both from customer_name)='' then null else  customer_name::text  end  customer_name  | ||||
| 	, case when trim(both from customer_tel)='' then null else  customer_tel::text  end  customer_tel  | ||||
| 	, case when trim(both from customer_email)='' then null else  customer_email::text  end  customer_email  | ||||
| 	, case when trim(both from customer_address)='' then null else  customer_address::text  end  customer_address  | ||||
| 	, case when trim(both from customer_creator_id)='' then null else  customer_creator_id::text  end  customer_creator_id  | ||||
| 	, case when trim(both from customer_creator_name)='' then null else  customer_creator_name::text  end  customer_creator_name  | ||||
| 	, case when trim(both from customer_modifier_id)='' then null else  customer_modifier_id::text  end  customer_modifier_id  | ||||
| 	, case when trim(both from customer_modifier_name)='' then null else  customer_modifier_name::text  end  customer_modifier_name  | ||||
| 	, case when trim(both from tags)='' then null else  tags::text  end  tags  | ||||
| 	, case when trim(both from system_form)='' then null else  system_form::text  end  system_form  | ||||
| ,etl_tx_dt | ||||
| from ( | ||||
| select  | ||||
| 	 (json_array_elements(data::json)::json->>'id')  id  | ||||
| 	, (json_array_elements(data::json)::json->>'workflowId')  workflow_id  | ||||
| 	, (json_array_elements(data::json)::json->>'workflowName')  workflow_name  | ||||
| 	, (json_array_elements(data::json)::json->>'type')  type  | ||||
| 	, (json_array_elements(data::json)::json->>'topic')  topic  | ||||
| 	, (json_array_elements(data::json)::json->>'level')  level  | ||||
| 	, (json_array_elements(data::json)::json->>'status')  status  | ||||
| 	, (json_array_elements(data::json)::json->>'creatorName')  creator_name  | ||||
| 	, (json_array_elements(data::json)::json->>'creatorId')  creator_id  | ||||
| 	, (json_array_elements(data::json)::json->>'creatorType')  creator_type  | ||||
| 	, (json_array_elements(data::json)::json->>'modifierId')  modifier_id  | ||||
| 	, (json_array_elements(data::json)::json->>'modifierType')  modifier_type  | ||||
| 	, (json_array_elements(data::json)::json->>'source')  source  | ||||
| 	, (json_array_elements(data::json)::json->>'timeout')  timeout  | ||||
| 	, (json_array_elements(data::json)::json->>'endTime')  end_time  | ||||
| 	, (json_array_elements(data::json)::json->>'createTime')  create_time  | ||||
| 	, (json_array_elements(data::json)::json->>'closeTime')  close_time  | ||||
| 	, (json_array_elements(data::json)::json->>'stateSelected')  state_selected  | ||||
| 	, (json_array_elements(data::json)::json->>'lastReminderTime')  last_reminder_time  | ||||
| 	, (json_array_elements(data::json)::json->>'reminderCount')  reminder_count  | ||||
| 	, (json_array_elements(data::json)::json->>'customerId')  customer_id  | ||||
| 	, (json_array_elements(data::json)::json->>'customerName')  customer_name  | ||||
| 	, (json_array_elements(data::json)::json->>'customerTel')  customer_tel  | ||||
| 	, (json_array_elements(data::json)::json->>'customerEmail')  customer_email  | ||||
| 	, (json_array_elements(data::json)::json->>'customerAddress')  customer_address  | ||||
| 	, (json_array_elements(data::json)::json->>'customerCreatorId')  customer_creator_id  | ||||
| 	, (json_array_elements(data::json)::json->>'customerCreatorName')  customer_creator_name  | ||||
| 	, (json_array_elements(data::json)::json->>'customerModifierId')  customer_modifier_id  | ||||
| 	, (json_array_elements(data::json)::json->>'customerModifierName')  customer_modifier_name  | ||||
| 	, (json_array_elements(data::json)::json->>'tags')  tags  | ||||
| 	, (json_array_elements(data::json)::json->>'systemForm')  system_form  | ||||
| 	,CURRENT_TIMESTAMP(0)  etl_tx_dt | ||||
| from (select * from data_api.api_data  | ||||
| WHERE api_id='c83284b6bbb148daa6b3d04173ab748f' and is_loaded = '0' order by request_tm desc limit 1) p )p; | ||||
| 
 | ||||
| update  data_api.api_data  | ||||
| set is_loaded = '1' , | ||||
| 	status = '1', | ||||
| 	request_tm = current_timestamp(0) | ||||
| where api_id='c83284b6bbb148daa6b3d04173ab748f'; | ||||
| \q | ||||
		Loading…
	
		Reference in New Issue