rushfee/resource/db/callrecord_sql.xml

88 lines
4.8 KiB
XML
Raw Normal View History

2022-05-16 15:07:40 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqls SYSTEM "sql_definition.dtd">
<sqls>
<sql group="callrecord">
<i id="getList"><![CDATA[
select * fromSELECT
nvl( OPERATOR, '合计' ) AS OPERATOR,
sum( CASE WHEN action = 'phone' THEN 1 ELSE 0 END ) AS 呼出总量,
sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) AS 接通总量,
to_char( ROUND( sum( CASE WHEN action = 'phone' THEN to_number( info ) ELSE 0 END ) / 60, 1 ), 'fm9999999990.9' ) || '分钟' 通话总时长,
to_char( ROUND( sum( CASE WHEN action = 'phone' THEN to_number( zltime-1 ) ELSE 0 END ) / 60, 1 ), 'fm9999999990.9' ) || '分钟' 振铃总时长,
round( DECODE(sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ),0,0,sum( CASE WHEN action = 'phone' THEN to_number( info ) ELSE 0 END ) /sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) ),1)||'秒' AS 平均通话时长,
ROUND( DECODE(sum( CASE WHEN action = 'phone' THEN 1 ELSE 0 END ),0,0,
sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) / sum( CASE WHEN action = 'phone' THEN 1 ELSE 0 END ) * 100),
2
) || '%' AS 接通率,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_online_success' THEN OBJ_ID ELSE NULL END ) AS 在线缴费成功量,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_need' THEN OBJ_ID ELSE NULL END )-count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_online_success' THEN OBJ_ID ELSE NULL END ) as 同意缴费量,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_need' THEN OBJ_ID ELSE NULL END ) AS 成功量,
ROUND(DECODE(sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) ,0,0,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_need' THEN OBJ_ID ELSE NULL END ) /
sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) * 100 ),
2
) || '%' AS 成功率
FROM
rush_log left JOIN RUSH_DICTIONARY y ON INFO = y.MEMO
WHERE
(action = 'phone' or ACTION='rushfee')
and $like(operator,operator) and $between(operate_date,searchbegindate,searchenddate)
and operator in (SELECT c.cname FROM
RUSH_USER_QUERYAUTH a
LEFT JOIN AOS_RMS_USER b ON a.USER_ID = b.cguid
LEFT JOIN AOS_RMS_USER c ON a.userauth_id = c.cguid
where a.USER_ID={user_id})
GROUP BY rollup(OPERATOR)
union all
select '统计平均值' as OPERATOR,FLOOR(AVG(呼出总量) )as 呼出总量 ,
FLOOR(AVG(接通总量)) as 接通总量
, to_char(ROUND(AVG(通话总时长),1),'fm9999999990.9') || '分钟' as 通话总时长
, to_char(ROUND(AVG(振铃总时长),1),'fm9999999990.9') || '分钟' as 振铃总时长
, ROUND(AVG(平均通话时长),1) || '秒' as 平均通话时长 ,
ROUND(AVG(接通率),2)|| '%' as 接通率,
FLOOR(AVG(在线缴费成功量)) as 在线缴费成功量,
FLOOR(AVG(同意缴费量)) as 同意缴费量, FLOOR(AVG(成功量) )as 成功量, ROUND(AVG(成功率),2)|| '%' as 成功率
from (SELECT
OPERATOR,
sum( CASE WHEN action = 'phone' THEN 1 ELSE 0 END ) AS 呼出总量,
sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) AS 接通总量,
to_char( ROUND( sum( CASE WHEN action = 'phone' THEN to_number( info ) ELSE 0 END ) / 60, 1 ), 'fm9999999990.9' ) as 通话总时长,
to_char( ROUND( sum( CASE WHEN action = 'phone' THEN to_number( zltime-1 ) ELSE 0 END ) / 60, 1 ), 'fm9999999990.9' ) as 振铃总时长,
round( DECODE(sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ),0,0,sum( CASE WHEN action = 'phone' THEN to_number( info ) ELSE 0 END ) /sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END )) ,1
) AS 平均通话时长,
ROUND( DECODE(sum( CASE WHEN action = 'phone' THEN 1 ELSE 0 END ),0,0,
sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) / sum( CASE WHEN action = 'phone' THEN 1 ELSE 0 END ) * 100),
2
) AS 接通率,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_online_success' THEN OBJ_ID ELSE NULL END ) AS 在线缴费成功量,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_need' THEN OBJ_ID ELSE NULL END )-count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_online_success' THEN OBJ_ID ELSE NULL END ) as 同意缴费量,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_need' THEN OBJ_ID ELSE NULL END ) AS 成功量,
ROUND(DECODE(sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) ,0,0,
count( DISTINCT CASE WHEN action = 'rushfee' AND CODETYPE = 'phone_need' THEN OBJ_ID ELSE NULL END ) /
sum( CASE WHEN action = 'phone' AND info > 0 THEN 1 ELSE 0 END ) * 100 ),
2
) AS 成功率
FROM
rush_log left JOIN RUSH_DICTIONARY y ON INFO = y.MEMO
WHERE
( action = 'phone' OR ACTION = 'rushfee' )
and $like(operator,operator) and $between(operate_date,searchbegindate,searchenddate)
GROUP BY OPERATOR) )
]]></i>
</sql>
</sqls>