diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..d0a7435
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..d0a7435
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190612.docx" "b/~$\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..5cfb046
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..d0a7435
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190612.docx" "b/~$\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..5cfb046
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
deleted file mode 100644
index 833b97a..0000000
--- "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
+++ /dev/null
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..d0a7435
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190612.docx" "b/~$\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..5cfb046
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
deleted file mode 100644
index 833b97a..0000000
--- "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
+++ /dev/null
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx"
new file mode 100644
index 0000000..60b395f
--- /dev/null
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx"
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..d0a7435
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190612.docx" "b/~$\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..5cfb046
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
deleted file mode 100644
index 833b97a..0000000
--- "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
+++ /dev/null
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx"
new file mode 100644
index 0000000..60b395f
--- /dev/null
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\21620190726.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\21620190522.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\21620190522.docx"
deleted file mode 100644
index ff3fe91..0000000
--- "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\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9f6565..de0c6a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,30 @@
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -28,37 +44,47 @@
-
+
+
-
+
+
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
@@ -79,6 +105,7 @@
getAlarmList
compositeFilter
alarmTypeId
+ getPipeGalleryByPgName
@@ -96,10 +123,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -135,18 +178,15 @@
-
-
-
-
+
+
+
-
-
@@ -172,17 +212,27 @@
+
+
+
+
+
+
+
+
+
+
-
+
@@ -290,16 +340,26 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -310,7 +370,7 @@
-
+
@@ -390,20 +450,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -468,13 +514,6 @@
-
-
-
-
-
-
-
@@ -507,25 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -533,20 +553,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -554,19 +560,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -584,39 +577,250 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
new file mode 100644
index 0000000..4ce2758
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgIntelPlan.java
@@ -0,0 +1,73 @@
+package com.casic.PgInterface.devTable.domain;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "PG_INTELPLAN")
+@SequenceGenerator(name = "SEQ_PG_INTELPLAN_ID", sequenceName = "SEQ_PG_INTELPLAN_ID", allocationSize = 1, initialValue = 1)
+public class PgIntelPlan implements Serializable {
+
+ private Long id;
+ private String parName;//分区
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean active;//状态位
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_INTELPLAN_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "PARNAME")
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ @Column(name = "LINENAME")
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ @Column(name = "MAXNUM")
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ @Column(name = "EXISTNUM")
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ @Column(name = "ACTIVE")
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
index eafd0c8..d76e835 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java
@@ -1,11 +1,8 @@
package com.casic.PgInterface.devTable.domain;
-import com.casic.PgInterface.construction.domain.PgConstruction;
-
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
/**
* Created by yxw on 2017/10/31.
@@ -26,9 +23,7 @@
private Date buildDate;//建设年代
private String material;//建设材质
private int active;//状态位
- private long pgRoadId;//所属道路
- private List pipeGalleryList;//管廊仓
-// private List pgConstructionList;//施工
+ private Long pgRoadId;//所属道路
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID")
@@ -49,15 +44,6 @@
this.parName = parName;
}
-// @Column(name = "ROAD")
-// public String getRoad() {
-// return road;
-// }
-//
-// public void setRoad(String road) {
-// this.road = road;
-// }
-
@Column(name = "PGPOSITION")
public String getPgPosition() {
return pgPosition;
@@ -122,30 +108,12 @@
}
@Column(name="PGROADID")
- public long getPgRoadId() {
+ public Long getPgRoadId() {
return pgRoadId;
}
- public void setPgRoadId(long pgRoadId) {
+ public void setPgRoadId(Long pgRoadId) {
this.pgRoadId = pgRoadId;
}
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
- public List getPipeGalleryList() {
- return pipeGalleryList;
- }
-
- public void setPipeGalleryList(List pipeGalleryList) {
- this.pipeGalleryList = pipeGalleryList;
- }
-
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId")
-// public List getPgConstructionList() {
-// return pgConstructionList;
-// }
-//
-// public void setPgConstructionList(List pgConstructionList) {
-// this.pgConstructionList = pgConstructionList;
-// }
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
index da9622e..bd0faff 100644
--- a/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
+++ b/src/main/java/com/casic/PgInterface/devTable/domain/PipeGallery.java
@@ -20,7 +20,7 @@
private String pgName;//管廊名称
private double pgLength;//仓体长度
private int active;//状态位
- private PgPartition pgPartitionId;//
+ private Long pgPartitionId;//
private List pgPipeLineList;
@Id
@@ -60,14 +60,12 @@
this.active = active;
}
- @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
- @NotFound(action = NotFoundAction.IGNORE)
- @JoinColumn(name = "PARTITIONID")
- public PgPartition getPgPartitionId() {
+ @Column(name = "PARTITIONID")
+ public Long getPgPartitionId() {
return pgPartitionId;
}
- public void setPgPartitionId(PgPartition pgPartitionId) {
+ public void setPgPartitionId(Long pgPartitionId) {
this.pgPartitionId = pgPartitionId;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
new file mode 100644
index 0000000..2fdc613
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanDto.java
@@ -0,0 +1,96 @@
+package com.casic.PgInterface.devTable.dto;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PgIntelPlanDto {
+
+ private Long id;
+ private String parName;//分区名称
+ private String lineName;//排线名称
+ private int maxNum;//最大排线数
+ private int existNum;//当前排线数
+ private boolean canStore;//是否可以入库
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getParName() {
+ return parName;
+ }
+
+ public void setParName(String parName) {
+ this.parName = parName;
+ }
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+
+ public int getMaxNum() {
+ return maxNum;
+ }
+
+ public void setMaxNum(int maxNum) {
+ this.maxNum = maxNum;
+ }
+
+ public int getExistNum() {
+ return existNum;
+ }
+
+ public void setExistNum(int existNum) {
+ this.existNum = existNum;
+ }
+
+ public boolean isCanStore() {
+ return canStore;
+ }
+
+ public void setCanStore(boolean canStore) {
+ this.canStore = canStore;
+ }
+
+ public static PgIntelPlanDto ConvertToDTO(PgIntelPlan pgIntelPlan){
+
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+
+ pgIntelPlanDto.setId(pgIntelPlan.getId());
+ pgIntelPlanDto.setParName(pgIntelPlan.getParName());
+ pgIntelPlanDto.setLineName(pgIntelPlan.getLineName());
+ pgIntelPlanDto.setMaxNum(pgIntelPlan.getMaxNum());
+ pgIntelPlanDto.setExistNum(pgIntelPlan.getExistNum());
+
+ if(pgIntelPlan.getExistNum() ConvertToDTOList(List pgIntelPlanList){
+ List pgIntelPlanDtoList=new ArrayList<>();
+
+ for(PgIntelPlan pgIntelPlan:pgIntelPlanList) {
+ PgIntelPlanDto pgIntelPlanDto=new PgIntelPlanDto();
+ pgIntelPlanDto=ConvertToDTO(pgIntelPlan);
+
+ pgIntelPlanDtoList.add(pgIntelPlanDto);
+ }
+
+ return pgIntelPlanDtoList;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
new file mode 100644
index 0000000..322d445
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgIntelPlanTypeDto.java
@@ -0,0 +1,14 @@
+package com.casic.PgInterface.devTable.dto;
+
+public class PgIntelPlanTypeDto {
+
+ private String lineName;
+
+ public String getLineName() {
+ return lineName;
+ }
+
+ public void setLineName(String lineName) {
+ this.lineName = lineName;
+ }
+}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
index ecdd8ee..324d5d0 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgPipeLineDto.java
@@ -1,6 +1,7 @@
package com.casic.PgInterface.devTable.dto;
import com.casic.PgInterface.devTable.domain.PgPipeLine;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
import java.text.SimpleDateFormat;
@@ -109,7 +110,7 @@
this.active = active;
}
- public PgPipeLineDto(PgPipeLine pgPipeLine) {
+ public PgPipeLineDto(PgPipeLine pgPipeLine, PgPartitionManager pgPartitionManager) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.setId(String.valueOf(pgPipeLine.getId()));
@@ -124,7 +125,11 @@
this.setDiameter(pgPipeLine.getDiameter());
this.setPipeGallery(pgPipeLine.getPipeGalleryId().getPgName());
this.setPipeLength(String.valueOf(pgPipeLine.getPipeLength()));
- this.setPartition(pgPipeLine.getPipeGalleryId().getPgPartitionId().getParName());
+ if(pgPipeLine.getPipeGalleryId()==null||pgPipeLine.getPipeGalleryId().getPgPartitionId()==null||
+ pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId())==null)
+ this.setPartition("");
+ else
+ this.setPartition(pgPartitionManager.get(pgPipeLine.getPipeGalleryId().getPgPartitionId()).getParName());
this.setActive(String.valueOf(pgPipeLine.getActive()));
}
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
index 59d77be..c2a603d 100644
--- a/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
+++ b/src/main/java/com/casic/PgInterface/devTable/dto/PipeGalleryDto.java
@@ -1,6 +1,8 @@
package com.casic.PgInterface.devTable.dto;
+import com.casic.PgInterface.devTable.domain.PgPartition;
import com.casic.PgInterface.devTable.domain.PipeGallery;
+import com.casic.PgInterface.devTable.manager.PgPartitionManager;
/**
* Created by yxw on 2017/11/2.
@@ -53,13 +55,16 @@
this.pgPartition = pgPartition;
}
- public PipeGalleryDto(PipeGallery pipeGallery)
+ public PipeGalleryDto(PipeGallery pipeGallery, PgPartitionManager pgPartitionManager)
{
this.setId(String.valueOf(pipeGallery.getId()));
this.setPgName(pipeGallery.getPgName());
this.setPgLength(String.valueOf(pipeGallery.getPgLength()));
- this.setPgPartition(pipeGallery.getPgPartitionId().getParName());
+ if(pipeGallery.getPgPartitionId()==null||pgPartitionManager.get(pipeGallery.getPgPartitionId())==null)
+ this.setPgPartition("");
+ else
+ this.setPgPartition(pgPartitionManager.get(pipeGallery.getPgPartitionId()).getParName());
this.setActive(String.valueOf(pipeGallery.getActive()));
}
-}
+}
\ No newline at end of file
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 569c9c3..493bf06 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgDeviceManager.java
@@ -152,7 +152,7 @@
List pgDevices=(List)this.getSession().createSQLQuery(hql).list();
- List pgDeviceDtoList = new ArrayList();
+ List pgDeviceDtoList = new ArrayList<>();
for (int i = 0; i {
+
+ public List getPgIntelPlanListByPartion(String lineName,String partitionStr){
+ try {
+ List pgIntelPlanList=getPgIntelPlan(lineName,partitionStr);
+ List pgIntelPlanDtoList=PgIntelPlanDto.ConvertToDTOList(pgIntelPlanList);
+
+ return pgIntelPlanDtoList;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private List getPgIntelPlan(String lineName,String partitionStr){
+
+ List pgIntelPlanList=new ArrayList<>();
+
+ if(StringUtils.isNotBlank(partitionStr)) {
+ String[] parNameArray = partitionStr.split(",");
+ for (String parName : parNameArray) {
+
+ PgIntelPlan pgIntelPlan = getPgIntelPlanByParNameAndLine(lineName, parName);
+
+ //如果分区不存对应的排线信息
+ if (pgIntelPlan == null) {
+ pgIntelPlan = new PgIntelPlan();
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setMaxNum(0);
+ pgIntelPlan.setExistNum(0);
+ }
+ pgIntelPlanList.add(pgIntelPlan);
+ }
+ }
+ else{
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ pgIntelPlanList=criteria.list();
+ }
+
+ return pgIntelPlanList;
+ }
+
+ public PgIntelPlan getPgIntelPlanByParNameAndLine(String lineName,String parName){
+
+ Criteria criteria = createCriteria(PgIntelPlan.class);
+ if (StringUtils.isNotBlank(lineName)) {
+ criteria.add(Restrictions.eq("lineName", lineName));
+ }
+
+ if (StringUtils.isNotBlank(parName)) {
+ criteria.add(Restrictions.eq("parName", parName));
+ }
+
+ criteria.add(Restrictions.eq("active", true));
+ criteria.addOrder(Order.desc("id"));
+
+ List pgIntelPlanList=criteria.list();
+
+ if(pgIntelPlanList==null||pgIntelPlanList.size()==0)
+ return null;
+ else
+ return pgIntelPlanList.get(0);
+ }
+
+ public void savePgIntelPlan(String parName,String lineName,String maxNumStr,String existNumStr){
+
+ int maxNum= Integer.valueOf(maxNumStr);
+ int existNum=Integer.valueOf(existNumStr);
+ PgIntelPlan pgIntelPlan=null;
+
+ PgIntelPlan pgIntelPlan1=getPgIntelPlanByParNameAndLine(lineName,parName);
+ if(pgIntelPlan1!=null)
+ pgIntelPlan=pgIntelPlan1;
+ else
+ pgIntelPlan=new PgIntelPlan();
+
+ pgIntelPlan.setParName(parName);
+ pgIntelPlan.setLineName(lineName);
+ pgIntelPlan.setMaxNum(maxNum);
+ pgIntelPlan.setExistNum(existNum);
+ pgIntelPlan.setActive(true);
+
+ this.save(pgIntelPlan);
+ }
+
+ public List getIntelPlanType() {
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+
+ String sql = "select distinct lineName from PG_INTELPLAN";
+ List objects = this.getSession().createSQLQuery(sql).list();
+
+ for (Object objects1 : objects) {
+ PgIntelPlanTypeDto pgIntelPlanTypeDto=new PgIntelPlanTypeDto();
+ pgIntelPlanTypeDto.setLineName(objects1.toString());
+
+ pgIntelPlanTypeDtoList.add(pgIntelPlanTypeDto);
+ }
+
+ return pgIntelPlanTypeDtoList;
+ }
+
+ public boolean addLineUse(String lineName,String parName,String numStr){
+ PgIntelPlan pgIntelPlan=getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ int num=Integer.valueOf(numStr);
+
+ if(pgIntelPlan==null) return false;
+ else
+ {
+ int existNum=pgIntelPlan.getExistNum();
+
+ if((existNum+num)>pgIntelPlan.getMaxNum())
+ return false;
+ else{
+ pgIntelPlan.setExistNum(existNum+num);
+ this.save(pgIntelPlan);
+
+ return true;
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
index 46063a6..05840be 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPipeLineManager.java
@@ -10,6 +10,7 @@
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +20,9 @@
@Service
public class PgPipeLineManager extends HibernateEntityDao {
+ @Resource
+ private PgPartitionManager pgPartitionManager;
+
public PgPipeLine getPipeLineBylineName(String lineName) {
Criteria criteria=createCriteria(PgPipeLine.class);
criteria.add(Restrictions.eq("lineName", lineName));
@@ -37,7 +41,7 @@
List pgPipeLineList = criteria.list();
List pgPipeLineDtoList = new ArrayList();
for (PgPipeLine pgPipeLine : pgPipeLineList) {
- pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine));
+ pgPipeLineDtoList.add(new PgPipeLineDto(pgPipeLine,pgPartitionManager));
}
return pgPipeLineDtoList;
}
diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
index 375c078..697a253 100644
--- a/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
+++ b/src/main/java/com/casic/PgInterface/devTable/manager/PipeGalleryManager.java
@@ -19,19 +19,15 @@
@Service
public class PipeGalleryManager extends HibernateEntityDao {
- private PgPartitionManager pgPartitionManager;
-
@Resource
- public void setPgPartitionManager(PgPartitionManager pgPartitionManager) {
- this.pgPartitionManager = pgPartitionManager;
- }
+ private PgPartitionManager pgPartitionManager;
public PipeGallery getPipeGalleryByPgName(String pgName,PgPartition pgPartition) {
if(pgPartition==null)
return null;
Criteria criteria = getSession().createCriteria(PipeGallery.class);
criteria.add(Restrictions.eq("pgName", pgName));
- criteria.add(Restrictions.eq("pgPartitionId",pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId",pgPartition.getId()));
List pipeGalleryList = criteria.list();
@@ -47,13 +43,13 @@
PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName);
Criteria criteria = getSession().createCriteria(PipeGallery.class);
- criteria.add(Restrictions.eq("pgPartitionId", pgPartition));
+ criteria.add(Restrictions.eq("pgPartitionId", pgPartition.getId()));
List pipeGalleryList = criteria.list();
List pipeGalleryDtoList = new ArrayList();
for (PipeGallery pipeGallery : pipeGalleryList) {
- pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery));
+ pipeGalleryDtoList.add(new PipeGalleryDto(pipeGallery,pgPartitionManager));
}
return pipeGalleryDtoList;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
index 72e2640..d64dc52 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java
@@ -16,7 +16,6 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
index e7447d2..a7332a3 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java
@@ -45,8 +45,8 @@
private PgDeviceManager pgDeviceManager;
/*
- *新建工程
- */
+ *新建工程
+ */
@POST
@Path("addConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -59,7 +59,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception {
+ throws Exception {
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -114,7 +114,7 @@
@FormParam("cs_phone")String cs_phone,
@FormParam("cs_type")String cs_type,
@FormParam("pgName") String pgName)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
@@ -123,29 +123,29 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
- if (id.equals(""))
- {
- result = "false";
- msg = "请输入ID";
- }else {
- PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
+ if (id.equals(""))
+ {
+ result = "false";
+ msg = "请输入ID";
+ }else {
+ PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType);
- PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
- pgConstruction.setCs_name(cs_name);
- pgConstruction.setCs_detail(cs_detail);
- pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
- pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
- pgConstruction.setCs_charge(cs_charge);
- pgConstruction.setCs_phone(cs_phone);
- pgConstruction.setCs_type(cs_type);
- pgConstruction.setPgConstructionTypeId(pgConstructionType);
- pgConstruction.setActive(1);
- pgConstruction.setPgName(pgName);
+ PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
+ pgConstruction.setCs_name(cs_name);
+ pgConstruction.setCs_detail(cs_detail);
+ pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime));
+ pgConstruction.setCs_endTime(sdf.parse(cs_endTime));
+ pgConstruction.setCs_charge(cs_charge);
+ pgConstruction.setCs_phone(cs_phone);
+ pgConstruction.setCs_type(cs_type);
+ pgConstruction.setPgConstructionTypeId(pgConstructionType);
+ pgConstruction.setActive(1);
+ pgConstruction.setPgName(pgName);
- pgConstructionManager.save(pgConstruction);
- result = "true";
- msg = "编辑成功";
- }
+ pgConstructionManager.save(pgConstruction);
+ result = "true";
+ msg = "编辑成功";
+ }
}catch (Exception e){
result = "false";
@@ -166,7 +166,7 @@
@Path("delConstruction")
@Produces(MediaType.APPLICATION_JSON)
public Map delConstruction(@FormParam("id")String id)
- throws Exception{
+ throws Exception{
Map resultMap = new HashMap();
String result = "";
String msg = "";
@@ -174,8 +174,8 @@
PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id));
if (pgConstruction == null)
{
- result = "false";
- msg = "不存在该施工信息";
+ result = "false";
+ msg = "不存在该施工信息";
}else
{
pgConstruction.setActive(0);
@@ -229,8 +229,8 @@
@Path("getConstructionByTimeAndStatus")
@Produces(MediaType.APPLICATION_JSON)
public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime,
- @FormParam("endTime") String endTime,
- @FormParam("statisticType") String statisticType) throws Exception {
+ @FormParam("endTime") String endTime,
+ @FormParam("statisticType") String statisticType) throws Exception {
Map resultMap = new HashMap();
String msg = "";
@@ -264,16 +264,19 @@
try{
pgConstructionStiatisticList=statisticType.equals("0")?pgConstructionManager.getStatisticByType():
pgConstructionManager.getStatisticByPar();
- msg="统计信息获取成功";
+ if(pgConstructionStiatisticList==null||pgConstructionStiatisticList.size()==0)
+ msg="不存在统计信息";
+ else {
+ msg = "统计信息获取成功";
+ resultMap.put("result", pgConstructionStiatisticList);
+ }
}
catch(Exception e)
{
e.printStackTrace();
msg="统计失败";
}
-
resultMap.put("msg",msg);
- resultMap.put("result",pgConstructionStiatisticList);
return resultMap;
}
@@ -302,9 +305,9 @@
return resultMap;
}
-/**
- * 获取关联设备《摄像机》
- */
+ /**
+ * 获取关联设备《摄像机》
+ */
@POST
@Path("getConstructionDev")
@Produces(MediaType.APPLICATION_JSON)
@@ -336,8 +339,8 @@
}
/*
- * 获取施工信息
- */
+ * 获取施工信息
+ */
@POST
@Path("getConstruction")
@Produces(MediaType.APPLICATION_JSON)
@@ -366,5 +369,4 @@
return resultMap;
}
-
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
index 1809ffb..7ce1ada 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgDeviceRs.java
@@ -31,10 +31,6 @@
@Resource
private PgDeviceManager pgDeviceManager;
- @Resource
- private PgPartitionManager pgPartitionManager;
- @Resource
- private PipeGalleryManager pipeGalleryManager;
/**
* 根据设备类型获取设备信息
@@ -48,13 +44,19 @@
List pgDeviceDtoList=new ArrayList();
try {
pgDeviceDtoList = pgDeviceManager.getDeviceByDevTypee(devType);
- msg = "获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0){
+ msg="不存在满足要求的数据";
+ resultMap.put("result",null);
+ }
+ else{
+ resultMap.put("result", pgDeviceDtoList);
+ msg = "获取成功";
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDtoList);
return resultMap;
}
@@ -70,14 +72,22 @@
PgDeviceDto pgDeviceDto=null;
try {
PgDevice pgDevice = pgDeviceManager.getDeviceByAssetCode(assetCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- msg = "获取成功";
+ if(pgDevice==null)
+ {
+ msg="不存在设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "获取成功";
+ resultMap.put("result", pgDeviceDto);
+ }
} catch (Exception e) {
msg = "获取失败";
e.printStackTrace();
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDeviceDto);
+
return resultMap;
}
@@ -95,16 +105,20 @@
List pgDeviceDtoList=new ArrayList<>();
try {
pgDeviceDtoList = pgDeviceManager.getAllDevice(road,partition,devType);
- if(pgDeviceDtoList.size()==0)
- msg="没有找到设备信息";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList.size()==0) {
+ msg = "没有找到设备信息";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result", pgDeviceDtoList);
+ }
}catch(Exception e){
e.printStackTrace();
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
+
return resultMap;
}
@@ -203,25 +217,25 @@
msg = "已存在同名设备";
} else {
*/
- PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
- pgDevice.setPipeGallery(pipeGallery);
- pgDevice.setPartition(partition);
- pgDevice.setRoad(road);
- pgDevice.setPosition(position);
- pgDevice.setDevType(devType);
- pgDevice.setDevCode(devCode);
- pgDevice.setAssetName(assetName);
- pgDevice.setAssetCode(assetCode);
- pgDevice.setAssetBarCode(assetBarCode);
- pgDevice.setIp(ip);
- pgDevice.setModBus(modBus);
- pgDevice.setMome(mome);
- pgDevice.setActive(1);
- pgDevice.setIsOpen(Integer.valueOf(isOpen));
+ PgDevice pgDevice = pgDeviceManager.get(Long.valueOf(id));
+ pgDevice.setPipeGallery(pipeGallery);
+ pgDevice.setPartition(partition);
+ pgDevice.setRoad(road);
+ pgDevice.setPosition(position);
+ pgDevice.setDevType(devType);
+ pgDevice.setDevCode(devCode);
+ pgDevice.setAssetName(assetName);
+ pgDevice.setAssetCode(assetCode);
+ pgDevice.setAssetBarCode(assetBarCode);
+ pgDevice.setIp(ip);
+ pgDevice.setModBus(modBus);
+ pgDevice.setMome(mome);
+ pgDevice.setActive(1);
+ pgDevice.setIsOpen(Integer.valueOf(isOpen));
- pgDeviceManager.save(pgDevice);
- result = "true";
- msg = "编辑成功";
+ pgDeviceManager.save(pgDevice);
+ result = "true";
+ msg = "编辑成功";
//}
} catch (Exception e) {
result = "false";
@@ -283,11 +297,15 @@
try{
PgDevice pgDevice=pgDeviceManager.getDeviceBydevCode(devCode);
- pgDeviceDto=new PgDeviceDto(pgDevice);
- if(pgDeviceDto==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDevice==null) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else{
+ pgDeviceDto = new PgDeviceDto(pgDevice);
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDto);
+ }
}
catch(Exception ex)
{
@@ -295,12 +313,12 @@
msg="设备状态获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDto);
+
return resultMap;
}
/*
- *根据分区获取设备列表
+ *根据分区获取设备列表
*/
@POST
@Path("getDeviceByPartition")
@@ -312,10 +330,14 @@
try{
pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(partition);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -323,26 +345,28 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
@POST
@Path("getDeviceByOldDAssetCodeCode")
@Produces(MediaType.APPLICATION_JSON)
public Map getDeviceByOldDAssetCodeCode(@FormParam("assetCode") String assetCode) throws Exception{
- Map resultMap = new HashMap();
+ Map resultMap = new HashMap<>();
String msg="";
- List pgDeviceDtoList=new ArrayList();
+ List pgDeviceDtoList=new ArrayList<>();
try{
pgDeviceDtoList=pgDeviceManager.getDeviceByOldDAssetCodeCode(assetCode);
- if(pgDeviceDtoList==null)
- msg="设备信息获取失败";
- else
- msg="设备信息获取成功";
+ if(pgDeviceDtoList==null||pgDeviceDtoList.size()==0) {
+ msg = "设备信息获取失败";;
+ resultMap.put("result",null);
+ }
+ else {
+ msg = "设备信息获取成功";
+ resultMap.put("result",pgDeviceDtoList);
+ }
}
catch(Exception e)
{
@@ -350,11 +374,8 @@
msg="设备信息获取失败";
}
resultMap.put("msg",msg);
- resultMap.put("result",pgDeviceDtoList);
return resultMap;
}
-
-
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
new file mode 100644
index 0000000..f3b8f72
--- /dev/null
+++ b/src/main/java/com/casic/PgInterface/rs/PgIntelPlanRs.java
@@ -0,0 +1,154 @@
+package com.casic.PgInterface.rs;
+
+import com.casic.PgInterface.devTable.domain.PgIntelPlan;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanDto;
+import com.casic.PgInterface.devTable.dto.PgIntelPlanTypeDto;
+import com.casic.PgInterface.devTable.manager.PgIntelPlanManager;
+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;
+
+@Component
+@Path("pgIntelPlan")
+public class PgIntelPlanRs {
+
+ @Resource
+ private PgIntelPlanManager pgIntelPlanManager;
+
+ @POST
+ @Path("addIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName,
+ @FormParam("maxNum") String maxNum,
+ @FormParam("existNum") String existNum) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+
+ pgIntelPlanManager.savePgIntelPlan(parName,lineName,maxNum,existNum);
+ msg="规划数据保存成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据保存失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelLineType")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelLineType() throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanTypeDtoList=new ArrayList<>();
+ try {
+ pgIntelPlanTypeDtoList=pgIntelPlanManager.getIntelPlanType();
+ msg="获取排线类型成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "获取排线类型失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanTypeDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("getIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map getIntelPlan(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+
+ List pgIntelPlanDtoList = new ArrayList<>();
+
+ try {
+ pgIntelPlanDtoList = pgIntelPlanManager.getPgIntelPlanListByPartion(lineName, partitionStr);
+ if(pgIntelPlanDtoList==null||pgIntelPlanDtoList.size()==0)
+ msg="请输入正确的规划参数";
+ else
+ msg="规划数据获取成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据获取失败";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", pgIntelPlanDtoList);
+ return resultMap;
+ }
+
+ @POST
+ @Path("addLineUse")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map addLineUse(@FormParam("lineName") String lineName,
+ @FormParam("partitionStr") String partitionStr,
+ @FormParam("num") String num) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ boolean bl=pgIntelPlanManager.addLineUse(lineName,partitionStr,num);
+ if(bl){
+ msg="排线入廊成功";
+ result="true";
+ }
+ else {
+ msg="排线入廊失败";
+ result="false";
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "排线入廊失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+ @POST
+ @Path("removeIntelPlan")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map removeIntelPlan(@FormParam("parName") String parName,
+ @FormParam("lineName") String lineName) throws Exception {
+ Map resultMap = new HashMap<>();
+ String msg = "";
+ String result="";
+
+ try {
+ PgIntelPlan pgIntelPlan=pgIntelPlanManager.getPgIntelPlanByParNameAndLine(lineName,parName);
+
+ pgIntelPlan.setActive(false);
+ pgIntelPlanManager.save(pgIntelPlan);
+ msg="规划数据删除成功";
+ result="true";
+ } catch (Exception e) {
+ e.printStackTrace();
+ msg = "规划数据删除失败";
+ result="false";
+ }
+ resultMap.put("msg", msg);
+ resultMap.put("result", result);
+ return resultMap;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
index 36f8a2e..2e72432 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgPipeLineRs.java
@@ -245,7 +245,7 @@
if(pgPipeLine==null)
msg="不存在:"+lineName;
else {
- pgPipeLineDto = new PgPipeLineDto(pgPipeLine);
+ pgPipeLineDto = new PgPipeLineDto(pgPipeLine,pgPartitionManager);
msg = "获取成功";
}
} catch (Exception e) {
@@ -282,7 +282,7 @@
}
/**
- * 根据管线名称获取管线信息
+ * 获取管线类型
*/
@POST
@Path("getPipeLineType")
diff --git a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
index e9ea38f..9c18d1b 100644
--- a/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PipeGalleryRs.java
@@ -60,7 +60,7 @@
} else {
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Double.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
logger.info("成功保存");
pipeGalleryManager.save(pipeGallery);
@@ -136,7 +136,7 @@
pipeGallery.setPgName(pgName);
pipeGallery.setPgLength(Long.valueOf(parLength));
- pipeGallery.setPgPartitionId(pgPartition);
+ pipeGallery.setPgPartitionId(pgPartition.getId());
pipeGallery.setActive(1);
pipeGalleryManager.save(pipeGallery);
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..d0a7435
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190612.docx" "b/~$\350\257\264\346\230\21620190612.docx"
new file mode 100644
index 0000000..5cfb046
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190612.docx"
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
deleted file mode 100644
index 833b97a..0000000
--- "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
+++ /dev/null
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190726.docx"
new file mode 100644
index 0000000..60b395f
--- /dev/null
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\21620190726.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\21620190522.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\21620190522.docx"
deleted file mode 100644
index ff3fe91..0000000
--- "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\21620190522.docx"
+++ /dev/null
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\21620190612.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\21620190612.docx"
new file mode 100644
index 0000000..87182ff
--- /dev/null
+++ "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\21620190612.docx"
Binary files differ