| | |
| | | date_format(ct."task_schedule_time",'%Y-%m-%d %H:%i:%s') as executeTime, |
| | | ctr."calling_number" as callingNumber, |
| | | ctra."callee_number_count" as calleeNumberCount, |
| | | ctra."connection_count" as connectionCount, |
| | | ctra."failure_count" as failureCount, |
| | | if(ifnull(scnfr.task_id,0)='0',ctra."connection_count",(ctra."connection_count"+scnfr.num)) as connectionCount, |
| | | if(ifnull(scnfr.task_id,0)='0',ctra."failure_count",(ctra."failure_count"-scnfr.num)) as failureCount, |
| | | ctra."other_status_count" as otherStatusCount, |
| | | cs."call_scenes_name" as callScenesName |
| | | from "SJZT_ODS"."call_task" ct |
| | | left join (select * from "SJZT_ODS"."call_scenes" where "is_deleted" = 0) cs on ct."scene_id" = cs."id" |
| | | left join (select DISTINCT "task_id","calling_number" from "SJZT_ODS"."call_task_result") ctr on ctr."task_id" = ct."id" |
| | | left join "SJZT_ODS"."call_task_result_analyse" ctra on ctra."task_id" = ct."id" |
| | | where 1=1 |
| | | left join (select task_id,count(*)as num from "YWXT".sm_call_not_fill_record group by task_id) scnfr on scnfr.task_id = ctr."task_id" |
| | | where 1=1 and ct."is_deleted" = 0 |
| | | <if test="callTask.taskName!=null and callTask.taskName!=''"> |
| | | and ct."task_name" like concat(concat('%',#{callTask.taskName}),'%') |
| | | </if> |
| | |
| | | and ct."task_status" = #{callTask.taskStatus} |
| | | </if> |
| | | <if test="callTask.startTime!=null and callTask.startTime!=''"> |
| | | and date_format(ct."gmt_create",'%Y-%m-%d') >= #{callTask.startTime} |
| | | and date_format(ct."task_schedule_time",'%Y-%m-%d') >= #{callTask.startTime} |
| | | </if> |
| | | <if test="callTask.endTime!=null and callTask.endTime!=''"> |
| | | and date_format(ct."gmt_create",'%Y-%m-%d') <= #{callTask.endTime} |
| | | and date_format(ct."task_schedule_time",'%Y-%m-%d') <= #{callTask.endTime} |
| | | </if> |
| | | order by ct."gmt_create" desc |
| | | </select> |
| | |
| | | ctr."intention_customer_flag" as intentionCustomerFlag, |
| | | ctr."is_deleted" as isDeleted, |
| | | ctc.waterCode, |
| | | arb."name" as waterName, |
| | | aab."ad_name" as areaName, |
| | | ctc.userName |
| | | 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 "SJZT_ODS"."call_task_result" 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."task_id" = ctc."task_id" and ctr."callee_number" = ctc."callee_number" |
| | | 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 "SJZT_MD"."att_ad_base" aab on aab."guid" = arb."interior_ad_guid" |
| | | 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="list != null and list.size()>0"> |
| | | and aab."ad_code" in |
| | | <foreach collection="list" item="adCode" separator ="," open="(" close=")"> |
| | | #{adCode} |
| | | </foreach> |
| | | </if> |
| | | <if test="idsList != null and idsList.size()>0"> |
| | | and ct."id" in |
| | | <foreach collection="idsList" item="id" separator ="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="callTaskResult.waterName!=null and callTaskResult.waterName!=''"> |
| | | and ctc."call_task_callee_content" like concat('%',#{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."call_task_callee_content" like concat('%',#{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} |
| | |
| | | |
| | | <!--通过行政区编号获取水库名称--> |
| | | <select id="getWaterNameByAreaCode" resultType="java.lang.String"> |
| | | select "name" from SJZT_MD."att_res_base" where concat("ad_guid",'000000') = #{areaCode} |
| | | select "name" from SJZT_MD."att_res_base" where concat("ad_guid",'000000') = #{adCode} |
| | | </select> |
| | | |
| | | <!--查询所有下级区域--> |
| | | <select id="getAllChildrenAreaByAreaCode" resultType="java.lang.String"> |
| | | select "ad_code" from SJZT_MD."att_ad_base" |
| | | start with "ad_code" = #{areaCode} |
| | | CONNECT BY PRIOR "ad_code" = "p_ad_code" |
| | | </select> |
| | | |
| | | <!-- <!–查询智能外呼统计数据-按日期-行政区统计–>--> |
| | | <!-- <select id="getOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic">--> |
| | | <!-- select a.*,round(a.connectionCount/a.calleeNumberCount*100,2) callCompletingRate from--> |
| | | <!-- (--> |
| | | <!-- select--> |
| | | <!-- count(*) as calleeNumberCount,--> |
| | | <!-- ifnull(sum(case when ctr."call_result"='200000' then 1 else 0 end),0) as connectionCount,--> |
| | | <!-- DATE_FORMAT(ctr."gmt_create",'%Y-%m-%d') as createTime,--> |
| | | <!-- aab."ad_name" as adName,--> |
| | | <!-- aab."guid"--> |
| | | <!-- from "SJZT_ODS"."call_task_result" ctr--> |
| | | <!-- left join--> |
| | | <!-- (--> |
| | | <!-- select "call_id","task_id",JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode 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')--> |
| | | <!-- where 1=1 and aab."ad_name" is not null--> |
| | | <!-- <if test="callTaskStatistic.startTime!=null and callTaskStatistic.startTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') >= #{callTaskStatistic.startTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskStatistic.endTime!=null and callTaskStatistic.endTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskStatistic.endTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="list != null and list.size()>0">--> |
| | | <!-- and aab."ad_code" in--> |
| | | <!-- <foreach collection="list" item="adCode" separator ="," open="(" close=")">--> |
| | | <!-- #{adCode}--> |
| | | <!-- </foreach>--> |
| | | <!-- </if>--> |
| | | <!-- group by DATE_FORMAT(ctr."gmt_create",'%Y-%m-%d'),aab."ad_name",aab."guid"--> |
| | | <!-- ) a--> |
| | | <!-- order by createTime desc,callCompletingRate desc--> |
| | | <!-- </select> --> |
| | | |
| | | <!--查询智能外呼统计数据-按日期-行政区统计--> |
| | | <select id="getOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select |
| | | aab."guid",aab."ad_name",aab."ad_grad" as grad, |
| | | ifnull(totalCount,0) as calleeNumberCount, |
| | | ifnull(connectCount,0) as connectionCount, |
| | | ifnull(threeNotConnectCount,0) as threeNoConnectCount, |
| | | ifnull(resConnectCount,0) as refuseConnectCount |
| | | from SJZT_MD."att_ad_base" aab left join( |
| | | select |
| | | aab."guid",aab."ad_name", |
| | | ifnull(sum(totalCount),0) as totalCount, |
| | | ifnull(sum(connectCount),0) as connectCount, |
| | | ifnull(sum(threeNotConnectCount),0) as threeNotConnectCount, |
| | | ifnull(sum(resConnectCount),0) as resConnectCount |
| | | from SJZT_MD."att_ad_base" aab join |
| | | ( |
| | | select b.*,aab."ad_name" as "city_name",aab."ad_grad" as "city_grad",aab."p_ad_code" as "province_code" |
| | | from SJZT_MD."att_ad_base" aab join ( |
| | | select a.*,aab."ad_name" as "county_name",aab."ad_grad" as "county_grad",aab."p_ad_code" as "city_code" |
| | | from SJZT_MD."att_ad_base" aab join( |
| | | select |
| | | ifnull(sum(case when ctc1."call_result"!='' then 1 else 0 end),0) as totalCount, |
| | | ifnull(sum(case when ctc1."call_result"='200000' then 1 when scnfr.id is not null then 1 else 0 end),0) as connectCount, |
| | | ifnull(sum(case when scnfr.id is not null then 0 |
| | | when ctc1."call_result"='200001' then 1 |
| | | when ctc1."call_result"='200003' then 1 |
| | | when ctc1."call_result"='200002' then 1 |
| | | when ctc1."call_result"='200004' then 1 |
| | | when ctc1."call_result"='200007' then 1 |
| | | when ctc1."call_result"='200010' then 1 |
| | | when ctc1."call_result"='200011' then 1 |
| | | when ctc1."call_result"='200100' then 1 |
| | | when ctc1."call_result"='200130' then 1 |
| | | else 0 end),0) as threeNotConnectCount, |
| | | ifnull(sum(case when scnfr.id is not null then 0 when ctc1."call_result"='200005' then 1 else 0 end),0) as resConnectCount, |
| | | aab."guid" as "town_code", |
| | | aab."ad_name" as "town_name", |
| | | aab."ad_grad" as "town_grad", |
| | | case when aab."ad_grad" =2 then aab."guid" |
| | | else aab."p_ad_code" end as "county_code" |
| | | from |
| | | ( |
| | | select ctr.*,waterCode 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 and sdct.time >= #{callTaskStatistic.startTime} and sdct.time <= #{callTaskStatistic.endTime} |
| | | ) 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" |
| | | ) ctc1 |
| | | left join "SJZT_MD"."att_res_base" arb on ctc1.waterCode = arb."code" |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = arb."interior_ad_guid" |
| | | left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctc1."call_id" |
| | | where 1=1 |
| | | group by aab."ad_name",aab."guid",aab."ad_grad",aab."p_ad_code" |
| | | ) a on aab."guid" = a."county_code" |
| | | ) b on aab."guid" = b."city_code" |
| | | ) c |
| | | <if test="callTaskStatistic.grad==1"> |
| | | on aab."guid" = c."city_code" or (aab."guid" = c."county_code" and c."county_grad" = 2) or (aab."guid" = c."county_code" and c."county_grad" = 1) |
| | | where aab."ad_grad" = 2 |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | on aab."guid" = c."county_code" or (aab."guid" = c."town_code" and c."county_grad" = 3) or (aab."guid" = c."town_code" and c."county_grad" = 2) |
| | | where 1=1 and (aab."ad_grad" = 3 or aab."ad_grad" = 2) and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | on aab."guid" = c."town_code" |
| | | where 1=1 and aab."ad_grad" = 4 and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | group by aab."guid",aab."ad_name" |
| | | ) d on d."guid" = aab."ad_code" |
| | | <if test="callTaskStatistic.grad==1"> |
| | | where aab."ad_grad" =2 |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | where (aab."ad_grad" = 3 or aab."ad_grad" = 2) and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | where aab."ad_grad" =4 and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | order by aab."guid" |
| | | </select> |
| | | |
| | | <!-- <!–查询智能外呼统计数据-按日期-行政区统计–>--> |
| | | <!-- <select id="getOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic">--> |
| | | <!-- select--> |
| | | <!-- b.*,--> |
| | | <!-- case when b.calleeNumberCount>0 then round(b.connectionCount/b.calleeNumberCount*100,2) else 0 end callCompletingRate--> |
| | | <!-- from (--> |
| | | <!-- select aab."guid",--> |
| | | <!-- aab."ad_name" as adName,--> |
| | | <!-- createTime,--> |
| | | <!-- ifnull(sum(totalCount),0) calleeNumberCount,--> |
| | | <!-- ifnull(sum(connectCount),0) + ifnull(sum(isSmsFillCount),0) connectionCount--> |
| | | <!-- from SJZT_MD."att_ad_base" aab--> |
| | | <!-- left join (--> |
| | | <!-- select--> |
| | | <!-- count(*) as totalCount,--> |
| | | <!-- ifnull(sum(case when ctr."call_result"='200000' then 1 else 0 end),0) as connectCount,--> |
| | | <!-- ifnull(sum(case when scnfr.task_id!='' then 1 else 0 end),0)as isSmsFillCount,--> |
| | | <!-- DATE_FORMAT(ctr."gmt_create",'%Y-%m-%d') as createTime,--> |
| | | <!-- aab."guid",--> |
| | | <!-- aab."ad_grad",--> |
| | | <!-- aab."p_ad_code",--> |
| | | <!-- aab."ad_name" as adName--> |
| | | <!-- from "SJZT_ODS"."call_task_result" ctr--> |
| | | <!-- left join--> |
| | | <!-- (--> |
| | | <!-- select "call_id","task_id",JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode 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 "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id"--> |
| | | <!-- where 1=1 and aab."ad_name" is not null--> |
| | | <!-- <if test="callTaskStatistic.createTime!=null and callTaskStatistic.createTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskStatistic.createTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskStatistic.startTime!=null and callTaskStatistic.startTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') >= #{callTaskStatistic.startTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskStatistic.endTime!=null and callTaskStatistic.endTime!=''">--> |
| | | <!-- and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskStatistic.endTime}--> |
| | | <!-- </if>--> |
| | | <!-- group by DATE_FORMAT(ctr."gmt_create",'%Y-%m-%d'),aab."ad_name",aab."guid",aab."ad_grad",aab."p_ad_code"--> |
| | | <!-- ) a--> |
| | | <!-- <if test="callTaskStatistic.grad==1">--> |
| | | <!-- on aab."guid" = a."p_ad_code" where aab."p_ad_code" = #{callTaskStatistic.adCode}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskStatistic.grad==2">--> |
| | | <!-- on aab."guid" = a."guid" where aab."p_ad_code" = #{callTaskStatistic.adCode}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="callTaskStatistic.grad==3">--> |
| | | <!-- on aab."guid" = a."guid" where aab."ad_code" = #{callTaskStatistic.adCode}--> |
| | | <!-- </if>--> |
| | | <!-- group by createTime,aab."ad_name",aab."guid"--> |
| | | <!-- order by aab."guid"--> |
| | | <!-- ) b--> |
| | | <!-- </select>--> |
| | | |
| | | <!--查询智能外呼统计数据-行政区统计--> |
| | | <select id="getOutgoingStatisticByArea" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select b.*,case when b.connectionCount>0 then round(b.connectionCount/b.calleeNumberCount*100,2) else 0 end callCompletingRate from( |
| | | select aab."guid", |
| | | aab."ad_name" as adName, |
| | | createTime, |
| | | ifnull(sum(totalCount),0) calleeNumberCount, |
| | | ifnull(sum(connectCount),0) + ifnull(sum(isSmsFillCount),0) connectionCount |
| | | from SJZT_MD."att_ad_base" aab |
| | | left join ( |
| | | select |
| | | count(*) as totalCount, |
| | | ifnull(sum(case when ctr."call_result"='200000' then 1 else 0 end),0) as connectCount, |
| | | ifnull(sum(case when scnfr.task_id!='' then 1 else 0 end),0)as isSmsFillCount, |
| | | DATE_FORMAT(ctr."gmt_create",'%Y-%m-%d') as createTime, |
| | | aab."guid", |
| | | aab."ad_grad", |
| | | aab."p_ad_code", |
| | | aab."ad_name" as adName |
| | | from "SJZT_ODS"."call_task_result" ctr |
| | | left join |
| | | ( |
| | | select "call_id","task_id",JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode 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 "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id" |
| | | where 1=1 and aab."ad_name" is not null |
| | | <if test="callTaskStatistic.createTime!=null and callTaskStatistic.createTime!=''"> |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') = #{callTaskStatistic.createTime} |
| | | </if> |
| | | <if test="callTaskStatistic.startTime!=null and callTaskStatistic.startTime!=''"> |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') >= #{callTaskStatistic.startTime} |
| | | </if> |
| | | <if test="callTaskStatistic.endTime!=null and callTaskStatistic.endTime!=''"> |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskStatistic.endTime} |
| | | </if> |
| | | group by DATE_FORMAT(ctr."gmt_create",'%Y-%m-%d'),aab."ad_name",aab."guid",aab."ad_grad",aab."p_ad_code" |
| | | ) a |
| | | <if test="callTaskStatistic.grad==1"> |
| | | on aab."guid" = a."guid" or aab."guid" = a."p_ad_code" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | on aab."guid" = a."guid" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | on aab."guid" = a."guid" where aab."ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | group by createTime,aab."ad_name",aab."guid" |
| | | order by aab."guid" |
| | | ) b |
| | | </select> |
| | | |
| | | <!--查询外呼多少天内已呼叫过的人员手机号集合信息--> |
| | | <select id="getCallUserPhoneByParam" resultType="java.lang.String"> |
| | | select "callee_number" from SJZT_ODS."call_task_result" |
| | | where date_format("gmt_create",'%Y-%m-%d') >= #{params.startTime} |
| | | and date_format("gmt_create",'%Y-%m-%d') <= #{params.endTime} |
| | | </select> |
| | | |
| | | <!--查询外呼多少天内已呼叫过的人员手机号集合信息-并只取接通的号码--> |
| | | <!-- <select id="getCallUserPhoneByParam" resultType="java.lang.String">--> |
| | | <!-- select "callee_number" from SJZT_ODS."call_task_result"--> |
| | | <!-- where date_format("gmt_create",'%Y-%m-%d') >= #{params.startTime}--> |
| | | <!-- and date_format("gmt_create",'%Y-%m-%d') <= #{params.endTime}--> |
| | | <!-- and "call_result" = '200000'--> |
| | | <!-- </select>--> |
| | | |
| | | <!--通过任务名称查询taskId-mysql--> |
| | | <select id="getTaskIdByTaskName" resultType="java.lang.String"> |
| | | select id from call_task where task_name = #{taskName} |
| | | </select> |
| | | |
| | | <!--通过任务名称查询taskId-mysql--> |
| | | <select id="getBeforeOneDayCallNotConnect" resultType="cn.gistack.sm.intelligentCall.entity.Scene"> |
| | | select ctc.callee_number as phone,ctc.callee_number as userId, |
| | | TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$水库编码$"')) as waterCode, |
| | | TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$水库名称$"')) as waterName, |
| | | TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$用户名$"')) as username |
| | | from call_task_callee ctc |
| | | join ( |
| | | select call_id,callee_number,call_result from call_task_result |
| | | where date_format(gmt_create,'%Y-%m-%d') >= #{params.startTime} |
| | | and date_format(gmt_create,'%Y-%m-%d') < #{params.endTime} |
| | | ) ctr on ctc.call_id = ctr.call_id |
| | | and ctc.call_status = 4 and ctr.call_result!='200000' |
| | | </select> |
| | | |
| | | <!--查询前一天已填报的人员-达梦--> |
| | | <select id="getFillRecordList" resultType="java.lang.String"> |
| | | select tel from sm_call_not_fill_record |
| | | where date_format(create_time,'%Y-%m-%d') >= #{params.startTime} |
| | | and date_format(create_time ,'%Y-%m-%d') < #{params.endTime} |
| | | </select> |
| | | |
| | | |
| | | <!--查询三天都未接通的人员-mysql--> |
| | | <select id="getBeforeThreeDayCallNotConnect" resultType="java.lang.String"> |
| | | select callee_number from ( |
| | | select callee_number,count(*) num from ( |
| | | select ctc.callee_number,ctr.gmt_create |
| | | from call_task_callee ctc |
| | | join ( |
| | | select call_id,callee_number,call_result,date_format(gmt_create,'%Y-%m-%d') gmt_create from call_task_result |
| | | where date_format(gmt_create,'%Y-%m-%d') >= #{params.startTime} |
| | | and date_format(gmt_create,'%Y-%m-%d') < #{params.endTime} |
| | | ) ctr on ctc.call_id = ctr.call_id |
| | | |
| | | and ctc.call_status = 4 and ctr.call_result!='200000' GROUP BY ctc.callee_number,ctr.gmt_create |
| | | )a GROUP BY callee_number |
| | | )b where num=3 |
| | | </select> |
| | | |
| | | <!--查询n天都未接通的人员--> |
| | | <select id="getNotCallConnectStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select aab."guid", |
| | | sum(case when ifnull(aa.num,9)='9' then 0 else 1 end) count, |
| | | aab."ad_name" as adName |
| | | from SJZT_MD."att_ad_base" aab |
| | | left join ( |
| | | select b.*,aab."guid",aab."ad_grad",aab."p_ad_code",aab."ad_name" as adName from ( |
| | | select "callee_number",waterCodes,LENGTH(waterCodes)- LENGTH(REPLACE(waterCodes,',','')) num from ( |
| | | select ctr."callee_number",WM_Concat(ctc.waterCode) waterCodes from ( |
| | | select "call_id","task_id",JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode from "SJZT_ODS"."call_task_callee" |
| | | ) ctc join ( |
| | | select ctr."call_id",ctr."callee_number",ctr."call_result",date_format(ctr."gmt_create",'%Y-%m-%d') "gmt_create" from SJZT_ODS."call_task_result" ctr |
| | | left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id" |
| | | where date_format(ctr."gmt_create",'%Y-%m-%d') >= #{day.startTime} and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{day.endTime} |
| | | and ctr."call_result"= #{resultStatus} and scnfr.id is null |
| | | )ctr on ctc."call_id" = ctr."call_id" group by ctr."callee_number" |
| | | ) a where LENGTH(waterCodes)- LENGTH(REPLACE(waterCodes,',','')) = #{number} |
| | | )b |
| | | left join "SJZT_MD"."att_res_base" arb on locate(arb."code",b.waterCodes)>0 |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = concat(arb."ad_guid",'000000') or aab."guid" = arb."interior_ad_guid" |
| | | where aab."ad_name" is not null |
| | | ) aa |
| | | <if test="callTaskStatistic.grad==1"> |
| | | on aab."guid" = aa."p_ad_code" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | on aab."guid" = aa."guid" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | on aab."guid" = aa."guid" where aab."ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | group by aab."ad_name",aab."guid" |
| | | order by aab."guid" |
| | | </select> |
| | | |
| | | |
| | | <!--查询未接通,拒接的呼叫结果详情列表信息--> |
| | | <select id="getCallNotConnectResultList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select |
| | | b.*, |
| | | aab."guid",aab."ad_grad",aab."p_ad_code",aab."ad_name" as adName, |
| | | bu.real_name as realName, |
| | | REGEXP_SUBSTR (arb."res_loc",'[^-]+',1,2) as cityName, |
| | | REGEXP_SUBSTR (arb."res_loc",'[^-]+',1,3) as countyName, |
| | | arb."name" as waterName |
| | | from ( |
| | | select "callee_number",waterCodes,LENGTH(waterCodes)- LENGTH(REPLACE(waterCodes,',','')) num from ( |
| | | select ctr."callee_number",WM_Concat(ctc.waterCode) waterCodes from ( |
| | | select "call_id","task_id",JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode from "SJZT_ODS"."call_task_callee" |
| | | ) ctc join ( |
| | | select ctr."call_id",ctr."callee_number",ctr."call_result",date_format(ctr."gmt_create",'%Y-%m-%d') "gmt_create" from SJZT_ODS."call_task_result" ctr |
| | | left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id" |
| | | where date_format(ctr."gmt_create",'%Y-%m-%d') >= #{day.startTime} and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{day.endTime} |
| | | and ctr."call_result"= #{callTaskStatistic.resultStatus} and scnfr.id is null |
| | | )ctr on ctc."call_id" = ctr."call_id" group by ctr."callee_number" |
| | | ) a where LENGTH(waterCodes)- LENGTH(REPLACE(waterCodes,',','')) = #{callTaskStatistic.count} |
| | | )b |
| | | left join "SJZT_MD"."att_res_base" arb on locate(arb."code",b.waterCodes)>0 |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = arb."interior_ad_guid" |
| | | left join "YWXT".blade_user bu on bu.phone = b."callee_number" and bu.is_deleted = 0 |
| | | where aab."ad_name" is not null |
| | | <if test="list != null and list.size()>0"> |
| | | and aab."ad_code" in |
| | | <foreach collection="list" item="adCode" separator ="," open="(" close=")"> |
| | | #{adCode} |
| | | </foreach> |
| | | </if> |
| | | <if test="callTaskStatistic.realName!=null and callTaskStatistic.realName!=''"> |
| | | and bu.real_name like concat('%',#{callTaskStatistic.realName},'%') |
| | | </if> |
| | | <if test="callTaskStatistic.waterName!=null and callTaskStatistic.waterName!=''"> |
| | | and arb."name" like concat('%',#{callTaskStatistic.waterName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <!--通过 taskId 查询未呼叫人员(mysql)--> |
| | | <select id="getCallNotConnectListByTaskId" resultType="cn.gistack.sm.intelligentCall.entity.Scene"> |
| | | select ctc.callee_number as phone,ctc.callee_number as userId, |
| | | TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$水库编码$"')) as waterCode, |
| | | TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$水库名称$"')) as waterName, |
| | | TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$用户名$"')) as username |
| | | from call_task_callee ctc |
| | | join call_task_result ctr on ctc.call_id = ctr.call_id |
| | | and ctc.call_status = 4 and ctr.call_result!='200000' and ctc.task_id = #{taskId} |
| | | </select> |
| | | |
| | | <!--查询当前天除去日常呼叫外的统计数据--> |
| | | <select id="getNoDayOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select |
| | | aab."guid",aab."ad_name",aab."ad_grad" as grad, |
| | | ifnull(totalCount,0) as calleeNumberCount, |
| | | ifnull(connectCount,0) as connectionCount, |
| | | ifnull(threeNotConnectCount,0) as threeNoConnectCount, |
| | | ifnull(resConnectCount,0) as refuseConnectCount |
| | | from SJZT_MD."att_ad_base" aab left join( |
| | | select |
| | | aab."guid",aab."ad_name", |
| | | ifnull(sum(totalCount),0) as totalCount, |
| | | ifnull(sum(connectCount),0) as connectCount, |
| | | ifnull(sum(threeNotConnectCount),0) as threeNotConnectCount, |
| | | ifnull(sum(resConnectCount),0) as resConnectCount |
| | | from SJZT_MD."att_ad_base" aab join |
| | | ( |
| | | select b.*,aab."ad_name" as "city_name",aab."ad_grad" as "city_grad",aab."p_ad_code" as "province_code" |
| | | from SJZT_MD."att_ad_base" aab join ( |
| | | select a.*,aab."ad_name" as "county_name",aab."ad_grad" as "county_grad",aab."p_ad_code" as "city_code" |
| | | from SJZT_MD."att_ad_base" aab join( |
| | | select |
| | | ifnull(sum(case when ctc."call_result"!='' then 1 else 0 end),0) as totalCount, |
| | | ifnull(sum(case when ctc."call_result"='200000' then 1 when ctc.task_id is not null then 1 else 0 end),0) as connectCount, |
| | | ifnull(sum(case when ctc.task_id is not null then 0 |
| | | when ctc."call_result"='200001' then 1 |
| | | when ctc."call_result"='200003' then 1 |
| | | when ctc."call_result"='200002' then 1 |
| | | when ctc."call_result"='200004' then 1 |
| | | when ctc."call_result"='200007' then 1 |
| | | when ctc."call_result"='200010' then 1 |
| | | when ctc."call_result"='200011' then 1 |
| | | when ctc."call_result"='200100' then 1 |
| | | when ctc."call_result"='200130' then 1 |
| | | else 0 end),0) as threeNotConnectCount, |
| | | ifnull(sum(case when ctc.task_id is not null then 0 when ctc."call_result"='200005' then 1 else 0 end),0) as resConnectCount, |
| | | aab."guid" as "town_code", |
| | | aab."ad_name" as "town_name", |
| | | aab."ad_grad" as "town_grad", |
| | | case when aab."ad_grad" =2 then aab."guid" |
| | | else aab."p_ad_code" end as "county_code" |
| | | from |
| | | ( |
| | | select ctc."gmt_create",ctc."call_id",ctc."task_id",JSON_VALUE(ctc."call_task_callee_content",'$."$水库编码$"') as waterCode,ctr."call_result",scnfr.task_id from "SJZT_ODS"."call_task_callee" ctc |
| | | left join SJZT_ODS."call_task" ct on ct."id" = ctc."task_id" |
| | | left join SJZT_ODS."call_task_result" ctr on ctr."call_id" = ctc."call_id" |
| | | left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id" |
| | | left join YWXT.sm_daily_call_task sdct on sdct.task_id = ct."id" |
| | | where 1=1 |
| | | and sdct.task_id is null |
| | | and date_format(ctc."gmt_create",'%Y-%m-%d') >= #{callTaskStatistic.startTime} |
| | | and date_format(ctc."gmt_create",'%Y-%m-%d') <= #{callTaskStatistic.endTime} |
| | | ) ctc |
| | | left join "SJZT_MD"."att_res_base" arb on ctc.waterCode = arb."code" |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = arb."interior_ad_guid" |
| | | where 1=1 |
| | | group by aab."ad_name",aab."guid",aab."ad_grad",aab."p_ad_code" |
| | | ) a on aab."guid" = a."county_code" |
| | | ) b on aab."guid" = b."city_code" |
| | | ) c |
| | | <if test="callTaskStatistic.grad==1"> |
| | | on aab."guid" = c."city_code" or (aab."guid" = c."county_code" and c."county_grad" = 2) or (aab."guid" = c."county_code" and c."county_grad" = 1) |
| | | where 1=1 and aab."ad_grad" = 2 |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | on aab."guid" = c."county_code" or (aab."guid" = c."town_code" and c."county_grad" = 3) or (aab."guid" = c."town_code" and c."county_grad" = 2) |
| | | where 1=1 and (aab."ad_grad" = 3 or aab."ad_grad" = 2) and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | on aab."guid" = c."town_code" |
| | | where 1=1 and aab."ad_grad" = 4 and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | group by aab."guid",aab."ad_name" |
| | | ) d on d."guid" = aab."ad_code" |
| | | <if test="callTaskStatistic.grad==1"> |
| | | where aab."ad_grad" =2 |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | where (aab."ad_grad" = 3 or aab."ad_grad" = 2) and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | where aab."ad_grad" =4 and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | order by aab."guid" |
| | | </select> |
| | | |
| | | <!--按日期行政区呼叫结果详情列表信息--> |
| | | <select id="getCallResultList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select x.* from ( |
| | | select |
| | | e."gmt_create" as createTime,e."call_id",e.waterCode,e.callResult,e."callee_number", |
| | | bu.real_name as realName, |
| | | if(ifnull(scnfr.call_id,0)='0','','已反馈') isSmsFill, |
| | | arb."name" as waterName,arb."eng_scal" as engScal,arb."res_reg_code" as resRegCode, |
| | | case when b."ad_grad" = 4 THEN b."ad_name" ELSE NULL END AS townName, |
| | | case when b."ad_grad" = 3 THEN b."ad_name" |
| | | when c."ad_grad" = 3 THEN c."ad_name" END AS countyName, |
| | | case when b."ad_grad" = 3 THEN b."ad_code" |
| | | when c."ad_grad" = 3 THEN c."ad_code" END AS countyCode, |
| | | case when b."ad_grad" = 2 THEN b."ad_code" |
| | | when c."ad_grad" = 2 THEN c."ad_code" |
| | | ELSE d."ad_code" END AS cityCode, |
| | | case when b."ad_grad" = 2 THEN b."ad_name" |
| | | when c."ad_grad" = 2 THEN c."ad_name" |
| | | ELSE d."ad_name" END AS cityName |
| | | from ( |
| | | select date_format(ctc."gmt_create",'%Y-%m-%d') "gmt_create",ctc."call_id",ctc."task_id",JSON_VALUE(ctc."call_task_callee_content",'$."$水库编码$"') as waterCode , |
| | | ctr."call_result" as callResult,ctr."callee_number" |
| | | from "SJZT_ODS"."call_task_callee" ctc |
| | | join ( |
| | | select d.* from ( |
| | | select ctr.*,waterCode 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 |
| | | and sdct.time >= #{callTaskStatistic.startTime} and sdct.time <= #{callTaskStatistic.endTime} |
| | | ) 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" |
| | | ) d left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = d."call_id" |
| | | where 1=1 |
| | | <if test="callTaskStatistic.count==2"> |
| | | and d."call_result" = '200000' or scnfr.task_id is not null |
| | | </if> |
| | | <if test="callTaskStatistic.count==3"> |
| | | and d."call_result" = '200003' and scnfr.id is null |
| | | </if> |
| | | <if test="callTaskStatistic.count==4"> |
| | | and d."call_result" = '200005' and scnfr.id is null |
| | | </if> |
| | | union all |
| | | |
| | | select ctr.*,waterCode from SJZT_ODS."call_task_result" ctr |
| | | 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" |
| | | left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = ctr."call_id" |
| | | 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') >= #{callTaskStatistic.startTime} |
| | | and date_format(ctr."gmt_create",'%Y-%m-%d') <= #{callTaskStatistic.endTime} |
| | | and sdct.task_id is null |
| | | <if test="callTaskStatistic.count==2"> |
| | | and ctr."call_result" = '200000' and scnfr.id is not null |
| | | </if> |
| | | <if test="callTaskStatistic.count==3"> |
| | | and ctr."call_result" = '200003' and scnfr.id is null |
| | | </if> |
| | | <if test="callTaskStatistic.count==4"> |
| | | and ctr."call_result" = '200005' and scnfr.id is null |
| | | </if> |
| | | )ctr on ctc."call_id" = ctr."call_id" |
| | | )e |
| | | left join YWXT.sm_call_not_fill_record scnfr on scnfr.call_id = e."call_id" |
| | | left join YWXT.blade_user bu on bu.phone = e."callee_number" and bu.is_deleted = 0 |
| | | left join SJZT_MD."att_res_base" arb on locate(arb."code",e.waterCode)>0 |
| | | left join SJZT_MD."att_ad_base" b ON arb."interior_ad_guid" = b."guid" |
| | | left join SJZT_MD."att_ad_base" c ON b."p_ad_code" = c."guid" |
| | | left join SJZT_MD."att_ad_base" d ON c."p_ad_code" = d."guid" |
| | | <if test="callTaskStatistic.realName!=null and callTaskStatistic.realName!=''"> |
| | | and bu.real_name like concat('%',#{callTaskStatistic.realName},'%') |
| | | </if> |
| | | <if test="callTaskStatistic.waterName!=null and callTaskStatistic.waterName!=''"> |
| | | and arb."name" like concat('%',#{callTaskStatistic.waterName},'%') |
| | | </if> |
| | | ) x |
| | | where 1=1 |
| | | <if test="callTaskStatistic.grad==2"> |
| | | and x.cityCode = #{callTaskStatistic.adCode} |
| | | </if> |
| | | <if test="callTaskStatistic.grad==3"> |
| | | and x.countyCode = #{callTaskStatistic.adCode} |
| | | </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 |
| | | 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, |
| | | REGEXP_SUBSTR (arb."res_loc",'[^-]+',1,4) as townName, |
| | | 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 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 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 |
| | | ( |
| | | 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> |
| | | order by ctr."gmt_create" desc |
| | | </select> |
| | | |
| | | <!--查询从未接通和从未呼叫的水库--> |
| | | <select id="getNotCallOrCallNotConnect" resultType="cn.gistack.sm.intelligentCall.entity.Scene"> |
| | | ( |
| | | select b."guid" as waterCode,b."name" as waterName,c."user_name" as username, |
| | | c."user_phone" as phone,c."user_phone" as userId from ( |
| | | select * from SJZT_MD."att_res_base" arb right join ( |
| | | select e.* from ( |
| | | select JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode |
| | | from "SJZT_ODS"."call_task_callee" where date_format("gmt_create",'%Y-%m-%d') >='2023-05-01' group by JSON_VALUE("call_task_callee_content",'$."$水库编码$"') |
| | | ) e left join |
| | | |
| | | ( |
| | | select waterCode from ( |
| | | select a.*,b."callee_number",b."call_result",c.id from ( |
| | | select "call_id", |
| | | JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode |
| | | from "SJZT_ODS"."call_task_callee" |
| | | where date_format("gmt_create",'%Y-%m-%d') >='2023-05-01' |
| | | ) a left join "SJZT_ODS"."call_task_result" b on a."call_id" = b."call_id" |
| | | left join "YWXT".sm_call_not_fill_record c on c.call_id = a."call_id" |
| | | where ("call_result" = '200000' or (b."call_result"!='200000' and c.id is not null)) |
| | | |
| | | ) d group by waterCode |
| | | ) f on e.waterCode = f.waterCode |
| | | where f.waterCode is null |
| | | )a on arb."guid" = a.waterCode) b |
| | | LEFT JOIN SJZT_MD."att_res_manage_person" c ON b."guid" = c."res_guid" and c."type" = 5 |
| | | where "user_phone" is not null |
| | | and b."eng_scal"!='中型' and b."eng_scal"!='大(2)型' and b."eng_scal"!='大(1)型' |
| | | order by b."interior_ad_guid" |
| | | ) |
| | | union |
| | | ( |
| | | select |
| | | e."code" as waterCode,e."name" as waterName,e."user_name" as username, |
| | | e."user_phone" as phone,e."user_phone" as userId |
| | | from ( |
| | | select b."code",b."name",b."res_reg_code",b."eng_scal",c."user_name", |
| | | c."user_phone",aab.* |
| | | from ( |
| | | select * from SJZT_MD."att_res_base" arb left join |
| | | |
| | | ( |
| | | select JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode from "SJZT_ODS"."call_task_callee" |
| | | where date_format("gmt_create",'%Y-%m-%d') >='2023-05-01' |
| | | group by JSON_VALUE("call_task_callee_content",'$."$水库编码$"') |
| | | ) a on arb."guid" = a.waterCode |
| | | where waterCode is null) b |
| | | LEFT JOIN SJZT_MD."att_res_manage_person" c ON b."guid" = c."res_guid" and c."type" = 5 |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = b."interior_ad_guid" |
| | | order by b."interior_ad_guid" ) e |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."ad_code" = e."p_ad_code" |
| | | where e."user_phone" is not null |
| | | and e."eng_scal"!='中型' and e."eng_scal"!='大(2)型' and e."eng_scal"!='大(1)型' |
| | | ) |
| | | </select> |
| | | |
| | | <!--按区域查询需要呼叫的人员信息--> |
| | | <select id="getCallListByArea" resultType="cn.gistack.sm.intelligentCall.entity.Scene"> |
| | | select |
| | | arb."guid" as waterCode, |
| | | arb."name" as waterName, |
| | | armp."user_name" as username, |
| | | armp."user_phone" as phone, |
| | | armp."user_phone" as userId |
| | | from SJZT_MD."att_res_base" arb |
| | | left join SJZT_MD."att_ad_base" aab on arb."interior_ad_guid" = aab."guid" |
| | | left join SJZT_MD."att_res_manage_person" armp on arb."guid" = armp."res_guid" and armp."type" = 5 |
| | | where 1=1 |
| | | and aab."p_ad_code" in( |
| | | '421181000000', |
| | | '421122000000', |
| | | '420116000000', |
| | | '420902000000' |
| | | ) |
| | | and armp."user_phone" is not null |
| | | and arb."eng_scal"!='中型' and arb."eng_scal"!='大(2)型' and arb."eng_scal"!='大(1)型' |
| | | </select> |
| | | |
| | | </mapper> |