| | |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- <!–详情导出临时接口–>--> |
| | | <!-- <select id="getCallResultListTemp" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskResultVO">--> |
| | | <!-- select--> |
| | | <!-- ctr."id",--> |
| | | <!-- ctr."call_result" as callResult,--> |
| | | <!-- ctr."call_duration" as callDuration,--> |
| | | <!-- ctr."call_conversation_round" as callConversationRound,--> |
| | | <!-- ctr."call_hangup_direction" as callHangupDirection,--> |
| | | <!-- ctr."call_id" as callId,--> |
| | | <!-- date_format(ctr."gmt_create",'%Y-%m-%d %H:%i:%s') as gmtCreate,--> |
| | | <!-- ctr."calling_number" as callingNumber,--> |
| | | <!-- ctr."callee_number" as calleeNumber,--> |
| | | <!-- ctr."task_id" as taskId,--> |
| | | <!-- ctr."call_start_time" as callStartTime,--> |
| | | <!-- date_format(ctr."call_end_time",'%Y-%m-%d %H:%i:%s') as callEndTime,--> |
| | | <!-- ctr."call_record_file" as callRecordFile,--> |
| | | <!-- ctr."intention_customer_flag" as intentionCustomerFlag,--> |
| | | <!-- ctr."is_deleted" as isDeleted,--> |
| | | <!-- ctc.waterCode,--> |
| | | <!-- aab."ad_name" as areaName,--> |
| | | <!-- case when ctr."call_result"!='200000' then concat(--> |
| | | <!-- if(ifnull(scnfr.is_danger,0)='0','',if(scnfr.is_danger='是','发现险情,','未发现险情,')),--> |
| | | <!-- if(ifnull(scnfr.is_patrol_person,0)='0','',if(scnfr.is_patrol_person='是','是巡查责任人,','不是巡查责任人,')) ,--> |
| | | <!-- if(ifnull(scnfr.is_patrol,0)='0','',if(scnfr.is_patrol='是','已巡查,','未巡查,')),--> |
| | | <!-- if(ifnull(scnfr.is_over,0)='0','',if(scnfr.is_over='是','超汛限','未超汛限'))--> |
| | | <!-- )--> |
| | | <!-- else cas."tag_title" end as tagTitle,--> |
| | | <!-- ctc.userName,--> |
| | | <!-- arb."name" as waterName,--> |
| | | <!-- arb."res_reg_code" resRegCode,--> |
| | | <!-- arb."eng_scal" engScal,--> |
| | | <!-- arb."res_type" resType,--> |
| | | <!-- arb."rv_name" rvName,--> |
| | | <!-- REGEXP_SUBSTR (arb."res_loc",'[^-]+',1,2) as cityName,--> |
| | | <!-- REGEXP_SUBSTR (arb."res_loc",'[^-]+',1,3) as countyName,--> |
| | | <!-- if(ifnull(scnfr.call_id,0)='0','','已反馈') isSmsFill,--> |
| | | <!-- case when ctr."call_result"!='200000' then if(ifnull(scnfr.is_danger,0)>'0',if(scnfr.is_danger='是',2,1),0)--> |
| | | <!-- else if(ifnull(cas."tag_title",0)>'0',if(instr(cas."tag_title",'未发现险情')>0,1,if(instr(cas."tag_title",'发现险情')>0,2,0)),0) end as isDange,--> |
| | | <!-- case when ctr."call_result"!='200000' then if(ifnull(scnfr.is_patrol_person,0)>'0',if(scnfr.is_patrol_person='是',2,1),0)--> |
| | | <!-- else if(ifnull(cas."tag_title",0)>'0',if(instr(cas."tag_title",'是否巡查责任人-未识别')>0,0,if(instr(cas."tag_title",'不是巡查责任人')>0,1,if(instr(cas."tag_title",'是巡查责任人')>0,2,0))),0) end as isMan,--> |
| | | <!-- case when ctr."call_result"!='200000' then if(ifnull(scnfr.is_patrol,0)>'0',if(scnfr.is_patrol='是',2,1),0)--> |
| | | <!-- else if(ifnull(cas."tag_title",0)>'0',if(instr(cas."tag_title",'是否巡查-未识别')>0,0,if(instr(cas."tag_title",'未巡查')>0,1,if(instr(cas."tag_title",'已巡查')>0,2,0))),0) end as isPatrol,--> |
| | | <!-- case when ctr."call_result"!='200000' then if(ifnull(scnfr.is_over,0)>'0',if(scnfr.is_over='是',2,1),0)--> |
| | | <!-- else if(ifnull(cas."tag_title",0)>'0',if(instr(cas."tag_title",'是否超汛限-未识别')>0,0,if(instr(cas."tag_title",'未超汛限')>0,1,if(instr(cas."tag_title",'超汛限')>0,2,0))),0) end as isOver--> |
| | | <!-- from--> |
| | | <!-- (--> |
| | | <!-- select ctr.* from SJZT_ODS."call_task_result" ctr--> |
| | | <!-- left join SJZT_ODS."call_task" ct on ct."id" = ctr."task_id"--> |
| | | <!-- left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id"--> |
| | | <!-- where date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskResult.gmtCreate}--> |
| | | <!-- and (sdct.type = '1' or sdct.type = '2' or sdct.type = '3') and ctr."call_result" = '200000' and ct."scene_id" = 228--> |
| | | <!-- union--> |
| | | <!-- select ctr.* from SJZT_ODS."call_task_result" ctr--> |
| | | <!-- left join SJZT_ODS."call_task" ct on ct."id" = ctr."task_id"--> |
| | | <!-- left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id"--> |
| | | <!-- where date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskResult.gmtCreate}--> |
| | | <!-- and sdct.type = '3' and ctr."call_result" != '200000' and ct."scene_id" = 228--> |
| | | <!-- union all--> |
| | | <!-- select ctr.* from SJZT_ODS."call_task_result" ctr--> |
| | | <!-- left join SJZT_ODS."call_task" ct on ct."id" = ctr."task_id"--> |
| | | <!-- left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id"--> |
| | | <!-- where date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskResult.gmtCreate} and ct."scene_id" = 228--> |
| | | <!-- and sdct.task_id is null--> |
| | | <!-- ) ctr--> |
| | | <!-- left join--> |
| | | <!-- (--> |
| | | <!-- select "callee_number",--> |
| | | <!-- "call_id",--> |
| | | <!-- "task_id",--> |
| | | <!-- JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode,--> |
| | | <!-- JSON_VALUE("call_task_callee_content",'$."$用户名$"') as userName from "SJZT_ODS"."call_task_callee"--> |
| | | <!-- ) ctc--> |
| | | <!-- on ctr."call_id" = ctc."call_id"--> |
| | | <!-- left join "SJZT_MD"."att_res_base" arb on ctc.waterCode = arb."code"--> |
| | | <!-- left join "SJZT_MD"."att_ad_base" aab on aab."guid" = concat(arb."ad_guid",'000000')--> |
| | | <!-- left join--> |
| | | <!-- (--> |
| | | <!-- SELECT ctra."call_id", replace(WM_CONCAT(ctag."tag_title"),',', ',') as "tag_title" from "SJZT_ODS"."call_tag" ctag--> |
| | | <!-- left join "SJZT_ODS"."call_task_result_attribute" ctra on ctag."id" = ctra."attribute_value"--> |
| | | <!-- GROUP BY ctra."call_id"--> |
| | | <!-- ) cas--> |
| | | <!-- on cas."call_id" = ctr."call_id"--> |
| | | <!-- left join "SJZT_ODS"."call_task" ct on ct."id" = ctr."task_id"--> |
| | | <!-- left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id"--> |
| | | <!-- where 1=1--> |
| | | <!-- <if test="callTaskResult.taskId!=null and callTaskResult.taskId!=''">--> |
| | | <!-- and ctr."task_id" = #{callTaskResult.taskId}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.waterName!=null and callTaskResult.waterName!=''">--> |
| | | <!-- and arb."name" like concat('%',#{callTaskResult.waterName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.isSmsFill!=null and callTaskResult.isSmsFill=='已反馈'">--> |
| | | <!-- and scnfr.call_id is not null--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.isSmsFill!=null and callTaskResult.isSmsFill=='未反馈'">--> |
| | | <!-- and scnfr.call_id is null and ctr."call_result"!='200000'--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.userName!=null and callTaskResult.userName!=''">--> |
| | | <!-- and ctc.userName like concat('%',#{callTaskResult.userName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.taskName!=null and callTaskResult.taskName!=''">--> |
| | | <!-- and ct."task_name" like concat(concat('%',#{callTaskResult.taskName}),'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.taskStatus!=null">--> |
| | | <!-- and ct."task_status" = #{callTaskResult.taskStatus}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.startTime!=null and callTaskResult.startTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') >= #{callTaskResult.startTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskResult.endTime!=null and callTaskResult.endTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskResult.endTime}--> |
| | | <!-- </if>--> |
| | | <!-- order by ctr."gmt_create" desc--> |
| | | <!-- </select>--> |
| | | |
| | | <!--详情导出临时接口--> |
| | | <select id="getCallResultListTemp" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskResultVO"> |
| | | select |
| | |
| | | else if(ifnull(cas."tag_title",0)>'0',if(instr(cas."tag_title",'是否超汛限-未识别')>0,0,if(instr(cas."tag_title",'未超汛限')>0,1,if(instr(cas."tag_title",'超汛限')>0,2,0))),0) end as isOver |
| | | from |
| | | ( |
| | | select ctr.* from SJZT_ODS."call_task_result" ctr |
| | | left join SJZT_ODS."call_task" ct on ct."id" = ctr."task_id" |
| | | left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id" |
| | | where date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskResult.gmtCreate} |
| | | and (sdct.type = '1' or sdct.type = '2' or sdct.type = '3') and ctr."call_result" = '200000' and ct."scene_id" = 228 |
| | | union |
| | | select ctr.* from SJZT_ODS."call_task_result" ctr |
| | | left join SJZT_ODS."call_task" ct on ct."id" = ctr."task_id" |
| | | left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id" |
| | | where date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskResult.gmtCreate} |
| | | and sdct.type = '3' and ctr."call_result" != '200000' and ct."scene_id" = 228 |
| | | select ctr.* from SJZT_ODS."call_task_result" ctr right join |
| | | ( |
| | | select max("gmt_create") "gmt_create",waterCode,"callee_number" from ( |
| | | select ctr.*,ctc.waterCode from SJZT_ODS."call_task_result" ctr right join ( |
| | | select date_format(create_time,'%Y-%m-%d') time,wm_concat(task_id) task_id from YWXT.sm_daily_call_task group by date_format(create_time,'%Y-%m-%d') |
| | | ) sdct on locate(ctr."task_id",sdct.task_id) >0 left join ( |
| | | select "call_id",JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode from "SJZT_ODS"."call_task_callee" |
| | | ) ctc on ctr."call_id" = ctc."call_id" |
| | | where 1=1 |
| | | <if test="callTaskResult.startTime!=null and callTaskResult.startTime!=''"> |
| | | and sdct.time >= #{callTaskResult.startTime} |
| | | </if> |
| | | <if test="callTaskResult.endTime!=null and callTaskResult.endTime!=''"> |
| | | and sdct.time <= #{callTaskResult.endTime} |
| | | </if> |
| | | <if test="list != null and list.size()>0"> |
| | | and ctr."task_id" in |
| | | <foreach collection="list" item="taskId" separator ="," open="(" close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | ) a group by date_format("gmt_create",'%Y-%m-%d'),waterCode,"callee_number" |
| | | ) b on ctr."gmt_create" = b."gmt_create" and ctr."callee_number" = b."callee_number" |
| | | union all |
| | | select ctr.* from SJZT_ODS."call_task_result" ctr |
| | | left join SJZT_ODS."call_task" ct on ct."id" = ctr."task_id" |
| | | left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id" |
| | | where date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskResult.gmtCreate} and ct."scene_id" = 228 |
| | | where 1=1 |
| | | <if test="callTaskResult.startTime!=null and callTaskResult.startTime!=''"> |
| | | and ct."scene_id" = 228 |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') >= #{callTaskResult.startTime} |
| | | </if> |
| | | <if test="callTaskResult.endTime!=null and callTaskResult.endTime!=''"> |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskResult.endTime} |
| | | </if> |
| | | <if test="list != null and list.size()>0"> |
| | | and ctr."task_id" in |
| | | <foreach collection="list" item="taskId" separator ="," open="(" close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | and sdct.task_id is null |
| | | ) ctr |
| | | left join |
| | |
| | | </if> |
| | | <if test="callTaskResult.taskStatus!=null"> |
| | | and ct."task_status" = #{callTaskResult.taskStatus} |
| | | </if> |
| | | <if test="callTaskResult.startTime!=null and callTaskResult.startTime!=''"> |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') >= #{callTaskResult.startTime} |
| | | </if> |
| | | <if test="callTaskResult.endTime!=null and callTaskResult.endTime!=''"> |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskResult.endTime} |
| | | </if> |
| | | order by ctr."gmt_create" desc |
| | | </select> |