Commit f0b14a47 authored by chenzhao's avatar chenzhao

风电预警设备层接口

parent 9f7d2709
......@@ -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.service.impl.IdxBizFanHealthIndexServiceImpl;
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.FanWarningRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -51,6 +53,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
IdxBizPvPointTagMapper idxBizPvPointTagMapper;
@Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper;
@Autowired
FanWaringRecordMapper fanWarningRecord;
/**
* 新增
*
......@@ -403,4 +407,34 @@ public class IdxBizFanHealthIndexController extends BaseController {
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
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.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanMap;
......@@ -341,4 +342,24 @@ public class IdxBizFanWarningRecordController extends BaseController {
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
Map<String,Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME);
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);
......
......@@ -203,8 +203,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
return this.getBaseMapper().queryForLeftTableListByPointNum(STATION,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME);
}
public int pointNum(String STATION, String SUBARRAY,String EQUIPMENTNAME) {
return this.getBaseMapper().pointNum(STATION, SUBARRAY,EQUIPMENTNAME);
public int pointNum(String STATION, String SUBSYSTEM,String EQUIPMENTNAME) {
return this.getBaseMapper().pointNum(STATION, SUBSYSTEM,EQUIPMENTNAME);
}
public List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY , String EQUIPMENTNAME) {
......
......@@ -10,4 +10,10 @@ import java.util.Map;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
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);
}
......@@ -1180,7 +1180,7 @@
<if test="STATION != null and STATION != '' ">
AND re.STATION = #{STATION}
</if>
</select>
</select>
<select id="pointNum" resultType="int">
SELECT
......@@ -1192,8 +1192,8 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND cl.SUBARRAY = #{SUBARRAY}
<if test="SUBSYSTEM != null and SUBSYSTEM != '' ">
AND cl.SUB_SYSTEM = #{SUBSYSTEM}
</if>
<if test="STATION != null and STATION != '' ">
AND cl.STATION = #{STATION}
......
......@@ -37,4 +37,90 @@
</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>
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