Commit 4e98bb8f authored by zhangsen's avatar zhangsen

修改 td

parent 2223c204
...@@ -360,7 +360,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -360,7 +360,7 @@ public class TDBigScreenAnalyseController extends BaseController {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId(); 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()))); 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<String> warningList = Arrays.asList("危险", "注意", "警告");
List<Integer> data = new ArrayList<>(); List<Integer> data = new ArrayList<>();
...@@ -534,7 +534,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -534,7 +534,7 @@ public class TDBigScreenAnalyseController extends BaseController {
subSystem = java.net.URLDecoder.decode(subSystem,"UTF-8"); subSystem = java.net.URLDecoder.decode(subSystem,"UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId()); // 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())); 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); List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem);
pointNameList.forEach(item -> { pointNameList.forEach(item -> {
...@@ -636,7 +636,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -636,7 +636,7 @@ public class TDBigScreenAnalyseController extends BaseController {
equipmentName = java.net.URLDecoder.decode(equipmentName,"UTF-8"); equipmentName = java.net.URLDecoder.decode(equipmentName,"UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId()); // List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvWarningInfoBySubSystemTd(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())); 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); List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
pointNameList.forEach(item -> { pointNameList.forEach(item -> {
...@@ -675,12 +675,12 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -675,12 +675,12 @@ public class TDBigScreenAnalyseController extends BaseController {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> resultListData = new ArrayList<>(); 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)) { if (CharSequenceUtil.isNotEmpty(recDate)) {
Date date = DateUtils.dateParse(recDate, DATE_TIME_PATTERN); Date date = DateUtils.dateParse(recDate, DATE_TIME_PATTERN);
String datejian8 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -8), 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); 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<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
......
...@@ -42,8 +42,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -42,8 +42,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode); 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, List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode, @Param("areaCode") String areaCode,
@Param("stationType") String stationType); @Param("stationType") String stationType);
...@@ -65,7 +63,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -65,7 +63,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId); 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,7 +83,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -86,7 +83,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId); 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>> getPvWarningInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvWarningInfoBySubSystemTd(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName); List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName);
...@@ -143,7 +139,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -143,7 +139,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName); 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, List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
...@@ -151,11 +146,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -151,11 +146,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
@Param("tableName") String tableName, @Param("tableName") String tableName,
@Param("recDate") String recDate); @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); int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId, @Param("tableName") String tableName);
......
...@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Select("<script>"+ @Select("<script>"+
...@@ -71,4 +72,19 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { ...@@ -71,4 +72,19 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto); List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@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);
} }
...@@ -1667,107 +1667,4 @@ ...@@ -1667,107 +1667,4 @@
) a ) a
</select> </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
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>
</mapper> </mapper>
...@@ -229,4 +229,109 @@ ...@@ -229,4 +229,109 @@
<delete id="deleteAllDataByTableName"> <delete id="deleteAllDataByTableName">
delete from ${tableName} where analysis_type = #{analysisType} delete from ${tableName} where analysis_type = #{analysisType}
</delete> </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>
</mapper> </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