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

动环枚举修改

parent 5360ac70
...@@ -15,9 +15,9 @@ public enum AlarmPointEnum { ...@@ -15,9 +15,9 @@ public enum AlarmPointEnum {
未确认已清除("未确认已清除", "未确认已清除"), 未确认已清除("未确认已清除", "未确认已清除"),
已确认未清除("已确认未清除", "已确认未清除"), 已确认未清除("已确认未清除", "已确认未清除"),
已确认已清除("已确认已清除", "已确认已清除"), 已确认已清除("已确认已清除", "已确认已清除"),
正常("正常", "正常"), NORMAL("正常", "正常"),
异常("异常", "异常"), ABNORMAL("异常", "异常"),
告警("告警", "告警"),; ALARM("告警", "告警"),;
/** /**
* 名称,描述 * 名称,描述
......
...@@ -11,13 +11,13 @@ import java.util.Map; ...@@ -11,13 +11,13 @@ import java.util.Map;
* *
*/ */
public enum AlarmPointTypeEnum { public enum AlarmPointTypeEnum {
设备("设备", "1"), SB("设备", "1"),
动环("动环", "2"), DH("动环", "2"),
巡检("巡检", "3"), XJ("巡检", "3"),
通道("通道", "4"), TD("通道", "4"),
虚拟设备("虚拟设备", "5"), XNSB("虚拟设备", "5"),
火探("火探", "6"); HT("火探", "6");
/** /**
* 名称,描述 * 名称,描述
*/ */
......
...@@ -342,7 +342,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean ...@@ -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 { 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); eqpId);
if (alarmPoint != null && alarmPoint.size() > 0) { if (alarmPoint != null && alarmPoint.size() > 0) {
// 存在报警,判断当前状态是不是合格,合格则删除上次的报警 // 存在报警,判断当前状态是不是合格,合格则删除上次的报警
...@@ -362,7 +362,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean ...@@ -362,7 +362,7 @@ public class EquipmentListener extends EmqxListener implements InitializingBean
// 增加告警 // 增加告警
AlarmPoint alarmPoint1 = new AlarmPoint(); AlarmPoint alarmPoint1 = new AlarmPoint();
alarmPoint1.setPointId(eqpId); alarmPoint1.setPointId(eqpId);
alarmPoint1.setPointType(AlarmPointTypeEnum.设备.getCode()); alarmPoint1.setPointType(AlarmPointTypeEnum.SB.getCode());
alarmPoint1.setUpdateDate(new Date()); alarmPoint1.setUpdateDate(new Date());
alarmPoint1.setIsAlarm(1);// 不合格 alarmPoint1.setIsAlarm(1);// 不合格
alarmPoint1.setContent(eqpName + "-" + ipAddress + "," + ALARM_CAUSE); alarmPoint1.setContent(eqpName + "-" + ipAddress + "," + ALARM_CAUSE);
......
...@@ -205,7 +205,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea ...@@ -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 (alarmPoint != null && alarmPoint.size() > 0) {
//存在报警,判断当前状态是不是合格,合格则删除上次的报警 //存在报警,判断当前状态是不是合格,合格则删除上次的报警
if (statusByName == 0) { if (statusByName == 0) {
...@@ -223,7 +223,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea ...@@ -223,7 +223,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
//增加告警 //增加告警
AlarmPoint alarmPoint1 = new AlarmPoint(); AlarmPoint alarmPoint1 = new AlarmPoint();
alarmPoint1.setPointId(eqpId); alarmPoint1.setPointId(eqpId);
alarmPoint1.setPointType(AlarmPointTypeEnum.设备.getCode()); alarmPoint1.setPointType(AlarmPointTypeEnum.SB.getCode());
alarmPoint1.setUpdateDate(new Date()); alarmPoint1.setUpdateDate(new Date());
alarmPoint1.setIsAlarm(1);//不合格 alarmPoint1.setIsAlarm(1);//不合格
alarmPoint1.setContent(eqpName + "-" + ipAddress + "-" + metricKey); alarmPoint1.setContent(eqpName + "-" + ipAddress + "-" + metricKey);
......
...@@ -55,9 +55,9 @@ public class AlarmWebSocketClient extends WebSocketClient { ...@@ -55,9 +55,9 @@ public class AlarmWebSocketClient extends WebSocketClient {
// @Value("${params.patrol}") // @Value("${params.patrol}")
// private String address; // private String address;
private PatrolRemoteClient patrolRemoteClient; private PatrolRemoteClient patrolRemoteClient;
private static ApplicationContext allpicationContext; private static ApplicationContext allpicationContext;
public static void setAllpicationContext(ApplicationContext context) { public static void setAllpicationContext(ApplicationContext context) {
allpicationContext = context; allpicationContext = context;
} }
...@@ -99,7 +99,7 @@ public class AlarmWebSocketClient extends WebSocketClient { ...@@ -99,7 +99,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
String curStatus = msgJson.getString("currentState"); String curStatus = msgJson.getString("currentState");
synchronized (this) { 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)) { if (AlarmPointEnum.已确认已清除.getName().equals(curStatus) || AlarmPointEnum.未确认已清除.getName().equals(curStatus)) {
alarmPointService.deleteItems(pointList); alarmPointService.deleteItems(pointList);
log.info("Clear alarm data ...success"); log.info("Clear alarm data ...success");
...@@ -115,7 +115,7 @@ public class AlarmWebSocketClient extends WebSocketClient { ...@@ -115,7 +115,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
AlarmPoint alarmPoint = new AlarmPoint(); AlarmPoint alarmPoint = new AlarmPoint();
alarmPoint.setPointId(eqpId); alarmPoint.setPointId(eqpId);
alarmPoint.setSourceId(msgJson.getString("sourceId")); alarmPoint.setSourceId(msgJson.getString("sourceId"));
alarmPoint.setPointType(AlarmPointTypeEnum.设备.getCode()); alarmPoint.setPointType(AlarmPointTypeEnum.SB.getCode());
alarmPoint.setUpdateDate(new Date()); alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(alramContent); alarmPoint.setContent(alramContent);
alarmPoint.setPointAttrs(equipmentAttrs); alarmPoint.setPointAttrs(equipmentAttrs);
...@@ -162,7 +162,7 @@ public class AlarmWebSocketClient extends WebSocketClient { ...@@ -162,7 +162,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
iAlarmDao.save(alarm); iAlarmDao.save(alarm);
log.info("Update alarm records ...success"); log.info("Update alarm records ...success");
} else { } else {
// if (alarm == null || AlarmPointEnum.已确认已清除.getName().equals(curStatus) // if (alarm == null || AlarmPointEnum.已确认已清除.getName().equals(curStatus)
// || AlarmPointEnum.未确认已清除.getName().equals(curStatus)) { // || AlarmPointEnum.未确认已清除.getName().equals(curStatus)) {
Alarm alarm = new Alarm(); Alarm alarm = new Alarm();
alarm.setSourceId(msgJson.getString("sourceId")); alarm.setSourceId(msgJson.getString("sourceId"));
......
...@@ -57,7 +57,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -57,7 +57,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
// @Value("${params.patrol}") // @Value("${params.patrol}")
// private String address; // private String address;
private static ApplicationContext allpicationContext; private static ApplicationContext allpicationContext;
private PatrolRemoteClient patrolRemoteClient; private PatrolRemoteClient patrolRemoteClient;
public static void setAllpicationContext(ApplicationContext context) { public static void setAllpicationContext(ApplicationContext context) {
...@@ -105,7 +105,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -105,7 +105,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
String affiliatedSystem = equipmentAttrs.getString("affiliatedSystem"); String affiliatedSystem = equipmentAttrs.getString("affiliatedSystem");
if(affiliatedSystem != null && "火探".equals(affiliatedSystem)) { if(affiliatedSystem != null && "火探".equals(affiliatedSystem)) {
log.info("Received message:" + paramString); log.info("Received message:" + paramString);
Long eqpId = msgJson.getLong("eqpId"); Long eqpId = msgJson.getLong("eqpId");
String status = msgJson.getString("status"); String status = msgJson.getString("status");
String sourceId = equipmentAttrs.getString("sourceId"); String sourceId = equipmentAttrs.getString("sourceId");
...@@ -114,23 +114,23 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -114,23 +114,23 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
Integer level = msgJson.getInteger("level") != null ? msgJson.getInteger("level") : 1; Integer level = msgJson.getInteger("level") != null ? msgJson.getInteger("level") : 1;
if (eqpId != null && status != null && !"".equals(status) && sourceId != null && !"".equals(sourceId)) { if (eqpId != null && status != null && !"".equals(status) && sourceId != null && !"".equals(sourceId)) {
synchronized (this) { synchronized (this) {
List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.火探.getCode(), eqpId); List<AlarmPoint> pointList = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.HT.getCode(), eqpId);
if (!FireDetectionAlarmType.产生.getCode().equals(status)) { if (!FireDetectionAlarmType.产生.getCode().equals(status)) {
alarmPointService.deleteItems(pointList); alarmPointService.deleteItems(pointList);
log.info("Clear alarm data ...success"); log.info("Clear alarm data ...success");
// iTopographyService.sendAbnormal(eqpId, 0); // iTopographyService.sendAbnormal(eqpId, 0);
iTopographyService.sendAbnormalByType(String.valueOf(eqpId), iTopographyService.sendAbnormalByType(String.valueOf(eqpId),
AbnormalStateEnum.N.getCode(), AbnormalStateEnum.N.getCode(),
TopoNodeTypeEnum.动环监控.getType(), TopoNodeTypeEnum.动环监控.getType(),
alramContent); alramContent);
} else { } else {
if (null == pointList || pointList.size() == 0) { if (null == pointList || pointList.size() == 0) {
AlarmPoint alarmPoint = new AlarmPoint(); AlarmPoint alarmPoint = new AlarmPoint();
alarmPoint.setPointId(eqpId); alarmPoint.setPointId(eqpId);
alarmPoint.setSourceId(sourceId); alarmPoint.setSourceId(sourceId);
alarmPoint.setPointType(AlarmPointTypeEnum.火探.getCode()); alarmPoint.setPointType(AlarmPointTypeEnum.HT.getCode());
alarmPoint.setUpdateDate(new Date()); alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(alramContent); alarmPoint.setContent(alramContent);
alarmPoint.setPointAttrs(equipmentAttrsJson); alarmPoint.setPointAttrs(equipmentAttrsJson);
...@@ -138,7 +138,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -138,7 +138,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
alarmPoint.setCode(msgJson.getString("orgCode")); alarmPoint.setCode(msgJson.getString("orgCode"));
alarmPointService.saveItem(alarmPoint); alarmPointService.saveItem(alarmPoint);
log.info("Save alarm data ...success"); log.info("Save alarm data ...success");
//String url = address + "api/msgSubscribe/alarmNotification"; //String url = address + "api/msgSubscribe/alarmNotification";
try { try {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
...@@ -151,12 +151,12 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -151,12 +151,12 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
} catch (Exception e) { } catch (Exception e) {
log.info("手机推送告警信息失败...fail" + e.getMessage()); log.info("手机推送告警信息失败...fail" + e.getMessage());
} }
} }
String alarmLevel = AbnormalStateEnum.getAbnormalName(level); String alarmLevel = AbnormalStateEnum.getAbnormalName(level);
// AbnormalStateEnum enum1 = AbnormalStateEnum.getEnum(alarmLevel); // AbnormalStateEnum enum1 = AbnormalStateEnum.getEnum(alarmLevel);
// iTopographyService.sendAbnormal(eqpId, enum1 == null ? 0 : enum1.getCode()); // iTopographyService.sendAbnormal(eqpId, enum1 == null ? 0 : enum1.getCode());
AbnormalStateEnum enum1 = AbnormalStateEnum.getEnum(alarmLevel); AbnormalStateEnum enum1 = AbnormalStateEnum.getEnum(alarmLevel);
iTopographyService.sendAbnormalByType(String.valueOf(eqpId), enum1 == null ? 0 : enum1.getCode(), iTopographyService.sendAbnormalByType(String.valueOf(eqpId), enum1 == null ? 0 : enum1.getCode(),
TopoNodeTypeEnum.动环监控.getType(), alramContent); TopoNodeTypeEnum.动环监控.getType(), alramContent);
...@@ -169,7 +169,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -169,7 +169,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
String url = (String) props.get("params.remoteWebsocketUrl") + "/generic/sendMessage"; String url = (String) props.get("params.remoteWebsocketUrl") + "/generic/sendMessage";
HttpUtil.PostJson(url, JSON.toJSONString(param)); HttpUtil.PostJson(url, JSON.toJSONString(param));
log.info("send websocekt info:" + param); log.info("send websocekt info:" + param);
//告警记录 //告警记录
String queryColumn = eqpId + "_" + msgJson.getString("type"); String queryColumn = eqpId + "_" + msgJson.getString("type");
List<Alarm> curAlarmList = alarmService.findByQueryColumn(queryColumn); List<Alarm> curAlarmList = alarmService.findByQueryColumn(queryColumn);
...@@ -189,7 +189,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient { ...@@ -189,7 +189,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
alarm.setAlarmReason(alramContent); alarm.setAlarmReason(alramContent);
alarm.setAlarmSourceIp(msgJson.getString("alarmSourceIp")); alarm.setAlarmSourceIp(msgJson.getString("alarmSourceIp"));
alarm.setAlarmSourceName(eqpName); alarm.setAlarmSourceName(eqpName);
alarm.setAlarmSourceType(AlarmPointTypeEnum.火探.getName()); alarm.setAlarmSourceType(AlarmPointTypeEnum.HT.getName());
alarm.setCurrentState(FireDetectionAlarmType.getEnumStatus(status)); alarm.setCurrentState(FireDetectionAlarmType.getEnumStatus(status));
Date date = new Date(msgJson.getLong("raiseTime")); Date date = new Date(msgJson.getLong("raiseTime"));
alarm.setHappenDate(df.format(date)); alarm.setHappenDate(df.format(date));
......
...@@ -53,9 +53,9 @@ import com.yeejoin.amos.spc.exception.YeeException; ...@@ -53,9 +53,9 @@ import com.yeejoin.amos.spc.exception.YeeException;
* *
*/ */
public class InspectionWebSocketClient extends WebSocketClient{ public class InspectionWebSocketClient extends WebSocketClient{
private static final Logger log = Logger.getLogger(InspectionWebSocketClient.class); private static final Logger log = Logger.getLogger(InspectionWebSocketClient.class);
private IAutoInspectionService autoInspectionService; private IAutoInspectionService autoInspectionService;
private ITopographyService iTopographyService; private ITopographyService iTopographyService;
private IAisleInfoService aisleInfoService; private IAisleInfoService aisleInfoService;
...@@ -64,20 +64,20 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -64,20 +64,20 @@ public class InspectionWebSocketClient extends WebSocketClient{
private AmosWsClient client; private AmosWsClient client;
private IAlarmRepository iAlarmDao; private IAlarmRepository iAlarmDao;
private static final String TAB = "\r\n"; private static final String TAB = "\r\n";
private PatrolRemoteClient patrolRemoteClient; private PatrolRemoteClient patrolRemoteClient;
//private String address; //private String address;
private static ApplicationContext allpicationContext; private static ApplicationContext allpicationContext;
public static void setAllpicationContext(ApplicationContext context){ public static void setAllpicationContext(ApplicationContext context){
allpicationContext = context; allpicationContext = context;
} }
public InspectionWebSocketClient(String url) throws URISyntaxException { public InspectionWebSocketClient(String url) throws URISyntaxException {
super(new URI(url)); super(new URI(url));
} }
@Override @Override
public void onOpen(ServerHandshake shake) { public void onOpen(ServerHandshake shake) {
log.info("InspectionWebSocketClient Shake hands......"); log.info("InspectionWebSocketClient Shake hands......");
...@@ -102,7 +102,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -102,7 +102,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
@Transactional @Transactional
public void onMessage(String paramString) { public void onMessage(String paramString) {
...@@ -116,22 +116,22 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -116,22 +116,22 @@ public class InspectionWebSocketClient extends WebSocketClient{
String alarmState = msgJson.getString("alarmState"); String alarmState = msgJson.getString("alarmState");
String monitorHostMachine = msgJson.getString("monitorHostMachine"); String monitorHostMachine = msgJson.getString("monitorHostMachine");
String eqpId = msgJson.getString("eqpId"); String eqpId = msgJson.getString("eqpId");
if(monitorItemName != null && !"".equals(monitorItemName) && alarmState != null && !"".equals(alarmState) if(monitorItemName != null && !"".equals(monitorItemName) && alarmState != null && !"".equals(alarmState)
&& eqpId != null && !"".equals(eqpId)) { && eqpId != null && !"".equals(eqpId)) {
log.info("监控项名称:" + monitorItemName + " 发送设备: " + monitorHostMachine); log.info("监控项名称:" + monitorItemName + " 发送设备: " + monitorHostMachine);
//查询自动巡检告警列表 //查询自动巡检告警列表
List<AutoInspection> abnormals = autoInspectionService.findAbnormalByMonitorItemNameAndHost(monitorItemName,monitorHostMachine); List<AutoInspection> abnormals = autoInspectionService.findAbnormalByMonitorItemNameAndHost(monitorItemName,monitorHostMachine);
if(abnormals != null && abnormals.size() > 0) { if(abnormals != null && abnormals.size() > 0) {
log.info("告警列表:" + abnormals); log.info("告警列表:" + abnormals);
String nextCheckTime = msgJson.getString("nextCheckTime"); String nextCheckTime = msgJson.getString("nextCheckTime");
AutoInspection abnormalInspection = abnormals.get(abnormals.size()-1); AutoInspection abnormalInspection = abnormals.get(abnormals.size()-1);
//状态更新为正常时 发送websocket //状态更新为正常时 发送websocket
Boolean sendMsg = false; Boolean sendMsg = false;
if(!alarmState.equals(abnormalInspection.getAlarmState())) { if(!alarmState.equals(abnormalInspection.getAlarmState())) {
sendMsg = true; sendMsg = true;
//删除告警表 //删除告警表
...@@ -147,30 +147,30 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -147,30 +147,30 @@ public class InspectionWebSocketClient extends WebSocketClient{
autoInspectionService.save(abnormalInspection); autoInspectionService.save(abnormalInspection);
log.info("异常[" + monitorItemName + "]点状态更新为"+ alarmState +",下次检查时间"+ nextCheckTime +"...success"); log.info("异常[" + monitorItemName + "]点状态更新为"+ alarmState +",下次检查时间"+ nextCheckTime +"...success");
saveSpcAlarm(abnormalInspection,msgJson);//保存告警记录 saveSpcAlarm(abnormalInspection,msgJson);//保存告警记录
if(sendMsg) { if(sendMsg) {
String aisleType = abnormalInspection.getAisleType(); String aisleType = abnormalInspection.getAisleType();
if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType) if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType)
|| AutoInspectionTypeEnum.NPC通道.getType().equals(aisleType))) {//通道 状态更新时 || AutoInspectionTypeEnum.NPC通道.getType().equals(aisleType))) {//通道 状态更新时
sendWebSocketMsg(abnormalInspection.getLabel1()); sendWebSocketMsg(abnormalInspection.getLabel1());
Long treeId = aisleInfoService.queryTreeIdByStratAndEnd(monitorHostMachine,abnormalInspection.getLabel2()); Long treeId = aisleInfoService.queryTreeIdByStratAndEnd(monitorHostMachine,abnormalInspection.getLabel2());
iTopographyService.sendPMTSAbnormal(PMTSTypeEnum.getEnumType(monitorHostMachine) iTopographyService.sendPMTSAbnormal(PMTSTypeEnum.getEnumType(monitorHostMachine)
,abnormalInspection.getLabel2() ,abnormalInspection.getLabel2()
,TopoGroupEnum.PMTS.getName() ,TopoGroupEnum.PMTS.getName()
,treeId,0); ,treeId,0);
log.info("topo图PMTS 通道状态更新信息发送成功...success"); log.info("topo图PMTS 通道状态更新信息发送成功...success");
}else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType) }else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType)
|| AutoInspectionTypeEnum.设备状态.getType().equals(aisleType))){//设备状态 更新 || AutoInspectionTypeEnum.设备状态.getType().equals(aisleType))){//设备状态 更新
iTopographyService.sendAbnormalByType(monitorHostMachine, iTopographyService.sendAbnormalByType(monitorHostMachine,
AbnormalStateEnum.N.getCode(), AbnormalStateEnum.N.getCode(),
TopoNodeTypeEnum.设备监控.getType(), TopoNodeTypeEnum.设备监控.getType(),
monitorItemName); monitorItemName);
log.info("topo图设备监控更新信息发送成功...success"); log.info("topo图设备监控更新信息发送成功...success");
} }
} }
}else { }else {
AutoInspection autoInspection = new AutoInspection(); AutoInspection autoInspection = new AutoInspection();
autoInspection.setAlarmState(alarmState); autoInspection.setAlarmState(alarmState);
autoInspection.setMonitorItemName(monitorItemName); autoInspection.setMonitorItemName(monitorItemName);
...@@ -182,7 +182,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -182,7 +182,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
autoInspection.setSourceId(msgJson.getString("sourceId")); autoInspection.setSourceId(msgJson.getString("sourceId"));
autoInspection.setCurrentCheckTime(msgJson.getString("currentCheckTime")); autoInspection.setCurrentCheckTime(msgJson.getString("currentCheckTime"));
autoInspection.setCurrentValue(msgJson.getString("currentValue")); autoInspection.setCurrentValue(msgJson.getString("currentValue"));
ArrayList<String> aisleInfo = new ArrayList<>(); ArrayList<String> aisleInfo = new ArrayList<>();
if(monitorItemName.contains("行号")) { if(monitorItemName.contains("行号")) {
String[] splits = monitorItemName.split(" "); String[] splits = monitorItemName.split(" ");
...@@ -198,11 +198,11 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -198,11 +198,11 @@ public class InspectionWebSocketClient extends WebSocketClient{
autoInspection.setLabel1(aisleInfo.get(0)); autoInspection.setLabel1(aisleInfo.get(0));
String label2 = aisleInfo.get(1); String label2 = aisleInfo.get(1);
String aisle = aisleInfo.get(2); String aisle = aisleInfo.get(2);
// label2 = aisle.contains("1") ? label2 + "1" : label2; // label2 = aisle.contains("1") ? label2 + "1" : label2;
autoInspection.setLabel2(label2); autoInspection.setLabel2(label2);
autoInspection.setAisle(aisle); autoInspection.setAisle(aisle);
log.info("设置通道信息Aisle:" + aisleInfo.get(2) + "Label1:"+ aisleInfo.get(0)+ "Label2:"+ aisleInfo.get(1)); log.info("设置通道信息Aisle:" + aisleInfo.get(2) + "Label1:"+ aisleInfo.get(0)+ "Label2:"+ aisleInfo.get(1));
}else if(monitorItemName.contains("MQ系统")) { }else if(monitorItemName.contains("MQ系统")) {
autoInspection.setAisle("MQ系统"); autoInspection.setAisle("MQ系统");
autoInspection.setAisleType(AutoInspectionTypeEnum.MQ状态.getType()); autoInspection.setAisleType(AutoInspectionTypeEnum.MQ状态.getType());
...@@ -211,19 +211,19 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -211,19 +211,19 @@ public class InspectionWebSocketClient extends WebSocketClient{
}else { }else {
autoInspection.setAisleType(AutoInspectionTypeEnum.设备状态.getType()); autoInspection.setAisleType(AutoInspectionTypeEnum.设备状态.getType());
} }
autoInspectionService.save(autoInspection); autoInspectionService.save(autoInspection);
log.info("[" + monitorItemName + "]自动巡检状态["+ alarmState +"],保存成功...success"); log.info("[" + monitorItemName + "]自动巡检状态["+ alarmState +"],保存成功...success");
saveSpcAlarm(autoInspection,msgJson);//保存告警记录 saveSpcAlarm(autoInspection,msgJson);//保存告警记录
if(AlarmPointEnum.异常.getName().equals(alarmState)) { if(AlarmPointEnum.ABNORMAL.getName().equals(alarmState)) {
saveAlarmPoint(autoInspection,msgJson,eqpId); saveAlarmPoint(autoInspection,msgJson,eqpId);
String aisleType = autoInspection.getAisleType(); String aisleType = autoInspection.getAisleType();
if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType) if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType)
|| AutoInspectionTypeEnum.NPC通道.getType().equals(aisleType))) {//通道 状态为异常时 || AutoInspectionTypeEnum.NPC通道.getType().equals(aisleType))) {//通道 状态为异常时
sendWebSocketMsg(autoInspection.getLabel1()); sendWebSocketMsg(autoInspection.getLabel1());
Long treeId = aisleInfoService.queryTreeIdByStratAndEnd(monitorHostMachine,autoInspection.getLabel2()); Long treeId = aisleInfoService.queryTreeIdByStratAndEnd(monitorHostMachine,autoInspection.getLabel2());
iTopographyService.sendPMTSAbnormal(PMTSTypeEnum.getEnumType(monitorHostMachine) iTopographyService.sendPMTSAbnormal(PMTSTypeEnum.getEnumType(monitorHostMachine)
,autoInspection.getLabel2() ,autoInspection.getLabel2()
...@@ -231,21 +231,21 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -231,21 +231,21 @@ public class InspectionWebSocketClient extends WebSocketClient{
,treeId ,treeId
,AbnormalStateEnum.M.getCode()); ,AbnormalStateEnum.M.getCode());
log.info("topo图PMTS异常发送成功...success"); log.info("topo图PMTS异常发送成功...success");
}else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType) }else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType)
|| AutoInspectionTypeEnum.设备状态.getType().equals(aisleType))) {//设备状态为异常时 || AutoInspectionTypeEnum.设备状态.getType().equals(aisleType))) {//设备状态为异常时
iTopographyService.sendAbnormalByType(monitorHostMachine, iTopographyService.sendAbnormalByType(monitorHostMachine,
AbnormalStateEnum.M.getCode(), AbnormalStateEnum.M.getCode(),
TopoNodeTypeEnum.设备监控.getType(), TopoNodeTypeEnum.设备监控.getType(),
monitorItemName); monitorItemName);
log.info("topo图设备监控异常发送成功...success"); log.info("topo图设备监控异常发送成功...success");
} }
//推送消息巡检app //推送消息巡检app
//String url =address+"api/msgSubscribe/alarmNotification"; //String url =address+"api/msgSubscribe/alarmNotification";
try { try {
Map<String, Object> map=new HashMap<String, Object>(); Map<String, Object> map=new HashMap<String, Object>();
map.put("code", msgJson.getString("orgCode")); map.put("code", msgJson.getString("orgCode"));
map.put("body", "告警源名称:"+monitorItemName+TAB+"告警信息"+alarmState); map.put("body", "告警源名称:"+monitorItemName+TAB+"告警信息"+alarmState);
String stringJson = JSONObject.toJSONString(map); String stringJson = JSONObject.toJSONString(map);
// HttpUtil.PostJson(url, stringJson); // HttpUtil.PostJson(url, stringJson);
...@@ -256,16 +256,16 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -256,16 +256,16 @@ public class InspectionWebSocketClient extends WebSocketClient{
} }
} }
} }
}else { }else {
throw new YeeException("监控项名/或告警状态/eqpId 不能为空!!!"); throw new YeeException("监控项名/或告警状态/eqpId 不能为空!!!");
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.info("*****************error**************************"); log.info("*****************error**************************");
log.info(e.getMessage()); log.info(e.getMessage());
...@@ -276,13 +276,13 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -276,13 +276,13 @@ public class InspectionWebSocketClient extends WebSocketClient{
public void onClose(int paramInt, String paramString, boolean paramBoolean) { public void onClose(int paramInt, String paramString, boolean paramBoolean) {
log.info("shut down..."); log.info("shut down...");
} }
@Override @Override
public void onError(Exception e) { public void onError(Exception e) {
log.info("abnormal"+e); log.info("abnormal"+e);
} }
public static synchronized void synInspectionAlarm() { public static synchronized void synInspectionAlarm() {
System.out.println("-------------------Inspection alarms Socket start-------------------------"); System.out.println("-------------------Inspection alarms Socket start-------------------------");
try { try {
...@@ -296,10 +296,10 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -296,10 +296,10 @@ public class InspectionWebSocketClient extends WebSocketClient{
System.out.println("build..." + alarmWebSocketClientUrl + " connected"); System.out.println("build..." + alarmWebSocketClientUrl + " connected");
} catch (URISyntaxException | IOException e) { } catch (URISyntaxException | IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private static ArrayList<String> getAisleInfo(String content,String replaceStr){ private static ArrayList<String> getAisleInfo(String content,String replaceStr){
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
String replaceAll = content.replaceAll("[^a-zA-Z0-9]", "_");//取英文数字 String replaceAll = content.replaceAll("[^a-zA-Z0-9]", "_");//取英文数字
...@@ -312,7 +312,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -312,7 +312,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
list.add(substring); list.add(substring);
return list; return list;
} }
public static void main(String[] args) { public static void main(String[] args) {
String aaaString="791TB到NPC发送通道状态1F"; String aaaString="791TB到NPC发送通道状态1F";
String bbbString="791TB到NPC发送通道状态F"; String bbbString="791TB到NPC发送通道状态F";
...@@ -321,7 +321,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -321,7 +321,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
ArrayList<String> bbb = getAisleInfo(bbbString,""); ArrayList<String> bbb = getAisleInfo(bbbString,"");
System.out.println(bbb); System.out.println(bbb);
} }
private void sendWebSocketMsg(String label) { private void sendWebSocketMsg(String label) {
try { try {
log.info("send websocekt start "); log.info("send websocekt start ");
...@@ -348,11 +348,11 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -348,11 +348,11 @@ public class InspectionWebSocketClient extends WebSocketClient{
List<AlarmPoint> pointList = alarmPointService.queryAutoInspection(eqpId,content); List<AlarmPoint> pointList = alarmPointService.queryAutoInspection(eqpId,content);
AlarmPoint alarmPoint = null; AlarmPoint alarmPoint = null;
if(pointList != null && pointList.size()==0) { if(pointList != null && pointList.size()==0) {
alarmPoint = new AlarmPoint(); alarmPoint = new AlarmPoint();
alarmPoint.setPointType(autoInspection.getAisleType().equals(AutoInspectionTypeEnum.NPC通道.getType()) alarmPoint.setPointType(autoInspection.getAisleType().equals(AutoInspectionTypeEnum.NPC通道.getType())
|| autoInspection.getAisleType().equals(AutoInspectionTypeEnum.商业银行通道.getType()) || autoInspection.getAisleType().equals(AutoInspectionTypeEnum.商业银行通道.getType())
? AlarmPointTypeEnum.通道.getCode() : AlarmPointTypeEnum.虚拟设备.getCode()); ? AlarmPointTypeEnum.TD.getCode() : AlarmPointTypeEnum.XNSB.getCode());
alarmPoint.setUpdateDate(new Date()); alarmPoint.setUpdateDate(new Date());
alarmPoint.setPointId(msgJson.getLong("eqpId") != null ? msgJson.getLong("eqpId") : 0); alarmPoint.setPointId(msgJson.getLong("eqpId") != null ? msgJson.getLong("eqpId") : 0);
alarmPoint.setContent(autoInspection.getMonitorItemName()); alarmPoint.setContent(autoInspection.getMonitorItemName());
...@@ -362,7 +362,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -362,7 +362,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
alarmPointService.save(alarmPoint); alarmPointService.save(alarmPoint);
log.info("p_alarm_point 告警表保存成功...success"); log.info("p_alarm_point 告警表保存成功...success");
sendAlarmWebSocket(); sendAlarmWebSocket();
}else { }else {
alarmPoint = pointList.get(0); alarmPoint = pointList.get(0);
alarmPoint.setUpdateDate(new Date()); alarmPoint.setUpdateDate(new Date());
...@@ -370,7 +370,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -370,7 +370,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("p_alarm_point 告警表更新成功...success"); log.info("p_alarm_point 告警表更新成功...success");
} }
} }
//删除告警表信息 //删除告警表信息
private void deleteAlarmPoint(String eqpId,String content) { private void deleteAlarmPoint(String eqpId,String content) {
List<AlarmPoint> pointList = alarmPointService.queryAutoInspection(eqpId,content); List<AlarmPoint> pointList = alarmPointService.queryAutoInspection(eqpId,content);
...@@ -380,8 +380,8 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -380,8 +380,8 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("删除告警点[eqpId:"+ eqpId +"] p_alarm_point 成功...success"); log.info("删除告警点[eqpId:"+ eqpId +"] p_alarm_point 成功...success");
sendAlarmWebSocket(); sendAlarmWebSocket();
} }
//推送前端告警信息 跑马灯 //推送前端告警信息 跑马灯
private void sendAlarmWebSocket() { private void sendAlarmWebSocket() {
try { try {
Sort sort = new Sort(Sort.Direction.DESC, "updateDate"); Sort sort = new Sort(Sort.Direction.DESC, "updateDate");
...@@ -397,7 +397,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -397,7 +397,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
e.printStackTrace(); e.printStackTrace();
} }
} }
private void saveSpcAlarm(AutoInspection autoInspection, JSONObject msgJson) { private void saveSpcAlarm(AutoInspection autoInspection, JSONObject msgJson) {
String columnString = msgJson.getString("eqpId") + "_" + autoInspection.getMonitorItemName(); String columnString = msgJson.getString("eqpId") + "_" + autoInspection.getMonitorItemName();
List<Alarm> spcAlarmList = alarmService.findByQueryColumn(columnString); List<Alarm> spcAlarmList = alarmService.findByQueryColumn(columnString);
...@@ -426,7 +426,7 @@ public class InspectionWebSocketClient extends WebSocketClient{ ...@@ -426,7 +426,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("Save alarm records...success"); log.info("Save alarm records...success");
} }
} }
} }
\ No newline at end of file
...@@ -143,22 +143,22 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -143,22 +143,22 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
Map<String,Object> nodeDetailMap = iTopographyNodeRepository.findNodeDetailBySourceId(msgJson.getString("sourceId")); Map<String,Object> nodeDetailMap = iTopographyNodeRepository.findNodeDetailBySourceId(msgJson.getString("sourceId"));
List<JSONObject> alarmAttributes = (List<JSONObject>) msgJson.get("capacityAttrList"); List<JSONObject> alarmAttributes = (List<JSONObject>) msgJson.get("capacityAttrList");
List<Map<String, String>> DHlist = new ArrayList<>();
synchronized (this) { synchronized (this) {
//拼接json存入动环详情表 //1.指标是否有异常
Boolean alarmFlagBoolean = false; boolean alarmFlagBoolean = false;
for (JSONObject a : alarmAttributes) { for (JSONObject a : alarmAttributes) {
String atr = (String) a.get("name"); String atr = (String) a.get("name");
String res = (String) msgJson.get(atr); 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; alarmFlagBoolean = true;
log.info("Moving ring device[" + eqpId + "]" + atr + "abnormal"); log.info("Moving ring device[" + eqpId + "]" + atr + "abnormal");
break; break;
} }
} }
//组装动环信息JSON //2.修改动环详情表的信息
List<Map<String, String>> DHlist = new ArrayList<>(); for (int i = 0; i < alarmAttributes.size(); i++) {
JSONObject a = alarmAttributes.get(i);
for (JSONObject a : alarmAttributes) {
String atr = (String) a.get("name"); String atr = (String) a.get("name");
String res = (String) msgJson.get(atr); String res = (String) msgJson.get(atr);
Map<String, String> map = new HashMap(); Map<String, String> map = new HashMap();
...@@ -202,8 +202,8 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -202,8 +202,8 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
iTopographyNodeDetailDao.save(topographyNodeDetail); iTopographyNodeDetailDao.save(topographyNodeDetail);
} }
//告警记录 //3.数据插入告警记录
String res = AlarmPointEnum.正常.getName(); String res = AlarmPointEnum.NORMAL.getName();
String alarmTypeCombination=""; String alarmTypeCombination="";
for (JSONObject atrJson : alarmAttributes) { for (JSONObject atrJson : alarmAttributes) {
String atrName = (String) atrJson.get("name"); String atrName = (String) atrJson.get("name");
...@@ -211,9 +211,9 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -211,9 +211,9 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
continue; continue;
} }
String alarmType = (String) atrJson.get("displayName"); 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; alarmTypeCombination = alarmType + alarmTypeCombination;
res = AlarmPointEnum.异常.getName(); res = AlarmPointEnum.ABNORMAL.getName();
} }
} }
...@@ -228,10 +228,12 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -228,10 +228,12 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
orgCode = authOrgTemp; orgCode = authOrgTemp;
} }
//添加告警记录
if(!"运行参数".equals(cpblName)||!"常电监测".equals(cpblName)||!"常电监测".equals(cpblName)){ if(!"运行参数".equals(cpblName)||!"常电监测".equals(cpblName)||!"常电监测".equals(cpblName)){
addRecordAlarm(alarmTypeCombination, res, sourceId, orgCode, authOrg, eqpName,cpblName,alramContent); 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); List<Alarm> curAlarmList = alarmService.selectByQuerySourceId(sourceId);
if (!alarmFlagBoolean && pointList.size() > 0) { if (!alarmFlagBoolean && pointList.size() > 0) {
alarmPointService.deleteItems(pointList); alarmPointService.deleteItems(pointList);
...@@ -242,21 +244,15 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -242,21 +244,15 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
} }
} else { } else {
if (alarmFlagBoolean && pointList.size() == 0) { if (alarmFlagBoolean && pointList.size() == 0) {
// String alramContent = msgJson.getString("describe");
String eqpType = msgJson.getString("eqpType"); String eqpType = msgJson.getString("eqpType");
// String eqpName = msgJson.getString("eqpName");
String equipmentAttrs = msgJson.getString("equipmentAttrs"); String equipmentAttrs = msgJson.getString("equipmentAttrs");
// String sourceId = msgJson.getString("sourceId");
String authOrgs = getAuthOrg(msgJson.getString("authOrg")); String authOrgs = getAuthOrg(msgJson.getString("authOrg"));
//String orgCode = msgJson.getString("orgCode");
AlarmPoint alarmPoint = new AlarmPoint(); AlarmPoint alarmPoint = new AlarmPoint();
alarmPoint.setCode(authOrgs); alarmPoint.setCode(authOrgs);
alarmPoint.setSourceId(sourceId); alarmPoint.setSourceId(sourceId);
alarmPoint.setPointId(eqpId); alarmPoint.setPointId(eqpId);
alarmPoint.setAuthOrg(authOrgs); alarmPoint.setAuthOrg(authOrgs);
// alarmPoint.setPointType(eqpType); alarmPoint.setPointType(AlarmPointTypeEnum.DH.getCode());
alarmPoint.setPointType(AlarmPointTypeEnum.动环.getCode());
alarmPoint.setUpdateDate(new Date()); alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(eqpName+alarmTypeCombination); alarmPoint.setContent(eqpName+alarmTypeCombination);
alarmPoint.setPointAttrs(equipmentAttrs); alarmPoint.setPointAttrs(equipmentAttrs);
...@@ -265,14 +261,12 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -265,14 +261,12 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
alarmPointService.saveItem(alarmPoint); alarmPointService.saveItem(alarmPoint);
log.info("Save alarm data....success"); log.info("Save alarm data....success");
//推送消息巡检app // 6 .推送消息巡检app
//String url = address + "api/msgSubscribe/alarmNotification";
try { try {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("code", msgJson.getString("orgCode")); map.put("code", msgJson.getString("orgCode"));
map.put("body", "告警源名称:" + eqpName + TAB + "告警信息" + alramContent); map.put("body", "告警源名称:" + eqpName + TAB + "告警信息" + alramContent);
String stringJson = JSONObject.toJSONString(map); String stringJson = JSONObject.toJSONString(map);
//HttpUtil.PostJson(url, stringJson);
CommonResponse result = patrolRemoteClient.sendAlarmNotification(stringJson); CommonResponse result = patrolRemoteClient.sendAlarmNotification(stringJson);
log.info("手机推送告警信息...success"); log.info("手机推送告警信息...success");
} catch (Exception e) { } catch (Exception e) {
...@@ -289,6 +283,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -289,6 +283,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
if(alarmFlagBoolean){ if(alarmFlagBoolean){
iTopographyService.sendAbnormal(msgJson.getString("sourceId"), 1); iTopographyService.sendAbnormal(msgJson.getString("sourceId"), 1);
} }
//7.给前台发送websocket
Sort sort = new Sort(Sort.Direction.DESC, "updateDate"); Sort sort = new Sort(Sort.Direction.DESC, "updateDate");
List<AlarmPoint> alarms = alarmPointService.findAll(sort); List<AlarmPoint> alarms = alarmPointService.findAll(sort);
...@@ -346,7 +341,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -346,7 +341,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
alarm.setContinueDate(subtract); 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); alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
} else { } else {
alarm.setClearDate(DateTimeKit.now()); alarm.setClearDate(DateTimeKit.now());
...@@ -370,7 +365,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -370,7 +365,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
alarm.setHappenDate(DateTimeKit.now()); alarm.setHappenDate(DateTimeKit.now());
alarm.setQueryColumn( sourceId + "_" + cpblName); alarm.setQueryColumn( sourceId + "_" + cpblName);
List<Alarm> curAlarmRList = alarmService.findByQueryColumn(queryColumn); 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); alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
iAlarmDao.save(alarm); iAlarmDao.save(alarm);
} else { } else {
......
...@@ -151,7 +151,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -151,7 +151,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
for (JSONObject a : alarmAttributes) { for (JSONObject a : alarmAttributes) {
String atr = (String) a.get("name"); String atr = (String) a.get("name");
String res = (String) msgJson.get(atr); 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; alarmFlagBoolean = true;
log.info("Moving ring device[" + eqpId + "]" + atr + "abnormal"); log.info("Moving ring device[" + eqpId + "]" + atr + "abnormal");
break; break;
...@@ -204,7 +204,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -204,7 +204,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
iTopographyNodeDetailDao.save(topographyNodeDetail); iTopographyNodeDetailDao.save(topographyNodeDetail);
} }
//告警记录 //告警记录
String res = AlarmPointEnum.正常.getName(); String res = AlarmPointEnum.NORMAL.getName();
String alarmTypeCombination=""; String alarmTypeCombination="";
for (JSONObject atrJson : alarmAttributes) { for (JSONObject atrJson : alarmAttributes) {
String atrName = (String) atrJson.get("name"); String atrName = (String) atrJson.get("name");
...@@ -212,9 +212,9 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -212,9 +212,9 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
continue; continue;
} }
String alarmType = (String) atrJson.get("displayName"); 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; alarmTypeCombination = alarmType + alarmTypeCombination;
res = AlarmPointEnum.异常.getName(); res = AlarmPointEnum.ABNORMAL.getName();
} }
} }
Long cpblId = msgJson.getLong("cpblId"); Long cpblId = msgJson.getLong("cpblId");
...@@ -229,9 +229,9 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -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); 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); List<Alarm> curAlarmList = alarmService.selectByQuerySourceId(sourceId);
if (!alarmFlagBoolean && pointList.size() > 0) { if (!alarmFlagBoolean && pointList.size() > 0) {
alarmPointService.deleteItems(pointList); alarmPointService.deleteItems(pointList);
...@@ -256,7 +256,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -256,7 +256,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
alarmPoint.setPointId(eqpId); alarmPoint.setPointId(eqpId);
alarmPoint.setAuthOrg(authOrgs); alarmPoint.setAuthOrg(authOrgs);
// alarmPoint.setPointType(eqpType); // alarmPoint.setPointType(eqpType);
alarmPoint.setPointType(AlarmPointTypeEnum.动环.getCode()); alarmPoint.setPointType(AlarmPointTypeEnum.DH.getCode());
alarmPoint.setUpdateDate(new Date()); alarmPoint.setUpdateDate(new Date());
alarmPoint.setContent(eqpName+alarmTypeCombination); alarmPoint.setContent(eqpName+alarmTypeCombination);
alarmPoint.setPointAttrs(equipmentAttrs); alarmPoint.setPointAttrs(equipmentAttrs);
...@@ -336,7 +336,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -336,7 +336,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
alarm.setContinueDate(subtract); 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); alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
} else { } else {
alarm.setClearDate(DateTimeKit.now()); alarm.setClearDate(DateTimeKit.now());
...@@ -360,7 +360,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -360,7 +360,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
alarm.setHappenDate(DateTimeKit.now()); alarm.setHappenDate(DateTimeKit.now());
alarm.setQueryColumn( sourceId + "_" + cpblName); alarm.setQueryColumn( sourceId + "_" + cpblName);
List<Alarm> curAlarmRList = alarmService.findByQueryColumn(queryColumn); 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); alarm.setCurrentState(ALARM_ABNORMAL_STATUS);
iAlarmDao.save(alarm); iAlarmDao.save(alarm);
} else { } else {
......
...@@ -3,13 +3,11 @@ package com.yeejoin.amos.spc.business.controller; ...@@ -3,13 +3,11 @@ package com.yeejoin.amos.spc.business.controller;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; 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.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -21,8 +19,6 @@ import com.yeejoin.amos.op.core.common.query.DaoCriteria; ...@@ -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.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil; import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.spc.business.param.ReginParams; 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.CommonPageable;
import com.yeejoin.amos.spc.core.common.request.CommonRequest; import com.yeejoin.amos.spc.core.common.request.CommonRequest;
import com.yeejoin.amos.spc.core.enums.QueryOperatorEnum; import com.yeejoin.amos.spc.core.enums.QueryOperatorEnum;
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.spc.business.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.spc.business.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.yeejoin.amos.bank.service.IDynamicRingDataService;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -34,7 +35,7 @@ public class SpcRiskSourceController extends BaseController { ...@@ -34,7 +35,7 @@ public class SpcRiskSourceController extends BaseController {
@Autowired @Autowired
private ISpcRiskSourceService riskSourceService; private ISpcRiskSourceService riskSourceService;
/** /**
* 获取风险源类型 * 获取风险源类型
...@@ -143,8 +144,8 @@ public class SpcRiskSourceController extends BaseController { ...@@ -143,8 +144,8 @@ public class SpcRiskSourceController extends BaseController {
return CommonResponseUtil.success(riskSourceService.getRiskSourceBoDetailById(id)); return CommonResponseUtil.success(riskSourceService.getRiskSourceBoDetailById(id));
} }
/** /**
* 查询风险源信息支持分页,条件查询 * 查询风险源信息支持分页,条件查询
* *
......
...@@ -41,7 +41,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -41,7 +41,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
/** /**
* *
* <pre> * <pre>
* 界面视图Controller * 界面视图Controller
* </pre> * </pre>
...@@ -62,21 +62,21 @@ public class View3DController extends BaseController { ...@@ -62,21 +62,21 @@ public class View3DController extends BaseController {
@Autowired @Autowired
private ISpcRiskSourceService riskSourceService; private ISpcRiskSourceService riskSourceService;
@Autowired @Autowired
private ISpcMajorHazardInstallationService iSpcMajorHazardInstallationService; private ISpcMajorHazardInstallationService iSpcMajorHazardInstallationService;
@Autowired @Autowired
ISpcEquipmentService iEquipmentService; ISpcEquipmentService iEquipmentService;
@Autowired @Autowired
private IDynamicRingDataService iDynamicRingDataService; private IDynamicRingDataService iDynamicRingDataService;
@Autowired @Autowired
private IEquipmentService iequipmentService; private IEquipmentService iequipmentService;
/** /**
* *
* <pre> * <pre>
* 初始化三维视图节点 * 初始化三维视图节点
* </pre> * </pre>
...@@ -91,14 +91,14 @@ public class View3DController extends BaseController { ...@@ -91,14 +91,14 @@ public class View3DController extends BaseController {
@ApiParam(value = "组织code", required = false) @RequestParam(required = false) String orgCode) { @ApiParam(value = "组织code", required = false) @RequestParam(required = false) String orgCode) {
if (StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(orgCode)) { if (StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(orgCode)) {
//动环数据 //动环数据
String token = getToken(); String token = getToken();
if(type.equals("dynamicRingData")) { if(type.equals("dynamicRingData")) {
ArrayList<Node3DVoResponse> query3dData = iDynamicRingDataService.query3dData(token,orgCode); ArrayList<Node3DVoResponse> query3dData = iDynamicRingDataService.query3dData(token,orgCode);
return CommonResponseUtil.success(query3dData); return CommonResponseUtil.success(query3dData);
}else if(type.equals("impEquipment")){//设备 }else if(type.equals("impEquipment")){//设备
return CommonResponseUtil.success(iequipmentService.queryEqui3dData(orgCode)); return CommonResponseUtil.success(iequipmentService.queryEqui3dData(orgCode));
} }
return CommonResponseUtil.success(view3DService.findViewDataByType(type, orgCode)); return CommonResponseUtil.success(view3DService.findViewDataByType(type, orgCode));
...@@ -109,7 +109,7 @@ public class View3DController extends BaseController { ...@@ -109,7 +109,7 @@ public class View3DController extends BaseController {
/** /**
* 获取风险详情 * 获取风险详情
* *
* @param id * @param id
* @return * @return
*/ */
...@@ -122,10 +122,10 @@ public class View3DController extends BaseController { ...@@ -122,10 +122,10 @@ public class View3DController extends BaseController {
} }
return CommonResponseUtil.failure(); return CommonResponseUtil.failure();
} }
/** /**
* 获取点详情 * 获取点详情
* *
* @param id * @param id
* @return * @return
*/ */
...@@ -142,7 +142,7 @@ public class View3DController extends BaseController { ...@@ -142,7 +142,7 @@ public class View3DController extends BaseController {
/** /**
* 获取设备详情 * 获取设备详情
* *
* @param id * @param id
* @return * @return
*/ */
...@@ -159,7 +159,7 @@ public class View3DController extends BaseController { ...@@ -159,7 +159,7 @@ public class View3DController extends BaseController {
/** /**
* 获取隐患详情 * 获取隐患详情
* *
* @param id * @param id
* @return * @return
*/ */
...@@ -176,7 +176,7 @@ public class View3DController extends BaseController { ...@@ -176,7 +176,7 @@ public class View3DController extends BaseController {
/** /**
* 根据类型查询资源信息 * 根据类型查询资源信息
* *
* @param type * @param type
* @param queryRequests * @param queryRequests
* @param commonPageable * @param commonPageable
...@@ -260,10 +260,10 @@ public class View3DController extends BaseController { ...@@ -260,10 +260,10 @@ public class View3DController extends BaseController {
return CommonResponseUtil.success(view3DMapper.queryForVideomonitorinfo3d()); return CommonResponseUtil.success(view3DMapper.queryForVideomonitorinfo3d());
} }
/** /**
* 巡点查询 * 巡点查询
* *
* @param id * @param id
* @return * @return
*/ */
...@@ -271,7 +271,7 @@ public class View3DController extends BaseController { ...@@ -271,7 +271,7 @@ public class View3DController extends BaseController {
@ApiOperation(value = "巡点查询", notes = "巡点查询") @ApiOperation(value = "巡点查询", notes = "巡点查询")
public CommonResponse getpointlist( public CommonResponse getpointlist(
@ApiParam(value = "节点类型", required = false) @RequestParam(required = false) String floor,@RequestParam(required = false) String code) { @ApiParam(value = "节点类型", required = false) @RequestParam(required = false) String floor,@RequestParam(required = false) String code) {
try { try {
return CommonResponseUtil.success(view3DMapper.getpointlist( floor, code)); return CommonResponseUtil.success(view3DMapper.getpointlist( floor, code));
...@@ -281,23 +281,23 @@ public class View3DController extends BaseController { ...@@ -281,23 +281,23 @@ public class View3DController extends BaseController {
return CommonResponseUtil.failure(); return CommonResponseUtil.failure();
} }
} }
@GetMapping(value = "/updatepoint", produces = "application/json;charset=UTF-8") @GetMapping(value = "/updatepoint", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "修改巡点点", notes = "修改巡点点") @ApiOperation(value = "修改巡点点", notes = "修改巡点点")
public CommonResponse updatepoint( public CommonResponse updatepoint(
@ApiParam(value = "节点类型", required = false) @RequestParam(required = false)String coordinates,@RequestParam(required = false)String id) { @ApiParam(value = "节点类型", required = false) @RequestParam(required = false)String coordinates,@RequestParam(required = false)String id) {
try { try {
view3DMapper.updatepoint( coordinates, id); view3DMapper.updatepoint( coordinates, id);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
return CommonResponseUtil.failure(); return CommonResponseUtil.failure();
} }
} }
} }
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