优化逻辑
This commit is contained in:
parent
3ae039735b
commit
998725b108
@ -1202,14 +1202,13 @@ public class NettyServerHandler extends SimpleChannelInboundHandler<MyMessagePro
|
||||
logMap.put("alarmCount", count);
|
||||
JSONObject jsonObject = new JSONObject(logMap);
|
||||
String stationCode = substation.getStationCode();
|
||||
jsonObject.putOpt("deviceid", jsonObject.getStr("deviceId"));
|
||||
|
||||
// if (ObjectUtil.isNotEmpty(map.get("patroldeviceCode")) && ObjectUtil.isNotEmpty(map.get(
|
||||
// "patroldeviceChannelcode"))) {
|
||||
// jsonObject.putOpt("channelId", map.get("patroldeviceChannelcode").toString());
|
||||
// jsonObject.putOpt("deviceId", map.get("patroldeviceCode").toString());
|
||||
// }
|
||||
jsonObject.putOpt("channelId", taskResult.getPatroldeviceChannelcode());
|
||||
jsonObject.putOpt("deviceId", taskResult.getPatroldeviceCode());
|
||||
|
||||
List<AlarmThreshold> list =
|
||||
alarmThresholdService.list(new LambdaQueryWrapper<AlarmThreshold>().eq(AlarmThreshold::getDeviceId,
|
||||
deviceid));
|
||||
@ -1218,6 +1217,9 @@ public class NettyServerHandler extends SimpleChannelInboundHandler<MyMessagePro
|
||||
Map<String, String> thresholdInterval = alarmThresholdService.getThresholdInterval(deviceid);
|
||||
jsonObject.putAll(thresholdInterval);
|
||||
}
|
||||
jsonObject.putOpt("deviceid", jsonObject.getStr("deviceId"));
|
||||
jsonObject.putOpt("channelId", taskResult.getPatroldeviceChannelcode());
|
||||
jsonObject.putOpt("deviceId", taskResult.getPatroldeviceCode());
|
||||
// 如果是站端则区域也需要发送告警
|
||||
WebSocketServer.sendInfo(stationId, jsonObject.toString());
|
||||
return true;
|
||||
|
@ -206,14 +206,19 @@ public class AnalyseCallController {
|
||||
@GetMapping("/playAudioFile")
|
||||
@ApiOperation("在线在线播放音频文件")
|
||||
@ResponseBody
|
||||
public void playAudioFile(HttpServletResponse response, String filename) throws IOException {
|
||||
public void playAudioFile(HttpServletResponse response, String filename,String type) throws IOException {
|
||||
OsInfo osInfo = new OsInfo();
|
||||
boolean isLinux = osInfo.isLinux();
|
||||
filename = URLDecoder.decode(filename, "utf-8");
|
||||
if (isLinux) {//linux系统替换文件路径字符
|
||||
filename = StrUtil.replace(filename, "\\", "/");
|
||||
}
|
||||
String originfilename = Config.getSnapFilePath() + filename;
|
||||
String originfilename = "";
|
||||
if (StrUtil.isNotEmpty(type) && "alarm".equals(type)) {//报警显示不同目录
|
||||
originfilename = Config.getAlarmFilePath() + filename;
|
||||
} else {
|
||||
originfilename = Config.getSnapFilePath() + filename;
|
||||
}
|
||||
if (cn.hutool.core.io.FileUtil.exist(originfilename)) {
|
||||
FileUtil.playAudio(originfilename, response);
|
||||
}
|
||||
|
@ -1170,15 +1170,7 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
@Override
|
||||
public Map<String, Object> getAlarmLogById(String id) {
|
||||
Map<String, Object> alarmLog = alarmLogMapper.getAlarmLogById(id);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(alarmLog.get("deviceid"))) {
|
||||
Map<String, String> thresholdInterval = alarmThresholdService.getThresholdInterval(alarmLog.get("deviceId"
|
||||
).toString());
|
||||
if (thresholdInterval != null) {
|
||||
alarmLog.putAll(thresholdInterval);
|
||||
}
|
||||
}
|
||||
|
||||
alarmLog.put("deviceid", alarmLog.get("adeviceId"));
|
||||
return alarmLog;
|
||||
}
|
||||
|
||||
@ -1919,19 +1911,21 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
||||
SysOrganization sysOrganization =
|
||||
sysOrganizationMapper.selectOne(new LambdaUpdateWrapper<SysOrganization>().eq(SysOrganization::getOrgcode, stationCode));
|
||||
String parentid = sysOrganization.getParentid();
|
||||
jsonObject.putOpt("deviceid", jsonObject.getStr("deviceId"));
|
||||
|
||||
// if (ObjectUtil.isNotEmpty(map.get("patroldeviceCode")) && ObjectUtil.isNotEmpty(map.get(
|
||||
// "patroldeviceChannelcode"))) {
|
||||
// jsonObject.putOpt("channelId", map.get("patroldeviceChannelcode").toString());
|
||||
// jsonObject.putOpt("deviceId", map.get("patroldeviceCode").toString());
|
||||
// }
|
||||
jsonObject.putOpt("channelId", taskResult.getPatroldeviceChannelcode());
|
||||
jsonObject.putOpt("deviceId", taskResult.getPatroldeviceCode());
|
||||
|
||||
// 告警阈值
|
||||
if (list.size() > 0) {
|
||||
Map<String, String> thresholdInterval = alarmThresholdService.getThresholdInterval(deviceid);
|
||||
jsonObject.putAll(thresholdInterval);
|
||||
}
|
||||
jsonObject.putOpt("channelId", taskResult.getPatroldeviceChannelcode());
|
||||
jsonObject.putOpt("deviceId", taskResult.getPatroldeviceCode());
|
||||
jsonObject.putOpt("deviceid", jsonObject.getStr("deviceId"));
|
||||
// 如果是站端则区域也需要发送告警
|
||||
if (!"0".equals(parentid)) {
|
||||
WebSocketServer.sendInfo(parentid, jsonObject.toString());
|
||||
|
@ -11,9 +11,9 @@ import java.util.Map;
|
||||
@ApiModel("查询构造器")
|
||||
public class QueryCondition {
|
||||
@ApiModelProperty("当前页")
|
||||
private Integer current;
|
||||
private Integer current = 1;
|
||||
@ApiModelProperty("页大小")
|
||||
private Integer size;
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty("条件过滤器")
|
||||
private Map<String, Object> filters;
|
||||
// 修改为 SortOrder 列表
|
||||
|
@ -95,6 +95,11 @@ public class QueryWrapperBuilder {
|
||||
wrapper.in(column, (Collection<?>) value);
|
||||
}
|
||||
break;
|
||||
case "notin":
|
||||
if (value instanceof Collection) {
|
||||
wrapper.notIn(column, (Collection<?>) value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("不支持的运算符: " + operator);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<select id="getThresholdInterval" resultType="java.util.Map">
|
||||
|
||||
SELECT
|
||||
device_id,
|
||||
device_id deviceId,
|
||||
MAX(CASE WHEN (alarm_level = '1' AND decide_rule ='6') THEN base_line_value ELSE NULL END) AS commonLower,
|
||||
MAX(CASE WHEN (alarm_level = '1' AND decide_rule ='7') THEN base_line_value ELSE NULL END) AS commonUpper,
|
||||
MAX(CASE WHEN (alarm_level = '2' AND decide_rule ='6') THEN base_line_value ELSE NULL END) AS seriousLower,
|
||||
|
@ -92,13 +92,71 @@
|
||||
</select>
|
||||
<select id="getAlarmLogById" resultType="java.util.Map">
|
||||
SELECT
|
||||
al.*,
|
||||
al.device_id deviceid,
|
||||
al.id,
|
||||
al.station_id,
|
||||
al.device_id adeviceId,
|
||||
al.station_name,
|
||||
al.station_code,
|
||||
al.area_id,
|
||||
al.area_name,
|
||||
al.bay_id,
|
||||
al.bay_name,
|
||||
al.main_device_id,
|
||||
al.main_device_name,
|
||||
al.component_id,
|
||||
al.component_name,
|
||||
al.device_name,
|
||||
al.patroldevice_id,
|
||||
al.patroldevice_code,
|
||||
al.patroldevice_name,
|
||||
al.task_id,
|
||||
al.task_patrolled_id,
|
||||
al.task_result_id,
|
||||
al.task_name,
|
||||
al.task_code,
|
||||
al.material_id,
|
||||
al.task_alarm_type,
|
||||
al.monitor_type,
|
||||
al.defect_type,
|
||||
al.alarm_level,
|
||||
al.alarm_type,
|
||||
al.recognition_type,
|
||||
al.file_type,
|
||||
al.file_path,
|
||||
al.defect_file_path,
|
||||
al.VALUE
|
||||
,
|
||||
al.unit,
|
||||
al.content,
|
||||
al.alarm_date,
|
||||
al.check_flag,
|
||||
al.check_user_code,
|
||||
al.check_user_name,
|
||||
al.check_date,
|
||||
al.check_result,
|
||||
al.check_comment,
|
||||
al.rectangle,
|
||||
al.systemcode,
|
||||
al.fk_alarm_type,
|
||||
al.normal_range,
|
||||
al.notice_action,
|
||||
al.notice_emails,
|
||||
al.notice_linkages,
|
||||
al.alarm_class,
|
||||
al.region,
|
||||
al.alarm_source_type,
|
||||
tr.patroldevice_code deviceId,
|
||||
tr.patroldevice_channelcode channelId,
|
||||
tr.patroldevice_pos patroldevicePos
|
||||
tr.patroldevice_pos patroldevicePos,
|
||||
MAX( CASE WHEN ( iat.alarm_level = '1' AND iat.decide_rule = '6' ) THEN base_line_value ELSE NULL END ) AS commonLower,
|
||||
MAX( CASE WHEN ( iat.alarm_level = '1' AND iat.decide_rule = '7' ) THEN base_line_value ELSE NULL END ) AS commonUpper,
|
||||
MAX( CASE WHEN ( iat.alarm_level = '2' AND iat.decide_rule = '6' ) THEN base_line_value ELSE NULL END ) AS seriousLower,
|
||||
MAX( CASE WHEN ( iat.alarm_level = '2' AND iat.decide_rule = '7' ) THEN base_line_value ELSE NULL END ) AS seriousUpper,
|
||||
MAX( CASE WHEN ( iat.alarm_level = '3' AND iat.decide_rule = '6' ) THEN base_line_value ELSE NULL END ) AS dangerLower,
|
||||
MAX( CASE WHEN ( iat.alarm_level = '3' AND iat.decide_rule = '7' ) THEN base_line_value ELSE NULL END ) AS dangerUpper
|
||||
FROM
|
||||
iis_alarm_log al
|
||||
LEFT JOIN iis_alarm_threshold iat ON al.device_id = iat.device_id
|
||||
LEFT JOIN iis_task_result tr ON al.task_result_id = tr.result_id
|
||||
WHERE
|
||||
al.id = #{id}
|
||||
@ -147,7 +205,7 @@
|
||||
<if test="endDate != null and endDate != ''">
|
||||
and al.alarm_date < DATE_ADD(#{endDate}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
|
||||
ORDER BY al.alarm_date DESC
|
||||
|
||||
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user