Commit f0b14a47 authored by chenzhao's avatar chenzhao

风电预警设备层接口

parent 9f7d2709
...@@ -15,7 +15,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper; ...@@ -15,7 +15,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanHealthIndexServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanHealthIndexServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
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.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -51,6 +53,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -51,6 +53,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
IdxBizPvPointTagMapper idxBizPvPointTagMapper; IdxBizPvPointTagMapper idxBizPvPointTagMapper;
@Autowired @Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper; FanHealthIndexDayMapper fanHealthIndexDayMapper;
@Autowired
FanWaringRecordMapper fanWarningRecord;
/** /**
* 新增 * 新增
* *
...@@ -403,4 +407,34 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -403,4 +407,34 @@ public class IdxBizFanHealthIndexController extends BaseController {
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计td", notes = "预警监测设备级统计td")
@GetMapping(value = "/selectPointNum")
public ResponseModel<List<Map<String,Object>>> selectPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBSYSTEM,@RequestParam(required = false) String EQUIPMENTNAME) {
List<FanWarningRecord> idxBizPvWarningRecordList = fanWarningRecord.warningData(STATION,EQUIPMENTNAME ,SUBSYSTEM );
int total = idxBizFanHealthIndexServiceImpl.pointNum(STATION, SUBSYSTEM, EQUIPMENTNAME);
Map<String,Object> map =new HashMap<>();
Map<String,Object> map1 =new HashMap<>();
Map<String,Object> warningNum =new HashMap<>();
Map<String,Object> pointNum =new HashMap<>();
map1.put("name","危险");
map1.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("危险")).count());
map.put("name","警告");
map.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("警告")).count());
warningNum.put("name","注意");
warningNum.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("注意")).count());
pointNum.put("name","安全");
pointNum.put("value",total - idxBizPvWarningRecordList.size());
List<Map<String,Object>> list = new ArrayList<>();
list.add(pointNum);
list.add(warningNum);
list.add(map);
list.add(map1);
return ResponseHelper.buildResponse(list);
}
} }
...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecor ...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecor
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.FanWaringRecordMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanMap;
...@@ -341,4 +342,24 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -341,4 +342,24 @@ public class IdxBizFanWarningRecordController extends BaseController {
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<List<Map<String,Object>>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME) {
List<Map<String, Object>> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME);
return ResponseHelper.buildResponse(maps);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectWarningPoint")
@ApiOperation(httpMethod = "GET", value = "预警监测设备右侧预警重复列表", notes = "预警监测设备右侧预警重复列表")
public ResponseModel<List<FanWarningRecord>> selectFanWarningNum(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME) {
List<FanWarningRecord> maps = fanWaringRecordMapper.selectWarningPoint(STATION,EQUIPMENTNAME);
return ResponseHelper.buildResponse(maps);
}
} }
...@@ -131,7 +131,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -131,7 +131,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
Map<String,Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME); Map<String,Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME);
List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME); List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Integer pointNum(String STATION, String SUBARRAY, String EQUIPMENTNAME); Integer pointNum(String STATION, String SUBSYSTEM, String EQUIPMENTNAME);
Map<String, Object> getPvEquipStatusByStation(String station); Map<String, Object> getPvEquipStatusByStation(String station);
......
...@@ -203,8 +203,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth ...@@ -203,8 +203,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
return this.getBaseMapper().queryForLeftTableListByPointNum(STATION,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME); return this.getBaseMapper().queryForLeftTableListByPointNum(STATION,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME);
} }
public int pointNum(String STATION, String SUBARRAY,String EQUIPMENTNAME) { public int pointNum(String STATION, String SUBSYSTEM,String EQUIPMENTNAME) {
return this.getBaseMapper().pointNum(STATION, SUBARRAY,EQUIPMENTNAME); return this.getBaseMapper().pointNum(STATION, SUBSYSTEM,EQUIPMENTNAME);
} }
public List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY , String EQUIPMENTNAME) { public List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY , String EQUIPMENTNAME) {
......
...@@ -10,4 +10,10 @@ import java.util.Map; ...@@ -10,4 +10,10 @@ import java.util.Map;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> { public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
public List<Map<String,Object>> selectFanWarningNum(String station); public List<Map<String,Object>> selectFanWarningNum(String station);
public List<FanWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBSYSTEM);
public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME);
public List<Map<String,Object>> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME);
} }
...@@ -1165,22 +1165,22 @@ ...@@ -1165,22 +1165,22 @@
</select> </select>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord"> <select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord">
SELECT SELECT
* *
FROM FROM
idx_biz_fan_warning_record re idx_biz_fan_warning_record re
WHERE WHERE
re.`STATUS` = 0 re.`STATUS` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND re.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="SUBARRAY != null and SUBARRAY != '' "> <if test="SUBARRAY != null and SUBARRAY != '' ">
AND re.SUBARRAY = #{SUBARRAY} AND re.SUBARRAY = #{SUBARRAY}
</if> </if>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
AND re.STATION = #{STATION} AND re.STATION = #{STATION}
</if> </if>
</select> </select>
<select id="pointNum" resultType="int"> <select id="pointNum" resultType="int">
SELECT SELECT
...@@ -1192,8 +1192,8 @@ ...@@ -1192,8 +1192,8 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="SUBARRAY != null and SUBARRAY != '' "> <if test="SUBSYSTEM != null and SUBSYSTEM != '' ">
AND cl.SUBARRAY = #{SUBARRAY} AND cl.SUB_SYSTEM = #{SUBSYSTEM}
</if> </if>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
AND cl.STATION = #{STATION} AND cl.STATION = #{STATION}
......
...@@ -4,37 +4,123 @@ ...@@ -4,37 +4,123 @@
<select id="selectFanWarningNum" resultType="map"> <select id="selectFanWarningNum" resultType="map">
SELECT `b`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`, SELECT `b`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`b`.`STATION` AS `STATION`, `b`.`STATION` AS `STATION`,
`b`.`警告` AS `警告`, `b`.`警告` AS `警告`,
`b`.`注意` AS `注意`, `b`.`注意` AS `注意`,
`b`.`危险` AS `危险`, `b`.`危险` AS `危险`,
sum(((`b`.`注意` + `b`.`危险`) + `b`.`警告`)) AS `sort` sum(((`b`.`注意` + `b`.`危险`) + `b`.`警告`)) AS `sort`
FROM (select `a`.`EQUIPMENT_NAME` as `EQUIPMENT_NAME`, FROM (select `a`.`EQUIPMENT_NAME` as `EQUIPMENT_NAME`,
a.`STATION` as `STATION`, a.`STATION` as `STATION`,
max(case `a`.`WARNING_NAME` when '危险' then `a`.`num` else 0 end) as `危险`, max(case `a`.`WARNING_NAME` when '危险' then `a`.`num` else 0 end) as `危险`,
max(case `a`.`WARNING_NAME` when '注意' then `a`.`num` else 0 end) as `注意`, max(case `a`.`WARNING_NAME` when '注意' then `a`.`num` else 0 end) as `注意`,
max(case `a`.`WARNING_NAME` when '警告' then `a`.`num` else 0 end) as `警告` max(case `a`.`WARNING_NAME` when '警告' then `a`.`num` else 0 end) as `警告`
from ( from (
select `warning_name` as `WARNING_NAME`, select `warning_name` as `WARNING_NAME`,
`equipment_name` as `EQUIPMENT_NAME`, `equipment_name` as `EQUIPMENT_NAME`,
`station` as `STATION`, `station` as `STATION`,
count(1) as `num` count(1) as `num`
from analysis_data.fan_warning_record from analysis_data.fan_warning_record
where `status` = 0 where `status` = 0
or (`status` = 1 or (`status` = 1
and `ts` > (now() - 3D - 8h)) and `ts` > (now() - 3D - 8h))
<if test="station != null"> <if test="station != null">
and station = #{station} and station = #{station}
</if> </if>
group by `station`, group by `station`,
`equipment_name`, `equipment_name`,
`warning_name`) a `warning_name`) a
group by `a`.`EQUIPMENT_NAME`, a.`STATION`) b group by `a`.`EQUIPMENT_NAME`, a.`STATION`) b
GROUP BY `b`.`EQUIPMENT_NAME`, GROUP BY `b`.`EQUIPMENT_NAME`,
`b`.`STATION`, `b`.`警告`, `b`.`注意`, `b`.`危险` `b`.`STATION`, `b`.`警告`, `b`.`注意`, `b`.`危险`
order by sort DESC order by sort DESC
</select> </select>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
SELECT
warning_name as WarningName
FROM
analysis_data.fan_warning_record re
WHERE
re.`status` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="SUBSYSTEM != null and SUBSYSTEM != '' ">
AND re.sub_system = #{SUBSYSTEM}
</if>
<if test="STATION != null and STATION != '' ">
AND re.station = #{STATION}
</if>
</select>
<select id="selectWarningPoint" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
SELECT
a.station,
a.warning_name,
a.content,
a.equipment_name,
a.point_name,
a.rec_date
from
analysis_data.fan_warning_record a
where
a.status = 0
<if test="STATION != null and STATION != '' ">
AND a.station = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.equipment_name = #{EQUIPMENTNAME}
</if>
group by
station,
equipment_name,
point_name,
rec_date ,
content,
warning_name
</select>
<select id="selectEquipWarningTotal" resultType="map">
SELECT
`STATION` AS `STATION`,
`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
max( ( case `WARNING_NAME` WHEN '注意' THEN `num` ELSE 0 END ) ) AS `zhuyi`,
max( ( case `WARNING_NAME` WHEN '警告' THEN `num` ELSE 0 END ) ) AS `jinggao`,
max( ( case `WARNING_NAME` WHEN '危险' THEN `num` ELSE 0 END ) ) AS `weixian`,
sum(
(
(
( CASE `WARNING_NAME` WHEN '注意' THEN `num` ELSE 0 END ) + ( case `WARNING_NAME` WHEN '警告' THEN `num` ELSE 0 END
)
) + ( case `WARNING_NAME` WHEN '危险' THEN `num` ELSE 0 END )
)
) AS `total`
FROM
(
select
`z`.`station` as `STATION`,
`z`.`equipment_name` as `EQUIPMENT_NAME`,
`z`.`warning_name` as `WARNING_NAME`,
count( 1 ) as `num`
from
analysis_data.fan_warning_record z where
( `z`.`status` = 0 )
<if test="STATION != null and STATION != '' ">
AND z.station = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND z.equipment_name = #{EQUIPMENTNAME}
</if>
group by
`z`.`station`,
`z`.`warning_name`,
`z`.`equipment_name`
) b
GROUP BY
`b`.`STATION`,
`b`.`EQUIPMENT_NAME`
</select>
</mapper> </mapper>
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