告警信息查询
This commit is contained in:
parent
d423d4c5e2
commit
fa6f7d7a8b
@ -289,4 +289,11 @@ public class AlarmLogController {
|
||||
return ResponseResult.successData(alarmLog);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getConfirmationRate")
|
||||
@ApiOperation("告警准确率统计")
|
||||
public ResponseResult getConfirmationRate(String stationId) {
|
||||
Map<String, Object> alarmLog = alarmLogService.getConfirmationRate(stationId);
|
||||
return ResponseResult.successData(alarmLog);
|
||||
}
|
||||
}
|
||||
|
@ -38,4 +38,12 @@ public interface AlarmLogMapper extends BaseMapper<AlarmLog> {
|
||||
***********************************/
|
||||
Page<Map<String, Object>> getAlarmListPage(Page<Map<String, Object>> page, String patrolDeviceCode, String monitorType, String startDate, String endDate);
|
||||
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 告警准确率统计
|
||||
* 参数说明 stationId 变电站Id
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
Map<String, Object> getConfirmationRate(String stationId);
|
||||
|
||||
}
|
||||
|
@ -53,8 +53,20 @@ public interface IAlarmLogService extends IService<AlarmLog> {
|
||||
|
||||
boolean setAlarmLogStatus(AlarmLog alarmLog);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据告警信息ID查询详情
|
||||
* 参数说明 id 告警id
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
Map<String, Object> getAlarmLogById(String id);
|
||||
|
||||
boolean updateDeviceResult(JSONObject jsonObject) throws Exception;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 告警准确率统计
|
||||
* 参数说明 stationId 变电站Id
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
Map<String, Object> getConfirmationRate(String stationId);
|
||||
|
||||
}
|
||||
|
@ -393,6 +393,16 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
return true;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 告警准确率统计
|
||||
* 参数说明 stationId 变电站Id
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
@Override
|
||||
public Map<String, Object> getConfirmationRate(String stationId) {
|
||||
return alarmLogMapper.getConfirmationRate(stationId);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 设置任务结果数据
|
||||
* 参数说明 taskResult
|
||||
@ -1151,6 +1161,11 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据告警信息ID查询详情
|
||||
* 参数说明 id 告警id
|
||||
* 返回值说明: java.util.Map<java.lang.String,java.lang.Object>
|
||||
***********************************/
|
||||
@Override
|
||||
public Map<String, Object> getAlarmLogById(String id) {
|
||||
Map<String, Object> map = this.getMap(new LambdaQueryWrapper<AlarmLog>().eq(AlarmLog::getId, id));
|
||||
|
@ -58,4 +58,20 @@
|
||||
</if>
|
||||
ORDER By alarm_date DESC
|
||||
</select>
|
||||
<select id="getConfirmationRate" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT(*) AS total_alarms, -- 总告警数量
|
||||
SUM(check_result = 1) AS confirmed_count, -- 属实的数量(check_result=1)
|
||||
ROUND(
|
||||
SUM(check_result = 1) / COUNT(*) * 100, -- 计算比率(分子/分母*100)
|
||||
3
|
||||
) AS confirmation_rate,-- 比率保留2位小数
|
||||
'%' AS unit
|
||||
FROM
|
||||
iis_alarm_log
|
||||
WHERE 1=1
|
||||
<if test="stationId != null and stationId != ''">
|
||||
AND station_id = #{stationId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user