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

动环枚举修改

parent 5360ac70
......@@ -15,9 +15,9 @@ public enum AlarmPointEnum {
未确认已清除("未确认已清除", "未确认已清除"),
已确认未清除("已确认未清除", "已确认未清除"),
已确认已清除("已确认已清除", "已确认已清除"),
正常("正常", "正常"),
异常("异常", "异常"),
告警("告警", "告警"),;
NORMAL("正常", "正常"),
ABNORMAL("异常", "异常"),
ALARM("告警", "告警"),;
/**
* 名称,描述
......
......@@ -11,13 +11,13 @@ 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);
......
......@@ -55,9 +55,9 @@ public class AlarmWebSocketClient extends WebSocketClient {
// @Value("${params.patrol}")
// private String address;
private PatrolRemoteClient patrolRemoteClient;
private static ApplicationContext allpicationContext;
public static void setAllpicationContext(ApplicationContext context) {
allpicationContext = context;
}
......@@ -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);
......@@ -162,7 +162,7 @@ public class AlarmWebSocketClient extends WebSocketClient {
iAlarmDao.save(alarm);
log.info("Update alarm records ...success");
} else {
// if (alarm == null || AlarmPointEnum.已确认已清除.getName().equals(curStatus)
// if (alarm == null || AlarmPointEnum.已确认已清除.getName().equals(curStatus)
// || AlarmPointEnum.未确认已清除.getName().equals(curStatus)) {
Alarm alarm = new Alarm();
alarm.setSourceId(msgJson.getString("sourceId"));
......
......@@ -57,7 +57,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
// @Value("${params.patrol}")
// private String address;
private static ApplicationContext allpicationContext;
private PatrolRemoteClient patrolRemoteClient;
public static void setAllpicationContext(ApplicationContext context) {
......@@ -105,7 +105,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
String affiliatedSystem = equipmentAttrs.getString("affiliatedSystem");
if(affiliatedSystem != null && "火探".equals(affiliatedSystem)) {
log.info("Received message:" + paramString);
Long eqpId = msgJson.getLong("eqpId");
String status = msgJson.getString("status");
String sourceId = equipmentAttrs.getString("sourceId");
......@@ -114,23 +114,23 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
Integer level = msgJson.getInteger("level") != null ? msgJson.getInteger("level") : 1;
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");
// iTopographyService.sendAbnormal(eqpId, 0);
iTopographyService.sendAbnormalByType(String.valueOf(eqpId),
AbnormalStateEnum.N.getCode(),
iTopographyService.sendAbnormalByType(String.valueOf(eqpId),
AbnormalStateEnum.N.getCode(),
TopoNodeTypeEnum.动环监控.getType(),
alramContent);
} else {
if (null == pointList || pointList.size() == 0) {
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);
......@@ -138,7 +138,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
alarmPoint.setCode(msgJson.getString("orgCode"));
alarmPointService.saveItem(alarmPoint);
log.info("Save alarm data ...success");
//String url = address + "api/msgSubscribe/alarmNotification";
try {
Map<String, Object> map = new HashMap<String, Object>();
......@@ -151,12 +151,12 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
} catch (Exception e) {
log.info("手机推送告警信息失败...fail" + e.getMessage());
}
}
String alarmLevel = AbnormalStateEnum.getAbnormalName(level);
// AbnormalStateEnum enum1 = AbnormalStateEnum.getEnum(alarmLevel);
// iTopographyService.sendAbnormal(eqpId, enum1 == null ? 0 : enum1.getCode());
AbnormalStateEnum enum1 = AbnormalStateEnum.getEnum(alarmLevel);
iTopographyService.sendAbnormalByType(String.valueOf(eqpId), enum1 == null ? 0 : enum1.getCode(),
TopoNodeTypeEnum.动环监控.getType(), alramContent);
......@@ -169,7 +169,7 @@ public class FireDetectionWebSocketClient extends WebSocketClient {
String url = (String) props.get("params.remoteWebsocketUrl") + "/generic/sendMessage";
HttpUtil.PostJson(url, JSON.toJSONString(param));
log.info("send websocekt info:" + param);
//告警记录
String queryColumn = eqpId + "_" + msgJson.getString("type");
List<Alarm> curAlarmList = alarmService.findByQueryColumn(queryColumn);
......@@ -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));
......
......@@ -53,9 +53,9 @@ import com.yeejoin.amos.spc.exception.YeeException;
*
*/
public class InspectionWebSocketClient extends WebSocketClient{
private static final Logger log = Logger.getLogger(InspectionWebSocketClient.class);
private IAutoInspectionService autoInspectionService;
private ITopographyService iTopographyService;
private IAisleInfoService aisleInfoService;
......@@ -64,20 +64,20 @@ public class InspectionWebSocketClient extends WebSocketClient{
private AmosWsClient client;
private IAlarmRepository iAlarmDao;
private static final String TAB = "\r\n";
private PatrolRemoteClient patrolRemoteClient;
//private String address;
private static ApplicationContext allpicationContext;
public static void setAllpicationContext(ApplicationContext context){
allpicationContext = context;
}
public InspectionWebSocketClient(String url) throws URISyntaxException {
super(new URI(url));
}
@Override
public void onOpen(ServerHandshake shake) {
log.info("InspectionWebSocketClient Shake hands......");
......@@ -102,7 +102,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
e.printStackTrace();
}
}
@Override
@Transactional
public void onMessage(String paramString) {
......@@ -116,22 +116,22 @@ public class InspectionWebSocketClient extends WebSocketClient{
String alarmState = msgJson.getString("alarmState");
String monitorHostMachine = msgJson.getString("monitorHostMachine");
String eqpId = msgJson.getString("eqpId");
if(monitorItemName != null && !"".equals(monitorItemName) && alarmState != null && !"".equals(alarmState)
&& eqpId != null && !"".equals(eqpId)) {
log.info("监控项名称:" + monitorItemName + " 发送设备: " + monitorHostMachine);
//查询自动巡检告警列表
List<AutoInspection> abnormals = autoInspectionService.findAbnormalByMonitorItemNameAndHost(monitorItemName,monitorHostMachine);
if(abnormals != null && abnormals.size() > 0) {
log.info("告警列表:" + abnormals);
String nextCheckTime = msgJson.getString("nextCheckTime");
AutoInspection abnormalInspection = abnormals.get(abnormals.size()-1);
//状态更新为正常时 发送websocket
Boolean sendMsg = false;
Boolean sendMsg = false;
if(!alarmState.equals(abnormalInspection.getAlarmState())) {
sendMsg = true;
//删除告警表
......@@ -147,30 +147,30 @@ public class InspectionWebSocketClient extends WebSocketClient{
autoInspectionService.save(abnormalInspection);
log.info("异常[" + monitorItemName + "]点状态更新为"+ alarmState +",下次检查时间"+ nextCheckTime +"...success");
saveSpcAlarm(abnormalInspection,msgJson);//保存告警记录
if(sendMsg) {
String aisleType = abnormalInspection.getAisleType();
if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType)
if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType)
|| AutoInspectionTypeEnum.NPC通道.getType().equals(aisleType))) {//通道 状态更新时
sendWebSocketMsg(abnormalInspection.getLabel1());
Long treeId = aisleInfoService.queryTreeIdByStratAndEnd(monitorHostMachine,abnormalInspection.getLabel2());
iTopographyService.sendPMTSAbnormal(PMTSTypeEnum.getEnumType(monitorHostMachine)
,abnormalInspection.getLabel2()
,TopoGroupEnum.PMTS.getName()
,treeId,0);
log.info("topo图PMTS 通道状态更新信息发送成功...success");
}else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType)
}else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType)
|| AutoInspectionTypeEnum.设备状态.getType().equals(aisleType))){//设备状态 更新
iTopographyService.sendAbnormalByType(monitorHostMachine,
AbnormalStateEnum.N.getCode(),
iTopographyService.sendAbnormalByType(monitorHostMachine,
AbnormalStateEnum.N.getCode(),
TopoNodeTypeEnum.设备监控.getType(),
monitorItemName);
log.info("topo图设备监控更新信息发送成功...success");
}
}
}else {
AutoInspection autoInspection = new AutoInspection();
autoInspection.setAlarmState(alarmState);
autoInspection.setMonitorItemName(monitorItemName);
......@@ -182,7 +182,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
autoInspection.setSourceId(msgJson.getString("sourceId"));
autoInspection.setCurrentCheckTime(msgJson.getString("currentCheckTime"));
autoInspection.setCurrentValue(msgJson.getString("currentValue"));
ArrayList<String> aisleInfo = new ArrayList<>();
if(monitorItemName.contains("行号")) {
String[] splits = monitorItemName.split(" ");
......@@ -198,11 +198,11 @@ public class InspectionWebSocketClient extends WebSocketClient{
autoInspection.setLabel1(aisleInfo.get(0));
String label2 = aisleInfo.get(1);
String aisle = aisleInfo.get(2);
// label2 = aisle.contains("1") ? label2 + "1" : label2;
// label2 = aisle.contains("1") ? label2 + "1" : label2;
autoInspection.setLabel2(label2);
autoInspection.setAisle(aisle);
log.info("设置通道信息Aisle:" + aisleInfo.get(2) + "Label1:"+ aisleInfo.get(0)+ "Label2:"+ aisleInfo.get(1));
}else if(monitorItemName.contains("MQ系统")) {
autoInspection.setAisle("MQ系统");
autoInspection.setAisleType(AutoInspectionTypeEnum.MQ状态.getType());
......@@ -211,19 +211,19 @@ public class InspectionWebSocketClient extends WebSocketClient{
}else {
autoInspection.setAisleType(AutoInspectionTypeEnum.设备状态.getType());
}
autoInspectionService.save(autoInspection);
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();
if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType)
if( (AutoInspectionTypeEnum.商业银行通道.getType().equals(aisleType)
|| AutoInspectionTypeEnum.NPC通道.getType().equals(aisleType))) {//通道 状态为异常时
sendWebSocketMsg(autoInspection.getLabel1());
Long treeId = aisleInfoService.queryTreeIdByStratAndEnd(monitorHostMachine,autoInspection.getLabel2());
iTopographyService.sendPMTSAbnormal(PMTSTypeEnum.getEnumType(monitorHostMachine)
,autoInspection.getLabel2()
......@@ -231,21 +231,21 @@ public class InspectionWebSocketClient extends WebSocketClient{
,treeId
,AbnormalStateEnum.M.getCode());
log.info("topo图PMTS异常发送成功...success");
}else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType)
}else if((AutoInspectionTypeEnum.MQ状态.getType().equals(aisleType)
|| AutoInspectionTypeEnum.设备状态.getType().equals(aisleType))) {//设备状态为异常时
iTopographyService.sendAbnormalByType(monitorHostMachine,
iTopographyService.sendAbnormalByType(monitorHostMachine,
AbnormalStateEnum.M.getCode(),
TopoNodeTypeEnum.设备监控.getType(),
monitorItemName);
log.info("topo图设备监控异常发送成功...success");
}
//推送消息巡检app
//String url =address+"api/msgSubscribe/alarmNotification";
try {
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);
String stringJson = JSONObject.toJSONString(map);
// HttpUtil.PostJson(url, stringJson);
......@@ -256,16 +256,16 @@ public class InspectionWebSocketClient extends WebSocketClient{
}
}
}
}else {
throw new YeeException("监控项名/或告警状态/eqpId 不能为空!!!");
}
}
}
} catch (Exception e) {
log.info("*****************error**************************");
log.info(e.getMessage());
......@@ -276,13 +276,13 @@ public class InspectionWebSocketClient extends WebSocketClient{
public void onClose(int paramInt, String paramString, boolean paramBoolean) {
log.info("shut down...");
}
@Override
public void onError(Exception e) {
log.info("abnormal"+e);
}
public static synchronized void synInspectionAlarm() {
System.out.println("-------------------Inspection alarms Socket start-------------------------");
try {
......@@ -296,10 +296,10 @@ public class InspectionWebSocketClient extends WebSocketClient{
System.out.println("build..." + alarmWebSocketClientUrl + " connected");
} catch (URISyntaxException | IOException e) {
e.printStackTrace();
}
}
}
private static ArrayList<String> getAisleInfo(String content,String replaceStr){
ArrayList<String> list = new ArrayList<>();
String replaceAll = content.replaceAll("[^a-zA-Z0-9]", "_");//取英文数字
......@@ -312,7 +312,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
list.add(substring);
return list;
}
public static void main(String[] args) {
String aaaString="791TB到NPC发送通道状态1F";
String bbbString="791TB到NPC发送通道状态F";
......@@ -321,7 +321,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
ArrayList<String> bbb = getAisleInfo(bbbString,"");
System.out.println(bbb);
}
private void sendWebSocketMsg(String label) {
try {
log.info("send websocekt start ");
......@@ -348,11 +348,11 @@ public class InspectionWebSocketClient extends WebSocketClient{
List<AlarmPoint> pointList = alarmPointService.queryAutoInspection(eqpId,content);
AlarmPoint alarmPoint = null;
if(pointList != null && pointList.size()==0) {
alarmPoint = new AlarmPoint();
alarmPoint.setPointType(autoInspection.getAisleType().equals(AutoInspectionTypeEnum.NPC通道.getType())
|| autoInspection.getAisleType().equals(AutoInspectionTypeEnum.商业银行通道.getType())
? AlarmPointTypeEnum.通道.getCode() : AlarmPointTypeEnum.虚拟设备.getCode());
alarmPoint.setPointType(autoInspection.getAisleType().equals(AutoInspectionTypeEnum.NPC通道.getType())
|| autoInspection.getAisleType().equals(AutoInspectionTypeEnum.商业银行通道.getType())
? AlarmPointTypeEnum.TD.getCode() : AlarmPointTypeEnum.XNSB.getCode());
alarmPoint.setUpdateDate(new Date());
alarmPoint.setPointId(msgJson.getLong("eqpId") != null ? msgJson.getLong("eqpId") : 0);
alarmPoint.setContent(autoInspection.getMonitorItemName());
......@@ -362,7 +362,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
alarmPointService.save(alarmPoint);
log.info("p_alarm_point 告警表保存成功...success");
sendAlarmWebSocket();
}else {
alarmPoint = pointList.get(0);
alarmPoint.setUpdateDate(new Date());
......@@ -370,7 +370,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("p_alarm_point 告警表更新成功...success");
}
}
//删除告警表信息
private void deleteAlarmPoint(String eqpId,String content) {
List<AlarmPoint> pointList = alarmPointService.queryAutoInspection(eqpId,content);
......@@ -380,8 +380,8 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("删除告警点[eqpId:"+ eqpId +"] p_alarm_point 成功...success");
sendAlarmWebSocket();
}
//推送前端告警信息 跑马灯
//推送前端告警信息 跑马灯
private void sendAlarmWebSocket() {
try {
Sort sort = new Sort(Sort.Direction.DESC, "updateDate");
......@@ -397,7 +397,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
e.printStackTrace();
}
}
private void saveSpcAlarm(AutoInspection autoInspection, JSONObject msgJson) {
String columnString = msgJson.getString("eqpId") + "_" + autoInspection.getMonitorItemName();
List<Alarm> spcAlarmList = alarmService.findByQueryColumn(columnString);
......@@ -426,7 +426,7 @@ public class InspectionWebSocketClient extends WebSocketClient{
log.info("Save alarm records...success");
}
}
}
\ No newline at end of file
......@@ -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;
......@@ -34,7 +35,7 @@ public class SpcRiskSourceController extends BaseController {
@Autowired
private ISpcRiskSourceService riskSourceService;
/**
* 获取风险源类型
......@@ -143,8 +144,8 @@ public class SpcRiskSourceController extends BaseController {
return CommonResponseUtil.success(riskSourceService.getRiskSourceBoDetailById(id));
}
/**
* 查询风险源信息支持分页,条件查询
*
......
......@@ -41,7 +41,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
*
*
* <pre>
* 界面视图Controller
* </pre>
......@@ -62,21 +62,21 @@ public class View3DController extends BaseController {
@Autowired
private ISpcRiskSourceService riskSourceService;
@Autowired
private ISpcMajorHazardInstallationService iSpcMajorHazardInstallationService;
@Autowired
ISpcEquipmentService iEquipmentService;
@Autowired
private IDynamicRingDataService iDynamicRingDataService;
@Autowired
private IEquipmentService iequipmentService;
/**
*
*
* <pre>
* 初始化三维视图节点
* </pre>
......@@ -91,14 +91,14 @@ public class View3DController extends BaseController {
@ApiParam(value = "组织code", required = false) @RequestParam(required = false) String orgCode) {
if (StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(orgCode)) {
//动环数据
String token = getToken();
String token = getToken();
if(type.equals("dynamicRingData")) {
ArrayList<Node3DVoResponse> query3dData = iDynamicRingDataService.query3dData(token,orgCode);
return CommonResponseUtil.success(query3dData);
}else if(type.equals("impEquipment")){//设备
return CommonResponseUtil.success(iequipmentService.queryEqui3dData(orgCode));
}
return CommonResponseUtil.success(view3DService.findViewDataByType(type, orgCode));
......@@ -109,7 +109,7 @@ public class View3DController extends BaseController {
/**
* 获取风险详情
*
*
* @param id
* @return
*/
......@@ -122,10 +122,10 @@ public class View3DController extends BaseController {
}
return CommonResponseUtil.failure();
}
/**
* 获取点详情
*
*
* @param id
* @return
*/
......@@ -142,7 +142,7 @@ public class View3DController extends BaseController {
/**
* 获取设备详情
*
*
* @param id
* @return
*/
......@@ -159,7 +159,7 @@ public class View3DController extends BaseController {
/**
* 获取隐患详情
*
*
* @param id
* @return
*/
......@@ -176,7 +176,7 @@ public class View3DController extends BaseController {
/**
* 根据类型查询资源信息
*
*
* @param type
* @param queryRequests
* @param commonPageable
......@@ -260,10 +260,10 @@ public class View3DController extends BaseController {
return CommonResponseUtil.success(view3DMapper.queryForVideomonitorinfo3d());
}
/**
* 巡点查询
*
*
* @param id
* @return
*/
......@@ -271,7 +271,7 @@ public class View3DController extends BaseController {
@ApiOperation(value = "巡点查询", notes = "巡点查询")
public CommonResponse getpointlist(
@ApiParam(value = "节点类型", required = false) @RequestParam(required = false) String floor,@RequestParam(required = false) String code) {
try {
return CommonResponseUtil.success(view3DMapper.getpointlist( floor, code));
......@@ -281,23 +281,23 @@ public class View3DController extends BaseController {
return CommonResponseUtil.failure();
}
}
@GetMapping(value = "/updatepoint", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "修改巡点点", notes = "修改巡点点")
public CommonResponse updatepoint(
@ApiParam(value = "节点类型", required = false) @RequestParam(required = false)String coordinates,@RequestParam(required = false)String id) {
try {
view3DMapper.updatepoint( coordinates, id);
return CommonResponseUtil.success();
} catch (Exception e) {
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