Commit c1373fa3 authored by tangwei's avatar tangwei

解决冲突

parents 1493e496 5dcd7d47
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("0 2000");
allMapDto.setScoreRange("");
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(350 + " " + (1410 + areaInt * 20));
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(680 + " " + (1000 + 900 * (stationInt - 1)));
stationDto.setScoreRange(null);
stationDto.setStatus(null); stationDto.setStatus("");
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(1000 + " " + (400 + 200 * (equipmentInt - 1)));
equipmentMapDto.setScoreRange(null); equipmentMapDto.setScoreRange("");
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());
...@@ -717,10 +851,14 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -717,10 +851,14 @@ public class BigScreenAnalyseController extends BaseController {
FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO();
subSystemMapDto.setKey(equipmentMapDto.getKey() + "-" + subSystemInt); subSystemMapDto.setKey(equipmentMapDto.getKey() + "-" + subSystemInt);
subSystemMapDto.setName(subSystemMap.getKey()); subSystemMapDto.setName(subSystemMap.getKey());
subSystemMapDto.setLoc(null); subSystemMapDto.setLoc(2000 + " " + (300 + 90 * (subSystemInt - 1)));
subSystemMapDto.setScoreRange(null); subSystemMapDto.setScoreRange("");
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,16 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -731,10 +869,16 @@ 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());
pointNameMapDto.setLoc(null);
pointNameMapDto.setScoreRange(null); FullViewRecallDataDTO fullViewRecallDataDTO = pointNameMap.getValue().get(0);
pointNameMapDto.setStatus(null);
pointNameMapDto.setScore(null); pointNameMapDto.setLoc(3800 + " " + (250 + 80 * (pointNameInt - 1)));
pointNameMapDto.setScoreRange("");
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 +888,12 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -744,7 +888,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;
} }
...@@ -8,6 +8,8 @@ public class FullViewRecallInfoDTO { ...@@ -8,6 +8,8 @@ public class FullViewRecallInfoDTO {
private String loc; private String loc;
private String name; private String name;
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 = "";
} }
...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
...@@ -38,8 +39,8 @@ public class IdxBizPvHealthLevel{ ...@@ -38,8 +39,8 @@ public class IdxBizPvHealthLevel{
/** /**
* *
*/ */
@TableField("REC_DATE") @TableField("REC_DATE")
private LocalDateTime recDate; private Date recDate;
/** /**
* *
......
...@@ -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();
} }
...@@ -7,27 +7,30 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; ...@@ -7,27 +7,30 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@EnableScheduling
@Service
public class HealthStatusIndicatorServiceImpl { public class HealthStatusIndicatorServiceImpl {
@Value("${healthValue_Warn}") // @Value("${healthValue_Warn}")
Double healthValueWarn; // Double healthValueWarn;
@Value("${healthValue_Risk}") // @Value("${healthValue_Risk}")
Double healthValueRisk; // Double healthValueRisk;
@Value("${healthValue_Notice}") // @Value("${healthValue_Notice}")
Double healthValueNotice; // Double healthValueNotice;
@Value("${healthValue_DayCount}") // @Value("${healthValue_DayCount}")
long healthValueDayCount; // long healthValueDayCount;
@Value("${healthValue_HourCount}") // @Value("${healthValue_HourCount}")
long healthValueHourCount; // long healthValueHourCount;
@Value("${healthValue_MinCount}") // @Value("${healthValue_MinCount}")
long healthValueMinCount; // long healthValueMinCount;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
...@@ -48,6 +51,10 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -48,6 +51,10 @@ public class HealthStatusIndicatorServiceImpl {
@Autowired @Autowired
IdxBizPvHealthIndexMapper idxBizPvHealthIndexMapper; IdxBizPvHealthIndexMapper idxBizPvHealthIndexMapper;
@Autowired
IdxBizPvWarningRuleSetMapper idxBizPvWarningRuleSetMapper;
@Autowired
IdxBizFanWarningRuleSetMapper idxBizFanWarningRuleSetMapper;
@Autowired @Autowired
IdxBizPvWarningRecordMapper idxBizPvWarningRecordMapper; IdxBizPvWarningRecordMapper idxBizPvWarningRecordMapper;
...@@ -66,7 +73,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -66,7 +73,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<IdxBizPvHealthIndex> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizPvHealthIndex::getAnalysisType,"按时刻"); wrapper.eq(IdxBizPvHealthIndex::getAnalysisType,"按时刻");
wrapper.le(IdxBizPvHealthIndex::getHealthIndex,healthValueNotice); wrapper.ne(IdxBizPvHealthIndex::getHealthLevel,"安全");
wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime())); wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate); wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate);
List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper); List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper);
...@@ -76,11 +83,46 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -76,11 +83,46 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId); Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) { for (String address : healthDataMaps.keySet()) {
List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address); List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address);
List<Double> healthIndex = idxBizPvHealthIndices.stream().map(IdxBizPvHealthIndex::getHealthIndex).collect(Collectors.toList()); LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
long riskNum = healthIndex.stream().filter(e -> e <= healthValueRisk).count(); queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按小时");
long warnNum = healthIndex.stream().filter(e -> e <= healthValueWarn).count(); queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
long noticeNum = healthIndex.stream().filter(e -> e <= healthValueNotice).count(); List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){
case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueMinCount =Long.parseLong(e.getWarningCycle());
break;
case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueMinCount =Long.parseLong(e.getWarningCycle());
break;
case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueMinCount =Long.parseLong(e.getWarningCycle());
break;
}
}
List<Double> healthIndex = idxBizPvHealthIndices.stream().map(IdxBizPvHealthIndex::getHealthIndex).collect(Collectors.toList());
Double finalHealthValueRisk = healthValueRisk;
long riskNum = healthIndex.stream().filter(e -> e <= finalHealthValueRisk).count();
Double finalHealthValueWarn = healthValueWarn;
long warnNum = healthIndex.stream().filter(e -> e <= finalHealthValueWarn).count();
Double finalHealthValueNotice = healthValueNotice;
long noticeNum = healthIndex.stream().filter(e -> e <= finalHealthValueNotice).count();
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
...@@ -134,7 +176,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -134,7 +176,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<IdxBizPvHealthIndex> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizPvHealthIndex::getAnalysisType,"按小时"); wrapper.eq(IdxBizPvHealthIndex::getAnalysisType,"按小时");
wrapper.le(IdxBizPvHealthIndex::getHealthIndex,healthValueNotice); wrapper.ne(IdxBizPvHealthIndex::getHealthLevel,"安全");
wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime())); wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate); wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate);
List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper); List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper);
...@@ -144,10 +186,48 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -144,10 +186,48 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId); Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) { for (String address : healthDataMaps.keySet()) {
List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address); List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按小时");
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){
case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueHourCount =Long.parseLong(e.getWarningCycle());
break;
case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueHourCount =Long.parseLong(e.getWarningCycle());
break;
case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueHourCount =Long.parseLong(e.getWarningCycle());
break;
}
}
List<Double> healthIndex = idxBizPvHealthIndices.stream().map(IdxBizPvHealthIndex::getHealthIndex).collect(Collectors.toList()); List<Double> healthIndex = idxBizPvHealthIndices.stream().map(IdxBizPvHealthIndex::getHealthIndex).collect(Collectors.toList());
long riskNum = healthIndex.stream().filter(e -> e <= healthValueRisk).count(); Double finalHealthValueRisk = healthValueRisk;
long warnNum = healthIndex.stream().filter(e -> e <= healthValueWarn).count(); long riskNum = healthIndex.stream().filter(e -> e <= finalHealthValueRisk).count();
long noticeNum = healthIndex.stream().filter(e -> e <= healthValueNotice).count(); Double finalHealthValueWarn = healthValueWarn;
long warnNum = healthIndex.stream().filter(e -> e <= finalHealthValueWarn).count();
Double finalHealthValueNotice = healthValueNotice;
long noticeNum = healthIndex.stream().filter(e -> e <= finalHealthValueNotice).count();
String level = ""; String level = "";
String content = ""; String content = "";
...@@ -203,7 +283,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -203,7 +283,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<IdxBizPvHealthIndex> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizPvHealthIndex::getAnalysisType,"按天"); wrapper.eq(IdxBizPvHealthIndex::getAnalysisType,"按天");
wrapper.le(IdxBizPvHealthIndex::getHealthIndex,healthValueNotice); wrapper.ne(IdxBizPvHealthIndex::getHealthLevel,"安全");
wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime())); wrapper.ge(IdxBizPvHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate); wrapper.orderByDesc(IdxBizPvHealthIndex::getRecDate);
List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper); List<IdxBizPvHealthIndex> healthIndices = idxBizPvHealthIndexMapper.selectList(wrapper);
...@@ -213,11 +293,48 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -213,11 +293,48 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId); Map<String, List<IdxBizPvHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) { for (String address : healthDataMaps.keySet()) {
List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address); List<IdxBizPvHealthIndex> idxBizPvHealthIndices = healthDataMaps.get(address);
List<Double> healthIndex = idxBizPvHealthIndices.stream().map(IdxBizPvHealthIndex::getHealthIndex).collect(Collectors.toList());
long riskNum = healthIndex.stream().filter(e -> e <= healthValueRisk).count();
long warnNum = healthIndex.stream().filter(e -> e <= healthValueWarn).count();
long noticeNum = healthIndex.stream().filter(e -> e <= healthValueNotice).count();
LambdaQueryWrapper<IdxBizPvWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisType,"按天");
queryWrapper.eq(IdxBizPvWarningRuleSet::getAnalysisPointId,idxBizPvHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizPvWarningRuleSet> idxBizPvWarningRuleSets = idxBizPvWarningRuleSetMapper.selectList(queryWrapper);
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizPvWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){
case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueDayCount =Long.parseLong(e.getWarningCycle());
break;
case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueDayCount =Long.parseLong(e.getWarningCycle());
break;
case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueDayCount =Long.parseLong(e.getWarningCycle());
break;
}
}
List<Double> healthIndex = idxBizPvHealthIndices.stream().map(IdxBizPvHealthIndex::getHealthIndex).collect(Collectors.toList());
Double finalHealthValueRisk = healthValueRisk;
long riskNum = healthIndex.stream().filter(e -> e <= finalHealthValueRisk).count();
Double finalHealthValueWarn = healthValueWarn;
long warnNum = healthIndex.stream().filter(e -> e <= finalHealthValueWarn).count();
Double finalHealthValueNotice = healthValueNotice;
long noticeNum = healthIndex.stream().filter(e -> e <= finalHealthValueNotice).count();
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
...@@ -257,7 +374,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -257,7 +374,7 @@ public class HealthStatusIndicatorServiceImpl {
} }
@Scheduled(cron = "0 0 */1 * * ?") @Scheduled(cron = "0 0/5 * * * ?")
private void healthWarningMinute() { private void healthWarningMinute() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1); calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
...@@ -265,7 +382,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -265,7 +382,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<IdxBizFanHealthIndex> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizFanHealthIndex::getAnalysisType,"按时刻"); wrapper.eq(IdxBizFanHealthIndex::getAnalysisType,"按时刻");
wrapper.le(IdxBizFanHealthIndex::getHealthIndex,healthValueNotice); wrapper.ne(IdxBizFanHealthIndex::getHealthLevel,"安全");
wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime())); wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate); wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate);
List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper); List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper);
...@@ -275,10 +392,49 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -275,10 +392,49 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId); Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) { for (String address : healthDataMaps.keySet()) {
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address); List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按时刻");
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){
case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueMinCount =Long.parseLong(e.getWarningCycle());
break;
case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueMinCount =Long.parseLong(e.getWarningCycle());
break;
case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueMinCount =Long.parseLong(e.getWarningCycle());
break;
}
}
List<Double> healthIndex = idxBizFanHealthIndices.stream().map(IdxBizFanHealthIndex::getHealthIndex).collect(Collectors.toList()); List<Double> healthIndex = idxBizFanHealthIndices.stream().map(IdxBizFanHealthIndex::getHealthIndex).collect(Collectors.toList());
long riskNum = healthIndex.stream().filter(e -> e <= healthValueRisk).count(); Double finalHealthValueRisk = healthValueRisk;
long warnNum = healthIndex.stream().filter(e -> e <= healthValueWarn).count(); long riskNum = healthIndex.stream().filter(e -> e <= finalHealthValueRisk).count();
long noticeNum = healthIndex.stream().filter(e -> e <= healthValueNotice).count(); Double finalHealthValueWarn = healthValueWarn;
long warnNum = healthIndex.stream().filter(e -> e <= finalHealthValueWarn).count();
Double finalHealthValueNotice = healthValueNotice;
long noticeNum = healthIndex.stream().filter(e -> e <= finalHealthValueNotice).count();
String level = ""; String level = "";
String content = ""; String content = "";
...@@ -333,7 +489,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -333,7 +489,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<IdxBizFanHealthIndex> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizFanHealthIndex::getAnalysisType,"按小时"); wrapper.eq(IdxBizFanHealthIndex::getAnalysisType,"按小时");
wrapper.le(IdxBizFanHealthIndex::getHealthIndex,healthValueNotice); wrapper.ne(IdxBizFanHealthIndex::getHealthLevel,"安全");
wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime())); wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate); wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate);
List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper); List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper);
...@@ -343,11 +499,49 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -343,11 +499,49 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId); Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) { for (String address : healthDataMaps.keySet()) {
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address); List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address);
List<Double> healthIndex = idxBizFanHealthIndices.stream().map(IdxBizFanHealthIndex::getHealthIndex).collect(Collectors.toList());
long riskNum = healthIndex.stream().filter(e -> e <= healthValueRisk).count();
long warnNum = healthIndex.stream().filter(e -> e <= healthValueWarn).count();
long noticeNum = healthIndex.stream().filter(e -> e <= healthValueNotice).count();
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按小时");
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){
case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueHourCount =Long.parseLong(e.getWarningCycle());
break;
case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueHourCount =Long.parseLong(e.getWarningCycle());
break;
case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueHourCount =Long.parseLong(e.getWarningCycle());
break;
}
}
List<Double> healthIndex = idxBizFanHealthIndices.stream().map(IdxBizFanHealthIndex::getHealthIndex).collect(Collectors.toList());
Double finalHealthValueRisk = healthValueRisk;
long riskNum = healthIndex.stream().filter(e -> e <= finalHealthValueRisk).count();
Double finalHealthValueWarn = healthValueWarn;
long warnNum = healthIndex.stream().filter(e -> e <= finalHealthValueWarn).count();
Double finalHealthValueNotice = healthValueNotice;
long noticeNum = healthIndex.stream().filter(e -> e <= finalHealthValueNotice).count();
String level = ""; String level = "";
String content = ""; String content = "";
String num = ""; String num = "";
...@@ -402,7 +596,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -402,7 +596,7 @@ public class HealthStatusIndicatorServiceImpl {
LambdaQueryWrapper<IdxBizFanHealthIndex> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizFanHealthIndex::getAnalysisType,"按天"); wrapper.eq(IdxBizFanHealthIndex::getAnalysisType,"按天");
wrapper.le(IdxBizFanHealthIndex::getHealthIndex,healthValueNotice); wrapper.ne(IdxBizFanHealthIndex::getHealthLevel,"安全");
wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime())); wrapper.ge(IdxBizFanHealthIndex::getRecDate,df.format(calendar.getTime()));
wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate); wrapper.orderByDesc(IdxBizFanHealthIndex::getRecDate);
List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper); List<IdxBizFanHealthIndex> healthIndices = idxBizFanHealthIndexMapper.selectList(wrapper);
...@@ -412,10 +606,49 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -412,10 +606,49 @@ public class HealthStatusIndicatorServiceImpl {
Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId); Map<String, List<IdxBizFanHealthIndex>> healthDataMaps = gateWayMaps.get(gateWayId);
for (String address : healthDataMaps.keySet()) { for (String address : healthDataMaps.keySet()) {
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address); List<IdxBizFanHealthIndex> idxBizFanHealthIndices = healthDataMaps.get(address);
LambdaQueryWrapper<IdxBizFanWarningRuleSet> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisType,"按天");
queryWrapper.eq(IdxBizFanWarningRuleSet::getAnalysisPointId,idxBizFanHealthIndices.get(0).getAnalysisObjSeq());
List<IdxBizFanWarningRuleSet> idxBizPvWarningRuleSets = idxBizFanWarningRuleSetMapper.selectList(queryWrapper);
Double healthValueWarn = 0.0;
Double healthValueRisk = 0.0;
Double healthValueNotice = 0.0;
long healthValueDayCount = 0;
long healthValueHourCount = 0;
long healthValueMinCount = 0;
for (IdxBizFanWarningRuleSet e : idxBizPvWarningRuleSets) {
switch (e.getWarningName()){
case "警告":
healthValueWarn = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueDayCount =Long.parseLong(e.getWarningCycle());
break;
case "危险":
healthValueRisk = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueDayCount =Long.parseLong(e.getWarningCycle());
break;
case "注意":
healthValueNotice = Double.parseDouble(e.getWarningIf().substring(e.getWarningIf().length()-2));
healthValueDayCount =Long.parseLong(e.getWarningCycle());
break;
}
}
List<Double> healthIndex = idxBizFanHealthIndices.stream().map(IdxBizFanHealthIndex::getHealthIndex).collect(Collectors.toList()); List<Double> healthIndex = idxBizFanHealthIndices.stream().map(IdxBizFanHealthIndex::getHealthIndex).collect(Collectors.toList());
long riskNum = healthIndex.stream().filter(e -> e <= healthValueRisk).count(); Double finalHealthValueRisk = healthValueRisk;
long warnNum = healthIndex.stream().filter(e -> e <= healthValueWarn).count(); long riskNum = healthIndex.stream().filter(e -> e <= finalHealthValueRisk).count();
long noticeNum = healthIndex.stream().filter(e -> e <= healthValueNotice).count(); Double finalHealthValueWarn = healthValueWarn;
long warnNum = healthIndex.stream().filter(e -> e <= finalHealthValueWarn).count();
Double finalHealthValueNotice = healthValueNotice;
long noticeNum = healthIndex.stream().filter(e -> e <= finalHealthValueNotice).count();
String level = ""; String level = "";
String content = ""; String content = "";
......
...@@ -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>
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
<version>1.9.0-SNAPSHOT</version> <version>1.9.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>3.2.4</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* 从数据源配置
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.jxiop.biz.tdmapper", sqlSessionFactoryRef = "taosSqlSessionFactory")
public class TdEngineConfig {
private Logger logger = LoggerFactory.getLogger(TdEngineConfig.class);
// 精确到 cluster 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/tdengine/*.xml";
@Value("${spring.db3.datasource.url}")
private String dbUrl;
@Value("${spring.db3.datasource.username}")
private String username;
@Value("${spring.db3.datasource.password}")
private String password;
@Value("${spring.db3.datasource.driver-class-name}")
private String driverClassName;
@Bean(name = "taosDataSource") //声明其为Bean实例
public DataSource clusterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "taosTransactionManager")
public DataSourceTransactionManager clusterTransactionManager() {
return new DataSourceTransactionManager(clusterDataSource());
}
@Bean(name = "taosSqlSessionFactory")
public SqlSessionFactory clusterSqlSessionFactory(@Qualifier("taosDataSource") DataSource culsterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(TdEngineConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
return sessionFactory.getObject();
}
}
...@@ -6,7 +6,8 @@ import java.util.HashMap; ...@@ -6,7 +6,8 @@ import java.util.HashMap;
public class CommonConstans { public class CommonConstans {
//光伏发电量系数 //光伏发电量系数
public static final Double pvGenPoweActor = 0.000001; public static final Double pvGenPoweActor = 0.00001;
public static final Double pvGenPoweActorDay = 0.01;
// 风电站: // 风电站:
// (日/月/年)发电量=场站所有风机(日/月/年)发电量总和 // (日/月/年)发电量=场站所有风机(日/月/年)发电量总和
// 装机容量=场站所有风机装机容量总和 // 装机容量=场站所有风机装机容量总和
...@@ -33,6 +34,10 @@ public class CommonConstans { ...@@ -33,6 +34,10 @@ public class CommonConstans {
public static final Double tToWT = 0.0001; public static final Double tToWT = 0.0001;
//万Kwh转MV //万Kwh转MV
public static final Integer wkwhToMv = 10; public static final Integer wkwhToMv = 10;
//kw转MV
public static final Double kwToMv =0.0001 ;
// 正常运行 发电状态=1 // 正常运行 发电状态=1
// 告警运行 报警状态=1 // 告警运行 报警状态=1
// 正常停机 停机状态=1 // 正常停机 停机状态=1
......
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 com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData; ...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
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.service.impl.EquipAlarmEventServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.EquipAlarmEventServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil; import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -69,6 +71,8 @@ public class MonitorFanIdxController extends BaseController { ...@@ -69,6 +71,8 @@ public class MonitorFanIdxController extends BaseController {
@Value("${fan.statuts.stattuspath}") @Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix; private String fanStatusImagePathPrefix;
@Autowired
IndicatorDataMapper indicatorDataMapper;
@Autowired @Autowired
MonitorFanIndicatorMapper monitorFanIndicatorMapper; MonitorFanIndicatorMapper monitorFanIndicatorMapper;
...@@ -609,23 +613,21 @@ public class MonitorFanIdxController extends BaseController { ...@@ -609,23 +613,21 @@ public class MonitorFanIdxController extends BaseController {
for (String column : columnList) { for (String column : columnList) {
Double result = commonService.getTotalByIndicatiorByGF(gatewayId, column); Double result = commonService.getTotalByIndicatiorByGF(gatewayId, column);
columnMap.put(column, String.format("%.2f",result)); columnMap.put(column, String.format("%.2f",result*CommonConstans.pvGenPoweActor));
} }
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P","WTX-801_25_WTX-801_总辐射累计","WTX-801_25_WTX-801_总辐射")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P","WTX-801_25_WTX-801_总辐射累计","WTX-801_25_WTX-801_总辐射","313光差保护_总反向有功电度"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonService.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result1 = commonService.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
columnMap.put("有功功率", String.format("%.2f", commonService.getSumByEquipmentIndxName(result1,"南瑞光差保护_313P")/1000)); columnMap.put("有功功率", String.format("%.2f", commonService.getSumByEquipmentIndxName(result1,"南瑞光差保护_313P")*CommonConstans.kwToMv));
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and(equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率')"); // mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and(equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率')");
//日-月-年-发电量需要保留四位小数问题修改 //日-月-年-发电量需要保留四位小数问题修改
String num = monitorFanIndicator.getEquipCount(gatewayId,"GF"); String num = monitorFanIndicator.getEquipCount(gatewayId,"GF");
columnMap.put("风机台数",num); columnMap.put("风机台数",num);
Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber()); Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
//装机容量保留两位小数 //装机容量保留两位小数
columnMap.put("装机容量",String.format("%.2f",capacityl)); columnMap.put("装机容量",String.format("%.2f",capacityl));
...@@ -658,7 +660,12 @@ public class MonitorFanIdxController extends BaseController { ...@@ -658,7 +660,12 @@ public class MonitorFanIdxController extends BaseController {
data8.put("title",String.format("%.2f",commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射累计"))); data8.put("title",String.format("%.2f",commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射累计")));
objects.add(data8); objects.add(data8);
Map<String, Object> data9 = new HashMap<>(); Map<String, Object> data9 = new HashMap<>();
data9.put("title","0.00%");//综合效率 //综合效率 = 发电量/理论发电量
//理论发电量 = 峰值日照数 * 总装机容量
//峰值日照数 = 累计辐照度/3.6
Double powerAll = Double.valueOf((indicatorDataMapper.selectLastDataOfPower("313光差保护_总反向有功电度",boosterGatewayId).getValueF()*CommonConstans.kwToMv*0.028));
Double overallEfficiency = powerAll/((commonService.getSumByEquipmentIndxName(result1,"WTX-801_25_WTX-801_总辐射累计")/3.6)*capacityl);
data9.put("title",String.format("%.2f",overallEfficiency*100)+"%");//综合效率
objects.add(data9); objects.add(data9);
IPage<Map<String,Object>> result = new Page<>(); IPage<Map<String,Object>> result = new Page<>();
result.setRecords(objects); result.setRecords(objects);
......
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import io.github.classgraph.json.Id;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.sql.Timestamp;
import java.util.Date;
@Data
public class IndicatorData {
private String id;
private String address;
private String dataType;
private String equipmentSpecificName;
private String gatewayId;
private String isAlarm;
private Date createdTime;
private String unit;
private String value;
private Float valueF ;
private String valueLabel;
private String equipmentIndexName;
private String equipmentNumber;
private String displayName;
}
...@@ -43,34 +43,34 @@ public class StationCacheDataInit implements CommandLineRunner { ...@@ -43,34 +43,34 @@ public class StationCacheDataInit implements CommandLineRunner {
Logger logger = LoggerFactory.getLogger(StationCacheDataInit.class); Logger logger = LoggerFactory.getLogger(StationCacheDataInit.class);
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>(); // List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
redisTemplate.delete("station_info_cache"); // redisTemplate.delete("station_info_cache");
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1)); // List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); // List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); // List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
stationBasicList.forEach(stationBasic -> { // stationBasicList.forEach(stationBasic -> {
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto(); // StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString()); // stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName()); // stationCacheInfoDto.setStationName(stationBasic.getStationName());
stationCacheInfoDto.setStationType(stationBasic.getStationType()); // stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0)); // stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0)); // stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))); // stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
try { // try {
List<QueryDto> queryDtoList = new ArrayList<>(); // List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId", stationBasic.getFanGatewayId())); // queryDtoList.add(new QueryDto("gatewayId", stationBasic.getFanGatewayId()));
queryDtoList.add(new QueryDto("equipmentIndexName.keyword", "有功功率")); // queryDtoList.add(new QueryDto("equipmentIndexName.keyword", "有功功率"));
if (!stationBasic.getStationType().equals("FDZ")) { // if (!stationBasic.getStationType().equals("FDZ")) {
queryDtoList.add(new QueryDto("frontModule", "逆变器")); // queryDtoList.add(new QueryDto("frontModule", "逆变器"));
} // }
stationCacheInfoDto.setEquipmentNumbers(commonServiceImpl.getCount(queryDtoList, "equipmentNumber.Keyword", ESEquipments.class).toString()); // stationCacheInfoDto.setEquipmentNumbers(commonServiceImpl.getCount(queryDtoList, "equipmentNumber.Keyword", ESEquipments.class).toString());
} catch (Exception exception) { // } catch (Exception exception) {
logger.info("--------------------查询ES错误---------------------------"); // logger.info("--------------------查询ES错误---------------------------");
} // }
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId()); // stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId()); // stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDtos.add(stationCacheInfoDto); // stationCacheInfoDtos.add(stationCacheInfoDto);
}); // });
redisTemplate.opsForList().leftPushAll("station_info_cache", stationCacheInfoDtos); // redisTemplate.opsForList().leftPushAll("station_info_cache", stationCacheInfoDtos);
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel; import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock; import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.EquipAlarmEventDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.EquipAlarmEventDto;
...@@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -19,16 +23,19 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, ...@@ -19,16 +23,19 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
@Autowired @Autowired
EquipAlarmEventMapper equipAlarmEventMapper; EquipAlarmEventMapper equipAlarmEventMapper;
@Autowired
StationBasicMapper stationBasicMapper;
public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex, String frontModule) { public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex, String frontModule) {
List<EquipAlarmEvent> equipAlarmEvents = new ArrayList<>();
//参数传递进来的实际上为场站id
StationBasic stationBasic = this.stationBasicMapper.selectById(gatewayId);
LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex); queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex);
queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId); queryWrapper.eq(EquipAlarmEvent::getGatewayId, stationBasic.getFanGatewayId());
queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule); queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule);
queryWrapper.orderByDesc(EquipAlarmEvent::getCreatedTime); queryWrapper.orderByDesc(EquipAlarmEvent::getCreatedTime);
List<EquipAlarmEvent> equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper); equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper);
DataGridMock DataGridMock = new DataGridMock(current, equipAlarmEvents.size(), false, current, equipAlarmEvents); DataGridMock DataGridMock = new DataGridMock(current, equipAlarmEvents.size(), false, current, equipAlarmEvents);
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName"); ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName");
ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc"); ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc");
...@@ -37,6 +44,4 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, ...@@ -37,6 +44,4 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData; return resultsData;
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -26,6 +27,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans; ...@@ -26,6 +27,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils; import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator;
import com.yeejoin.amos.component.robot.BadRequest; import com.yeejoin.amos.component.robot.BadRequest;
...@@ -47,6 +49,7 @@ import java.io.File; ...@@ -47,6 +49,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.Collator; import java.text.Collator;
import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -106,6 +109,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -106,6 +109,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Value("classpath:/json/fanlocation.json") @Value("classpath:/json/fanlocation.json")
private Resource fanlocation; private Resource fanlocation;
@Autowired
private IndicatorDataMapper indicatorDataMapper;
private List<Map> list; private List<Map> list;
...@@ -118,17 +123,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -118,17 +123,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override @Override
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway; String table = gateway;
Map<String,List<String>> queryCodntion = new HashMap<>(); Map<String, List<String>> queryCodntion = new HashMap<>();
queryCodntion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(gateway)); queryCodntion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gateway));
queryCodntion.put(CommonConstans.QueryStringIsAlarmKeyword,Arrays.asList("1")); queryCodntion.put(CommonConstans.QueryStringIsAlarmKeyword, Arrays.asList("1"));
List<ESEquipments> alldata = commonServiceImpl.getListDataByCondtionsAndLike(queryCodntion,null,ESEquipments.class, null); List<ESEquipments> alldata = commonServiceImpl.getListDataByCondtionsAndLike(queryCodntion, null, ESEquipments.class, null);
List<ESEquipments> waringData = alldata.stream().filter(esEquipments -> !esEquipments.getValue().equals("0.0")&&!esEquipments.getValue().equals(esEquipments.getValueLabel())).collect(Collectors.toList()); List<ESEquipments> waringData = alldata.stream().filter(esEquipments -> !esEquipments.getValue().equals("0.0") && !esEquipments.getValue().equals(esEquipments.getValueLabel())).collect(Collectors.toList());
if (StringUtils.isNotEmpty(equipmentNumber)) { if (StringUtils.isNotEmpty(equipmentNumber)) {
waringData= waringData.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipmentNumber)).collect(Collectors.toList()); waringData = waringData.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipmentNumber)).collect(Collectors.toList());
} }
if (CollectionUtils.isNotEmpty(waringData)) { if (CollectionUtils.isNotEmpty(waringData)) {
Integer newSize = waringData.size() >= size ? size : waringData.size(); Integer newSize = waringData.size() >= size ? size : waringData.size();
waringData=waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * newSize),(current*newSize)); waringData = waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * newSize), (current * newSize));
} }
//对于查询到的告警信息进行按照时间顺序进行排序 //对于查询到的告警信息进行按照时间顺序进行排序
DataGridMock DataGridMock = new DataGridMock(current, !waringData.isEmpty() ? waringData.size() : 0, false, current, waringData); DataGridMock DataGridMock = new DataGridMock(current, !waringData.isEmpty() ? waringData.size() : 0, false, current, waringData);
...@@ -150,24 +155,24 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -150,24 +155,24 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId); StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
String gateway = stationBasic.getFanGatewayId(); String gateway = stationBasic.getFanGatewayId();
Map<String,List<String>> queryCodntion = new HashMap<>(); Map<String, List<String>> queryCodntion = new HashMap<>();
queryCodntion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(gateway)); queryCodntion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gateway));
queryCodntion.put(CommonConstans.QueryStringIsAlarmKeyword,Arrays.asList("1")); queryCodntion.put(CommonConstans.QueryStringIsAlarmKeyword, Arrays.asList("1"));
HashMap<String, String> notMustMap = new HashMap<>(); HashMap<String, String> notMustMap = new HashMap<>();
notMustMap.put(CommonConstans.QueryStringValueKeyword, "0.0"); notMustMap.put(CommonConstans.QueryStringValueKeyword, "0.0");
notMustMap.put(CommonConstans.QueryStringValueLabelKeyword, "0.0"); notMustMap.put(CommonConstans.QueryStringValueLabelKeyword, "0.0");
Integer newSize = size; Integer newSize = size;
List<ESEquipments> lisSort= new ArrayList<>(); List<ESEquipments> lisSort = new ArrayList<>();
List<ESEquipments> waringData = commonServiceImpl.getListDataByCondtionsByValueNotEqValueLabel(queryCodntion,null, notMustMap, ESEquipments.class); List<ESEquipments> waringData = commonServiceImpl.getListDataByCondtionsByValueNotEqValueLabel(queryCodntion, null, notMustMap, ESEquipments.class);
if (StringUtils.isNotEmpty(equipmentNumber) && CollectionUtils.isNotEmpty(waringData)) { if (StringUtils.isNotEmpty(equipmentNumber) && CollectionUtils.isNotEmpty(waringData)) {
waringData= waringData.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipmentNumber)&&esEquipments.getEquipmentSpecificName().contains("风机")).collect(Collectors.toList()); waringData = waringData.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipmentNumber) && esEquipments.getEquipmentSpecificName().contains("风机")).collect(Collectors.toList());
newSize = waringData.size() >= size ? size : waringData.size(); newSize = waringData.size() >= size ? size : waringData.size();
lisSort = waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * newSize),(current*newSize)); lisSort = waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * newSize), (current * newSize));
} }
//对于查询到的告警信息进行按照时间顺序进行排序 //对于查询到的告警信息进行按照时间顺序进行排序
//构建平台数据 //构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, CollectionUtils.isNotEmpty(waringData)? waringData.size(): 0, false, current, lisSort); DataGridMock DataGridMock = new DataGridMock(current, CollectionUtils.isNotEmpty(waringData) ? waringData.size() : 0, false, current, lisSort);
ColModel colModelequipmentNumber = new ColModel("equipmentNumber", "equipmentSpecificName", "风机号", "风机号", "dataGrid", "equipmentNumber"); ColModel colModelequipmentNumber = new ColModel("equipmentNumber", "equipmentSpecificName", "风机号", "风机号", "dataGrid", "equipmentNumber");
ColModel colModelvalueLabel = new ColModel("valueLabel", "valueLabel", "事件描述", "事件描述", "dataGrid", "valueLabel"); ColModel colModelvalueLabel = new ColModel("valueLabel", "valueLabel", "事件描述", "事件描述", "dataGrid", "valueLabel");
ColModel colModelcreatedTime = new ColModel("createdTime", "createdTime", "发生时间", "发生时间", "dataGrid", "createdTime"); ColModel colModelcreatedTime = new ColModel("createdTime", "createdTime", "发生时间", "发生时间", "dataGrid", "createdTime");
...@@ -303,7 +308,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -303,7 +308,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
colorMap.put("通讯中断", "#7d8e95"); colorMap.put("通讯中断", "#7d8e95");
List<ESEquipmentsDTO> resultList = new ArrayList<>(); List<ESEquipmentsDTO> resultList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(equipNumList)){ if (CollectionUtils.isNotEmpty(equipNumList)) {
equipNumList.forEach(item -> { equipNumList.forEach(item -> {
String status = ObjectUtils.isEmpty(CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()))) ? "通讯中断" : CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber())); String status = ObjectUtils.isEmpty(CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()))) ? "通讯中断" : CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()));
item.setAddress(status); item.setAddress(status);
...@@ -394,7 +399,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -394,7 +399,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ESEquipments esEquipments = result.get(i); ESEquipments esEquipments = result.get(i);
if (esEquipments.getEquipmentIndexName().contains("温度")) { if (esEquipments.getEquipmentIndexName().contains("温度")) {
xList.add(esEquipments.getEquipmentIndexName()); xList.add(esEquipments.getEquipmentIndexName());
yList.add(null == esEquipments.getValueF()?"0": esEquipments.getValueF().toString()); yList.add(null == esEquipments.getValueF() ? "0" : esEquipments.getValueF().toString());
} }
} }
realTimeTemperatureResult.put("axisData", xList); realTimeTemperatureResult.put("axisData", xList);
...@@ -427,18 +432,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -427,18 +432,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
} }
public String getEquipCount(String gatewayId,String stationType) { public String getEquipCount(String gatewayId, String stationType) {
Map<String, List<String>> queryCondtion1 = new HashMap<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
if (stationType.equals("FDZ")){ if (stationType.equals("FDZ")) {
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
}else { } else {
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行"));
} }
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
if (!CollectionUtils.isEmpty(equipNumList)){ if (!CollectionUtils.isEmpty(equipNumList)) {
return equipNumList.size()+""; return equipNumList.size() + "";
} }
return "0"; return "0";
} }
...@@ -474,67 +479,57 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -474,67 +479,57 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
public Map<String, Object> getDetailsWindSpeed(String gatewayId, String name) { public Map<String, Object> getDetailsWindSpeed(String gatewayId, String name) {
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
String time = ""; Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
try { String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { List<IndicatorData> indicatorDataListWindSpeed = new ArrayList<>();
e.printStackTrace(); List<IndicatorData> indicatorDataListActivePower = new ArrayList<>();
indicatorDataListWindSpeed = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber("瞬时风速", name, startTime, endTime, gatewayId);
indicatorDataListActivePower = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber("有功功率", name, startTime, endTime, gatewayId);
List<String> windSpeeds = new ArrayList<>();
List<String> activePowers = new ArrayList<>();
List<String> axisData = new ArrayList<>();
for (int i = 0; i < indicatorDataListWindSpeed.size(); i++) {
windSpeeds.add(indicatorDataListWindSpeed.get(i).getValue());
activePowers.add(indicatorDataListActivePower.get(i).getValue());
axisData.add(DateUtil.format(indicatorDataListWindSpeed.get(i).getCreatedTime(), "HH:mm"));
} }
String sql = "SELECT DISTINCT value FROM iot_data_" + gatewayId + " WHERE equipmentIndexName = '瞬时风速' and equipmentSpecificName =~/" + name + "/and time >='" + time + "'GROUP BY time(2m)";
String sql1 = "SELECT DISTINCT value FROM iot_data_" + gatewayId + " WHERE equipmentIndexName = '有功功率' and equipmentSpecificName =~/" + name + "/ and time >='" + time + "'GROUP BY time(2m)";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
List<IndicatorsDto> indicatorsDtoLists = influxDButils.getListDataAll(sql1, IndicatorsDto.class);
LinkedHashMap<String, String> collect = indicatorsDtoList.stream().collect(Collectors.toMap(IndicatorsDto::getTime, IndicatorsDto::getDistinct, (key1, ky2) -> (String) key1, LinkedHashMap::new));
LinkedHashMap<String, String> collects = indicatorsDtoLists.stream().collect(Collectors.toMap(IndicatorsDto::getTime, IndicatorsDto::getDistinct, (key1, ky2) -> (String) key1, LinkedHashMap::new));
Collection<String> values = collect.values();
Collection<String> valuess = collects.values();
Set<String> keySet = collect.keySet();
Set<String> keySets = collects.keySet();
List<Map<String, Object>> seriesData = new ArrayList<>(); List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String, Object> map1 = new HashMap<>(); Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>(); Map<String, Object> map2 = new HashMap<>();
map1.put("data", values); map1.put("data", windSpeeds);
map2.put("data", valuess); map2.put("data", activePowers);
seriesData.add(map1); seriesData.add(map1);
seriesData.add(map2); seriesData.add(map2);
map.put("seriesData", seriesData); map.put("seriesData", seriesData);
map.put("axisData", keySet.size() > keySets.size() ? keySet : keySets); map.put("axisData", axisData);
return map; return map;
} }
public Map<String, Object> getDetailsWindSpeeds(String gatewayId, String name) { public Map<String, Object> getDetailsWindSpeeds(String gatewayId, String name) {
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
String time = ""; Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
try { String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { List<IndicatorData> indicatorDataListActivePowers = new ArrayList<>();
e.printStackTrace(); indicatorDataListActivePowers= indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber("有功功率",name,startTime,endTime,gatewayId);
} List<String> axisData= new ArrayList<>();
Map<String, List<String>> queryCondtion = new HashMap<>(); List<String> activePowers = new ArrayList<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); for (int i = 0; i < indicatorDataListActivePowers.size(); i++) {
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(name)); activePowers.add(indicatorDataListActivePowers.get(i).getValue());
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); axisData.add(DateUtil.format(indicatorDataListActivePowers.get(i).getCreatedTime(),"HH:mm"));
name = indicatorsDtoList.get(0).getEquipmentSpecificName();
StringBuffer param = new StringBuffer();
String[] split = name.replace("#", "").split("/");
for (int i = 0; i < split.length; i++) {
param.append(" and equipmentSpecificName =~/" + split[i] + "/");
} }
String sql1 = "SELECT DISTINCT value FROM iot_data_" + gatewayId + " WHERE equipmentIndexName = '有功功率'" + param + " and time >='" + time + "'GROUP BY time(2m)";
List<IndicatorsDto> indicatorsDtoLists = influxDButils.getListDataAll(sql1, IndicatorsDto.class);
LinkedHashMap<String, String> collects = indicatorsDtoLists.stream().collect(Collectors.toMap(IndicatorsDto::getTime, IndicatorsDto::getDistinct, (key1, ky2) -> (String) key1, LinkedHashMap::new));
Collection<String> valuess = collects.values();
Set<String> keySets = collects.keySet();
List<Map<String, Object>> seriesData = new ArrayList<>(); List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String, Object> map2 = new HashMap<>(); Map<String, Object> map2 = new HashMap<>();
map2.put("data", valuess); map2.put("data", activePowers);
seriesData.add(map2); seriesData.add(map2);
map.put("seriesData", seriesData); map.put("seriesData", seriesData);
map.put("axisData", keySets); map.put("axisData", axisData);
return map; return map;
} }
...@@ -660,7 +655,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -660,7 +655,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setCreatedTime(time.split(" ")[1]); temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentIndexName()); temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentIndexName());
temporaryData.setGatewayId(stationBasic.getFanGatewayId()); temporaryData.setGatewayId(stationBasic.getFanGatewayId());
temporaryData.setValue(null ==indicatorsDto.getValueF()?0:indicatorsDto.getValueF()); temporaryData.setValue(null == indicatorsDto.getValueF() ? 0 : indicatorsDto.getValueF());
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber()); temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryDatas.add(temporaryData); temporaryDatas.add(temporaryData);
} catch (Exception e) { } catch (Exception e) {
...@@ -674,7 +669,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -674,7 +669,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setCreatedTime(time.split(" ")[1]); temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setEquipmentIndexName("有功功率"); temporaryData.setEquipmentIndexName("有功功率");
temporaryData.setGatewayId(stationBasic.getFanGatewayId()); temporaryData.setGatewayId(stationBasic.getFanGatewayId());
temporaryData.setValue(null ==indicatorsDto.getValueF()?0:indicatorsDto.getValueF()); temporaryData.setValue(null == indicatorsDto.getValueF() ? 0 : indicatorsDto.getValueF());
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber()); temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryDatass.add(temporaryData); temporaryDatass.add(temporaryData);
} catch (Exception e) { } catch (Exception e) {
...@@ -723,7 +718,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -723,7 +718,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setBatchNo(timeInMillis); temporaryData.setBatchNo(timeInMillis);
temporaryData.setCreatedTime(time.split(" ")[1]); temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setGatewayId(indicatorsDto.getGatewayId()); temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(indicatorsDto.getValueF()/1000); temporaryData.setValue(indicatorsDto.getValueF() / 1000);
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber()); temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName("有功功率"); temporaryData.setEquipmentIndexName("有功功率");
temporaryDatass.add(temporaryData); temporaryDatass.add(temporaryData);
...@@ -826,8 +821,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -826,8 +821,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, String> likeCodtion = new HashMap<>(); Map<String, String> likeCodtion = new HashMap<>();
likeCodtion.put(CommonConstans.QueryStringFrontMoudle, frontModule); likeCodtion.put(CommonConstans.QueryStringFrontMoudle, frontModule);
likeCodtion.put(CommonConstans.QueryStringDisplayName+".keyword", "合位"); likeCodtion.put(CommonConstans.QueryStringDisplayName + ".keyword", "合位");
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeCodtion); List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeCodtion);
Collator instance = Collator.getInstance(Locale.CHINA); Collator instance = Collator.getInstance(Locale.CHINA);
Collections.sort(listData, (e1, e2) -> { Collections.sort(listData, (e1, e2) -> {
...@@ -840,9 +835,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -840,9 +835,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, Object> statusMap = new HashMap<>(); Map<String, Object> statusMap = new HashMap<>();
if (frontModule.equals("前光")) { if (frontModule.equals("前光")) {
likeCodtion.remove(CommonConstans.QueryStringDisplayName+".keyword"); likeCodtion.remove(CommonConstans.QueryStringDisplayName + ".keyword");
likeCodtion.put(CommonConstans.QueryStringSystemType+".keyword", "模拟量"); likeCodtion.put(CommonConstans.QueryStringSystemType + ".keyword", "模拟量");
List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeCodtion); List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeCodtion);
for (ESEquipments indicatorsDto : value) { for (ESEquipments indicatorsDto : value) {
Double aDouble = Double.valueOf(indicatorsDto.getValue()); Double aDouble = Double.valueOf(indicatorsDto.getValue());
...@@ -903,12 +898,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -903,12 +898,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<String> numList = Arrays.asList(dataMap.get("equipNum").toString().split(",")); List<String> numList = Arrays.asList(dataMap.get("equipNum").toString().split(","));
List<Map<String, Object>> statusMaps = new ArrayList<>(); List<Map<String, Object>> statusMaps = new ArrayList<>();
for (ESEquipments listDatum : listData) { for (ESEquipments listDatum : listData) {
if (null == listDatum.getValueF()){ if (null == listDatum.getValueF()) {
listDatum.setValueF(0F); listDatum.setValueF(0F);
} }
for (ESEquipments indicatorsDto : listData1) { for (ESEquipments indicatorsDto : listData1) {
if (listDatum.getEquipmentNumber().equals(indicatorsDto.getEquipmentNumber())) { if (listDatum.getEquipmentNumber().equals(indicatorsDto.getEquipmentNumber())) {
listDatum.setValueLabel(String.valueOf(indicatorsDto.getValueF() == null?0:indicatorsDto.getValueF()/1000)); listDatum.setValueLabel(String.valueOf(indicatorsDto.getValueF() == null ? 0 : indicatorsDto.getValueF() / 1000));
} }
} }
...@@ -1053,9 +1048,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1053,9 +1048,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (ESEquipments indicatorsDto : stringListEntry.getValue()) { for (ESEquipments indicatorsDto : stringListEntry.getValue()) {
stringStringHashMap.put(ElectricQuantity.getCode(indicatorsDto.getDisplayName()), String.format("%.3f", ObjectUtils.isEmpty(indicatorsDto.getValueF()) ? 0.0 : indicatorsDto.getValueF())); stringStringHashMap.put(ElectricQuantity.getCode(indicatorsDto.getDisplayName()), String.format("%.3f", ObjectUtils.isEmpty(indicatorsDto.getValueF()) ? 0.0 : indicatorsDto.getValueF()));
} }
if (stringListEntry.getKey().contains("SVG")){ if (stringListEntry.getKey().contains("SVG")) {
resultList1.add(stringStringHashMap); resultList1.add(stringStringHashMap);
}else { } else {
resultList.add(stringStringHashMap); resultList.add(stringStringHashMap);
} }
} }
...@@ -1159,9 +1154,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1159,9 +1154,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> { xianData.forEach(item -> {
if ("220kVⅠ母PT".equals(item.getFrontModule())) { if ("220kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("220" + item.getDisplayName(), item.getValueF() ==null?"0":keepTwoDecimalPlaces(item.getValueF().toString())); resultMap.put("220" + item.getDisplayName(), item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
} else if ("35kVⅠ母PT".equals(item.getFrontModule())) { } else if ("35kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("35" + item.getDisplayName(),item.getValueF() ==null?"0": keepTwoDecimalPlaces(item.getValueF().toString())); resultMap.put("35" + item.getDisplayName(), item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
} }
}); });
List<String> xyxDisplayNameList = Arrays.asList("Ia", "P", "Q", "Ux"); List<String> xyxDisplayNameList = Arrays.asList("Ia", "P", "Q", "Ux");
...@@ -1171,9 +1166,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1171,9 +1166,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// 正向总有功正向总无功需要计算 // 正向总有功正向总无功需要计算
dlbjSqlData.forEach(item -> { dlbjSqlData.forEach(item -> {
if ("正向总有功".equals(item.getDisplayName())) { if ("正向总有功".equals(item.getDisplayName())) {
resultMap.put("2000S1",item.getValueF() ==null?"0": keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000)))); resultMap.put("2000S1", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000))));
} else if ("正向总无功".equals(item.getDisplayName())) { } else if ("正向总无功".equals(item.getDisplayName())) {
resultMap.put("2000S2",item.getValueF() ==null?"0": keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000)))); resultMap.put("2000S2", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueF().toString()) / 1000))));
} }
}); });
...@@ -1227,13 +1222,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1227,13 +1222,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("value3", "0.0"); stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> { listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) { if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1",item.getValueF() ==null?"0": keepTwoDecimalPlaces(item.getValueF().toString())); stringStringHashMap.put("value1", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
} }
if (item.getDisplayName().equals("P")) { if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2",item.getValueF() ==null?"0": keepTwoDecimalPlaces(item.getValueF().toString())); stringStringHashMap.put("value2", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
} }
if (item.getDisplayName().equals("Q")) { if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3",item.getValueF() ==null?"0":keepTwoDecimalPlaces(item.getValueF().toString())); stringStringHashMap.put("value3", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
} }
}); });
resultList.add(stringStringHashMap); resultList.add(stringStringHashMap);
...@@ -1513,43 +1508,43 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1513,43 +1508,43 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String load = String.format(CommonConstans.Twodecimalplaces, Double.parseDouble(String.valueOf(listData.get(0).getValueF())) / Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())); String load = String.format(CommonConstans.Twodecimalplaces, Double.parseDouble(String.valueOf(listData.get(0).getValueF())) / Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
List<Map<String, Object>> list = temporaryDataMapper.timingTemporarysSorageDataByIndexName(gatewayId,equipmentIndexName); List<Map<String, Object>> list = temporaryDataMapper.timingTemporarysSorageDataByIndexName(gatewayId, equipmentIndexName);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
List<String> values = new ArrayList<>(); List<String> values = new ArrayList<>();
Set<String> time = new TreeSet<>(); Set<String> time = new TreeSet<>();
String v = null ==list ?"":list.get(0).get("value").toString(); String v = null == list ? "" : list.get(0).get("value").toString();
double min = Double.parseDouble(v); double min = Double.parseDouble(v);
double max = Double.parseDouble(v); double max = Double.parseDouble(v);
double mean = 0.0; double mean = 0.0;
String minTime =null ==list?"":list.get(0).get("createdTime").toString(); String minTime = null == list ? "" : list.get(0).get("createdTime").toString();
String maxTime =null ==list?"":list.get(0).get("createdTime").toString(); String maxTime = null == list ? "" : list.get(0).get("createdTime").toString();
for (Map<String, Object> stringStringMap : list) { for (Map<String, Object> stringStringMap : list) {
double value = Double.parseDouble(stringStringMap.get("value").toString()); double value = Double.parseDouble(stringStringMap.get("value").toString());
values.add( String.format("%.2f",value)); values.add(String.format("%.2f", value));
if (value < min){ if (value < min) {
min = value; min = value;
minTime = stringStringMap.get("createdTime").toString(); minTime = stringStringMap.get("createdTime").toString();
}else if (value > max){ } else if (value > max) {
max = value; max = value;
maxTime = stringStringMap.get("createdTime").toString(); maxTime = stringStringMap.get("createdTime").toString();
} }
time.add(stringStringMap.get("createdTime").toString()); time.add(stringStringMap.get("createdTime").toString());
} }
for (String value : values) { for (String value : values) {
mean += Double.parseDouble(value); mean += Double.parseDouble(value);
} }
mean = Double.parseDouble(String.format("%.2f",mean/values.size())); mean = Double.parseDouble(String.format("%.2f", mean / values.size()));
List<Map<String,Object>> seriesData = new ArrayList<>(); List<Map<String, Object>> seriesData = new ArrayList<>();
map.put("mean",mean); map.put("mean", mean);
map.put("max",max); map.put("max", max);
map.put("min",min); map.put("min", min);
map.put("maxTime",maxTime); map.put("maxTime", maxTime);
map.put("minTime",minTime); map.put("minTime", minTime);
map.put("load", load); map.put("load", load);
return map; return map;
...@@ -1607,9 +1602,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1607,9 +1602,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldConditon = new HashMap<>(); Map<String, String> shouldConditon = new HashMap<>();
shouldConditon.put(CommonConstans.QueryStringEquipmentIndexName, "合闸"); shouldConditon.put(CommonConstans.QueryStringEquipmentIndexName, "合闸");
List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryConditon, null, ESEquipments.class,shouldConditon); List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryConditon, null, ESEquipments.class, shouldConditon);
if (!ValidationUtil.isEmpty(list)) { if (!ValidationUtil.isEmpty(list)) {
Map<String, List<ESEquipments>> collect = list.stream().filter(e->StringUtils.isNotBlank(e.getEquipmentNumber())).collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber)); Map<String, List<ESEquipments>> collect = list.stream().filter(e -> StringUtils.isNotBlank(e.getEquipmentNumber())).collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
for (String s : collect.keySet()) { for (String s : collect.keySet()) {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
collect.get(s).stream().forEach(e -> { collect.get(s).stream().forEach(e -> {
...@@ -1743,38 +1738,23 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1743,38 +1738,23 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public Map<String, Object> hlWindSpeeds(String gatewayId, String equipNum) { public Map<String, Object> hlWindSpeeds(String gatewayId, String equipNum) {
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
String time = ""; Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
try { String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) { List<IndicatorData> originarPVs = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumberPv(equipNum,startTime,endTime,gatewayId);
e.printStackTrace(); originarPVs.size();
}
String[] equipNumber = equipNum.split("-");
String sql = "SELECT time ,equipmentIndexName ,value FROM iot_data_" + gatewayId + " WHERE time >'" + time + "' and equipmentSpecificName =~/" + equipNumber[0] + "子阵/ and equipmentSpecificName =~/逆变器" + equipNumber[1] + "/ and equipmentSpecificName =~/" + Integer.parseInt(equipNumber[2]) + "汇流箱/ and equipmentIndexName =~/路电流/";
String timeSql = "SELECT DISTINCT value FROM iot_data_" + gatewayId + " WHERE time >'" + time + "' and equipmentSpecificName =~/" + equipNumber[0] + "子阵/ and equipmentSpecificName =~/逆变器" + equipNumber[1] + "/ and equipmentSpecificName =~/" + Integer.parseInt(equipNumber[2]) + "汇流箱/ and equipmentIndexName =~/路电流/ group by time(2m)";
List<IndicatorsDto> dataList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
Map<String, List<IndicatorsDto>> data = dataList.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentIndexName, LinkedHashMap::new, Collectors.toList())); Map<String, List<IndicatorData>> data = originarPVs.stream().collect(Collectors.groupingBy(IndicatorData::getEquipmentIndexName, TreeMap::new, Collectors.toList()));
int num = 0; List<String> axisData = new ArrayList<>();
List<Map<String, Object>> seriesData = new ArrayList<>(); List<Map<String, Object>> seriesData = new ArrayList<>();
for (String s : data.keySet()) { for (String s : data.keySet()) {
data.get(s).stream().forEach(e -> {
e.setTimeValue(e.getTime());
});
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
List<String> value = data.get(s).stream().map(IndicatorsDto::getValue).collect(Collectors.toList()); List<String> value = data.get(s).stream().map(IndicatorData::getValue).collect(Collectors.toList());
axisData =data.get(s).stream().map(indicatorData -> DateUtil.format(indicatorData.getCreatedTime(),"HH:mm")).collect(Collectors.toList());
map.put("data", value); map.put("data", value);
// map.put("name","pv"+s.substring(4,6));
seriesData.add(map); seriesData.add(map);
if (value.size() > num) {
Map<String, List<IndicatorsDto>> timeMap = data.get(s).stream().collect(Collectors.groupingBy(IndicatorsDto::getTimeValue, LinkedHashMap::new, Collectors.toList()));
resultMap.put("axisData", timeMap.keySet());
}
num = value.size() > num ? value.size() : num;
} }
resultMap.put("axisData",axisData);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return resultMap; return resultMap;
} }
......
...@@ -163,7 +163,7 @@ public class MonitoringServiceIMQTTmpl { ...@@ -163,7 +163,7 @@ public class MonitoringServiceIMQTTmpl {
Map<String, String> shouldQueryCondtion = new HashMap<>(); Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put("frontModule", "逆变器"); shouldQueryCondtion.put("frontModule", "逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldQueryCondtion, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldQueryCondtion, ESEquipments.class);
dailyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")*CommonConstans.pvGenPoweActor); dailyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")*CommonConstans.pvGenPoweActor*CommonConstans.pvGenPoweActorDay);
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")*CommonConstans.pvGenPoweActor); monthlyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")*CommonConstans.pvGenPoweActor);
annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")*CommonConstans.pvGenPoweActor); annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")*CommonConstans.pvGenPoweActor);
} }
......
...@@ -221,8 +221,8 @@ public class MonitoringServiceImpl { ...@@ -221,8 +221,8 @@ public class MonitoringServiceImpl {
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeQuerCondtion); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeQuerCondtion);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"))); completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P")/1000)); completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P")*CommonConstans.kwToMv));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor)); completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor*CommonConstans.pvGenPoweActorDay));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor)); completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, new BigDecimal(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor))); completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, new BigDecimal(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor)));
} }
...@@ -287,7 +287,7 @@ public class MonitoringServiceImpl { ...@@ -287,7 +287,7 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor); dailyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor*CommonConstans.pvGenPoweActorDay);
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor); monthlyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor);
annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor); annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor);
} }
...@@ -611,7 +611,7 @@ public class MonitoringServiceImpl { ...@@ -611,7 +611,7 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor); dailyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor*CommonConstans.pvGenPoweActorDay);
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor); monthlyPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor);
annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor); annualPower.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor);
} }
...@@ -927,7 +927,7 @@ public class MonitoringServiceImpl { ...@@ -927,7 +927,7 @@ public class MonitoringServiceImpl {
list1.add(stringHashMap8); list1.add(stringHashMap8);
page1.setRecords(list1); page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>(); HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get() + powerOfDayGF.get() * CommonConstans.pvGenPoweActor)); stringHashMap9.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get() + (powerOfDayGF.get() * CommonConstans.pvGenPoweActor*CommonConstans.pvGenPoweActorDay)));
list2.add(stringHashMap9); list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>(); HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get() * CommonConstans.pvGenPoweActor)); stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get() * CommonConstans.pvGenPoweActor));
......
package com.yeejoin.amos.boot.module.jxiop.biz.tdmapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("equipmentIndexName") String equipmentIndexName, @Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF, equipment_index_name from iot_data.indicator_data where equipment_index_name like '%路电流%' and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumberPv(@Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select last(`value_f`) as `value_f`,created_time from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id=#{gatewayId} ")
IndicatorData selectLastDataOfPower(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId);
}
## DB properties: ## DB properties:
## db1-production database ## db1-production database
spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:mysql://39.98.224.23:3306/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.db1.datasource.url=jdbc:mysql://139.9.173.44:3306/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username=root spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin@2020 spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name: com.mysql.cj.jdbc.Driver spring.db1.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
## db2-sync_data ## db2-sync_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:mysql://39.98.224.23:3306/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.db2.datasource.url=jdbc:mysql://139.9.173.44:3306/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.username=root spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020 spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name: com.mysql.cj.jdbc.Driver spring.db2.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
## db3-td-engine
#spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
## eureka properties: ## eureka properties:
eureka.instance.hostname=172.16.10.220 eureka.instance.hostname=172.16.10.220
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
......
...@@ -82,10 +82,10 @@ windSpeed.cron = 0 25 9 * * ? ...@@ -82,10 +82,10 @@ windSpeed.cron = 0 25 9 * * ?
#本地使用 0 0 5 29 2 ? ? 线上使用 0 */5 * * * ? #本地使用 0 0 5 29 2 ? ? 线上使用 0 */5 * * * ?
windSpeed.Scheduled.cron = 0 0 5 29 2 ? windSpeed.Scheduled.cron = 0 0 5 29 2 ?
spring.elasticsearch.rest.uris=http://39.98.224.23:9200 spring.elasticsearch.rest.uris=http://139.9.173.44:9200
spring.elasticsearch.rest.connection-timeout=30000 spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=123456 spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000 spring.elasticsearch.rest.read-timeout=30000
#elasticsearch.username= elastic #elasticsearch.username= elastic
......
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