diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 523e99c..769f1f2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -9,11 +9,9 @@ - + - - - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -151,9 +177,10 @@ @@ -209,9 +236,7 @@ - - @@ -252,24 +277,6 @@ - - - - - - - - - - - - - - - - - - @@ -289,6 +296,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -310,12 +337,14 @@ + + - + @@ -505,7 +534,8 @@ - + + 1583481566842 @@ -514,17 +544,23 @@ - - - - + @@ -602,7 +638,8 @@ - @@ -841,13 +878,6 @@ - - - - - - - @@ -862,24 +892,41 @@ - + - - + + - - + + + + + + + + + + + + + + + + + + + - - + + diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index b480829..06a29f0 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -19,6 +19,7 @@ private String alarmDate;//报警时间 private String description;//描述 private String alarmDevName;//报警设备 + private Long alarmDevId;//报警设备ID private String alarmLocation;//报警位置 private String assetCode;//资产编号 private String partition;//所在分区 @@ -76,6 +77,14 @@ this.alarmDevName = alarmDevName; } + public Long getAlarmDevId() { + return alarmDevId; + } + + public void setAlarmDevId(Long alarmDevId) { + this.alarmDevId = alarmDevId; + } + public String getAlarmLocation() { return alarmLocation; } @@ -161,6 +170,7 @@ this.setDescription(pgAlarm.getDescription()); if(pgAlarm.getAlarmDevId()==null) { + this.setAlarmDevId(null); this.setAlarmDevName(""); this.setAlarmLocation(""); this.setAssetCode(""); @@ -169,6 +179,7 @@ } else { + this.setAlarmDevId(pgAlarm.getAlarmDevId().getId()); this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setAssetCode(pgAlarm.getAlarmDevId().getAssetCode()); diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 523e99c..769f1f2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -9,11 +9,9 @@ - + - - - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -151,9 +177,10 @@ @@ -209,9 +236,7 @@ - - @@ -252,24 +277,6 @@ - - - - - - - - - - - - - - - - - - @@ -289,6 +296,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -310,12 +337,14 @@ + + - + @@ -505,7 +534,8 @@ - + + 1583481566842 @@ -514,17 +544,23 @@ - - - - + @@ -602,7 +638,8 @@ - @@ -841,13 +878,6 @@ - - - - - - - @@ -862,24 +892,41 @@ - + - - + + - - + + + + + + + + + + + + + + + + + + + - - + + diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index b480829..06a29f0 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -19,6 +19,7 @@ private String alarmDate;//报警时间 private String description;//描述 private String alarmDevName;//报警设备 + private Long alarmDevId;//报警设备ID private String alarmLocation;//报警位置 private String assetCode;//资产编号 private String partition;//所在分区 @@ -76,6 +77,14 @@ this.alarmDevName = alarmDevName; } + public Long getAlarmDevId() { + return alarmDevId; + } + + public void setAlarmDevId(Long alarmDevId) { + this.alarmDevId = alarmDevId; + } + public String getAlarmLocation() { return alarmLocation; } @@ -161,6 +170,7 @@ this.setDescription(pgAlarm.getDescription()); if(pgAlarm.getAlarmDevId()==null) { + this.setAlarmDevId(null); this.setAlarmDevName(""); this.setAlarmLocation(""); this.setAssetCode(""); @@ -169,6 +179,7 @@ } else { + this.setAlarmDevId(pgAlarm.getAlarmDevId().getId()); this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setAssetCode(pgAlarm.getAlarmDevId().getAssetCode()); diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java index 92a6b47..37e8068 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -247,4 +247,16 @@ return pgAlarmTjDtoList; } + public PgAlarm getPgAlarmByDevId(Long alarmDevId){ + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.add(Restrictions.eq("alarmDevId", alarmDevId)); + + List pgAlarmList=criteria.list(); + + if(pgAlarmList==null||pgAlarmList.size()==0) + return null; + else + return pgAlarmList.get(0); + } } \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index ceceff3..b2e0d58 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -62,7 +62,7 @@ @POST @Path("clearAlarmInfo") @Produces(MediaType.APPLICATION_JSON) - public Map clearAlarmList(@FormParam("id") String id) throws Exception { + public Map clearAlarmList(@FormParam("alarmDevId") String alarmDevId) throws Exception { Map resultMap = new HashMap<>(); String msg = ""; @@ -70,8 +70,7 @@ String code="0"; try { - PgAlarm pgAlarm = new PgAlarm(); - pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + PgAlarm pgAlarm = pgAlarmManager.getPgAlarmByDevId(Long.valueOf(alarmDevId)); if (pgAlarm == null) { msg = "不存在该报警信息"; result = "false";