Commit a9095a7f authored by caotao's avatar caotao

分析模块需求变更

parent 06bbd582
...@@ -618,26 +618,45 @@ private FanHealthIndexMapper fanHealthIndexMapper; ...@@ -618,26 +618,45 @@ private FanHealthIndexMapper fanHealthIndexMapper;
@ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表") @ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表")
@GetMapping("/getPvSubSystemPointInfo") @GetMapping("/getPvSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName, public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) throws UnsupportedEncodingException { @RequestParam(value = "stationId", required = false) String stationId) {
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.getPvWarningInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> t.get("warningName").toString())); Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").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 -> {
String equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全"); Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
item.put("status", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
if (ObjectUtils.isEmpty(idxBizFanHealthLevel)) {
item.put("warningName", "安全");
item.put("status", "安全");
} else {
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
item.put("status", idxBizFanHealthLevel.getHealthLevel());
}
}
int sort = 4; int sort = 4;
if ("注意".equals(equipmentHealthScore)) { if ("注意".equals(item.get("warningName"))) {
sort = 3; sort = 3;
} else if ("警告".equals(equipmentHealthScore)) { } else if ("警告".equals(item.get("warningName"))) {
sort = 2; sort = 2;
} else if ("危险".equals(equipmentHealthScore)) { } else if ("危险".equals(item.get("warningName"))) {
sort = 1; sort = 1;
} }
item.put("sort", sort); item.put("sort", sort);
item.put("warningName", equipmentHealthScore); item.put("healthIndex", equipmentHealthScore);
item.put("status", equipmentHealthScore);
}); });
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString())); pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString()));
Page<Map<String, Object>> mapPage = new Page<>(); Page<Map<String, Object>> mapPage = new Page<>();
...@@ -645,6 +664,7 @@ private FanHealthIndexMapper fanHealthIndexMapper; ...@@ -645,6 +664,7 @@ private FanHealthIndexMapper fanHealthIndexMapper;
mapPage.setTotal(pointNameList.size()); mapPage.setTotal(pointNameList.size());
mapPage.setCurrent(1); mapPage.setCurrent(1);
mapPage.setRecords(pointNameList); mapPage.setRecords(pointNameList);
return ResponseHelper.buildResponse(mapPage); return ResponseHelper.buildResponse(mapPage);
} }
......
...@@ -162,4 +162,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -162,4 +162,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String endTimeTop); String endTimeTop);
Map<String, Object> getHealthIndexByIndexAddress(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress); Map<String, Object> getHealthIndexByIndexAddress(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress);
Map<String, Object> getHealthIndexByIndexAddressPv(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress);
} }
...@@ -644,14 +644,13 @@ ...@@ -644,14 +644,13 @@
</select> </select>
<select id="getPvHealthInfoBySubSystem" resultType="java.util.Map"> <select id="getPvHealthInfoBySubSystem" resultType="java.util.Map">
SELECT SELECT
IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex, IFNULL(HEALTH_INDEX, 100) AS healthIndex,
POINT_NAME AS pointName POINT_NAME AS pointName
FROM FROM
idx_biz_pv_health_index pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '测点' ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL AND POINT_NAME IS NOT NULL
AND POINT_NAME != '' AND POINT_NAME != ''
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
...@@ -1643,5 +1642,18 @@ ...@@ -1643,5 +1642,18 @@
and GATEWAY_ID = #{gatewayId} and GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点' and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按天' and ANALYSIS_TYPE = '按天'
limit 1
</select>
<select id="getHealthIndexByIndexAddressPv" resultType="java.util.Map">
select ROUND(ifnull(HEALTH_INDEX, 100.0), 1) as healthIndex,
STATION as station
from pv_health_index_latest_data
where
INDEX_ADDRESS = #{indexAddress}
and GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按天'
limit 1
</select> </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