| | |
| | | ) 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 "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 |
| | |
| | | |
| | | <!--查询智能外呼统计数据-按日期-行政区统计--> |
| | | <select id="getOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select aab."guid", |
| | | aab."ad_name" as adName, |
| | | createTime, |
| | | ifnull(sum(totalCount),0) calleeNumberCount, |
| | | ifnull(sum(connectCount),0) + ifnull(sum(connectCount1),0) + ifnull(sum(connectCount2),0) + ifnull(sum(isSmsFillCount),0) as connectionCount, |
| | | ifnull(sum(resConnectCount1),0) - ifnull(sum(resConnectCount2),0) refuseConnectCount, |
| | | ifnull(sum(twoNotConnectCount),0) twoNoConnectCount, |
| | | ifnull(sum(threeNotConnectCount),0) - ifnull(sum(threeNotConnectCount1),0) threeNoConnectCount |
| | | from SJZT_MD."att_ad_base" aab |
| | | left join ( |
| | | 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 |
| | | 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 else 0 end),0) as connectCount, |
| | | ifnull(sum(case when ctc2."call_result"='200000' then 1 else 0 end),0) as connectCount1, |
| | | ifnull(sum(case when ctc3."call_result"='200000' then 1 else 0 end),0) as connectCount2, |
| | | ifnull(sum(case when ctc3.task_id!='' then 1 else 0 end),0) as isSmsFillCount, |
| | | ifnull(sum(case when ctc2."call_result"='200003' then 1 else 0 end),0) as twoNotConnectCount, |
| | | ifnull(sum(case when ctc3."call_result"='200003' then 1 else 0 end),0) as threeNotConnectCount, |
| | | ifnull(sum(case when ctc3.task_id!='' and ctc3."call_result"='200003' then 1 else 0 end),0) as threeNotConnectCount1, |
| | | ifnull(sum(case when ctc3."call_result"='200005' then 1 else 0 end),0) as resConnectCount1, |
| | | ifnull(sum(case when ctc3.task_id!='' and ctc3."call_result"='200005' then 1 else 0 end),0) as resConnectCount2, |
| | | DATE_FORMAT(ctc1."gmt_create",'%Y-%m-%d') as createTime, |
| | | aab."guid", |
| | | aab."ad_grad", |
| | | aab."p_ad_code", |
| | | aab."ad_name" as adName |
| | | from |
| | | 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 ctc."gmt_create",ctc."call_id",ctc."task_id",JSON_VALUE(ctc."call_task_callee_content",'$."$水库编码$"') as waterCode,ctr."call_result" 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_daily_call_task sdct on sdct.task_id = ct."id" |
| | | where date_format(ct."task_schedule_time",'%Y-%m-%d') = #{callTaskStatistic.createTime} and sdct.type ='1' |
| | | ) ctc1 |
| | | left join ( |
| | | select ctc."gmt_create",ctc."call_id",ctc."task_id",JSON_VALUE(ctc."call_task_callee_content",'$."$水库编码$"') as waterCode,ctr."call_result" 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_daily_call_task sdct on sdct.task_id = ct."id" |
| | | where date_format(ct."task_schedule_time",'%Y-%m-%d') = #{callTaskStatistic.createTime} and sdct.type ='2' |
| | | ) ctc2 on ctc1.waterCode= ctc2.waterCode |
| | | left join ( |
| | | 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 date_format(ct."task_schedule_time",'%Y-%m-%d') = #{callTaskStatistic.createTime} and sdct.type ='3' |
| | | ) ctc3 on ctc1.waterCode= ctc3.waterCode |
| | | |
| | | left join "SJZT_MD"."att_res_base" arb on ctc1.waterCode = arb."code" |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = concat(arb."ad_guid",'000000') or aab."guid" = arb."interior_ad_guid" |
| | | where 1=1 and aab."ad_name" is not null |
| | | <if test="callTaskStatistic.createTime!=null and callTaskStatistic.createTime!=''"> |
| | | and date_format(ctc1."gmt_create",'%Y-%m-%d') = #{callTaskStatistic.createTime} |
| | | 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.startTime!=null and callTaskStatistic.startTime!=''"> |
| | | and date_format(ctc1."gmt_create",'%Y-%m-%d') >= #{callTaskStatistic.startTime} |
| | | <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.endTime!=null and callTaskStatistic.endTime!=''"> |
| | | and date_format(ctc1."gmt_create",'%Y-%m-%d') <= #{callTaskStatistic.endTime} |
| | | <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 DATE_FORMAT(ctc1."gmt_create",'%Y-%m-%d'),aab."ad_name",aab."guid",aab."ad_grad",aab."p_ad_code" |
| | | ) a |
| | | group by aab."guid",aab."ad_name" |
| | | ) d on d."guid" = aab."ad_code" |
| | | <if test="callTaskStatistic.grad==1"> |
| | | on aab."guid" = a."p_ad_code" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | where aab."ad_grad" =2 |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | on aab."guid" = a."guid" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | where (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" = a."guid" where aab."ad_code" = #{callTaskStatistic.adCode} |
| | | where aab."ad_grad" =4 and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | group by createTime,aab."ad_name",aab."guid" |
| | | order by aab."guid" |
| | | </select> |
| | | |
| | |
| | | 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} |
| | | 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} |
| | |
| | | |
| | | <!--查询当前天除去日常呼叫外的统计数据--> |
| | | <select id="getNoDayOutgoingStatisticList" resultType="cn.gistack.sm.intelligentCall.vo.CallTaskStatistic"> |
| | | select aab."guid", |
| | | aab."ad_name" as adName, |
| | | createTime, |
| | | ifnull(sum(totalCount),0) calleeNumberCount, |
| | | ifnull(sum(connectCount),0) + ifnull(sum(isSmsFillCount),0) as connectionCount, |
| | | ifnull(sum(resConnectCount1),0) - ifnull(sum(resConnectCount2),0) refuseConnectCount |
| | | from SJZT_MD."att_ad_base" aab |
| | | left join ( |
| | | 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 |
| | | 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 else 0 end),0) as connectCount, |
| | | ifnull(sum(case when ctc.task_id!='' then 1 else 0 end),0)as isSmsFillCount, |
| | | ifnull(sum(case when ctc."call_result"='200005' then 1 else 0 end),0) as resConnectCount1, |
| | | ifnull(sum(case when ctc.task_id!='' and ctc."call_result"='200005' then 1 else 0 end),0) as resConnectCount2, |
| | | DATE_FORMAT(ctc."gmt_create",'%Y-%m-%d') as createTime, |
| | | aab."guid", |
| | | aab."ad_grad", |
| | | aab."p_ad_code", |
| | | aab."ad_name" as adName |
| | | from |
| | | 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 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.type!='1' and sdct.type!='2' and sdct.type!='3' |
| | | <if test="callTaskStatistic.createTime!=null and callTaskStatistic.createTime!=''"> |
| | | and date_format(ctc."gmt_create",'%Y-%m-%d') = #{callTaskStatistic.createTime} |
| | | 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> |
| | | ) 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" = concat(arb."ad_guid",'000000') or aab."guid" = arb."interior_ad_guid" |
| | | where 1=1 and aab."ad_name" is not null |
| | | group by DATE_FORMAT(ctc."gmt_create",'%Y-%m-%d'),aab."ad_name",aab."guid",aab."ad_grad",aab."p_ad_code" |
| | | ) a |
| | | <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"> |
| | | on aab."guid" = a."p_ad_code" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | where aab."ad_grad" =2 |
| | | </if> |
| | | <if test="callTaskStatistic.grad==2"> |
| | | on aab."guid" = a."guid" where aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | where (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" = a."guid" where aab."ad_code" = #{callTaskStatistic.adCode} |
| | | where aab."ad_grad" =4 and aab."p_ad_code" = #{callTaskStatistic.adCode} |
| | | </if> |
| | | group by createTime,aab."ad_name",aab."guid" |
| | | 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 |
| | | a.*, |
| | | aab."guid",aab."ad_grad",aab."p_ad_code",aab."ad_name" as adName, |
| | | bu.real_name as realName, |
| | | if(ifnull(scnfr.call_id,0)='0','','已反馈') isSmsFill, |
| | | 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, |
| | | arb."name" as waterName |
| | | 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 * from ( |
| | | select ctr."call_id",ctr."callee_number",ctr."call_result" 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') = #{callTaskStatistic.createTime} |
| | | and sdct.type = '1' and ctr."call_result" = '200000' |
| | | ) a |
| | | union all |
| | | select * from ( |
| | | select ctr."call_id",ctr."callee_number",ctr."call_result" 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') = #{callTaskStatistic.createTime} |
| | | and sdct.type = '2' and ctr."call_result" = '200000' |
| | | ) b |
| | | union all |
| | | select * from ( |
| | | select ctr."call_id",ctr."callee_number",ctr."call_result" 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') = #{callTaskStatistic.createTime} |
| | | and sdct.type = '3' |
| | | ) c |
| | | ) d left join "YWXT".sm_call_not_fill_record scnfr on scnfr.call_id = d."call_id" |
| | | 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="callTaskStatistic.count==2"> |
| | | and d."call_result" = '200000' or scnfr.task_id is not null |
| | | <if test="callTaskResult.startTime!=null and callTaskResult.startTime!=''"> |
| | | and sdct.time >= #{callTaskResult.startTime} |
| | | </if> |
| | | <if test="callTaskStatistic.count==3"> |
| | | and d."call_result" = '200003' and scnfr.id is null |
| | | <if test="callTaskResult.endTime!=null and callTaskResult.endTime!=''"> |
| | | and sdct.time <= #{callTaskResult.endTime} |
| | | </if> |
| | | <if test="callTaskStatistic.count==4"> |
| | | and d."call_result" = '200005' and scnfr.id is null |
| | | <if test="list != null and list.size()>0"> |
| | | and ctr."task_id" in |
| | | <foreach collection="list" item="taskId" separator ="," open="(" close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | union all |
| | | ) 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 ctr."call_id",ctr."callee_number",ctr."call_result" from SJZT_ODS."call_task_result" ctr |
| | | 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.createTime} |
| | | and sdct.type = '1' and sdct.type = '2' and sdct.type = '3' |
| | | <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" |
| | | )a |
| | | left join "SJZT_MD"."att_res_base" arb on locate(arb."code",a.waterCode)>0 |
| | | 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 = a."call_id" |
| | | left join "YWXT".blade_user bu on bu.phone = a."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 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> |