Commit 139cedcb authored by chenzhao's avatar chenzhao

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

parents c8f2aa65 69d72c1e
......@@ -190,7 +190,7 @@ public class KafkaAnalyseController {
int stationInt = 1;
int equipmentInt = 1;
int subSystemInt = 1;
Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(null, null).doubleValue();
Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(null, null, analysisType).doubleValue();
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
......@@ -208,14 +208,14 @@ public class KafkaAnalyseController {
allMapDto.setScore(healthScoreInfo);
allMapDto.setIsRoot(true);
allMapDto.setCategory("category");
allMapDto.setChildList(new ArrayList<>());
allMapDto.setChildren(new ArrayList<>());
allMapDto.setParentKey("0");
for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap.entrySet()) {
Double areaLowScore = null;
Double areaHighScore = null;
Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(areaMap.getKey(), null).doubleValue();
Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(areaMap.getKey(), null, analysisType).doubleValue();
LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>();
areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
......@@ -230,7 +230,7 @@ public class KafkaAnalyseController {
areaMapDto.setStatus(areaIdxBizFanHealthLevel.getHealthLevel());
areaMapDto.setScore(areaHealthScoreInfo);
areaMapDto.setParentKey(allMapDto.getKey());
allMapDto.getChildList().add(areaMapDto);
allMapDto.getChildren().add(areaMapDto);
areaInt++;
List<FullViewRecallInfoDTO> areaMapList = new ArrayList<>();
for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap.getValue().entrySet()) {
......@@ -273,7 +273,7 @@ public class KafkaAnalyseController {
}
}
stationDto.setParentKey(areaMapDto.getKey());
areaMapDto.getChildList().add(stationDto);
areaMapDto.getChildren().add(stationDto);
stationInt++;
for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap.getValue().entrySet()) {
......@@ -298,7 +298,7 @@ public class KafkaAnalyseController {
equipmentMapDto.setStatus(levelInfo.getHealthLevel());
equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
equipmentMapDto.setParentKey(stationDto.getKey());
stationDto.getChildList().add(equipmentMapDto);
stationDto.getChildren().add(equipmentMapDto);
equipmentInt++;
for (Map.Entry<String, Map<String, List<FullViewRecallDataDTO>>> subSystemMap : equipmentMap.getValue().entrySet()) {
FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO();
......@@ -312,7 +312,7 @@ public class KafkaAnalyseController {
subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
subSystemMapDto.setParentKey(equipmentMapDto.getKey());
equipmentMapDto.getChildList().add(subSystemMapDto);
equipmentMapDto.getChildren().add(subSystemMapDto);
subSystemInt++;
for (Map.Entry<String, List<FullViewRecallDataDTO>> pointNameMap : subSystemMap.getValue().entrySet()) {
FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO();
......@@ -328,7 +328,7 @@ public class KafkaAnalyseController {
pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0));
pointNameMapDto.setParentKey(subSystemMapDto.getKey());
subSystemMapDto.getChildList().add(pointNameMapDto);
subSystemMapDto.getChildren().add(pointNameMapDto);
pointNameInt++;
}
......@@ -352,8 +352,9 @@ public class KafkaAnalyseController {
String stationType = "风电站";
List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList());
for (IdxBizFanHealthLevel item : collect) {
if (!item.getAnalysisObjType().contains("子系统")) {
if (item.getAnalysisObjType().contains("子阵")) {
stationType = "光伏站";
break;
}
}
for (IdxBizFanHealthLevel item : collect) {
......
......@@ -15,6 +15,6 @@ public class FullViewRecallInfoDTO {
private String status = "";
private Boolean isRoot = false;
private String category = "";
private List<FullViewRecallInfoDTO> childList = new ArrayList<>();
private List<FullViewRecallInfoDTO> children = new ArrayList<>();
private String parentKey;
}
......@@ -25,6 +25,8 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode, @Param("tableName") String tableName);
BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("analysisType") String analysisType);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
......
......@@ -53,6 +53,77 @@
) a
</select>
<select id="getHealthScoreInfoByParam" resultType="java.math.BigDecimal">
SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
idx_biz_fan_health_index
<where>
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if>
<if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if>
<if test="analysisType == '按时刻'">
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="areaCode != null and areaCode != ''">
AND ARAE 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
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
idx_biz_pv_health_index
<where>
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if>
<if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if>
<if test="analysisType == '按时刻'">
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="areaCode != null and areaCode != ''">
AND ARAE 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>
)
) a
</select>
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
SELECT
......
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