Commit 3498e484 authored by wujiang's avatar wujiang

添加全域指数接口

parent d3916a30
...@@ -129,4 +129,10 @@ public class CommonConstans { ...@@ -129,4 +129,10 @@ public class CommonConstans {
put("按天", DatePattern.NORM_DATE_PATTERN); put("按天", DatePattern.NORM_DATE_PATTERN);
} }
}; };
public static final String ANALYSE_TYPE_MOMENT = "按时刻";
public static final String ANALYSE_TYPE_HOUR = "按小时";
public static final String ANALYSE_TYPE_DAY = "按天";
} }
...@@ -95,5 +95,9 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { ...@@ -95,5 +95,9 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
String getInfoByDate(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("date") String date); List<Map<String,Object>> getInfoByDate(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
List<Map<String,Object>> getInfoByHour(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
List<Map<String,Object>> getInfoByMoment(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
} }
...@@ -334,14 +334,18 @@ ...@@ -334,14 +334,18 @@
group by point_name group by point_name
</select> </select>
<select id="getInfoByDate" resultType="java.lang.String"> <select id="getInfoByDate" resultType="java.util.Map">
select ceil(avg(b.health_index)) as healthIndex from select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT (SELECT
health_index health_index,
rec_date
FROM FROM
pv_health_index_day pv_health_index_day
<where> <where>
rec_date = concat(#{date}, ' 00:00:00') rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area like #{areaCode} AND area like #{areaCode}
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
...@@ -357,12 +361,15 @@ ...@@ -357,12 +361,15 @@
UNION ALL UNION ALL
( (
SELECT SELECT
health_index health_index,
rec_date
FROM FROM
fan_health_index_day fan_health_index_day
<where> <where>
rec_date = concat(#{date}, ' 00:00:00') rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area like #{areaCode} AND area like #{areaCode}
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
...@@ -375,10 +382,110 @@ ...@@ -375,10 +382,110 @@
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
</if> </if>
</where> </where>
)) b )) b GROUP BY b.rec_date
</select>
<select id="getInfoByHour" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index,
rec_date
FROM
pv_health_index_hour
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
UNION ALL
(
SELECT
health_index,
rec_date
FROM
fan_health_index_hour
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
)) b GROUP BY b.rec_date
</select>
<select id="getInfoByMoment" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index,
rec_date
FROM
pv_health_index_moment
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
UNION ALL
(
SELECT
health_index,
rec_date
FROM
fan_health_index_moment
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
)) b GROUP BY b.rec_date
</select> </select>
<select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex"> <select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment