Commit 2c115bd8 authored by 吴俊凯's avatar 吴俊凯

动环枚举修改

parent 5360ac70
......@@ -15,9 +15,9 @@ public enum AlarmPointEnum {
未确认已清除("未确认已清除", "未确认已清除"),
已确认未清除("已确认未清除", "已确认未清除"),
已确认已清除("已确认已清除", "已确认已清除"),
正常("正常", "正常"),
异常("异常", "异常"),
告警("告警", "告警"),;
NORMAL("正常", "正常"),
ABNORMAL("异常", "异常"),
ALARM("告警", "告警"),;
/**
* 名称,描述
......
......@@ -11,12 +11,12 @@ import java.util.Map;
*
*/
public enum AlarmPointTypeEnum {
设备("设备", "1"),
动环("动环", "2"),
巡检("巡检", "3"),
通道("通道", "4"),
虚拟设备("虚拟设备", "5"),
火探("火探", "6");
SB("设备", "1"),
DH("动环", "2"),
XJ("巡检", "3"),
TD("通道", "4"),
XNSB("虚拟设备", "5"),
HT("火探", "6");
/**
* 名称,描述
......
......@@ -342,7 +342,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
}
public void addAlarmMethod(Long eqpId, Integer statusByName, String eqpName, String ipAddress, String metricKey, String orgCode, String sanwei, String lou) throws IOException {
List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.设备.getCode(),
List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.SB.getCode(),
eqpId);
if (alarmPoint != null && alarmPoint.size() > 0) {
// 存在报警,判断当前状态是不是合格,合格则删除上次的报警
......@@ -362,7 +362,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
// 增加告警
AlarmPoint alarmPoint1 = new AlarmPoint();
alarmPoint1.setPointId(eqpId);
alarmPoint1.setPointType(AlarmPointTypeEnum.设备.getCode());
alarmPoint1.setPointType(AlarmPointTypeEnum.SB.getCode());
alarmPoint1.setUpdateDate(new Date());
alarmPoint1.setIsAlarm(1);// 不合格
alarmPoint1.setContent(eqpName + "-" + ipAddress + "," + ALARM_CAUSE);
......
......@@ -205,7 +205,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
//增加报警
List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.设备.getCode(), eqpId);
List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.SB.getCode(), eqpId);
if (alarmPoint != null && alarmPoint.size() > 0) {
//存在报警,判断当前状态是不是合格,合格则删除上次的报警
if (statusByName == 0) {
......@@ -223,7 +223,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
//增加告警
AlarmPoint alarmPoint1 = new AlarmPoint();
alarmPoint1.setPointId(eqpId);
alarmPoint1.setPointType(AlarmPointTypeEnum.设备.getCode());
alarmPoint1.setPointType(AlarmPointTypeEnum.SB.getCode());
alarmPoint1.setUpdateDate(new Date());
alarmPoint1.setIsAlarm(1);//不合格
alarmPoint1.setContent(eqpName + "-" + ipAddress + "-" + metricKey);
......
......@@ -99,7 +99,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
String curStatus = msgJson.getString("currentState");
synchronized (this) {
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.设备.getCode(), eqpId);
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.SB.getCode(), eqpId);
if (AlarmPointEnum.已确认已清除.getName().equals(curStatus) || AlarmPointEnum.未确认已清除.getName().equals(curStatus)) {
alarmPointService.deleteItems(pointList);
log.info("Clear alarm data ...success");
......@@ -115,7 +115,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
AlarmPoint alarmPoint = new AlarmPoint();
alarmPoint.setPointId(eqpId);
alarmPoint.setSourceId(msgJson.getString("sourceId"));
alarmPoint.setPointType(AlarmPointTypeEnum.设备.getCode());
alarmPoint.setPointType(AlarmPointTypeEnum.SB.getCode());
alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(alramContent);
alarmPoint.setPointAttrs(equipmentAttrs);
......
......@@ -115,7 +115,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
if (eqpId != null && status != null && !"".equals(status) && sourceId != null && !"".equals(sourceId)) {
synchronized (this) {
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.火探.getCode(), eqpId);
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.HT.getCode(), eqpId);
if (!FireDetectionAlarmType.产生.getCode().equals(status)) {
alarmPointService.deleteItems(pointList);
log.info("Clear alarm data ...success");
......@@ -130,7 +130,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
AlarmPoint alarmPoint = new AlarmPoint();
alarmPoint.setPointId(eqpId);
alarmPoint.setSourceId(sourceId);
alarmPoint.setPointType(AlarmPointTypeEnum.火探.getCode());
alarmPoint.setPointType(AlarmPointTypeEnum.HT.getCode());
alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(alramContent);
alarmPoint.setPointAttrs(equipmentAttrsJson);
......@@ -189,7 +189,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
alarm.setAlarmReason(alramContent);
alarm.setAlarmSourceIp(msgJson.getString("alarmSourceIp"));
alarm.setAlarmSourceName(eqpName);
alarm.setAlarmSourceType(AlarmPointTypeEnum.火探.getName());
alarm.setAlarmSourceType(AlarmPointTypeEnum.HT.getName());
alarm.setCurrentState(FireDetectionAlarmType.getEnumStatus(status));
Date date = new Date(msgJson.getLong("raiseTime"));
alarm.setHappenDate(df.format(date));
......
......@@ -216,7 +216,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("[" + monitorItemName + "]自动巡检状态["+ alarmState +"],保存成功...success");
saveSpcAlarm(autoInspection,msgJson);//保存告警记录
if(AlarmPointEnum.异常.getName().equals(alarmState)) {
if(AlarmPointEnum.ABNORMAL.getName().equals(alarmState)) {
saveAlarmPoint(autoInspection,msgJson,eqpId);
String aisleType = autoInspection.getAisleType();
......@@ -352,7 +352,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
alarmPoint = new AlarmPoint();
alarmPoint.setPointType(autoInspection.getAisleType().equals(AutoInspectionTypeEnum.NPC通道.getType())
|| autoInspection.getAisleType().equals(AutoInspectionTypeEnum.商业银行通道.getType())
? AlarmPointTypeEnum.通道.getCode() : AlarmPointTypeEnum.虚拟设备.getCode());
? AlarmPointTypeEnum.TD.getCode() : AlarmPointTypeEnum.XNSB.getCode());
alarmPoint.setUpdateDate(new Date());
alarmPoint.setPointId(msgJson.getLong("eqpId") != null ? msgJson.getLong("eqpId") : 0);
alarmPoint.setContent(autoInspection.getMonitorItemName());
......
......@@ -143,22 +143,22 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
Map<String,Object> nodeDetailMap = iTopographyNodeRepository.findNodeDetailBySourceId(msgJson.getString("sourceId"));
List<JSONObject> alarmAttributes = (List<JSONObject>) msgJson.get("capacityAttrList");
List<Map<String, String>> DHlist = new ArrayList<>();
synchronized (this) {
//拼接json存入动环详情表
Boolean alarmFlagBoolean = false;
//1.指标是否有异常
boolean alarmFlagBoolean = false;
for (JSONObject a : alarmAttributes) {
String atr = (String) a.get("name");
String res = (String) msgJson.get(atr);
if (res != null &&(AlarmPointEnum.异常.getName().equals(res)||AlarmPointEnum.告警.getName().equals(res))) {
if (res != null &&(AlarmPointEnum.ABNORMAL.getName().equals(res)||AlarmPointEnum.ALARM.getName().equals(res))) {
alarmFlagBoolean = true;
log.info("Moving ring device[" + eqpId + "]" + atr + "abnormal");
break;
}
}
//组装动环信息JSON
List<Map<String, String>> DHlist = new ArrayList<>();
for (JSONObject a : alarmAttributes) {
//2.修改动环详情表的信息
for (int i = 0; i < alarmAttributes.size(); i++) {
JSONObject a = alarmAttributes.get(i);
String atr = (String) a.get("name");
String res = (String) msgJson.get(atr);
Map<String, String> map = new HashMap();
......@@ -202,8 +202,8 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
iTopographyNodeDetailDao.save(topographyNodeDetail);
}
//告警记录
String res = AlarmPointEnum.正常.getName();
//3.数据插入告警记录
String res = AlarmPointEnum.NORMAL.getName();
String alarmTypeCombination="";
for (JSONObject atrJson : alarmAttributes) {
String atrName = (String) atrJson.get("name");
......@@ -211,9 +211,9 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
continue;
}
String alarmType = (String) atrJson.get("displayName");
if(AlarmPointEnum.异常.getName().equals(msgJson.getString(atrName))||AlarmPointEnum.告警.getName().equals(msgJson.getString(atrName))){
if(AlarmPointEnum.ABNORMAL.getName().equals(msgJson.getString(atrName))||AlarmPointEnum.ALARM.getName().equals(msgJson.getString(atrName))){
alarmTypeCombination = alarmType + alarmTypeCombination;
res = AlarmPointEnum.异常.getName();
res = AlarmPointEnum.ABNORMAL.getName();
}
}
......@@ -228,10 +228,12 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
orgCode = authOrgTemp;
}
//添加告警记录
if(!"运行参数".equals(cpblName)||!"常电监测".equals(cpblName)||!"常电监测".equals(cpblName)){
addRecordAlarm(alarmTypeCombination, res, sourceId, orgCode, authOrg, eqpName,cpblName,alramContent);
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.动环.getCode(), eqpId,cpblId);
//4.对跑马灯显示进行处理
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.DH.getCode(), eqpId,cpblId);
List<Alarm> curAlarmList = alarmService.selectByQuerySourceId(sourceId);
if (!alarmFlagBoolean && pointList.size() > 0) {
alarmPointService.deleteItems(pointList);
......@@ -242,21 +244,15 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
}
} else {
if (alarmFlagBoolean && pointList.size() == 0) {
// String alramContent = msgJson.getString("describe");
String eqpType = msgJson.getString("eqpType");
// String eqpName = msgJson.getString("eqpName");
String equipmentAttrs = msgJson.getString("equipmentAttrs");
// String sourceId = msgJson.getString("sourceId");
String authOrgs = getAuthOrg(msgJson.getString("authOrg"));
//String orgCode = msgJson.getString("orgCode");
AlarmPoint alarmPoint = new AlarmPoint();
alarmPoint.setCode(authOrgs);
alarmPoint.setSourceId(sourceId);
alarmPoint.setPointId(eqpId);
alarmPoint.setAuthOrg(authOrgs);
// alarmPoint.setPointType(eqpType);
alarmPoint.setPointType(AlarmPointTypeEnum.动环.getCode());
alarmPoint.setPointType(AlarmPointTypeEnum.DH.getCode());
alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(eqpName+alarmTypeCombination);
alarmPoint.setPointAttrs(equipmentAttrs);
......@@ -265,14 +261,12 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
alarmPointService.saveItem(alarmPoint);
log.info("Save alarm data....success");
//推送消息巡检app
//String url = address + "api/msgSubscribe/alarmNotification";
// 6 .推送消息巡检app
try {
Map<String, Object> map = new HashMap<String, Object>();
map.put("code", msgJson.getString("orgCode"));
map.put("body", "告警源名称:" + eqpName + TAB + "告警信息" + alramContent);
String stringJson = JSONObject.toJSONString(map);
//HttpUtil.PostJson(url, stringJson);
CommonResponse result = patrolRemoteClient.sendAlarmNotification(stringJson);
log.info("手机推送告警信息...success");
} catch (Exception e) {
......@@ -289,6 +283,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
if(alarmFlagBoolean){
iTopographyService.sendAbnormal(msgJson.getString("sourceId"), 1);
}
//7.给前台发送websocket
Sort sort = new Sort(Sort.Direction.DESC, "updateDate");
List<AlarmPoint> alarms = alarmPointService.findAll(sort);
......@@ -346,7 +341,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
alarm.setContinueDate(subtract);
}
if (AlarmPointEnum.异常.getName().equals(alarmStatus)||AlarmPointEnum.告警.getName().equals(alarmStatus)) {
if (AlarmPointEnum.ABNORMAL.getName().equals(alarmStatus)||AlarmPointEnum.ALARM.getName().equals(alarmStatus)) {
alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
} else {
alarm.setClearDate(DateTimeKit.now());
......@@ -370,7 +365,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
alarm.setHappenDate(DateTimeKit.now());
alarm.setQueryColumn( sourceId + "_" + cpblName);
List<Alarm> curAlarmRList = alarmService.findByQueryColumn(queryColumn);
if (AlarmPointEnum.异常.getName().equals(alarmStatus)||AlarmPointEnum.告警.getName().equals(alarmStatus)) {
if (AlarmPointEnum.ABNORMAL.getName().equals(alarmStatus)||AlarmPointEnum.ALARM.getName().equals(alarmStatus)) {
alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
iAlarmDao.save(alarm);
} else {
......
......@@ -151,7 +151,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
for (JSONObject a : alarmAttributes) {
String atr = (String) a.get("name");
String res = (String) msgJson.get(atr);
if (res != null && (AlarmPointEnum.异常.getName().equals(res)||AlarmPointEnum.告警.getName().equals(res))) {
if (res != null && (AlarmPointEnum.ABNORMAL.getName().equals(res)||AlarmPointEnum.ALARM.getName().equals(res))) {
alarmFlagBoolean = true;
log.info("Moving ring device[" + eqpId + "]" + atr + "abnormal");
break;
......@@ -204,7 +204,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
iTopographyNodeDetailDao.save(topographyNodeDetail);
}
//告警记录
String res = AlarmPointEnum.正常.getName();
String res = AlarmPointEnum.NORMAL.getName();
String alarmTypeCombination="";
for (JSONObject atrJson : alarmAttributes) {
String atrName = (String) atrJson.get("name");
......@@ -212,9 +212,9 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
continue;
}
String alarmType = (String) atrJson.get("displayName");
if(AlarmPointEnum.异常.getName().equals(msgJson.getString(atrName))||AlarmPointEnum.告警.getName().equals(msgJson.getString(atrName))){
if(AlarmPointEnum.ABNORMAL.getName().equals(msgJson.getString(atrName))||AlarmPointEnum.ALARM.getName().equals(msgJson.getString(atrName))){
alarmTypeCombination = alarmType + alarmTypeCombination;
res = AlarmPointEnum.异常.getName();
res = AlarmPointEnum.ABNORMAL.getName();
}
}
Long cpblId = msgJson.getLong("cpblId");
......@@ -229,9 +229,9 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
}
//添加告警记录
if(!"运行参数".equals(cpblName)||!"常电监测".equals(cpblName)||!"常电监测".equals(cpblName)){
if(!"运行参数".equals(cpblName)||!"常电监测".equals(cpblName)||!"市电监测".equals(cpblName)||!"进行参数".equals(cpblName)){
addRecordAlarm(alarmTypeCombination, res, sourceId, orgCode, authOrg, eqpName,cpblName,alramContent);
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.动环.getCode(), eqpId,cpblId);
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.DH.getCode(), eqpId,cpblId);
List<Alarm> curAlarmList = alarmService.selectByQuerySourceId(sourceId);
if (!alarmFlagBoolean && pointList.size() > 0) {
alarmPointService.deleteItems(pointList);
......@@ -256,7 +256,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
alarmPoint.setPointId(eqpId);
alarmPoint.setAuthOrg(authOrgs);
// alarmPoint.setPointType(eqpType);
alarmPoint.setPointType(AlarmPointTypeEnum.动环.getCode());
alarmPoint.setPointType(AlarmPointTypeEnum.DH.getCode());
alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(eqpName+alarmTypeCombination);
alarmPoint.setPointAttrs(equipmentAttrs);
......@@ -336,7 +336,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
alarm.setContinueDate(subtract);
}
if (AlarmPointEnum.异常.getName().equals(alarmStatus)||AlarmPointEnum.告警.getName().equals(alarmStatus)) {
if (AlarmPointEnum.ALARM.getName().equals(alarmStatus)||AlarmPointEnum.ABNORMAL.getName().equals(alarmStatus)) {
alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
} else {
alarm.setClearDate(DateTimeKit.now());
......@@ -360,7 +360,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
alarm.setHappenDate(DateTimeKit.now());
alarm.setQueryColumn( sourceId + "_" + cpblName);
List<Alarm> curAlarmRList = alarmService.findByQueryColumn(queryColumn);
if (AlarmPointEnum.异常.getName().equals(alarmStatus)||AlarmPointEnum.异常.getName().equals(alarmStatus)) {
if (AlarmPointEnum.ALARM.getName().equals(alarmStatus)||AlarmPointEnum.ABNORMAL.getName().equals(alarmStatus)) {
alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
iAlarmDao.save(alarm);
} else {
......
......@@ -3,13 +3,11 @@ package com.yeejoin.amos.spc.business.controller;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.bank.dto.TopographyTreeDTO;
import liquibase.pro.packaged.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -21,8 +19,6 @@ import com.yeejoin.amos.op.core.common.query.DaoCriteria;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.spc.business.param.ReginParams;
//import com.yeejoin.amos.security.common.authorization.Authorization;
import com.yeejoin.amos.spc.business.service.intfc.ISpcEvaluateModelService;
import com.yeejoin.amos.spc.core.common.request.CommonPageable;
import com.yeejoin.amos.spc.core.common.request.CommonRequest;
import com.yeejoin.amos.spc.core.enums.QueryOperatorEnum;
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.spc.business.controller;
import java.util.ArrayList;
import java.util.List;
import com.yeejoin.amos.bank.service.IDynamicRingDataService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......
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