Commit e6b1d263 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 71f9d999 a26efcfc
......@@ -128,18 +128,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);
}
......@@ -360,7 +362,7 @@ public class TDBigScreenAnalyseController extends BaseController {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
}
List<Map<String, Object>> list = idxBizFanHealthIndexMapper.equipWarningRadarMapByTd(stationCode);
List<Map<String, Object>> list = fanHealthIndexMapper.equipWarningRadarMapByTd(stationCode);
Map<String, Integer> warningNumMap = list.stream().collect(Collectors.toMap(t -> t.get("warningName").toString(), t -> Integer.parseInt(t.get("num").toString())));
List<String> warningList = Arrays.asList("危险", "注意", "警告");
List<Integer> data = new ArrayList<>();
......@@ -534,7 +536,7 @@ public class TDBigScreenAnalyseController extends BaseController {
subSystem = java.net.URLDecoder.decode(subSystem,"UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getWarningInfoBySubSystemTd(subSystem, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getWarningInfoBySubSystemTd(subSystem, stationBasic.getFanGatewayId());
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> t.get("warningName").toString()));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem);
pointNameList.forEach(item -> {
......@@ -636,7 +638,7 @@ public class TDBigScreenAnalyseController extends BaseController {
equipmentName = java.net.URLDecoder.decode(equipmentName,"UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvWarningInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getPvWarningInfoBySubSystemTd(equipmentName, stationBasic.getFanGatewayId());
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> t.get("warningName").toString()));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
pointNameList.forEach(item -> {
......@@ -675,12 +677,12 @@ public class TDBigScreenAnalyseController extends BaseController {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> resultListData = new ArrayList<>();
String recDate = idxBizFanHealthIndexMapper.getRecDateByIndexAddressTs(stationBasic.getFanGatewayId(), indexAddress, tableName);
String recDate = fanHealthIndexMapper.getRecDateByIndexAddressTs(stationBasic.getFanGatewayId(), indexAddress, tableName);
if (CharSequenceUtil.isNotEmpty(recDate)) {
Date date = DateUtils.dateParse(recDate, DATE_TIME_PATTERN);
String datejian8 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -8), DATE_TIME_PATTERN);
String datejian20 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -20), DATE_TIME_PATTERN);
resultListData = idxBizFanHealthIndexMapper.getInfoListByTableNameTs(stationBasic.getFanGatewayId(), indexAddress, tableName2, datejian8, datejian20);
resultListData = fanHealthIndexMapper.getInfoListByTableNameTs(stationBasic.getFanGatewayId(), indexAddress, tableName2, datejian8, datejian20);
}
HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>();
......
......@@ -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);
......@@ -42,8 +43,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode);
List<Map<String, Object>> equipWarningRadarMapByTd(@Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode,
@Param("stationType") String stationType);
......@@ -65,7 +64,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
......@@ -86,6 +84,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvWarningInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName);
......@@ -141,7 +140,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
String getRecDateByIndexAddressTs(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
......@@ -149,11 +147,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
@Param("tableName") String tableName,
@Param("recDate") String recDate);
List<Map<String, Object>> getInfoListByTableNameTs(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress,
@Param("tableName") String tableName,
@Param("recDate") String recDate,
@Param("date12") String date12);
int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId, @Param("tableName") String tableName);
......
......@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Select("<script>"+
......@@ -71,4 +72,20 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto);
List<Map<String, Object>> equipWarningRadarMapByTd(@Param("stationCode") String stationCode);
List<Map<String, Object>> getInfoListByTableNameTs(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress,
@Param("tableName") String tableName,
@Param("recDate") String recDate,
@Param("date12") String date12);
String getRecDateByIndexAddressTs(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
List<Map<String, Object>> getPvWarningInfoBySubSystemTd(@Param("equipmentName") String equipmentName, @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);
}
......@@ -142,6 +142,7 @@
</select>
<select id="getHealthListInfo" resultType="java.util.Map">
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
......@@ -616,7 +617,7 @@
IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex,
SUBARRAY as subarray
FROM
idx_biz_pv_health_index
pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '子阵'
AND ANALYSIS_TYPE = '按天'
......@@ -634,7 +635,7 @@
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM
idx_biz_pv_health_index
pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天'
......@@ -1667,88 +1668,14 @@
) a
</select>
<select id="equipWarningRadarMapByTd" resultType="java.util.Map">
select
a.warningName,
count(1) as num
from
(
select
warning_name as warningName
from
analysis_data.fan_warning_record
<where>
((disposotion_state = '未处置')
or (disposotion_state = '已处置'
and ts > now - 3d - 8h))
<if test="stationCode != null and stationCode != ''">
and gateway_id = #{stationCode}
</if>
</where>
union all
(select
warning_name as warningName
from
analysis_data.pv_warning_record
<where>((disposotion_state = '未处置')
or (
disposotion_state = '已处置'
and ts > now - 3d - 8h ))
<if test="stationCode != null and stationCode != ''">
and gateway_id = #{stationCode}
</if>
</where>)
) a
group by
a.warningName
</select>
<select id="getWarningInfoBySubSystemTd" resultType="java.util.Map">
<select id="getDateInfoBy15" resultType="java.util.Map">
SELECT
point_name as pointName,
warning_name as warningName,
last(ts)
FROM
fan_warning_record
<where>
disposotion_state = '未处置'
<if test="subSystem != null and subSystem != ''">
AND sub_system = #{subSystem}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
</where>
group by point_name
</select>
<select id="getRecDateByIndexAddressTs" resultType="java.lang.String">
SELECT
rec_date
FROM
${tableName}
WHERE
index_address = #{indexAddress}
AND disposotion_state = '未处置'
and gateway_id = #{fanGatewayId}
ORDER BY
ts DESC
LIMIT 1
</select>
<select id="getInfoListByTableNameTs" resultType="java.util.Map">
SELECT
*,
CEIL(health_index) as healthIndex
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
${tableName}
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
#{recDate} >= ts
AND ts >= #{date12}
AND analysis_type = '按时刻'
AND index_address = #{indexAddress}
AND gateway_id = #{fanGatewayId}
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
</select>
</mapper>
......@@ -229,4 +229,155 @@
<delete id="deleteAllDataByTableName">
delete from ${tableName} where analysis_type = #{analysisType}
</delete>
<select id="equipWarningRadarMapByTd" resultType="java.util.Map">
select
a.warningName,
count(1) as num
from
(
select
warning_name as warningName
from
analysis_data.fan_warning_record
<where>
((disposotion_state = '未处置')
or (disposotion_state = '已处置'
and ts > now - 3d - 8h))
<if test="stationCode != null and stationCode != ''">
and gateway_id = #{stationCode}
</if>
</where>
union all
(select
warning_name as warningName
from
analysis_data.pv_warning_record
<where>((disposotion_state = '未处置')
or (
disposotion_state = '已处置'
and ts > now - 3d - 8h ))
<if test="stationCode != null and stationCode != ''">
and gateway_id = #{stationCode}
</if>
</where>)
) a
group by
a.warningName
</select>
<select id="getWarningInfoBySubSystemTd" resultType="java.util.Map">
SELECT
point_name as pointName,
warning_name as warningName,
last(ts)
FROM
fan_warning_record
<where>
disposotion_state = '未处置'
<if test="subSystem != null and subSystem != ''">
AND sub_system = #{subSystem}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
</where>
group by point_name
</select>
<select id="getRecDateByIndexAddressTs" resultType="java.lang.String">
SELECT
rec_date
FROM
${tableName}
WHERE
index_address = #{indexAddress}
AND disposotion_state = '未处置'
and gateway_id = #{fanGatewayId}
ORDER BY
ts DESC
LIMIT 1
</select>
<select id="getInfoListByTableNameTs" resultType="java.util.Map">
SELECT
*,
CEIL(health_index) as healthIndex
FROM
${tableName}
WHERE
#{recDate} >= ts
AND ts >= #{date12}
AND analysis_type = '按时刻'
AND index_address = #{indexAddress}
AND gateway_id = #{fanGatewayId}
</select>
<select id="getPvWarningInfoBySubSystemTd" resultType="java.util.Map">
SELECT
point_name as pointName,
warning_name as warningName,
last(ts)
FROM
pv_warning_record
<where>
disposotion_state = '未处置'
<if test="equipmentName != null and equipmentName != ''">
AND equipment_name = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
</where>
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