Commit 3498e484 authored by wujiang's avatar wujiang

添加全域指数接口

parent d3916a30
......@@ -129,4 +129,10 @@ public class CommonConstans {
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> {
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 @@
group by point_name
</select>
<select id="getInfoByDate" resultType="java.lang.String">
select ceil(avg(b.health_index)) as healthIndex from
<select id="getInfoByDate" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index
health_index,
rec_date
FROM
pv_health_index_day
<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 != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
......@@ -357,12 +361,15 @@
UNION ALL
(
SELECT
health_index
health_index,
rec_date
FROM
fan_health_index_day
<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 != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
......@@ -375,10 +382,110 @@
AND analysis_obj_type = '片区'
</if>
</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 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