Commit e8717d2a authored by zhangsen's avatar zhangsen

分析需求 API开发,bug修改

parent d7ed49dd
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -11,26 +10,22 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils; ...@@ -11,26 +10,22 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.feign.RiskWarningFeign; import com.yeejoin.amos.boot.module.jxiop.api.feign.RiskWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -57,6 +52,10 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -57,6 +52,10 @@ public class BigScreenAnalyseController extends BaseController {
IdxBizFanWarningRecordMapper idxBizFanWarningRecordMapper; IdxBizFanWarningRecordMapper idxBizFanWarningRecordMapper;
@Autowired @Autowired
IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
@Autowired @Autowired
...@@ -648,6 +647,46 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -648,6 +647,46 @@ public class BigScreenAnalyseController extends BaseController {
} }
private IdxBizFanHealthLevel getHealthLevelByScore(List<IdxBizFanHealthLevel> healthLevelInfoList, String station, String type, Double score) {
IdxBizFanHealthLevel resultDto = new IdxBizFanHealthLevel();
String stationType = "风电站";
List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList());
for (IdxBizFanHealthLevel item : collect) {
if (item.getAnalysisObjType().contains("子系统")) {
stationType = "光伏站";
}
}
for (IdxBizFanHealthLevel item : collect) {
if (type.equals("设备") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) {
resultDto = item;
break;
}
if (type.equals("子系统") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) {
resultDto = item;
break;
}
if (type.equals("测点") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) {
resultDto = item;
break;
}
if (type.equals("设备") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("子阵") && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) {
resultDto = item;
break;
}
if (type.equals("子系统") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("设备") && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) {
resultDto = item;
break;
}
}
return resultDto;
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "全景诊断回溯") @ApiOperation(value = "全景诊断回溯")
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
...@@ -657,6 +696,21 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -657,6 +696,21 @@ public class BigScreenAnalyseController extends BaseController {
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo(); List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfo();
Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfo();
Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfo();
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList();
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(); List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall();
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream() Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
...@@ -671,42 +725,122 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -671,42 +725,122 @@ public class BigScreenAnalyseController extends BaseController {
int subSystemInt = 1; int subSystemInt = 1;
List<FullViewRecallInfoDTO> fullViewRecallList = new ArrayList<>(); List<FullViewRecallInfoDTO> fullViewRecallList = new ArrayList<>();
List<Map<String, String>> resultMapFromToList = new ArrayList<>(); List<Map<String, String>> resultMapFromToList = new ArrayList<>();
Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(null, null).doubleValue();
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.isNull(IdxBizFanHealthLevel::getStatus);
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域");
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, healthScoreInfo);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, healthScoreInfo);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
FullViewRecallInfoDTO allMapDto = new FullViewRecallInfoDTO();
allMapDto.setKey("0");
allMapDto.setName("全域设备健康状态指数");
allMapDto.setLoc(null);
allMapDto.setScoreRange(null);
allMapDto.setStatus(idxBizFanHealthLevel.getHealthLevel());
allMapDto.setScore(healthScoreInfo);
allMapDto.setIsRoot(true);
allMapDto.setCategory("category");
fullViewRecallList.add(allMapDto);
for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap.entrySet()) { 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();
LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>();
areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
areaQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区");
areaQuery.le(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
areaQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
IdxBizFanHealthLevel areaIdxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(areaQuery);
FullViewRecallInfoDTO areaMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO areaMapDto = new FullViewRecallInfoDTO();
areaMapDto.setKey("0-" + areaInt); areaMapDto.setKey("0-" + areaInt);
areaMapDto.setName(areaMap.getKey()); areaMapDto.setName(areaMap.getKey());
areaMapDto.setLoc(null); areaMapDto.setLoc(null);
areaMapDto.setScoreRange(null); areaMapDto.setStatus(areaIdxBizFanHealthLevel.getHealthLevel());
areaMapDto.setStatus(null); areaMapDto.setScore(areaHealthScoreInfo);
areaMapDto.setScore(null);
fullViewRecallList.add(areaMapDto);
HashMap<String, String> areaMapFromTo = new HashMap<>(); HashMap<String, String> areaMapFromTo = new HashMap<>();
areaMapFromTo.put("from", "0"); areaMapFromTo.put("from", "0");
areaMapFromTo.put("to", areaMapDto.getKey()); areaMapFromTo.put("to", areaMapDto.getKey());
resultMapFromToList.add(areaMapFromTo); resultMapFromToList.add(areaMapFromTo);
areaInt++; areaInt++;
for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap.getValue().entrySet()) { for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap.getValue().entrySet()) {
Double stationLowScore = null;
Double stationHighScore = null;
if (areaLowScore == null && areaHighScore == null) {
areaLowScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
areaHighScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
} else {
if (stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0) < areaLowScore) {
areaLowScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
}
if (stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0) > areaHighScore) {
areaHighScore = stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0);
}
}
FullViewRecallInfoDTO stationDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO stationDto = new FullViewRecallInfoDTO();
stationDto.setKey(areaMapDto.getKey() + "-" + stationInt); stationDto.setKey(areaMapDto.getKey() + "-" + stationInt);
stationDto.setName(stationMap.getKey()); stationDto.setName(stationMap.getKey());
stationDto.setLoc(null); stationDto.setLoc(null);
stationDto.setScoreRange(null);
stationDto.setStatus(null); stationDto.setStatus(null);
stationDto.setScore(stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0)); stationDto.setScore(stationHealthIndexMap.getOrDefault(stationMap.getKey(), 100.0));
fullViewRecallList.add(stationDto); LambdaQueryWrapper<IdxBizFanHealthLevel> stationQuery = new LambdaQueryWrapper<>();
stationQuery.like(IdxBizFanHealthLevel::getStatus, stationMap.getKey());
stationQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "场站");
stationQuery.le(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
stationQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
IdxBizFanHealthLevel stationLevel = idxBizFanHealthLevelMapper.selectOne(stationQuery);
stationDto.setStatus(ObjectUtils.isNotEmpty(stationLevel) ? stationLevel.getHealthLevel() : "");
if (ObjectUtils.isEmpty(stationLevel)) {
LambdaQueryWrapper<IdxBizPvHealthLevel> stationPvQuery = new LambdaQueryWrapper<>();
stationPvQuery.like(IdxBizPvHealthLevel::getStatus, stationMap.getKey());
stationPvQuery.eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站");
stationPvQuery.le(IdxBizPvHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
stationPvQuery.ge(IdxBizPvHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
IdxBizPvHealthLevel stationPvLevel = idxBizPvHealthLevelMapper.selectOne(stationPvQuery);
if (ObjectUtils.isNotEmpty(stationPvLevel)) {
stationDto.setStatus(stationPvLevel.getHealthLevel());
}
}
HashMap<String, String> stationMapFromTo = new HashMap<>(); HashMap<String, String> stationMapFromTo = new HashMap<>();
stationMapFromTo.put("from", areaMapDto.getKey()); stationMapFromTo.put("from", areaMapDto.getKey());
stationMapFromTo.put("to", stationDto.getKey()); stationMapFromTo.put("to", stationDto.getKey());
resultMapFromToList.add(stationMapFromTo); resultMapFromToList.add(stationMapFromTo);
stationInt++; stationInt++;
for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap.getValue().entrySet()) { for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap.getValue().entrySet()) {
if (stationLowScore == null && stationHighScore == null) {
stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
stationHighScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
} else {
if (equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0) < stationLowScore) {
stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
}
if (equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0) > stationHighScore) {
stationHighScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
}
}
FullViewRecallInfoDTO equipmentMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO equipmentMapDto = new FullViewRecallInfoDTO();
equipmentMapDto.setKey(stationDto.getKey() + "-" + equipmentInt); equipmentMapDto.setKey(stationDto.getKey() + "-" + equipmentInt);
equipmentMapDto.setName(equipmentMap.getKey()); equipmentMapDto.setName(equipmentMap.getKey());
equipmentMapDto.setLoc(null); equipmentMapDto.setLoc(null);
equipmentMapDto.setScoreRange(null); equipmentMapDto.setScoreRange(null);
equipmentMapDto.setStatus(null);
equipmentMapDto.setScore(null); IdxBizFanHealthLevel levelInfo = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "设备", equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
equipmentMapDto.setStatus(levelInfo.getHealthLevel());
equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
fullViewRecallList.add(equipmentMapDto); fullViewRecallList.add(equipmentMapDto);
HashMap<String, String> equipmentMapFromTo = new HashMap<>(); HashMap<String, String> equipmentMapFromTo = new HashMap<>();
equipmentMapFromTo.put("from", stationDto.getKey()); equipmentMapFromTo.put("from", stationDto.getKey());
...@@ -719,8 +853,12 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -719,8 +853,12 @@ public class BigScreenAnalyseController extends BaseController {
subSystemMapDto.setName(subSystemMap.getKey()); subSystemMapDto.setName(subSystemMap.getKey());
subSystemMapDto.setLoc(null); subSystemMapDto.setLoc(null);
subSystemMapDto.setScoreRange(null); subSystemMapDto.setScoreRange(null);
subSystemMapDto.setStatus(null); // subSystemMapDto.setStatus(null);
subSystemMapDto.setScore(null);
IdxBizFanHealthLevel levelInfoZxt = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "子系统", subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
subSystemMapDto.setStatus(levelInfoZxt.getHealthLevel());
subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
fullViewRecallList.add(subSystemMapDto); fullViewRecallList.add(subSystemMapDto);
HashMap<String, String> subSystemMapFromTo = new HashMap<>(); HashMap<String, String> subSystemMapFromTo = new HashMap<>();
subSystemMapFromTo.put("from", equipmentMapDto.getKey()); subSystemMapFromTo.put("from", equipmentMapDto.getKey());
...@@ -731,10 +869,17 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -731,10 +869,17 @@ public class BigScreenAnalyseController extends BaseController {
FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO();
pointNameMapDto.setKey(subSystemMapDto.getKey() + "-" + pointNameInt); pointNameMapDto.setKey(subSystemMapDto.getKey() + "-" + pointNameInt);
pointNameMapDto.setName(pointNameMap.getKey()); pointNameMapDto.setName(pointNameMap.getKey());
FullViewRecallDataDTO fullViewRecallDataDTO = pointNameMap.getValue().get(0);
pointNameMapDto.setLoc(null); pointNameMapDto.setLoc(null);
pointNameMapDto.setScoreRange(null); pointNameMapDto.setScoreRange(null);
pointNameMapDto.setStatus(null);
pointNameMapDto.setScore(null); IdxBizFanHealthLevel levelInfoBL = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "测点", pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0));
pointNameMapDto.setStatus(levelInfoBL.getHealthLevel());
pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0));
fullViewRecallList.add(pointNameMapDto); fullViewRecallList.add(pointNameMapDto);
HashMap<String, String> pointNameMapFromTo = new HashMap<>(); HashMap<String, String> pointNameMapFromTo = new HashMap<>();
pointNameMapFromTo.put("from", subSystemMapDto.getKey()); pointNameMapFromTo.put("from", subSystemMapDto.getKey());
...@@ -744,7 +889,12 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -744,7 +889,12 @@ public class BigScreenAnalyseController extends BaseController {
} }
} }
} }
stationDto.setScoreRange("(" + stationLowScore + ", " + stationHighScore + ")");
fullViewRecallList.add(stationDto);
} }
areaMapDto.setScoreRange("(" + areaLowScore + ", " + areaHighScore + ")");
fullViewRecallList.add(areaMapDto);
} }
resultMapFinally.put("nodeDataArray", fullViewRecallList); resultMapFinally.put("nodeDataArray", fullViewRecallList);
......
...@@ -10,4 +10,5 @@ public class FullViewRecallDataDTO { ...@@ -10,4 +10,5 @@ public class FullViewRecallDataDTO {
private String equipmentName; private String equipmentName;
private String subSystem; private String subSystem;
private String pointName; private String pointName;
private String indexAddress;
} }
...@@ -10,4 +10,6 @@ public class FullViewRecallInfoDTO { ...@@ -10,4 +10,6 @@ public class FullViewRecallInfoDTO {
private Double score; private Double score;
private String scoreRange; private String scoreRange;
private String status; private String status;
private Boolean isRoot = false;
private String category;
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -81,4 +82,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -81,4 +82,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<FullViewRecallDataDTO> getFullViewRecall(); List<FullViewRecallDataDTO> getFullViewRecall();
List<Map<String, Object>> getStationIndexInfo(); List<Map<String, Object>> getStationIndexInfo();
List<Map<String, Object>> getEquipmentIndexInfo();
List<Map<String, Object>> getSubSystemIndexInfo();
List<Map<String, Object>> getPointNameIndexInfo();
List<IdxBizFanHealthLevel> getHealthLevelInfoList();
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
idx_biz_fan_health_index idx_biz_fan_health_index
<where>ANALYSIS_TYPE = '按天' <where>ANALYSIS_TYPE = '按天'
AND AND
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
WHERE WHERE
( STATION IS NULL OR STATION = '' ) ( STATION IS NULL OR STATION = '' )
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY GROUP BY
ARAE UNION ALL ARAE UNION ALL
( (
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
WHERE WHERE
( STATION IS NULL OR STATION = '' ) ( STATION IS NULL OR STATION = '' )
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY GROUP BY
ARAE ARAE
) )
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME like concat( '%', #{equipmentName} '风机系统') AND EQUIPMENT_NAME like concat( '%', #{equipmentName} '风机系统')
</if> </if>
...@@ -354,7 +354,7 @@ ...@@ -354,7 +354,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
...@@ -409,7 +409,7 @@ ...@@ -409,7 +409,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) 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="subSystem != null and subSystem != ''"> <if test="subSystem != null and subSystem != ''">
...@@ -464,7 +464,7 @@ ...@@ -464,7 +464,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
...@@ -483,7 +483,7 @@ ...@@ -483,7 +483,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="subarray != null and subarray != ''"> <if test="subarray != null and subarray != ''">
AND SUBARRAY = #{subarray} AND SUBARRAY = #{subarray}
</if> </if>
...@@ -529,7 +529,7 @@ ...@@ -529,7 +529,7 @@
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) 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 != ''">
...@@ -579,20 +579,22 @@ ...@@ -579,20 +579,22 @@
( (
SELECT SELECT
ARAE AS area, ARAE AS area,
GATEWAY_ID AS station, STATION AS station,
EQUIPMENT_NAME AS equipmentName, EQUIPMENT_NAME AS equipmentName,
SUB_SYSTEM AS subSystem, SUB_SYSTEM AS subSystem,
POINT_NAME AS pointName POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress
FROM FROM
idx_biz_fan_point_process_variable_classification idx_biz_fan_point_process_variable_classification
WHERE WHERE
TAG_CODE = '分析变量' UNION ALL TAG_CODE = '分析变量' UNION ALL
SELECT SELECT
ARAE AS area, ARAE AS area,
GATEWAY_ID AS station, STATION AS station,
SUBARRAY AS equipmentName, SUBARRAY AS equipmentName,
EQUIPMENT_NAME AS subSystem, EQUIPMENT_NAME AS subSystem,
POINT_NAME AS pointName POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
WHERE WHERE
...@@ -608,32 +610,161 @@ ...@@ -608,32 +610,161 @@
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
GATEWAY_ID AS STATION STATION AS STATION
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
WHERE WHERE
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY GROUP BY
GATEWAY_ID UNION ALL STATION UNION ALL
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
GATEWAY_ID AS STATION STATION AS STATION
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
WHERE WHERE
STATION IS NOT NULL STATION IS NOT NULL
AND STATION != '' AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY GROUP BY
GATEWAY_ID STATION
) )
) a ) a
GROUP BY GROUP BY
a.STATION a.STATION
</select> </select>
<select id="getEquipmentIndexInfo" resultType="java.util.Map">
SELECT
a.equipmentName AS equipmentName,
ROUND( avg( a.avgHealthIndex ), 2 ) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM
idx_biz_fan_health_index
WHERE
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
EQUIPMENT_NAME UNION ALL
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
SUBARRAY AS equipmentName
FROM
idx_biz_pv_health_index
WHERE
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
SUBARRAY
)
) a
GROUP BY
a.equipmentName
</select>
<select id="getSubSystemIndexInfo" resultType="java.util.Map">
SELECT
a.subSystem AS subSystem,
ROUND( avg( a.avgHealthIndex ), 2 ) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
SUB_SYSTEM AS subSystem
FROM
idx_biz_fan_health_index
WHERE
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
SUB_SYSTEM UNION ALL
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
EQUIPMENT_NAME AS subSystem
FROM
idx_biz_pv_health_index
WHERE
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
EQUIPMENT_NAME
)
) a
GROUP BY
a.subSystem
</select>
<select id="getPointNameIndexInfo" resultType="java.util.Map">
SELECT
IFNULL( HEALTH_INDEX, 100 ) AS healthIndex,
concat( STATION, '_', INDEX_ADDRESS ) as gatewayIndexAddress
FROM
idx_biz_fan_health_index
WHERE
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
INDEX_ADDRESS UNION ALL
(
SELECT
IFNULL( HEALTH_INDEX, 100 ) AS healthIndex,
concat( STATION, '_', INDEX_ADDRESS ) as gatewayIndexAddress
FROM
idx_biz_pv_health_index
WHERE
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
INDEX_ADDRESS
)
</select>
<select id="getHealthLevelInfoList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel">
SELECT
CONCAT( `STATUS`, '_', ANALYSIS_OBJ_TYPE ) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM
idx_biz_fan_health_level
WHERE
STATUS IS NOT NULL
OR STATUS != '' UNION ALL
SELECT
CONCAT( `STATUS`, '_', ANALYSIS_OBJ_TYPE ) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM
idx_biz_pv_health_level
WHERE
STATUS IS NOT NULL
OR STATUS != ''
</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