Commit 59684e63 authored by caotao's avatar caotao

分析模块需求变更

parent f5e651f0
......@@ -20,7 +20,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -500,39 +503,48 @@ public class BigScreenAnalyseController 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) throws UnsupportedEncodingException {
// subSystem = java.net.URLDecoder.decode(subSystem,"UTF-8");
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
//// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getWarningInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
// Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> t.get("warningName").toString()));
// List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem);
// pointNameList.forEach(item -> {
// String warningName = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全");
// int sort = 4;
// item.put("warningName", warningName);
// item.put("status", warningName);
// if ("注意".equals(warningName)) {
// sort = 3;
// } else if ("警告".equals(warningName)) {
// sort = 2;
// } else if ("危险".equals(warningName)) {
// sort = 1;
// }
// item.put("sort", sort);
// });
// pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString()));
// Page<Map<String, Object>> mapPage = new Page<>();
// mapPage.setSize(pointNameList.size());
// mapPage.setTotal(pointNameList.size());
// mapPage.setCurrent(1);
// mapPage.setRecords(pointNameList);
// return ResponseHelper.buildResponse(mapPage);
// }
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
@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) throws UnsupportedEncodingException {
subSystem = java.net.URLDecoder.decode(subSystem, "UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
equipmentName = StrUtil.isNotEmpty(equipmentName) ? "%" + equipmentName + "风机%" : equipmentName;
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getWarningInfoBySubSystemTd(subSystem,
stationBasic.getFanGatewayId(), equipmentName);
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("pointname"), t -> t.get("warningname").toString()));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper
.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem, equipmentName);
pointNameList.forEach(item -> {
String warningName = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全");
int sort = 4;
item.put("warningName", warningName);
item.put("status", warningName);
if ("注意".equals(warningName)) {
sort = 3;
} else if ("警告".equals(warningName)) {
sort = 2;
} else if ("危险".equals(warningName)) {
sort = 1;
}
item.put("sort", sort);
});
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString()));
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
mapPage.setCurrent(1);
mapPage.setRecords(pointNameList);
return ResponseHelper.buildResponse(mapPage);
}
......@@ -639,32 +651,37 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired
private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddress")
public ResponseModel<Map<String, Object>> getTrendInfoByAddress(@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "tableName", required = false) String tableName,
@RequestParam(value = "tableName2", required = false) String tableName2) {
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> resultListData = new ArrayList<>();
String recDate = idxBizFanHealthIndexMapper.getRecDateByIndexAddress(stationBasic.getFanGatewayId(), indexAddress, tableName);
if (CharSequenceUtil.isNotEmpty(recDate)) {
resultListData = idxBizFanHealthIndexMapper.getInfoListByTableName(stationBasic.getFanGatewayId(), indexAddress, tableName2, recDate);
}
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);
List<FanHealthIndexDay> list = new ArrayList<>();
LambdaQueryWrapper<FanHealthIndexDay> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(FanHealthIndexDay::getIndexAddress, indexAddress);
lambdaQueryWrapper.eq(FanHealthIndexDay::getGatewayId, stationBasic.getFanGatewayId());
lambdaQueryWrapper.eq(FanHealthIndexDay::getAnalysisObjType, "测点");
lambdaQueryWrapper.le(FanHealthIndexDay::getRecDate, endTime);
lambdaQueryWrapper.ge(FanHealthIndexDay::getRecDate, startTime);
List<FanHealthIndexDay> fanHealthIndexDayList = fanHealthIndexDayMapper.selectList(lambdaQueryWrapper);
// List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(indexAddress, startTime, endTime, stationBasic.getFanGatewayId());
HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>();
List<Object> valueList = new ArrayList<>();
resultListData.forEach(item -> {
String date = "";
try {
date = DateUtils.convertDateToString(DateUtils.dateParse(item.get("REC_DATE").toString(), DateUtils.DATE_TIME_PATTERN), "MM-dd HH:mm:ss");
} catch (ParseException e) {
}
time.add(date);
String value = CharSequenceUtil.isEmpty(item.get("healthIndex").toString().replace(".0", "")) ? "100" : item.get("healthIndex").toString().replace(".0", "");
valueList.add(value);
fanHealthIndexDayList.forEach(item -> {
time.add(item.getRecDate());
valueList.add(item.getHealthIndex());
});
List<Map<String, Object>> arrayList = new ArrayList<>();
HashMap<String, Object> stringStringHashMap = new HashMap<>();
......@@ -672,9 +689,11 @@ public class BigScreenAnalyseController extends BaseController {
arrayList.add(stringStringHashMap);
resultMap.put("axisData", time);
resultMap.put("seriesData", arrayList);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据测点ID查询测点名称")
@GetMapping("/getMapStringByString")
......
......@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -586,38 +587,38 @@ 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,
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) throws UnsupportedEncodingException {
subSystem = java.net.URLDecoder.decode(subSystem, "UTF-8");
@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());
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getWarningInfoBySubSystemTd(subSystem,
stationBasic.getFanGatewayId(), equipmentName);
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("pointname"), t -> t.get("warningname").toString()));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper
.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem, 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())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem, equipmentName);
pointNameList.forEach(item -> {
String warningName = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全");
int sort = 4;
item.put("warningName", warningName);
item.put("status", warningName);
if ("注意".equals(warningName)) {
sort = 3;
} else if ("警告".equals(warningName)) {
sort = 2;
} else if ("危险".equals(warningName)) {
sort = 1;
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("sort", sort);
item.put("healthIndex", equipmentHealthScore);
});
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString()));
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
......@@ -626,6 +627,8 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage")
......@@ -1248,4 +1251,46 @@ public class TDBigScreenAnalyseController extends BaseController {
map.put("seriesData", seriesData);
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) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
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);
LambdaQueryWrapper<FanHealthIndexDay> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(FanHealthIndexDay::getIndexAddress, indexAddress);
lambdaQueryWrapper.eq(FanHealthIndexDay::getGatewayId, stationBasic.getFanGatewayId());
lambdaQueryWrapper.eq(FanHealthIndexDay::getAnalysisObjType, "测点");
lambdaQueryWrapper.le(FanHealthIndexDay::getRecDate, endTime);
lambdaQueryWrapper.ge(FanHealthIndexDay::getRecDate, startTime);
List<FanHealthIndexDay> fanHealthIndexDayList = fanHealthIndexDayMapper.selectList(lambdaQueryWrapper);
// List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(indexAddress, startTime, endTime, stationBasic.getFanGatewayId());
HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>();
List<Object> valueList = new ArrayList<>();
fanHealthIndexDayList.forEach(item -> {
time.add(item.getRecDate());
valueList.add(item.getHealthIndex());
});
List<Map<String, Object>> arrayList = new ArrayList<>();
HashMap<String, Object> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("data", valueList);
arrayList.add(stringStringHashMap);
resultMap.put("axisData", time);
resultMap.put("seriesData", arrayList);
return ResponseHelper.buildResponse(resultMap);
}
}
......@@ -72,7 +72,8 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
@Param("equipmentName") String equipmentName);
List<Map<String, Object>> getHealthInfoBySubSystem(@Param("subSystem") String subSystem,
@Param("gatewayId") String gatewayId);
@Param("gatewayId") String gatewayId,
@Param("equipmentName") String equipmentName);
List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem,
@Param("gatewayId") String gatewayId);
......
......@@ -529,14 +529,13 @@
</select>
<select id="getHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
IFNULL( avg( HEALTH_INDEX ), 100 ) AS healthIndex,
IFNULL(HEALTH_INDEX, 100) AS healthIndex,
POINT_NAME AS pointName
FROM
idx_biz_fan_health_index
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE= '测点'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if test="subSystem != null and subSystem != ''">
......@@ -545,6 +544,9 @@
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME like #{equipmentName}
</if>
</where>
GROUP BY
POINT_NAME
......
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