| | |
| | | <!--查询智能外呼统计数据-按日期-行政区统计--> |
| | | <select id="getOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select |
| | | aab."guid",aab."ad_name", |
| | | 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, |
| | |
| | | <!--查询当前天除去日常呼叫外的统计数据--> |
| | | <select id="getNoDayOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select |
| | | aab."guid",aab."ad_name", |
| | | 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, |
| | |
| | | |
| | | <!--按日期行政区呼叫结果详情列表信息--> |
| | | <select id="getCallResultList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select |
| | | e."gmt_create" as createTime,e."call_id",e.waterCode,e.callResult,e."callee_number", |
| | | aab."guid",aab."ad_name" as adName, |
| | | bu.real_name as realName, |
| | | if(ifnull(scnfr.call_id,0)='0','','已反馈') isSmsFill, |
| | | case when aab."ad_grad"= 3 then aab."p_ad_name" |
| | | when e."ad_grad"= 2 then e."ad_name" |
| | | when e."ad_grad"= 3 then e."p_ad_name" |
| | | end as cityName, |
| | | case when e."ad_grad"= 4 then e."p_ad_name" |
| | | when e."ad_grad"= 3 then e."ad_name" |
| | | end as countyName, |
| | | arb."name" as waterName |
| | | from ( |
| | | select date_format(ctc."gmt_create",'%Y-%m-%d') "gmt_create",ctc."call_id",ctr."ad_grad",ctr."ad_name",ctr."p_ad_name", |
| | | 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.*,aab."ad_grad",aab."ad_name",aab."p_ad_name" 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" |
| | | left join "SJZT_MD"."att_res_base" arb on d.waterCode = arb."code" |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = concat(arb."ad_guid",'000000') |
| | | 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 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,aab."ad_grad",aab."ad_name",aab."p_ad_name" 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" |
| | | 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 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 "SJZT_MD"."att_res_base" arb on locate(arb."code",e.waterCode)>0 |
| | | 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 = e."call_id" |
| | | left join "YWXT".blade_user bu on bu.phone = e."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> |
| | | 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.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 test="callTaskStatistic.grad==3"> |
| | | and x.countyCode = #{callTaskStatistic.adCode} |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | 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, |