Commit 47d6e956 authored by wujiang's avatar wujiang

修改健康等级判断

parent bd9b0b9b
......@@ -127,12 +127,12 @@ public class TDBigScreenAnalyseController extends BaseController {
if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper
.getHealthScoreInfoByStation(stationCode, tableName));
stringBigDecimalHashMap.put("value",
idxBizFanHealthIndexMapper.getHealthScoreInfoByStation(stationCode, tableName));
return ResponseHelper.buildResponse(stringBigDecimalHashMap);
}
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper
.getHealthScoreInfoByLatest(areaCode, stationCode));
stringBigDecimalHashMap.put("value",
idxBizFanHealthIndexMapper.getHealthScoreInfoByLatest(areaCode, stationCode));
return ResponseHelper.buildResponse(stringBigDecimalHashMap);
}
......@@ -297,7 +297,8 @@ public class TDBigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea();
Map<String, Object> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> t.get("healthIndex")));
Map<String, Object> collect = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("area").toString(), t -> t.get("healthIndex")));
List<String> list = new ArrayList<>();
......@@ -562,8 +563,8 @@ public class TDBigScreenAnalyseController extends BaseController {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName,
stationBasic.getFanGatewayId());
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(
t -> t.get("subSystem"), t -> t.get("healthIndex")));
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("subSystem"), t -> t.get("healthIndex")));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
......@@ -580,22 +581,24 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "该子系统各指标预警 - 风站中间 下方列表")
@GetMapping("/getSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getSubSystemPointInfo(@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName) {
public ResponseModel<Page<Map<String, Object>>> getSubSystemPointInfo(
@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
equipmentName = StrUtil.isNotEmpty(equipmentName) ? "%" + equipmentName + "风机%" : equipmentName;
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId(), equipmentName);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem,
stationBasic.getFanGatewayId(), equipmentName);
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(
Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem, equipmentName);
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper
.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem, equipmentName);
pointNameList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
......@@ -638,8 +641,6 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage")
......@@ -691,8 +692,8 @@ public class TDBigScreenAnalyseController extends BaseController {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray,
stationBasic.getFanGatewayId());
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors
.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex")));
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex")));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
......@@ -712,15 +713,19 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表")
@GetMapping("/getPvSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) {
public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName,
stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(
Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper
.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
pointNameList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
......@@ -1190,13 +1195,43 @@ public class TDBigScreenAnalyseController extends BaseController {
@ApiOperation(value = "修改业务事实表的一条数据")
@PutMapping("/updateRowAndManyTable")
public ResponseModel<Boolean> updateRowAndManyTable(@RequestBody Map<String, Object> kv) {
if ("安全".equals(kv.get("HEALTH_LEVEL").toString()) && (!"100.0".equals(kv.get("GROUP_UPPER_LIMIT").toString())
&& !"100".equals(kv.get("GROUP_UPPER_LIMIT").toString()))) {
throw new RuntimeException("安全的分数上限只能是100");
if ("安全".equals(kv.get("HEALTH_LEVEL").toString())) {
if ((!"100.0".equals(kv.get("GROUP_UPPER_LIMIT").toString())
&& !"100".equals(kv.get("GROUP_UPPER_LIMIT").toString()))) {
throw new RuntimeException("安全的分数上限只能是100");
}
List<IdxBizFanHealthLevel> list = idxBizFanHealthLevelMapper.selectList(
new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "注意"));
Map<String, Double> map = list.stream().collect(
Collectors.toMap(IdxBizFanHealthLevel::getHealthLevel, IdxBizFanHealthLevel::getGroupLowerLimit));
if (Double.valueOf(kv.get("GROUP_LOWER_LIMIT").toString()) <= map.get("groupUpperLimit")) {
throw new RuntimeException("安全的下限和注意的上限不能低于注意的下限");
}
} else if ("注意".equals(kv.get("HEALTH_LEVEL").toString())) {
List<IdxBizFanHealthLevel> list = idxBizFanHealthLevelMapper.selectList(
new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "警告"));
Map<String, Double> map = list.stream().collect(
Collectors.toMap(IdxBizFanHealthLevel::getHealthLevel, IdxBizFanHealthLevel::getGroupLowerLimit));
if (Double.valueOf(kv.get("GROUP_LOWER_LIMIT").toString()) <= map.get("groupUpperLimit")) {
throw new RuntimeException("注意的下限和安全的上限不能低于安全的下限");
}
} else if ("警告".equals(kv.get("HEALTH_LEVEL").toString())) {
List<IdxBizFanHealthLevel> list = idxBizFanHealthLevelMapper.selectList(
new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "危险"));
Map<String, Double> map = list.stream().collect(
Collectors.toMap(IdxBizFanHealthLevel::getHealthLevel, IdxBizFanHealthLevel::getGroupLowerLimit));
if (Double.valueOf(kv.get("GROUP_LOWER_LIMIT").toString()) <= map.get("groupUpperLimit")) {
throw new RuntimeException("警告的下限和注意的上限不能低于注意的下限");
}
} else if ("危险".equals(kv.get("HEALTH_LEVEL").toString())) {
if ((!"0.0".equals(kv.get("GROUP_LOWER_LIMIT").toString())
&& !"0".equals(kv.get("GROUP_LOWER_LIMIT").toString()))) {
throw new RuntimeException("危险的分数下限只能是0");
}
}
if ("危险".equals(kv.get("HEALTH_LEVEL").toString()) && (!"0.0".equals(kv.get("GROUP_LOWER_LIMIT").toString())
&& !"0".equals(kv.get("GROUP_LOWER_LIMIT").toString()))) {
throw new RuntimeException("危险的分数下限只能是0");
if (Integer.valueOf(kv.get("GROUP_UPPER_LIMIT").toString()) <= Integer
.valueOf(kv.get("GROUP_LOWER_LIMIT").toString())) {
throw new RuntimeException(kv.get("HEALTH_LEVEL").toString() + "的分数上限不能小于或等于本身下限");
}
idxBizFanHealthLevelMapper.updateByInfo("idx_biz_pv_health_level", kv.get("GROUP_UPPER_LIMIT").toString(),
......@@ -1278,15 +1313,15 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddressBy1118")
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118(@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118(
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(DateUtils.dateAddDays(new Date(), - 15));
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(DateUtils.dateAddDays(new Date(), -15));
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
......@@ -1325,11 +1360,12 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddressBy1118Pv")
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118Pv(@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118Pv(
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(DateUtils.dateAddDays(new Date(), - 15));
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(DateUtils.dateAddDays(new Date(), -15));
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
......@@ -1371,7 +1407,8 @@ public class TDBigScreenAnalyseController extends BaseController {
@RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper.getHealthIndexByIndexAddress(stationBasic.getFanGatewayId(), varDesc);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddress(stationBasic.getFanGatewayId(), varDesc);
if (ObjectUtils.isEmpty(healthIndexMap)) {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", "正常运行");
......@@ -1412,7 +1449,6 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(stringStringHashMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下诊断分析")
@GetMapping("/getRiskHandleByVarDescBy1118Pv")
......@@ -1422,7 +1458,8 @@ public class TDBigScreenAnalyseController extends BaseController {
@RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper.getHealthIndexByIndexAddressPv(stationBasic.getFanGatewayId(), varDesc);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddressPv(stationBasic.getFanGatewayId(), varDesc);
if (ObjectUtils.isEmpty(healthIndexMap)) {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", "正常运行");
......@@ -1463,5 +1500,4 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(stringStringHashMap);
}
}
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