|
@@ -1,266 +0,0 @@
|
|
|
-<?xml version="1.0" encoding="UTF-8"?>
|
|
|
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
-
|
|
|
-<mapper namespace="com.nokia.tsl_data.dao.TslMapper">
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectCompCountForDay" resultType="int"> select count(1)
|
|
|
- from report_auto.he_d_mobile_comp
|
|
|
- where acct_date = #{day} </select>
|
|
|
-
|
|
|
- <select id="selectQualityCountForDay" resultType="int"> select count(1)
|
|
|
- from report_auto.he_d_high_quality
|
|
|
- where acct_date = #{day} </select>
|
|
|
-
|
|
|
- <!-- 满意率 -->
|
|
|
- <select id="selectClientRatioForDay" resultType="Map">with t1 as (select businoareaname,
|
|
|
- complaint_satisfied_list::float8,
|
|
|
- complaint_satisfied_count::float8,
|
|
|
- complaint_resolution_list::float8,
|
|
|
- complaint_resolution_count::float8,
|
|
|
- complaint_response_list::float8,
|
|
|
- complaint_response_count::float8,
|
|
|
- complaint::float8
|
|
|
- from report_auto.he_d_high_quality hdhq
|
|
|
- where acct_date = #{day}
|
|
|
- and profes_dep = '网络质量'
|
|
|
- and big_type_name = '移网网络体验'
|
|
|
- and small_type_name = '--')
|
|
|
- select '全省' as businoareaname,
|
|
|
- sum(complaint_satisfied_list) /
|
|
|
- sum(complaint_satisfied_count + complaint) as
|
|
|
- complaint_satisfied,
|
|
|
- sum(complaint_resolution_list) /
|
|
|
- sum(complaint_resolution_count +
|
|
|
- complaint) as complaint_resolution,
|
|
|
- sum(complaint_response_list) /
|
|
|
- sum(complaint_response_count + complaint) as complaint_response
|
|
|
- from t1
|
|
|
- union
|
|
|
- select businoareaname,
|
|
|
- case
|
|
|
- when (complaint_satisfied_count + complaint) = 0
|
|
|
- then 0
|
|
|
- else
|
|
|
- complaint_satisfied_list / (complaint_satisfied_count + complaint) end as
|
|
|
- complaint_satisfied,
|
|
|
- case
|
|
|
- when (complaint_resolution_count + complaint) = 0
|
|
|
- then 0
|
|
|
- else
|
|
|
- complaint_resolution_list / (complaint_resolution_count + complaint) end as
|
|
|
- complaint_resolution,
|
|
|
- case
|
|
|
- when (complaint_response_count + complaint) = 0
|
|
|
- then 0
|
|
|
- else
|
|
|
- complaint_response_list / (complaint_response_count + complaint) end as complaint_response
|
|
|
- from t1</select>
|
|
|
-
|
|
|
- <select id="selectOldTsDurationForMonth" resultType="Map"> select city_name, avg_duration
|
|
|
- from report_auto.avg_duration
|
|
|
- where month_id = #{monthId} </select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <!-- 从现有数据获取上月处理时长并插入数据表 -->
|
|
|
- <insert id="insertOldTsDurationForMonth">with t1 as (select compl_area_local,
|
|
|
- case
|
|
|
- when
|
|
|
- proce_time != '' then (extract('epoch' from
|
|
|
- to_timestamp(
|
|
|
- proce_time, 'YYYY-MM-DD
|
|
|
- HH24:MI:SS')) - extract('epoch' from to_timestamp(accept_time, 'YYYY-MM-DD
|
|
|
- HH24:MI:SS'))) / 3600
|
|
|
- when is_online_complete = '是' then 0
|
|
|
- else (extract('epoch' from
|
|
|
- to_timestamp(end_time, 'YYYY-MM-DD HH24:MI:SS')) -
|
|
|
- extract('epoch' from
|
|
|
- to_timestamp(accept_time, 'YYYY-MM-DD HH24:MI:SS'))) /
|
|
|
- 3600 end as duration
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = #{month_id}
|
|
|
- and day_id::float8 <=
|
|
|
- extract('day' from
|
|
|
- to_timestamp(#{month_id}, 'YYYYMM') + interval '1 month' -
|
|
|
- interval '1
|
|
|
- day'))
|
|
|
- insert
|
|
|
- into report_auto.avg_duration (month_id, city_name, avg_duration)
|
|
|
- select #{month_id} as month_id,
|
|
|
- compl_area_local as city_name,
|
|
|
- avg(duration) as avg_duration
|
|
|
- from t1
|
|
|
- group by compl_area_local </insert>
|
|
|
-
|
|
|
- <insert id="insertOldTsDuration" parameterType="Map"> INSERT INTO report_auto.avg_duration
|
|
|
- (month_id, city_name, avg_duration)
|
|
|
- VALUES (#{map.month_id}, #{map.city_name},
|
|
|
- #{map.avg_duration}); </insert>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectTsDurationForDay" resultType="Map"> with t1 as (select compl_area_local,
|
|
|
- case
|
|
|
- when proce_time != '' then
|
|
|
- (extract('epoch' from
|
|
|
- to_timestamp(
|
|
|
- proce_time, 'YYYY-MM-DD
|
|
|
- HH24:MI:SS')) - extract('epoch' from to_timestamp(accept_time, 'YYYY-MM-DD
|
|
|
- HH24:MI:SS'))) / 3600
|
|
|
- when is_online_complete = '是' then 0
|
|
|
- else (extract('epoch' from
|
|
|
- to_timestamp(end_time, 'YYYY-MM-DD HH24:MI:SS')) -
|
|
|
- extract('epoch' from
|
|
|
- to_timestamp(accept_time, 'YYYY-MM-DD HH24:MI:SS'))) /
|
|
|
- 3600 end as duration
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1 for 6)
|
|
|
- and day_id
|
|
|
- <= substring(#{day} from 7 for 2))
|
|
|
- select compl_area_local, avg(duration) as avg_duration
|
|
|
- from t1
|
|
|
- group by compl_area_local </select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectTimeoutTsCountForDay" resultType="Map">with t1 as (select compl_area_local,
|
|
|
- is_timeout
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1
|
|
|
- for 6)
|
|
|
- and day_id <= substring(#{day} from 7 for 2)),
|
|
|
- t2 as (select '全省' as
|
|
|
- compl_area_local,
|
|
|
- count(1) as total_num
|
|
|
- from t1),
|
|
|
- t3 as (select compl_area_local,
|
|
|
- count(1)
|
|
|
- as total_num
|
|
|
- from t1
|
|
|
- group by compl_area_local),
|
|
|
- t4 as (select *
|
|
|
- from t2
|
|
|
- union
|
|
|
- select *
|
|
|
- from t3),
|
|
|
- t5 as (select compl_area_local from t1 where is_timeout = '是'),
|
|
|
- t7 as (select '全省' as
|
|
|
- compl_area_local,
|
|
|
- count(1) as timeout_num
|
|
|
- from t5),
|
|
|
- t8 as (select compl_area_local,
|
|
|
- count(1)
|
|
|
- as timeout_num
|
|
|
- from t5
|
|
|
- group by compl_area_local),
|
|
|
- t9 as (select *
|
|
|
- from t7
|
|
|
- union
|
|
|
- select *
|
|
|
- from t8)
|
|
|
- select t4.compl_area_local,
|
|
|
- t4.total_num,
|
|
|
- t9.timeout_num,
|
|
|
- t9.timeout_num /
|
|
|
- t4.total_num::float8 as timeout_ratio
|
|
|
- from t4,
|
|
|
- t9
|
|
|
- where t4.compl_area_local =
|
|
|
- t9.compl_area_local</select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectRepeatTsCountForDay" resultType="Map"> with t1 as (select compl_area_local,
|
|
|
- busi_no
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1 for
|
|
|
- 6)
|
|
|
- and day_id <= substring(#{day} from 7 for 2)),
|
|
|
- t2 as (select distinct * from t1),
|
|
|
- t3
|
|
|
- as (select compl_area_local, count(1) as total_num
|
|
|
- from t1
|
|
|
- group by compl_area_local),
|
|
|
- t4 as
|
|
|
- (select compl_area_local, count(1) as distinct_num
|
|
|
- from t2
|
|
|
- group by compl_area_local),
|
|
|
- t5 as
|
|
|
- (select t3.compl_area_local,
|
|
|
- t3.total_num,
|
|
|
- t3.total_num - t4.distinct_num::float8 as
|
|
|
- repeat_num,
|
|
|
- (t3.total_num - t4.distinct_num) / t3.total_num::float8 as repeat_ratio
|
|
|
- from T3,
|
|
|
- t4
|
|
|
- where t3.compl_area_local = t4.compl_area_local)
|
|
|
- select '全省' as compl_area_local,
|
|
|
- sum(total_num) as total_num,
|
|
|
- sum(repeat_num) as repeat_num,
|
|
|
- sum(repeat_num)
|
|
|
- / sum(total_num)::float8 as repeat_ratio
|
|
|
- from t5
|
|
|
- union
|
|
|
- select *
|
|
|
- from t5 </select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectCityTslForMonth" resultType="Map"> select compl_area_local,
|
|
|
- day_id,
|
|
|
- count(1)
|
|
|
- as num
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1 for
|
|
|
- 6)
|
|
|
- and day_id <= substring(#{day} from 7 for 2)
|
|
|
- group by compl_area_local, day_id
|
|
|
- order by compl_area_local, day_id </select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectAllTslForMonth" resultType="Map"> select day_id, count(1) as num
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1 for 6)
|
|
|
- and day_id
|
|
|
- <= substring(#{day} from 7 for 2)
|
|
|
- group by day_id
|
|
|
- order by day_id </select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectCityAllForMonth" resultType="Map">select compl_area_local, count(1) as num
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1 for 6)
|
|
|
- and day_id <= substring(#{day} from 7 for 2)
|
|
|
- group by compl_area_local
|
|
|
- order by compl_area_local </select>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <select id="selectAllForMonth" resultType="int">select count(1) as num
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where month_id = substring(#{day} from 1 for 6)
|
|
|
- and day_id
|
|
|
- <= substring(#{day} from 7 for 2)</select>
|
|
|
-
|
|
|
- <select id="selectUserCountForMonth" resultType="Map">select city_name, user_count
|
|
|
- from report_auto.user_count
|
|
|
- where month_id = #{monthId}</select>
|
|
|
-
|
|
|
- <select id="selectTargetTsRatioForMonth" resultType="Map">select city_name, target_ts_ratio
|
|
|
- from report_auto.target_ts_ratio
|
|
|
- where month_id = #{monthId}</select>
|
|
|
-
|
|
|
- <insert id="insertUserCount" parameterType="map"> INSERT INTO report_auto.user_count (month_id,
|
|
|
- city_name, user_count)
|
|
|
- VALUES (#{map.monthId}, #{map.cityName}, #{map.userCount})</insert>
|
|
|
-
|
|
|
- <insert id="insertTargetTsRatio" parameterType="map">INSERT INTO report_auto.target_ts_ratio
|
|
|
- (month_id, city_name, target_ts_ratio)
|
|
|
- VALUES (#{map.monthId}, #{map.cityName},
|
|
|
- #{map.targetTsRatio}); </insert>
|
|
|
-
|
|
|
- <delete id="deleteHighQualityForDay" parameterType="string">delete
|
|
|
- from report_auto.he_d_high_quality hdhq
|
|
|
- where acct_date = #{day}</delete>
|
|
|
-
|
|
|
- <!-- V1.5废弃 -->
|
|
|
- <delete id="deleteMobileCompForDay" parameterType="string">delete
|
|
|
- from report_auto.he_d_mobile_comp hdmc
|
|
|
- where acct_date = #{day}</delete>
|
|
|
-
|
|
|
-</mapper>
|