| | |
| | | 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" |
| | | 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 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> |
| | |
| | | aab."ad_name" as adName, |
| | | createTime, |
| | | ifnull(sum(totalCount),0) calleeNumberCount, |
| | | ifnull(sum(connectCount),0) connectionCount |
| | | 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", |
| | |
| | | ) 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} |
| | |
| | | aab."ad_name" as adName, |
| | | createTime, |
| | | ifnull(sum(totalCount),0) calleeNumberCount, |
| | | ifnull(sum(connectCount),0) connectionCount |
| | | 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", |
| | |
| | | ) 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} |
| | |
| | | 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> |
| | | |
| | | </mapper> |