Commit a26efcfc authored by zhangsen's avatar zhangsen

修改 td

parent 4e98bb8f
......@@ -129,18 +129,20 @@ public class TDBigScreenAnalyseController extends BaseController {
}
HashMap<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode);
List<String> time = new ArrayList<>();
List<Map<String, String>> dateInfoBy15 = idxBizFanHealthIndexMapper.getDateInfoBy15();
List<String> valueList = new ArrayList<>();
healthListInfo.forEach(item -> {
time.add(item.get("date").toString());
valueList.add(item.get("avgHealthIndex").toString().replace(".0", ""));
String finalStationCode = stationCode;
dateInfoBy15.forEach(item -> {
String healthListInfo = fanHealthIndexMapper.getInfoByDate(areaCode, finalStationCode, item.get("date"));
valueList.add(StrUtil.isNotEmpty(healthListInfo) ? healthListInfo : "100");
});
List<Map<String, Object>> arrayList = new ArrayList<>();
HashMap<String, Object> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("data", valueList);
arrayList.add(stringStringHashMap);
resultMap.put("axisData", time);
resultMap.put("axisData", dateInfoBy15);
resultMap.put("seriesData", arrayList);
return ResponseHelper.buildResponse(resultMap);
}
......
......@@ -28,6 +28,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("analysisType") String analysisType);
List<Map<String, String>> getDateInfoBy15();
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
......
......@@ -87,4 +87,5 @@ 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);
}
......@@ -142,6 +142,7 @@
</select>
<select id="getHealthListInfo" resultType="java.util.Map">
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
......@@ -1667,4 +1668,14 @@
) a
</select>
<select id="getDateInfoBy15" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
</select>
</mapper>
......@@ -334,4 +334,50 @@
group by point_name
</select>
<select id="getInfoByDate" resultType="java.lang.String">
select ceil(avg(b.health_index)) as healthIndex from
(SELECT
health_index
FROM
pv_health_index_day
<where>
rec_date = concat(#{date}, ' 00:00:00')
<if test="areaCode != null and areaCode != ''">
AND area like concat('%', #{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
FROM
fan_health_index_day
<where>
rec_date = concat(#{date}, ' 00:00:00')
<if test="areaCode != null and areaCode != ''">
AND area like concat('%', #{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
</select>
</mapper>
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