Commit 59684e63 authored by caotao's avatar caotao

分析模块需求变更

parent f5e651f0
...@@ -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) throws UnsupportedEncodingException { @RequestParam(value = "equipmentName", required = false) String equipmentName) {
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