Commit 59684e63 authored by caotao's avatar caotao

分析模块需求变更

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