diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
new file mode 100644
index 0000000..d7c6024
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
@@ -0,0 +1,49 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Service
+public class PgDeviceTypeManager extends HibernateEntityDao{
+
+ public List getAllDeviceType() {
+
+ Criteria criteria = createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList= criteria.list();
+ List pgDeviceTypeDtoList=new ArrayList();
+ for (PgDeviceType pgDeviceType : pgDeviceTypeList) {
+ pgDeviceTypeDtoList.add(new PgDeviceTypeDto(pgDeviceType));
+ }
+
+ return pgDeviceTypeDtoList;
+ }
+
+ public PgDeviceType getPgDeviceTypeByDevType(String devType)
+ {
+ Criteria criteria=createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("devType",devType));
+ criteria.add(Restrictions.eq("active",1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList=criteria.list();
+ if(pgDeviceTypeList==null||pgDeviceTypeList.size()==0)
+ return null;
+ else
+ return pgDeviceTypeList.get(0);
+ }
+
+}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
new file mode 100644
index 0000000..d7c6024
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
@@ -0,0 +1,49 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Service
+public class PgDeviceTypeManager extends HibernateEntityDao{
+
+ public List getAllDeviceType() {
+
+ Criteria criteria = createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList= criteria.list();
+ List pgDeviceTypeDtoList=new ArrayList();
+ for (PgDeviceType pgDeviceType : pgDeviceTypeList) {
+ pgDeviceTypeDtoList.add(new PgDeviceTypeDto(pgDeviceType));
+ }
+
+ return pgDeviceTypeDtoList;
+ }
+
+ public PgDeviceType getPgDeviceTypeByDevType(String devType)
+ {
+ Criteria criteria=createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("devType",devType));
+ criteria.add(Restrictions.eq("active",1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList=criteria.list();
+ if(pgDeviceTypeList==null||pgDeviceTypeList.size()==0)
+ return null;
+ else
+ return pgDeviceTypeList.get(0);
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index dab4338..874647f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -2,6 +2,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+import com.casic.PgInterface.devTable.dto.PgAlarmTjDto;
import com.casic.PgInterface.devTable.manager.PgAlarmManager;
import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
@@ -125,11 +126,11 @@
@POST
@Path("addAlarm")
@Produces(MediaType.APPLICATION_JSON)
- public Map addAlarm(@FormParam("alarmTypeId") String alarmTypeId,
+ public Map addAlarm(@FormParam("alarmType") String alarmType,
@FormParam("alarmValue") String alarmValue,
@FormParam("alarmDate") String alarmDate,
@FormParam("description") String description,
- @FormParam("devName") String devName,
+ @FormParam("devCode") String devCode,
@FormParam("userName") String userName)throws Exception {
Map resultMap = new HashMap();
String result = "";
@@ -142,12 +143,12 @@
result = "false";
msg = "不存在该用户!";
} else {
- pgAlarm.setAlarmTypeId(pgAlarmTypeManager.get(alarmTypeId));
+ pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType));
pgAlarm.setAlarmValue(alarmValue);
pgAlarm.setAlarmDate(sdf.parse(alarmDate));
pgAlarm.setDescription(description);
pgAlarm.setPatrolerId(pgPatrolerManager.getPatrolerByuserName(userName));
- pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevName(devName));
+ pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode));
logger.info("成功保存");
pgAlarmManager.save(pgAlarm);
@@ -165,4 +166,31 @@
return resultMap;
}
+ /**
+ * 历史报警统计
+ */
+ @POST
+ @Path("getAlarmTypeCountAmongDate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getAlarmTJByDate(@FormParam("startDate") String startDate,
+ @FormParam("endDate") String endDate)throws Exception{
+ Map resultMap = new HashMap();
+ String result = "";
+ String msg = "";
+ try{
+ List pgAlarmTjDtoList=new ArrayList();
+
+
+
+ }
+ catch(Exception ex)
+ {
+ result="false";
+ msg="统计失败";
+ }
+ resultMap.put("result",result);
+ resultMap.put("msg",msg);
+ return resultMap;
+ }
+
}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
new file mode 100644
index 0000000..d7c6024
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
@@ -0,0 +1,49 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Service
+public class PgDeviceTypeManager extends HibernateEntityDao{
+
+ public List getAllDeviceType() {
+
+ Criteria criteria = createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList= criteria.list();
+ List pgDeviceTypeDtoList=new ArrayList();
+ for (PgDeviceType pgDeviceType : pgDeviceTypeList) {
+ pgDeviceTypeDtoList.add(new PgDeviceTypeDto(pgDeviceType));
+ }
+
+ return pgDeviceTypeDtoList;
+ }
+
+ public PgDeviceType getPgDeviceTypeByDevType(String devType)
+ {
+ Criteria criteria=createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("devType",devType));
+ criteria.add(Restrictions.eq("active",1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList=criteria.list();
+ if(pgDeviceTypeList==null||pgDeviceTypeList.size()==0)
+ return null;
+ else
+ return pgDeviceTypeList.get(0);
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index dab4338..874647f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -2,6 +2,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+import com.casic.PgInterface.devTable.dto.PgAlarmTjDto;
import com.casic.PgInterface.devTable.manager.PgAlarmManager;
import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
@@ -125,11 +126,11 @@
@POST
@Path("addAlarm")
@Produces(MediaType.APPLICATION_JSON)
- public Map addAlarm(@FormParam("alarmTypeId") String alarmTypeId,
+ public Map addAlarm(@FormParam("alarmType") String alarmType,
@FormParam("alarmValue") String alarmValue,
@FormParam("alarmDate") String alarmDate,
@FormParam("description") String description,
- @FormParam("devName") String devName,
+ @FormParam("devCode") String devCode,
@FormParam("userName") String userName)throws Exception {
Map resultMap = new HashMap();
String result = "";
@@ -142,12 +143,12 @@
result = "false";
msg = "不存在该用户!";
} else {
- pgAlarm.setAlarmTypeId(pgAlarmTypeManager.get(alarmTypeId));
+ pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType));
pgAlarm.setAlarmValue(alarmValue);
pgAlarm.setAlarmDate(sdf.parse(alarmDate));
pgAlarm.setDescription(description);
pgAlarm.setPatrolerId(pgPatrolerManager.getPatrolerByuserName(userName));
- pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevName(devName));
+ pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode));
logger.info("成功保存");
pgAlarmManager.save(pgAlarm);
@@ -165,4 +166,31 @@
return resultMap;
}
+ /**
+ * 历史报警统计
+ */
+ @POST
+ @Path("getAlarmTypeCountAmongDate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getAlarmTJByDate(@FormParam("startDate") String startDate,
+ @FormParam("endDate") String endDate)throws Exception{
+ Map resultMap = new HashMap();
+ String result = "";
+ String msg = "";
+ try{
+ List pgAlarmTjDtoList=new ArrayList();
+
+
+
+ }
+ catch(Exception ex)
+ {
+ result="false";
+ msg="统计失败";
+ }
+ resultMap.put("result",result);
+ resultMap.put("msg",msg);
+ return resultMap;
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index d9104b7..7e587a1 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -5,6 +5,7 @@
import com.casic.PgInterface.devTable.domain.PipeGallery;
import com.casic.PgInterface.devTable.dto.PgDeviceDto;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import com.casic.PgInterface.devTable.manager.PipeGalleryManager;
import org.slf4j.Logger;
@@ -34,6 +35,8 @@
private PgDeviceManager pgDeviceManager;
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
private PgPartitionManager pgPartitionManager;
private PipeGalleryManager pipeGalleryManager;
@@ -53,6 +56,11 @@
this.pipeGalleryManager = pipeGalleryManager;
}
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
/**
* 获取设备信息
*/
@@ -76,6 +84,7 @@
return resultMap;
}
+
/**
* 显示设备列表
*/
@@ -108,6 +117,7 @@
@Path("addDevice")
@Produces(MediaType.APPLICATION_JSON)
public Map addLog(@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@@ -135,12 +145,14 @@
} else {
PgDevice pgDevice = new PgDevice();
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(0);
pgDevice.setActive(1);
pgDeviceManager.save(pgDevice);
@@ -168,12 +180,14 @@
@Produces(MediaType.APPLICATION_JSON)
public Map editPartition(@FormParam("id") String id,
@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@FormParam("installDate") String installDate,
@FormParam("pgName") String pgName,
- @FormParam("parName") String parName) throws Exception {
+ @FormParam("parName") String parName,
+ @FormParam("isOpen") String isOpen) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -193,12 +207,14 @@
msg = "已存在同名设备";
} else {
PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
pgDeviceManager.save(pgDevice);
result = "true";
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
new file mode 100644
index 0000000..d7c6024
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
@@ -0,0 +1,49 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Service
+public class PgDeviceTypeManager extends HibernateEntityDao{
+
+ public List getAllDeviceType() {
+
+ Criteria criteria = createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList= criteria.list();
+ List pgDeviceTypeDtoList=new ArrayList();
+ for (PgDeviceType pgDeviceType : pgDeviceTypeList) {
+ pgDeviceTypeDtoList.add(new PgDeviceTypeDto(pgDeviceType));
+ }
+
+ return pgDeviceTypeDtoList;
+ }
+
+ public PgDeviceType getPgDeviceTypeByDevType(String devType)
+ {
+ Criteria criteria=createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("devType",devType));
+ criteria.add(Restrictions.eq("active",1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList=criteria.list();
+ if(pgDeviceTypeList==null||pgDeviceTypeList.size()==0)
+ return null;
+ else
+ return pgDeviceTypeList.get(0);
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index dab4338..874647f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -2,6 +2,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+import com.casic.PgInterface.devTable.dto.PgAlarmTjDto;
import com.casic.PgInterface.devTable.manager.PgAlarmManager;
import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
@@ -125,11 +126,11 @@
@POST
@Path("addAlarm")
@Produces(MediaType.APPLICATION_JSON)
- public Map addAlarm(@FormParam("alarmTypeId") String alarmTypeId,
+ public Map addAlarm(@FormParam("alarmType") String alarmType,
@FormParam("alarmValue") String alarmValue,
@FormParam("alarmDate") String alarmDate,
@FormParam("description") String description,
- @FormParam("devName") String devName,
+ @FormParam("devCode") String devCode,
@FormParam("userName") String userName)throws Exception {
Map resultMap = new HashMap();
String result = "";
@@ -142,12 +143,12 @@
result = "false";
msg = "不存在该用户!";
} else {
- pgAlarm.setAlarmTypeId(pgAlarmTypeManager.get(alarmTypeId));
+ pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType));
pgAlarm.setAlarmValue(alarmValue);
pgAlarm.setAlarmDate(sdf.parse(alarmDate));
pgAlarm.setDescription(description);
pgAlarm.setPatrolerId(pgPatrolerManager.getPatrolerByuserName(userName));
- pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevName(devName));
+ pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode));
logger.info("成功保存");
pgAlarmManager.save(pgAlarm);
@@ -165,4 +166,31 @@
return resultMap;
}
+ /**
+ * 历史报警统计
+ */
+ @POST
+ @Path("getAlarmTypeCountAmongDate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getAlarmTJByDate(@FormParam("startDate") String startDate,
+ @FormParam("endDate") String endDate)throws Exception{
+ Map resultMap = new HashMap();
+ String result = "";
+ String msg = "";
+ try{
+ List pgAlarmTjDtoList=new ArrayList();
+
+
+
+ }
+ catch(Exception ex)
+ {
+ result="false";
+ msg="统计失败";
+ }
+ resultMap.put("result",result);
+ resultMap.put("msg",msg);
+ return resultMap;
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index d9104b7..7e587a1 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -5,6 +5,7 @@
import com.casic.PgInterface.devTable.domain.PipeGallery;
import com.casic.PgInterface.devTable.dto.PgDeviceDto;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import com.casic.PgInterface.devTable.manager.PipeGalleryManager;
import org.slf4j.Logger;
@@ -34,6 +35,8 @@
private PgDeviceManager pgDeviceManager;
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
private PgPartitionManager pgPartitionManager;
private PipeGalleryManager pipeGalleryManager;
@@ -53,6 +56,11 @@
this.pipeGalleryManager = pipeGalleryManager;
}
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
/**
* 获取设备信息
*/
@@ -76,6 +84,7 @@
return resultMap;
}
+
/**
* 显示设备列表
*/
@@ -108,6 +117,7 @@
@Path("addDevice")
@Produces(MediaType.APPLICATION_JSON)
public Map addLog(@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@@ -135,12 +145,14 @@
} else {
PgDevice pgDevice = new PgDevice();
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(0);
pgDevice.setActive(1);
pgDeviceManager.save(pgDevice);
@@ -168,12 +180,14 @@
@Produces(MediaType.APPLICATION_JSON)
public Map editPartition(@FormParam("id") String id,
@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@FormParam("installDate") String installDate,
@FormParam("pgName") String pgName,
- @FormParam("parName") String parName) throws Exception {
+ @FormParam("parName") String parName,
+ @FormParam("isOpen") String isOpen) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -193,12 +207,14 @@
msg = "已存在同名设备";
} else {
PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
pgDeviceManager.save(pgDevice);
result = "true";
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java
new file mode 100644
index 0000000..b872eb4
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java
@@ -0,0 +1,84 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Component
+@Path("pgDeviceType")
+public class PgDeviceTypeRs {
+ private static Logger logger = LoggerFactory.getLogger(PgDeviceRs.class);
+
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
+ /**
+ *
+ */
+ @POST
+ @Path("getPgDeviceTypeByDevType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getPgDeviceTypeByDevType(@FormParam("devType") String devType) throws Exception {
+ Map resultMap = new HashMap();
+ String msg = "";
+ PgDeviceTypeDto pgDeviceTypeDto=null;
+ try {
+ PgDeviceType pgDeviceType = pgDeviceTypeManager.getPgDeviceTypeByDevType(devType);
+ pgDeviceTypeDto=new PgDeviceTypeDto(pgDeviceType);
+ msg = "获取成功";
+ } catch (Exception e) {
+ msg = "获取失败";
+ e.printStackTrace();
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgDeviceTypeDto);
+ return resultMap;
+ }
+
+ /**
+ * 获取设备类型
+ */
+ @POST
+ @Path("getDeviceType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getDeviceType()throws Exception {
+ Map resultMap = new HashMap();
+ String msg="";
+ List pgDeviceTypeDtoList=new ArrayList();
+ try {
+ pgDeviceTypeDtoList = pgDeviceTypeManager.getAllDeviceType();
+ if(pgDeviceTypeDtoList.size()==0)
+ msg="没有设备类型信息";
+ else
+ msg="设备类型获取失败";
+ }catch(Exception e){
+ e.printStackTrace();
+ msg="设备类型信息获取失败";
+ }
+ resultMap.put("msg",msg);
+ resultMap.put("result",pgDeviceTypeDtoList);
+ return resultMap;
+ }
+
+}
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
new file mode 100644
index 0000000..d7c6024
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
@@ -0,0 +1,49 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Service
+public class PgDeviceTypeManager extends HibernateEntityDao{
+
+ public List getAllDeviceType() {
+
+ Criteria criteria = createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList= criteria.list();
+ List pgDeviceTypeDtoList=new ArrayList();
+ for (PgDeviceType pgDeviceType : pgDeviceTypeList) {
+ pgDeviceTypeDtoList.add(new PgDeviceTypeDto(pgDeviceType));
+ }
+
+ return pgDeviceTypeDtoList;
+ }
+
+ public PgDeviceType getPgDeviceTypeByDevType(String devType)
+ {
+ Criteria criteria=createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("devType",devType));
+ criteria.add(Restrictions.eq("active",1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList=criteria.list();
+ if(pgDeviceTypeList==null||pgDeviceTypeList.size()==0)
+ return null;
+ else
+ return pgDeviceTypeList.get(0);
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index dab4338..874647f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -2,6 +2,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+import com.casic.PgInterface.devTable.dto.PgAlarmTjDto;
import com.casic.PgInterface.devTable.manager.PgAlarmManager;
import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
@@ -125,11 +126,11 @@
@POST
@Path("addAlarm")
@Produces(MediaType.APPLICATION_JSON)
- public Map addAlarm(@FormParam("alarmTypeId") String alarmTypeId,
+ public Map addAlarm(@FormParam("alarmType") String alarmType,
@FormParam("alarmValue") String alarmValue,
@FormParam("alarmDate") String alarmDate,
@FormParam("description") String description,
- @FormParam("devName") String devName,
+ @FormParam("devCode") String devCode,
@FormParam("userName") String userName)throws Exception {
Map resultMap = new HashMap();
String result = "";
@@ -142,12 +143,12 @@
result = "false";
msg = "不存在该用户!";
} else {
- pgAlarm.setAlarmTypeId(pgAlarmTypeManager.get(alarmTypeId));
+ pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType));
pgAlarm.setAlarmValue(alarmValue);
pgAlarm.setAlarmDate(sdf.parse(alarmDate));
pgAlarm.setDescription(description);
pgAlarm.setPatrolerId(pgPatrolerManager.getPatrolerByuserName(userName));
- pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevName(devName));
+ pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode));
logger.info("成功保存");
pgAlarmManager.save(pgAlarm);
@@ -165,4 +166,31 @@
return resultMap;
}
+ /**
+ * 历史报警统计
+ */
+ @POST
+ @Path("getAlarmTypeCountAmongDate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getAlarmTJByDate(@FormParam("startDate") String startDate,
+ @FormParam("endDate") String endDate)throws Exception{
+ Map resultMap = new HashMap();
+ String result = "";
+ String msg = "";
+ try{
+ List pgAlarmTjDtoList=new ArrayList();
+
+
+
+ }
+ catch(Exception ex)
+ {
+ result="false";
+ msg="统计失败";
+ }
+ resultMap.put("result",result);
+ resultMap.put("msg",msg);
+ return resultMap;
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index d9104b7..7e587a1 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -5,6 +5,7 @@
import com.casic.PgInterface.devTable.domain.PipeGallery;
import com.casic.PgInterface.devTable.dto.PgDeviceDto;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import com.casic.PgInterface.devTable.manager.PipeGalleryManager;
import org.slf4j.Logger;
@@ -34,6 +35,8 @@
private PgDeviceManager pgDeviceManager;
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
private PgPartitionManager pgPartitionManager;
private PipeGalleryManager pipeGalleryManager;
@@ -53,6 +56,11 @@
this.pipeGalleryManager = pipeGalleryManager;
}
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
/**
* 获取设备信息
*/
@@ -76,6 +84,7 @@
return resultMap;
}
+
/**
* 显示设备列表
*/
@@ -108,6 +117,7 @@
@Path("addDevice")
@Produces(MediaType.APPLICATION_JSON)
public Map addLog(@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@@ -135,12 +145,14 @@
} else {
PgDevice pgDevice = new PgDevice();
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(0);
pgDevice.setActive(1);
pgDeviceManager.save(pgDevice);
@@ -168,12 +180,14 @@
@Produces(MediaType.APPLICATION_JSON)
public Map editPartition(@FormParam("id") String id,
@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@FormParam("installDate") String installDate,
@FormParam("pgName") String pgName,
- @FormParam("parName") String parName) throws Exception {
+ @FormParam("parName") String parName,
+ @FormParam("isOpen") String isOpen) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -193,12 +207,14 @@
msg = "已存在同名设备";
} else {
PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
pgDeviceManager.save(pgDevice);
result = "true";
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java
new file mode 100644
index 0000000..b872eb4
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java
@@ -0,0 +1,84 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Component
+@Path("pgDeviceType")
+public class PgDeviceTypeRs {
+ private static Logger logger = LoggerFactory.getLogger(PgDeviceRs.class);
+
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
+ /**
+ *
+ */
+ @POST
+ @Path("getPgDeviceTypeByDevType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getPgDeviceTypeByDevType(@FormParam("devType") String devType) throws Exception {
+ Map resultMap = new HashMap();
+ String msg = "";
+ PgDeviceTypeDto pgDeviceTypeDto=null;
+ try {
+ PgDeviceType pgDeviceType = pgDeviceTypeManager.getPgDeviceTypeByDevType(devType);
+ pgDeviceTypeDto=new PgDeviceTypeDto(pgDeviceType);
+ msg = "获取成功";
+ } catch (Exception e) {
+ msg = "获取失败";
+ e.printStackTrace();
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgDeviceTypeDto);
+ return resultMap;
+ }
+
+ /**
+ * 获取设备类型
+ */
+ @POST
+ @Path("getDeviceType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getDeviceType()throws Exception {
+ Map resultMap = new HashMap();
+ String msg="";
+ List pgDeviceTypeDtoList=new ArrayList();
+ try {
+ pgDeviceTypeDtoList = pgDeviceTypeManager.getAllDeviceType();
+ if(pgDeviceTypeDtoList.size()==0)
+ msg="没有设备类型信息";
+ else
+ msg="设备类型获取失败";
+ }catch(Exception e){
+ e.printStackTrace();
+ msg="设备类型信息获取失败";
+ }
+ resultMap.put("msg",msg);
+ resultMap.put("result",pgDeviceTypeDtoList);
+ return resultMap;
+ }
+
+}
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\216.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\216.docx"
index 6529026..f0d98f0 100644
--- "a/\346\216\245\345\217\243\350\257\264\346\230\216.docx"
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\216.docx"
Binary files differ
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
index 0586b8c..e75204e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDevice.java
@@ -19,12 +19,14 @@
private static final long serialVersionUID = 1L;
private long id;
- private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private Date installDate;//安装时间
+ private int isOpen;//设备是否开启
private int active;//状态位
+ private PgDeviceType devTypeId;//设备类型
private List pgAlarms;
private PgPartition pgPartitionId;//所在管廊信息
private List pgSenseDevs;//
@@ -39,17 +41,15 @@
this.id = id;
}
- @Column(name = "DEV_TYPE")
- public String getDevType() {
- return devType;
+ @Column(name = "DEV_CODE")
+ public String getDevCode() {
+ return devCode;
}
- public void setDevType(String devType) {
- this.devType = devType;
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
}
-
-
@Column(name = "DEV_NAME")
public String getDevName() {
return devName;
@@ -86,6 +86,15 @@
this.installDate = installDate;
}
+ @Column(name = "ISOPEN")
+ public int getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(int isOpen) {
+ this.isOpen = isOpen;
+ }
+
@Column(name = "ACTIVE")
public int getActive() {
return active;
@@ -115,6 +124,17 @@
this.pgPartitionId = pgPartitionId;
}
+ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
+ @NotFound(action = NotFoundAction.IGNORE)
+ @JoinColumn(name = "DEVICE_TYPE_ID")
+ public PgDeviceType getDevTypeId() {
+ return devTypeId;
+ }
+
+ public void setDevTypeId(PgDeviceType devTypeId) {
+ this.devTypeId = devTypeId;
+ }
+
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgDeviceId")
public List getPgSenseDevs() {
return pgSenseDevs;
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
new file mode 100644
index 0000000..22bca34
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgDeviceType.java
@@ -0,0 +1,57 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Entity
+@Table(name = "PG_DEVICE_TYPE")
+@SequenceGenerator(name = "SEQ_PG_DEVICE_TYPE_ID", sequenceName = "SEQ_PG_DEVICE_TYPE_ID", allocationSize = 1, initialValue = 1)
+public class PgDeviceType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private long id;
+ private String devType;
+ private String active;
+ private List pgDeviceList;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_DEVICE_TYPE_ID")
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name = "DEV_TYPE")
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ @Column(name = "ACTIVE")
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "devTypeId")
+ public List getPgDeviceList() {
+ return pgDeviceList;
+ }
+
+ public void setPgDeviceList(List pgDeviceList) {
+ this.pgDeviceList = pgDeviceList;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
new file mode 100644
index 0000000..74ba162
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmTjDto.java
@@ -0,0 +1,47 @@
+package com.casic.PgInterface.devTable.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjDto implements Serializable {
+
+ private String alarmNum;//发生报警次数
+ private String alarmMonth;//报警月份
+ private String alarmType;//报警类型
+ private String alarmPG;//发生区域
+
+ public String getAlarmNum() {
+ return alarmNum;
+ }
+
+ public void setAlarmNum(String alarmNum) {
+ this.alarmNum = alarmNum;
+ }
+
+ public String getAlarmMonth() {
+ return alarmMonth;
+ }
+
+ public void setAlarmMonth(String alarmMonth) {
+ this.alarmMonth = alarmMonth;
+ }
+
+ public String getAlarmType() {
+ return alarmType;
+ }
+
+ public void setAlarmType(String alarmType) {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmPG() {
+ return alarmPG;
+ }
+
+ public void setAlarmPG(String alarmPG) {
+ this.alarmPG = alarmPG;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
index d76fdf5..ae76e95 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceDto.java
@@ -12,10 +12,12 @@
private String id;
private String devType;//设备类型
+ private String devCode;//设备编号
private String devName;//设备名称
private String brand;//品牌
private String ownerUnit;//权属单位
private String installDate;//安装时间
+ private String isOpen;//设备开启状态
private String active;//状态位
private String pipeGallery;//仓位
private String partition;//分区
@@ -36,6 +38,14 @@
this.devType = devType;
}
+ public String getDevCode() {
+ return devCode;
+ }
+
+ public void setDevCode(String devCode) {
+ this.devCode = devCode;
+ }
+
public String getDevName() {
return devName;
}
@@ -68,6 +78,14 @@
this.installDate = installDate;
}
+ public String getIsOpen() {
+ return isOpen;
+ }
+
+ public void setIsOpen(String isOpen) {
+ this.isOpen = isOpen;
+ }
+
public String getActive() {
return active;
}
@@ -97,11 +115,13 @@
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgDevice.getId()));
- this.setDevType(pgDevice.getDevType());
+ this.setDevType(pgDevice.getDevTypeId().getDevType());
+ this.setDevCode(pgDevice.getDevCode());
this.setDevName(pgDevice.getDevName());
this.setBrand(pgDevice.getBrand());
this.setOwnerUnit(pgDevice.getOwnerUnit());
this.setInstallDate(sdf.format(pgDevice.getInstallDate()));
+ this.setIsOpen(String.valueOf(pgDevice.getIsOpen()));
this.setActive(String.valueOf(pgDevice.getActive()));
this.setPipeGallery(pgDevice.getPgPartitionId().getPipeGalleryId().getPgName());
this.setPartition(pgDevice.getPgPartitionId().getParName());
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
new file mode 100644
index 0000000..3ca0260
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgDeviceTypeDto.java
@@ -0,0 +1,48 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+
+import java.io.Serializable;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+public class PgDeviceTypeDto implements Serializable {
+
+ private String id;
+ private String devType;
+ private String active;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDevType() {
+ return devType;
+ }
+
+ public void setDevType(String devType) {
+ this.devType = devType;
+ }
+
+ public String getActive() {
+ return active;
+ }
+
+ public void setActive(String active) {
+ this.active = active;
+ }
+
+ public PgDeviceTypeDto(PgDeviceType pgDeviceType)
+ {
+ this.setId(String.valueOf(pgDeviceType.getId()));
+ this.setDevType(pgDeviceType.getDevType());
+ this.setActive(pgDeviceType.getActive());
+
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
new file mode 100644
index 0000000..3df56e8
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmTjManager.java
@@ -0,0 +1,52 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgAlarm;
+import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/22.
+ */
+public class PgAlarmTjManager extends HibernateEntityDao {
+
+ private PgAlarmTypeManager pgAlarmTypeManager;
+
+ @Resource
+ public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) {
+ this.pgAlarmTypeManager = pgAlarmTypeManager;
+ }
+
+ //
+ public List getAlarmAmongDate(String startDate,String endDate) throws Exception {
+
+ /*
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ List pgAlarmTypeDtoList = pgAlarmTypeManager.getAllAlarmType();
+
+ Criteria criteria = createCriteria(PgAlarm.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ if (StringUtils.isNotBlank(startDate)) {
+ criteria.add(Restrictions.ge("alarmDate", sdf.parse(startDate)));
+ }
+ if (StringUtils.isNotBlank(endDate)) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(sdf.parse(endDate));
+ calendar.add(Calendar.DATE, 1);
+ criteria.add(Restrictions.le("alarmDate", calendar.getTime()));
+ }
+ Map paraMap = new HashMap();
+
+ String hql = " select count(pgAlarm),pgAlarm.alarmType from PG_ALARM pgAlarm GROUP BY pgAlarm.alarmType";
+
+ this.createQuery(hql, paraMap).list();
+
+*/
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
index 15f55a0..758049e 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -34,6 +34,7 @@
return pgDeviceDtoList;
}
+ //根据名字获取当前设备
public PgDevice getDeviceBydevName(String devName) {
Criteria criteria=createCriteria(PgDevice.class);
criteria.add(Restrictions.eq("devName",devName));
@@ -45,5 +46,17 @@
return pgDeviceList.get(0);
}
+ //根据名字获取当前设备
+ public PgDevice getDeviceBydevCode(String devCode) {
+ Criteria criteria=createCriteria(PgDevice.class);
+ criteria.add(Restrictions.eq("devCode",devCode));
+
+ List pgDeviceList=criteria.list();
+ if(pgDeviceList.size()==0)
+ return null;
+ else
+ return pgDeviceList.get(0);
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
new file mode 100644
index 0000000..d7c6024
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceTypeManager.java
@@ -0,0 +1,49 @@
+package com.casic.PgInterface.devTable.manager;
+
+import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Service
+public class PgDeviceTypeManager extends HibernateEntityDao{
+
+ public List getAllDeviceType() {
+
+ Criteria criteria = createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("active", 1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList= criteria.list();
+ List pgDeviceTypeDtoList=new ArrayList();
+ for (PgDeviceType pgDeviceType : pgDeviceTypeList) {
+ pgDeviceTypeDtoList.add(new PgDeviceTypeDto(pgDeviceType));
+ }
+
+ return pgDeviceTypeDtoList;
+ }
+
+ public PgDeviceType getPgDeviceTypeByDevType(String devType)
+ {
+ Criteria criteria=createCriteria(PgDeviceType.class);
+ criteria.add(Restrictions.eq("devType",devType));
+ criteria.add(Restrictions.eq("active",1));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgDeviceTypeList=criteria.list();
+ if(pgDeviceTypeList==null||pgDeviceTypeList.size()==0)
+ return null;
+ else
+ return pgDeviceTypeList.get(0);
+ }
+
+}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index dab4338..874647f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -2,6 +2,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.devTable.dto.PgAlarmDto;
+import com.casic.PgInterface.devTable.dto.PgAlarmTjDto;
import com.casic.PgInterface.devTable.manager.PgAlarmManager;
import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
@@ -125,11 +126,11 @@
@POST
@Path("addAlarm")
@Produces(MediaType.APPLICATION_JSON)
- public Map addAlarm(@FormParam("alarmTypeId") String alarmTypeId,
+ public Map addAlarm(@FormParam("alarmType") String alarmType,
@FormParam("alarmValue") String alarmValue,
@FormParam("alarmDate") String alarmDate,
@FormParam("description") String description,
- @FormParam("devName") String devName,
+ @FormParam("devCode") String devCode,
@FormParam("userName") String userName)throws Exception {
Map resultMap = new HashMap();
String result = "";
@@ -142,12 +143,12 @@
result = "false";
msg = "不存在该用户!";
} else {
- pgAlarm.setAlarmTypeId(pgAlarmTypeManager.get(alarmTypeId));
+ pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType));
pgAlarm.setAlarmValue(alarmValue);
pgAlarm.setAlarmDate(sdf.parse(alarmDate));
pgAlarm.setDescription(description);
pgAlarm.setPatrolerId(pgPatrolerManager.getPatrolerByuserName(userName));
- pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevName(devName));
+ pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode));
logger.info("成功保存");
pgAlarmManager.save(pgAlarm);
@@ -165,4 +166,31 @@
return resultMap;
}
+ /**
+ * 历史报警统计
+ */
+ @POST
+ @Path("getAlarmTypeCountAmongDate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getAlarmTJByDate(@FormParam("startDate") String startDate,
+ @FormParam("endDate") String endDate)throws Exception{
+ Map resultMap = new HashMap();
+ String result = "";
+ String msg = "";
+ try{
+ List pgAlarmTjDtoList=new ArrayList();
+
+
+
+ }
+ catch(Exception ex)
+ {
+ result="false";
+ msg="统计失败";
+ }
+ resultMap.put("result",result);
+ resultMap.put("msg",msg);
+ return resultMap;
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index d9104b7..7e587a1 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -5,6 +5,7 @@
import com.casic.PgInterface.devTable.domain.PipeGallery;
import com.casic.PgInterface.devTable.dto.PgDeviceDto;
import com.casic.PgInterface.devTable.manager.PgDeviceManager;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import com.casic.PgInterface.devTable.manager.PipeGalleryManager;
import org.slf4j.Logger;
@@ -34,6 +35,8 @@
private PgDeviceManager pgDeviceManager;
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
private PgPartitionManager pgPartitionManager;
private PipeGalleryManager pipeGalleryManager;
@@ -53,6 +56,11 @@
this.pipeGalleryManager = pipeGalleryManager;
}
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
/**
* 获取设备信息
*/
@@ -76,6 +84,7 @@
return resultMap;
}
+
/**
* 显示设备列表
*/
@@ -108,6 +117,7 @@
@Path("addDevice")
@Produces(MediaType.APPLICATION_JSON)
public Map addLog(@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@@ -135,12 +145,14 @@
} else {
PgDevice pgDevice = new PgDevice();
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(0);
pgDevice.setActive(1);
pgDeviceManager.save(pgDevice);
@@ -168,12 +180,14 @@
@Produces(MediaType.APPLICATION_JSON)
public Map editPartition(@FormParam("id") String id,
@FormParam("devType") String devType,
+ @FormParam("devCode") String devCode,
@FormParam("devName") String devName,
@FormParam("brand") String brand,
@FormParam("ownerUnit") String ownerUnit,
@FormParam("installDate") String installDate,
@FormParam("pgName") String pgName,
- @FormParam("parName") String parName) throws Exception {
+ @FormParam("parName") String parName,
+ @FormParam("isOpen") String isOpen) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -193,12 +207,14 @@
msg = "已存在同名设备";
} else {
PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setDevType(devType);
+ pgDevice.setDevTypeId(pgDeviceTypeManager.getPgDeviceTypeByDevType(devType));
+ pgDevice.setDevCode(devCode);
pgDevice.setDevName(devName);
pgDevice.setBrand(brand);
pgDevice.setOwnerUnit(ownerUnit);
pgDevice.setInstallDate(sdf.parse(installDate));
pgDevice.setPgPartitionId(pgPartition);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
pgDeviceManager.save(pgDevice);
result = "true";
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java
new file mode 100644
index 0000000..b872eb4
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceTypeRs.java
@@ -0,0 +1,84 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgDeviceType;
+import com.casic.PgInterface.devTable.dto.PgDeviceTypeDto;
+import com.casic.PgInterface.devTable.manager.PgDeviceTypeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by yxw on 2017/11/23.
+ */
+@Component
+@Path("pgDeviceType")
+public class PgDeviceTypeRs {
+ private static Logger logger = LoggerFactory.getLogger(PgDeviceRs.class);
+
+ private PgDeviceTypeManager pgDeviceTypeManager;
+
+ @Resource
+ public void setPgDeviceTypeManager(PgDeviceTypeManager pgDeviceTypeManager) {
+ this.pgDeviceTypeManager = pgDeviceTypeManager;
+ }
+
+ /**
+ *
+ */
+ @POST
+ @Path("getPgDeviceTypeByDevType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getPgDeviceTypeByDevType(@FormParam("devType") String devType) throws Exception {
+ Map resultMap = new HashMap();
+ String msg = "";
+ PgDeviceTypeDto pgDeviceTypeDto=null;
+ try {
+ PgDeviceType pgDeviceType = pgDeviceTypeManager.getPgDeviceTypeByDevType(devType);
+ pgDeviceTypeDto=new PgDeviceTypeDto(pgDeviceType);
+ msg = "获取成功";
+ } catch (Exception e) {
+ msg = "获取失败";
+ e.printStackTrace();
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgDeviceTypeDto);
+ return resultMap;
+ }
+
+ /**
+ * 获取设备类型
+ */
+ @POST
+ @Path("getDeviceType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getDeviceType()throws Exception {
+ Map resultMap = new HashMap();
+ String msg="";
+ List pgDeviceTypeDtoList=new ArrayList();
+ try {
+ pgDeviceTypeDtoList = pgDeviceTypeManager.getAllDeviceType();
+ if(pgDeviceTypeDtoList.size()==0)
+ msg="没有设备类型信息";
+ else
+ msg="设备类型获取失败";
+ }catch(Exception e){
+ e.printStackTrace();
+ msg="设备类型信息获取失败";
+ }
+ resultMap.put("msg",msg);
+ resultMap.put("result",pgDeviceTypeDtoList);
+ return resultMap;
+ }
+
+}
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\216.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\216.docx"
index 6529026..f0d98f0 100644
--- "a/\346\216\245\345\217\243\350\257\264\346\230\216.docx"
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\216.docx"
Binary files differ
diff --git "a/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216.docx" "b/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216.docx"
index 24c6001..92e8fa2 100644
--- "a/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216.docx"
+++ "b/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216.docx"
Binary files differ